:root {
  --bg: #07090d;
  --surface: rgba(18, 23, 33, 0.72);
  --surface-2: rgba(26, 33, 47, 0.85);
  --line: rgba(120, 160, 220, 0.14);
  --text: #e6edf6;
  --muted: #8592a6;
  --cyan: #22d3ee;
  --violet: #a78bfa;
  --amber: #fbbf24;
  --green: #34d399;
  --red: #f87171;
  --blue: #60a5fa;
  --slate: #94a3b8;
  --radius: 18px;
  --font: "Space Grotesk", "Heebo", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
a { color: var(--cyan); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 400px at 85% -10%, rgba(167, 139, 250, 0.16), transparent 70%),
    radial-gradient(500px 380px at -10% 20%, rgba(34, 211, 238, 0.12), transparent 70%),
    linear-gradient(rgba(120, 160, 220, 0.045) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, rgba(120, 160, 220, 0.045) 1px, transparent 1px) 0 0 / 32px 100%;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
}

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.tiny { font-size: 0.74rem; letter-spacing: 0.02em; }

.wordmark { font-weight: 700; letter-spacing: 0.18em; font-size: 1.6rem; }
.wordmark span {
  margin-left: 0.35em;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wordmark.sm { font-size: 0.95rem; letter-spacing: 0.16em; }

/* Landing */
.landing { max-width: 30rem; margin: 0 auto; padding: 18vh 20px 40px; text-align: center; }
.landing-logo { border-radius: 24px; box-shadow: 0 0 60px rgba(34, 211, 238, 0.25); }
.landing p { line-height: 1.6; }

/* Shell */
#app { max-width: 40rem; margin: 0 auto; padding: 0 16px 40px; }
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0 12px;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 12px; }
.top-actions { display: flex; gap: 8px; }
.eta { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 0.86rem; }
.eta svg { color: var(--cyan); flex: none; }
.eta .basis { color: var(--muted); font-size: 0.74rem; }
.brand img { border-radius: 10px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color .2s, box-shadow .2s;
}
.icon-btn:hover, .icon-btn:focus-visible { border-color: var(--cyan); box-shadow: 0 0 18px rgba(34, 211, 238, 0.25); outline: none; }
.icon-btn.spin svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; backdrop-filter: blur(10px);
}
.stat b { display: block; font-size: 1.5rem; font-weight: 600; line-height: 1.1; }
.stat span { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.stat.pickup b { color: var(--amber); text-shadow: 0 0 16px rgba(251, 191, 36, 0.45); }
.stat.moving b { color: var(--cyan); text-shadow: 0 0 16px rgba(34, 211, 238, 0.4); }
.stat.done b { color: var(--green); }

/* Tabs */
.tabs {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 18px;
}
.tab { position: relative; z-index: 1; background: none; border: 0; padding: 10px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.tab.active { color: var(--text); }
.tab-glow {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: 10px; background: var(--surface-2);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.35), 0 0 22px rgba(34, 211, 238, 0.12);
  transition: transform .25s ease;
}
.tabs[data-view="history"] .tab-glow { transform: translateX(100%); }

/* Sections */
.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted);
  margin: 22px 2px 10px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
details.collapsed > summary { list-style: none; cursor: pointer; }
details.collapsed > summary::-webkit-details-marker { display: none; }
details.collapsed > summary .section-title::before { content: "▸"; transition: transform .2s; }
details.collapsed[open] > summary .section-title::before { transform: rotate(90deg); }

/* Cards */
.card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; backdrop-filter: blur(12px);
  transition: border-color .2s, transform .2s;
}
.card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent, var(--slate)); box-shadow: 0 0 16px var(--accent, transparent);
}
.card.pickup { border-color: rgba(251, 191, 36, 0.3); }
.card.urgent { border-color: rgba(248, 113, 113, 0.5); box-shadow: 0 0 28px rgba(248, 113, 113, 0.12); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; cursor: pointer; }
.card-title { font-weight: 600; font-size: 1.02rem; line-height: 1.3; overflow-wrap: anywhere; }
.card-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; font-size: 0.8rem; color: var(--muted); }
.store-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--store, var(--slate)); box-shadow: 0 0 8px var(--store, transparent); }
.mono { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.02em; }
.copyable { display: inline-flex; align-items: center; gap: 2px; }
.copy-text, .copy-icon { background: none; border: 0; padding: 4px; border-radius: 6px; color: var(--text); }
.copy-text { color: var(--text); user-select: all; }
.copy-icon { color: var(--muted); display: inline-grid; place-items: center; }
.copy-text:active, .copy-icon:active { background: rgba(34, 211, 238, 0.15); color: var(--cyan); }
.copy-text:focus-visible, .copy-icon:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }

.chip {
  flex: none; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 5px 9px; border-radius: 999px; white-space: nowrap;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

/* Progress */
.progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin: 14px 0 2px; }
.progress i { height: 4px; border-radius: 4px; background: rgba(120, 160, 220, 0.12); }
.progress i.on { background: linear-gradient(90deg, var(--cyan), var(--violet)); box-shadow: 0 0 10px rgba(34, 211, 238, 0.45); }
.progress-labels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; font-size: 0.62rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* Pickup block */
.pickup-box {
  margin-top: 14px; padding: 12px; border-radius: 12px;
  background: rgba(251, 191, 36, 0.06); border: 1px solid rgba(251, 191, 36, 0.2);
  display: grid; gap: 8px;
}
.row { display: flex; align-items: flex-start; gap: 10px; font-size: 0.88rem; line-height: 1.45; }
.row svg { flex: none; margin-top: 2px; color: var(--amber); }
.rtl { direction: rtl; text-align: right; font-family: "Heebo", var(--font); flex: 1; }
.deadline { font-weight: 600; }
.deadline.urgent { color: var(--red); text-shadow: 0 0 12px rgba(248, 113, 113, 0.45); }
.code {
  display: inline-flex; align-items: center; gap: 8px; align-self: start;
  font-family: var(--mono); font-size: 1.05rem; font-weight: 600; letter-spacing: 0.08em;
  padding: 6px 12px; border-radius: 10px; background: var(--bg); border: 1px dashed rgba(251, 191, 36, 0.5); color: var(--amber);
}

/* Actions */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 14px; border-radius: 12px; font-weight: 500; font-size: 0.88rem;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
}
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.btn-primary {
  border: 0; color: #041016; font-weight: 600;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.3);
}
.landing .btn-primary { margin: 18px 0 8px; padding: 12px 28px; }

/* Timeline */
.timeline { margin: 14px 0 0; padding: 0 0 0 14px; list-style: none; border-left: 1px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 12px; font-size: 0.82rem; }
.timeline li::before {
  content: ""; position: absolute; left: -19px; top: 5px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--cyan);
}
.timeline li:last-child::before { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.timeline .when { color: var(--muted); font-size: 0.72rem; }
.timeline .src { font-family: var(--mono); font-size: 0.66rem; color: var(--violet); margin-left: 6px; }

.empty { text-align: center; padding: 48px 12px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }
.skeleton { height: 120px; border-radius: var(--radius); margin-bottom: 12px; background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.foot { text-align: center; margin-top: 30px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px; font-size: 0.88rem;
  background: var(--surface-2); border: 1px solid rgba(34, 211, 238, 0.4); box-shadow: 0 0 24px rgba(34, 211, 238, 0.2);
  backdrop-filter: blur(12px);
}

.sheet {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(3, 5, 8, 0.6); backdrop-filter: blur(4px);
}
.sheet-card {
  width: 100%; max-width: 40rem; padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0; background: var(--surface-2);
  border: 1px solid rgba(34, 211, 238, 0.35); border-bottom: 0; box-shadow: 0 -10px 40px rgba(34, 211, 238, 0.15);
  animation: rise .22s ease-out;
}
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.sheet-q { font-size: 1.2rem; font-weight: 600; margin-bottom: 4px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 18px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
