:root {
  --bg: #0f1117;
  --card: #161824;
  --card-soft: #1e2130;
  --line: #25293a;
  --text: #e8eaf6;
  --muted: #8b8fa8;
  --muted-2: #555b7a;
  --brand: #2563eb;
  --brand-soft: #2563eb33;
  --green: #4ade80;
  --green-soft: #0d2a16;
  --orange: #fb923c;
  --orange-soft: #2a1800;
  --yellow: #f59e0b;
  --yellow-soft: #2a2400;
  --red: #ef4444;
  --red-soft: #2a0000;
  --tg-top-shift: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--card-soft);
  border-bottom: 1px solid var(--line);
  padding: calc(12px + env(safe-area-inset-top) + var(--tg-top-shift)) 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (min-width: 768px) {
  :root {
    --tg-top-shift: 8px;
  }
}

.topbar-back {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.topbar-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-title,
.topbar-sub {
  margin: 0;
}

.topbar-title {
  font-size: 14px;
  font-weight: 600;
}

.topbar-sub {
  font-size: 11px;
  color: var(--green);
}

.content {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen-title {
  margin: 0 0 6px;
  font-size: 19px;
  text-align: center;
}

.screen-subtitle,
.screen-text {
  margin: 0;
  text-align: center;
  color: var(--muted);
}

.screen-subtitle {
  margin-bottom: 4px;
  font-size: 13px;
}

.screen-text {
  margin-bottom: 18px;
  font-size: 12px;
  line-height: 1.5;
}

.center-icon {
  text-align: center;
  font-size: 48px;
  margin-bottom: 14px;
}

.feature-list {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.feature-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.muted-item {
  opacity: 0.5;
}

.feature-title,
.feature-desc {
  margin: 0;
}

.feature-title {
  font-size: 13px;
  font-weight: 600;
}

.feature-desc {
  font-size: 11px;
  color: var(--muted-2);
}

.profile-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-name,
.profile-handle {
  margin: 0;
}

.profile-name {
  font-size: 14px;
  font-weight: 600;
}

.profile-handle {
  font-size: 12px;
  color: var(--muted);
}

.input-label {
  display: block;
  margin-top: 10px;
  margin-bottom: 5px;
  font-size: 12px;
  color: var(--muted);
}

.input {
  width: 100%;
  background: #0f1424;
  border: 1px solid #28314f;
  border-radius: 10px;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

.input:focus {
  border-color: var(--brand);
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn.full {
  width: 100%;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn-emoji {
  margin-right: 8px;
  font-size: 14px;
  line-height: 1;
  vertical-align: middle;
}

.btn.secondary {
  background: var(--card-soft);
  color: var(--muted);
}

.btn.subtle-back {
  background: transparent;
  border: 1px dashed #2a2f44;
  color: #5f6787;
  font-size: 12px;
  font-weight: 500;
  padding: 9px 10px;
  opacity: 0.72;
  width: auto;
  min-width: 72px;
  justify-self: center;
}

.btn.subtle-back .back-arrow {
  font-size: 10px;
  opacity: 0.75;
  margin-right: 4px;
  vertical-align: middle;
}

.btn.danger {
  background: #7f1d1d;
  color: #fecaca;
}

.btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.link-btn {
  width: 100%;
  margin-top: 10px;
  background: transparent;
  border: none;
  color: var(--muted-2);
  padding: 8px;
  cursor: pointer;
}

.app-screen {
  min-height: 100%;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.panel-header {
  margin-bottom: 12px;
}

.panel-header h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.panel-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.order-item,
.history-item {
  background: var(--card);
  border: 1px solid #26314f;
  border-radius: 15px;
  padding: 12px 14px;
  cursor: pointer;
}

.order-top,
.history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.order-id,
.history-id {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.order-dot {
  font-size: 15px;
  line-height: 1;
}

.order-meta,
.history-meta {
  margin: 0;
  color: #5f7ab8;
  font-size: 12px;
  line-height: 1.45;
}

.order-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.order-meta-tight {
  margin-top: 2px;
}

.meta-icon {
  font-size: 12px;
  opacity: 0.95;
}

.order-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.order-arrow {
  color: #52608f;
  font-size: 18px;
  line-height: 1;
}

.status-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}

.chip-pending {
  background: #2d2600;
  color: #f6b410;
}

.chip-accepted {
  background: #2a1800;
  color: #fb923c;
}

.chip-completed {
  background: var(--green-soft);
  color: var(--green);
}

.chip-cancelled {
  background: var(--red-soft);
  color: var(--red);
}

.detail-card {
  background: var(--card);
  border: 1px solid #1f2a45;
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
}

.detail-no {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.detail-row {
  display: flex;
  align-items: center;
  gap: 7px;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}

.detail-row span {
  color: var(--muted);
}

.detail-row b {
  font-size: 13px;
  text-align: right;
  font-weight: 600;
}

.actions-row {
  align-items: center;
  flex-wrap: wrap;
}

.mini-btn {
  border: 1px solid #21416e;
  border-radius: 8px;
  background: #0a2240;
  color: #60a5fa;
  font-size: 12px;
  padding: 6px 9px;
  cursor: pointer;
}

.status-badge {
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}

.status-pending {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.status-accepted {
  background: var(--orange-soft);
  color: var(--orange);
}

.status-completed {
  background: var(--green-soft);
  color: var(--green);
}

.status-cancelled {
  background: var(--red-soft);
  color: var(--red);
}

.detail-actions {
  display: grid;
  gap: 8px;
}

.bottom-nav {
  background: var(--card-soft);
  border-top: 1px solid var(--line);
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-around;
}

.nav-btn {
  border: none;
  background: transparent;
  color: var(--muted-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 17px;
  cursor: pointer;
}

.nav-btn span {
  font-size: 10px;
}

.nav-btn .nav-emoji {
  font-size: 18px;
  line-height: 1;
}

.nav-btn.active {
  color: var(--brand);
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}

.sheet {
  width: 100%;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 4px;
  margin: 0 auto 12px;
  background: #2a2d3a;
}

.sheet-title {
  margin: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}

.sheet-text {
  margin: 8px 0 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(68px + env(safe-area-inset-bottom));
  background: #0b1220;
  color: #dbeafe;
  border: 1px solid #1e3a8a;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  z-index: 200;
}

.hidden {
  display: none !important;
}
