/* Apollo Vendor Portal. Brand from apollocouriers.com: charcoal #282932, logo orange #f39200, gold #f7b614,
   cream #f2efe6; Heebo (headings) and Catamaran (text). Light and dark themes share the tokens below. */

:root {
  --brand: #f39200;
  --brand-hover: #e08600;
  --brand-ink: #282932;          /* text on brand buttons (white on orange is too faint) */
  --brand-soft: #fff1dc;
  --gold: #f7b614;
  --charcoal: #282932;

  --bg: #f5f2ea;
  --bg-grad: radial-gradient(1200px 500px at 85% -10%, #ffe9c7 0%, transparent 60%),
             radial-gradient(900px 400px at -10% 0%, #f9f1e1 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --surface-3: #f3efe6;
  --border: #e6e0d2;
  --border-strong: #d6cfbe;
  --text: #282932;
  --muted: #6d6e78;
  --faint: #9a9aa3;
  --header: #282932;
  --header-text: #f5f2ea;

  --ok: #17864a;      --ok-bg: #e3f5ea;
  --warn: #a96500;    --warn-bg: #fff2dc;
  --danger: #c81e1e;  --danger-bg: #fde8e8;
  --info: #2f5fa7;    --info-bg: #e7eefa;

  --shadow-sm: 0 1px 2px rgba(40, 41, 50, .06), 0 1px 1px rgba(40, 41, 50, .04);
  --shadow: 0 1px 3px rgba(40, 41, 50, .08), 0 6px 20px -8px rgba(40, 41, 50, .14);
  --shadow-lg: 0 18px 50px -12px rgba(40, 41, 50, .35);
  --ring: 0 0 0 3px rgba(243, 146, 0, .32);
  --radius: 14px;
  --radius-sm: 10px;
  --font-head: "Heebo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font: "Catamaran", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand: #f7a21b;
  --brand-hover: #ffb43d;
  --brand-ink: #1b1c22;
  --brand-soft: rgba(247, 162, 27, .14);
  --bg: #121318;
  --bg-grad: radial-gradient(1200px 500px at 85% -10%, rgba(243, 146, 0, .10) 0%, transparent 60%),
             radial-gradient(900px 400px at -10% 0%, rgba(247, 182, 20, .05) 0%, transparent 55%);
  --surface: #1b1c23;
  --surface-2: #20212a;
  --surface-3: #282933;
  --border: #2e2f3a;
  --border-strong: #3c3d4a;
  --text: #ecebe6;
  --muted: #a5a6b0;
  --faint: #7c7d88;
  --header: #0d0e12;
  --header-text: #ecebe6;
  --ok: #4ccf86;      --ok-bg: rgba(76, 207, 134, .13);
  --warn: #f5b649;    --warn-bg: rgba(245, 182, 73, .13);
  --danger: #ff6b6b;  --danger-bg: rgba(255, 107, 107, .13);
  --info: #7fa8ee;    --info-bg: rgba(127, 168, 238, .13);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 20px 60px -10px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed;
  color: var(--text); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round;
        stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ buttons and fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .field input:focus-visible, .field select:focus-visible, .chip-btn:focus-visible,
.order-head:focus-visible, .stop-row:focus-visible, .tab:focus-visible, .icon-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: 14px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn .spinner { width: 16px; height: 16px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0;
  background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: rgba(127, 127, 127, .14); }

.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select, .field textarea, .input {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .input:focus { border-color: var(--brand); outline: none; box-shadow: var(--ring); }
.field .hint { font-size: 13px; color: var(--muted); }
.with-btn { display: flex; gap: 6px; }
.with-btn input { flex: 1; min-width: 0; }
input[type="datetime-local"], input[type="date"] { font-variant-numeric: tabular-nums; }
/* Calendar and clock icons: the browser draws them for the page's color-scheme (dark icons in light mode, light in
   dark mode), so no filter is needed; just keep them visible and clickable. */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator { opacity: .75; cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

.spinner {
  width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; display: inline-block; opacity: .8;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--header); color: var(--header-text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04), 0 6px 20px -12px rgba(0, 0, 0, .5);
}
.topbar::after {             /* thin brand stripe */
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--gold) 60%, transparent);
}
.topbar-in { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 10px 20px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand img { height: 40px; width: auto; display: block; }
.brand .product { font-family: var(--font-head); font-weight: 700; font-size: 15px; letter-spacing: .08em;
                  text-transform: uppercase; color: var(--gold); border-left: 1px solid rgba(255, 255, 255, .18);
                  padding-left: 12px; }
.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; border: 0;
  background: transparent; color: rgba(245, 242, 234, .72); font-weight: 600; cursor: pointer;
}
.tab:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.tab[aria-current="page"] { color: var(--charcoal); background: var(--gold); }
.topbar .spacer { flex: 1; }
.topbar .icon-btn { color: var(--header-text); }
.cust-btn {
  display: inline-flex; align-items: center; gap: 8px; max-width: 280px; padding: 7px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); color: var(--header-text);
  cursor: pointer; font-weight: 600;
}
.cust-btn:hover { background: rgba(255, 255, 255, .12); }
.cust-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(135deg, var(--brand), var(--gold)); color: var(--charcoal); border: 0; cursor: pointer;
  font-family: var(--font-head);
}

/* bottom tab bar on phones */
.bottom-nav { display: none; }

/* ------------------------------------------------------------------ menus / popovers */
.menu {
  position: absolute; z-index: 50; min-width: 240px; padding: 6px; border-radius: 12px; background: var(--surface);
  color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: pop .12s ease-out;
}
.menu .menu-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu .menu-head strong { display: block; }
.menu .menu-head small { color: var(--muted); }
.menu button.item, .menu label.item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; text-align: left; font-weight: 500;
}
.menu .item:hover { background: var(--surface-3); }
.menu .item.danger { color: var(--danger); }
.menu .item input { accent-color: var(--brand); width: 18px; height: 18px; }
.menu .menu-foot { padding: 8px 12px 4px; font-size: 12px; color: var(--faint); border-top: 1px solid var(--border); margin-top: 4px; }
.menu .search-in { margin: 4px 4px 6px; }
.menu .scroll { max-height: 320px; overflow: auto; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ page */
main { max-width: 1180px; margin: 0 auto; padding: 26px 20px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 28px; font-weight: 800; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }

.day-nav { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border);
           border-radius: 12px; padding: 4px; box-shadow: var(--shadow-sm); }
.day-nav .icon-btn { width: 36px; height: 36px; }
.day-nav .date-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px;
                     border: 0; background: transparent; font: inherit; color: inherit;
                 font-weight: 700; cursor: pointer; min-width: 150px; justify-content: center; }
.day-nav .date-btn:hover { background: var(--surface-3); }
.day-nav .date-btn .icon:last-of-type { width: 15px; height: 15px; color: var(--faint); }
/* invisible, but laid out under the button so the browser opens its calendar right there */
.day-nav input[type="date"] { position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.day-nav .today-btn { margin-left: 2px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
        box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 12px; }
.stat .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.stat.ok .ic { background: var(--ok-bg); color: var(--ok); }
.stat.warn .ic { background: var(--warn-bg); color: var(--warn); }
.stat.info .ic { background: var(--info-bg); color: var(--info); }
.stat .n { font-family: var(--font-head); font-size: 24px; font-weight: 800; line-height: 1; }
.stat .l { color: var(--muted); font-size: 14px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search-box input { width: 100%; min-height: 44px; padding: 9px 12px 9px 40px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); }
.search-box input:focus { border-color: var(--brand); outline: none; box-shadow: var(--ring); }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg .count { font-size: 12px; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); }
.seg button[aria-pressed="true"] .count { background: var(--brand-soft); color: var(--brand); }

/* ------------------------------------------------------------------ order cards */
.orders { display: grid; gap: 10px; }
.order {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow: hidden; transition: box-shadow .2s, border-color .2s; position: relative;
}
.order::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--border-strong); }
.order.st-open::before { background: var(--brand); }
.order.st-progress::before { background: linear-gradient(var(--brand), var(--gold)); }
.order.st-done::before { background: var(--ok); }
.order.st-new::before { background: var(--info); }
.order:hover { box-shadow: var(--shadow); }
.order.open { border-color: var(--brand); box-shadow: var(--shadow); }
.order-head {
  display: grid; grid-template-columns: minmax(150px, 190px) 1fr auto; gap: 18px; align-items: center;
  padding: 14px 18px 14px 22px; cursor: pointer; width: 100%; text-align: left; border: 0; background: transparent;
}
.order-id { display: grid; gap: 4px; }
.order-id .num { font-family: var(--font-head); font-weight: 800; font-size: 19px; letter-spacing: .01em; }
.order-id .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.route { display: grid; gap: 4px; min-width: 0; }
.route .leg { display: flex; align-items: center; gap: 8px; min-width: 0; }
.route .leg .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; border: 2px solid var(--brand); }
.route .leg.d .dot { background: var(--brand); }
.route .leg .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route .leg .ct { color: var(--muted); white-space: nowrap; }
.route .leg .tm { color: var(--faint); font-size: 14px; margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.route .more { color: var(--muted); font-size: 13px; padding-left: 17px; }
.order-end { display: flex; align-items: center; gap: 14px; }
.progress { display: grid; gap: 5px; justify-items: end; min-width: 96px; }
.progress .txt { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.progress .bar { width: 96px; height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress .bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--gold)); }
.progress.done .bar i { background: var(--ok); }
.chev { color: var(--faint); transition: transform .2s; }
.order.open .chev { transform: rotate(180deg); color: var(--brand); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12.5px;
         font-weight: 700; background: var(--surface-3); color: var(--muted); white-space: nowrap; line-height: 1.6; }
.badge .icon { width: 13px; height: 13px; }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }

.order-body { border-top: 1px solid var(--border); background: var(--surface-2); padding: 16px 18px 18px 22px; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.order-facts { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.order-facts b { color: var(--text); font-weight: 600; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 10px; font-size: 14.5px; margin-bottom: 12px; }
.note.info { background: var(--info-bg); color: var(--info); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.danger { background: var(--danger-bg); color: var(--danger); }
.note .icon { margin-top: 2px; }

/* stop timeline */
.stops { display: grid; gap: 0; position: relative; }
.stop { position: relative; padding-left: 40px; }
.stop::before { content: ""; position: absolute; left: 15px; top: 0; bottom: 0; width: 2px; background: var(--border-strong); }
.stop:first-child::before { top: 22px; }
.stop:last-child::before { bottom: calc(100% - 22px); }
.stop:only-child::before { display: none; }
.stop .marker { position: absolute; left: 0; top: 7px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
                background: var(--surface); border: 2px solid var(--border-strong); color: var(--muted); z-index: 1; }
.stop .marker .icon { width: 16px; height: 16px; }
.stop.partial .marker { border-color: var(--brand); color: var(--brand); }
.stop.done .marker { background: var(--ok); border-color: var(--ok); color: #fff; }
.stop.sel .marker { box-shadow: var(--ring); }
.stop-row {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: center; width: 100%; text-align: left;
  border: 1px solid transparent; background: transparent; border-radius: 12px; padding: 8px 12px; cursor: pointer; margin: 2px 0;
}
.stop-row:hover { background: var(--surface); border-color: var(--border); }
.stop.sel .stop-row { background: var(--surface); border-color: var(--brand); }
.stop-row .t { font-size: 12.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }
.stop-row .nm { font-weight: 700; font-size: 16.5px; }
.stop-row .addr { color: var(--muted); font-size: 14.5px; }
.stop-row .sched { color: var(--muted); font-size: 14px; text-align: right; white-space: nowrap; }
.stop-row .chips { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.stop-row .cta { color: var(--brand); font-weight: 700; font-size: 14px; display: inline-flex; gap: 4px; align-items: center; }

/* stop editor card */
.editor {
  margin: 6px 0 14px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); animation: pop .15s ease-out;
}
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.editor-head h3 { font-size: 18px; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.editor-grid .span2 { grid-column: 1 / -1; }
.editor .section-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 700; margin: 18px 0 10px; }
.editor .section-title .icon { color: var(--brand); }
.editor-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.editor-actions .left { margin-right: auto; color: var(--muted); font-size: 13.5px; align-self: center; }
.now-btn { min-width: 64px; }
.dt input[type="date"] { flex: 1.25; }
.dt input[type="time"] { flex: 1; min-width: 0; }
.editor-actions .left.unsaved { color: var(--warn); font-weight: 700; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--border);
         background: var(--surface-3); display: grid; place-items: center; cursor: pointer; padding: 0; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px; font-size: 11px; color: #fff; text-align: left;
              background: linear-gradient(transparent, rgba(0, 0, 0, .65)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb.uploading::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .35); }
.thumb.uploading .spinner { position: absolute; z-index: 1; color: #fff; }
.thumb.failed { border-color: var(--danger); }
.add-photo { border: 2px dashed var(--border-strong); background: transparent; color: var(--brand); font-weight: 700; font-size: 13px;
             display: grid; place-items: center; align-content: center; gap: 4px; }
.add-photo:hover, .add-photo.drag { border-color: var(--brand); background: var(--brand-soft); }
.add-photo .icon { width: 24px; height: 24px; }

/* ------------------------------------------------------------------ empty / loading */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); background: var(--surface); border: 1px dashed var(--border-strong);
         border-radius: var(--radius); }
.empty .art { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty .art .icon { width: 30px; height: 30px; }
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 19px; }
.skel { border-radius: var(--radius); height: 84px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-3) 50%, var(--surface) 100%);
        background-size: 200% 100%; animation: shimmer 1.2s infinite; border: 1px solid var(--border); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.center-load { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 20px; color: var(--muted); }

/* ------------------------------------------------------------------ search page */
.search-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
                display: grid; grid-template-columns: 1fr 170px 170px auto; gap: 12px; align-items: end; margin-bottom: 18px; }
.result-head { display: flex; justify-content: space-between; color: var(--muted); margin: 6px 2px 10px; font-size: 14.5px; }

/* ------------------------------------------------------------------ users page */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700;
            padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }
.u-name { display: flex; align-items: center; gap: 12px; }
.u-name .av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-3); color: var(--muted); flex: none; }
.u-name small { display: block; color: var(--muted); }
.codes { display: flex; gap: 5px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.sub-tabs { display: inline-flex; gap: 4px; margin-bottom: 16px; }

/* chip input */
.chips-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; min-height: 44px; border-radius: 10px;
               border: 1px solid var(--border-strong); background: var(--surface); position: relative; }
.chips-input:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.chips-input input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 120px; padding: 4px; }
.chip-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--brand-soft);
            color: var(--brand); font-weight: 700; font-size: 14px; border: 0; }
.chip-btn button { border: 0; background: transparent; color: inherit; cursor: pointer; display: grid; place-items: center; padding: 2px; border-radius: 50%; }
.chip-btn button:hover { background: rgba(0, 0, 0, .08); }
.chip-btn .icon { width: 14px; height: 14px; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; background: var(--surface); border: 1px solid var(--border);
           border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 240px; overflow: auto; padding: 4px; }
.suggest button { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.suggest button:hover, .suggest button.hl { background: var(--surface-3); }
.suggest b { min-width: 70px; }
.checks { display: grid; gap: 6px; }
.checks label { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; }
.checks input { accent-color: var(--brand); width: 18px; height: 18px; }

/* ------------------------------------------------------------------ dialogs */
dialog.modal { border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
               width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); }
dialog.modal::backdrop { background: rgba(18, 19, 24, .55); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop .16s ease-out; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.modal-head h2 { font-size: 20px; }
.modal-body { padding: 12px 20px 8px; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 18px; }
.link-box { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--surface-3); font-family: ui-monospace, Consolas, monospace;
            font-size: 13px; word-break: break-all; }
.link-box span { flex: 1; }
dialog.viewer { width: min(1000px, calc(100vw - 24px)); background: #000; }
dialog.viewer img { display: block; max-width: 100%; max-height: calc(100vh - 120px); margin: 0 auto; }
dialog.viewer .modal-head { color: #fff; }
dialog.viewer .modal-head .icon-btn { color: #fff; }

/* ------------------------------------------------------------------ toasts */
#toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px; background: var(--charcoal); color: #fff; box-shadow: var(--shadow-lg);
         font-weight: 600; opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s; max-width: min(560px, calc(100vw - 32px)); }
.toast.in { opacity: 1; transform: none; }
.toast.ok .icon { color: #4ccf86; }
.toast.warn .icon { color: var(--gold); }
.toast.error { background: #a31818; }

/* ------------------------------------------------------------------ sign-in page */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-art {
  position: relative; overflow: hidden; color: #f5f2ea; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(700px 400px at 100% 100%, rgba(243, 146, 0, .35), transparent 60%),
              radial-gradient(500px 300px at 0% 0%, rgba(247, 182, 20, .18), transparent 60%), #282932;
}
.auth-art .hexes { position: absolute; right: -80px; bottom: -60px; width: 520px; opacity: .22; }
.auth-art img.logo { height: 56px; width: auto; align-self: flex-start; }
.auth-art h1 { font-size: 44px; font-weight: 800; max-width: 520px; line-height: 1.08; }
.auth-art h1 em { font-style: normal; color: var(--gold); }
.auth-art p { font-size: 18px; color: rgba(245, 242, 234, .78); max-width: 460px; }
.auth-art .points { display: grid; gap: 12px; margin-top: 26px; }
.auth-art .points div { display: flex; gap: 12px; align-items: center; font-weight: 600; }
.auth-art .points .icon { color: var(--gold); width: 22px; height: 22px; }
.auth-art small { color: rgba(245, 242, 234, .5); }
.auth-main { display: grid; place-items: center; padding: 32px 20px; position: relative; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .mobile-logo { display: none; }
.auth-card h2 { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin: 0 0 24px; }
.auth-card form { display: grid; gap: 16px; }
.auth-card .err { display: none; }
.auth-card .err.show { display: flex; }
.theme-corner { position: absolute; top: 16px; right: 16px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-wrap .icon-btn { position: absolute; right: 3px; top: 3px; color: var(--muted); }
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 14px; color: var(--muted); margin-top: 2px; }
.rules span { display: flex; gap: 6px; align-items: center; }
.rules span .icon { width: 15px; height: 15px; color: var(--faint); }
.rules span.ok { color: var(--ok); }
.rules span.ok .icon { color: var(--ok); }
.code-input { font-family: var(--font-head); font-size: 30px !important; letter-spacing: .5em; text-align: center; font-weight: 700; padding-left: .5em !important; }
.qr { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: 14px; border: 1px solid var(--border); width: 220px; margin: 0 auto; }
.qr img { width: 190px; height: 190px; display: block; }
.secret { text-align: center; font-family: ui-monospace, Consolas, monospace; font-size: 15px; letter-spacing: .05em; color: var(--muted); }
.steps { display: grid; gap: 8px; color: var(--muted); font-size: 15px; padding-left: 20px; margin: 0; }
.foot-note { text-align: center; color: var(--faint); font-size: 13px; margin-top: 28px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-head { grid-template-columns: 1fr auto; }
  .order-head .route { grid-column: 1 / -1; grid-row: 2; }
  .search-panel { grid-template-columns: 1fr 1fr; }
  .search-panel .q { grid-column: 1 / -1; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-card .mobile-logo { display: block; height: 52px; margin: 0 auto 26px; }
}
@media (max-width: 720px) {
  main { padding: 18px 14px 96px; }
  .topbar-in { padding: 8px 14px; gap: 8px; }
  .brand img { height: 32px; }
  .brand .product { display: none; }
  .tabs { display: none; }
  .cust-btn { max-width: 150px; padding: 6px 10px; }
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, .25);
  }
  .bottom-nav button { display: grid; justify-items: center; gap: 2px; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; padding: 6px; border-radius: 10px; cursor: pointer; }
  .bottom-nav button[aria-current="page"] { color: var(--brand); }
  .bottom-nav .icon { width: 22px; height: 22px; }
  .page-head h1 { font-size: 23px; }
  .day-nav { width: 100%; justify-content: space-between; }
  .day-nav .date-btn { flex: 1; min-width: 0; justify-content: center; }
  .stat { padding: 10px 12px; }
  .stat .ic { width: 34px; height: 34px; }
  .stat .n { font-size: 20px; }
  .order-head { padding: 12px 14px 12px 18px; gap: 10px; }
  .order-body { padding: 12px 10px 14px 14px; }
  .progress .bar { width: 70px; }
  .progress { min-width: 70px; }
  .editor { padding: 14px; margin-left: -30px; }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-actions .btn { flex: 1; }
  .editor-actions .left { width: 100%; }
  .search-panel { grid-template-columns: 1fr 1fr; padding: 14px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--border); padding: 10px 6px; }
  .table td { border: 0; padding: 4px 10px; }
  .rules { grid-template-columns: 1fr; }
  #toasts { bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
