/* Emporania "Transit": the frame and the parts every page shares. Top bar, phone bars, tabs, buttons, chips, segmented
   switches, stage colours, tickets and the request track, the departure board, popovers, palette, dialogs, sheets,
   toasts, the theme switch, the tour. Tokens are in app.css; colours here are tokens only (light and dark).
   Author: Jeremiah Buttler */

/* ---------- helpers ---------- */
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r); }
.skip:focus { top: 10px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.sign { font-family: var(--font-sign); font-stretch: semi-condensed; text-transform: uppercase; letter-spacing: .04em; }
.mono { font-family: var(--font-mono); }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* a project's accent: --pc (the line colour) and --pi (the ink on it). lib-p{id} comes from /library/colours.css. */
.lib-c0 { --pc: #e8590c; --pi: #ffffff; }
.lib-c1 { --pc: #1c6ed5; --pi: #ffffff; }
.lib-c2 { --pc: #c2255c; --pi: #ffffff; }
.lib-c3 { --pc: #0c8f7e; --pi: #ffffff; }
.lib-c4 { --pc: #8a6a00; --pi: #ffffff; }
.lib-c5 { --pc: #7048c4; --pi: #ffffff; }
.lib-c6 { --pc: #b4531a; --pi: #ffffff; }
.lib-c7 { --pc: #2b8a3e; --pi: #ffffff; }
.lib-c8 { --pc: #0b7285; --pi: #ffffff; }
.lib-c9 { --pc: #5f3dc4; --pi: #ffffff; }
:root { --pc: var(--st-working); --pi: #ffffff; }  /* the fallback accent; an accent class on the element or an ancestor wins */

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 60; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.topbar__in { height: var(--bar-h); display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 9px; min-height: 44px; text-decoration: none; padding: 6px 8px 6px 4px; border-radius: var(--r); border: 0; background: none; cursor: pointer; color: var(--ink); }
.brand:hover { background: var(--surface); color: var(--ink); }
.brand__mark, .brand .logo-mark { width: auto; height: 28px; color: var(--ink); }
.brand__name, .brand .logo-word { font: 700 21px/1 var(--font-sign); letter-spacing: .01em; color: var(--ink); }
.brand__chev { width: 12px; height: 12px; color: var(--muted); }
.switcher { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); cursor: pointer; max-width: 210px; color: var(--ink); }
.switcher:hover { border-color: var(--line-strong); background: var(--surface); }
.switcher__dot { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--pc, var(--st-working)); background: var(--bg); flex: none; display: inline-block; }
.switcher__name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher .i { width: 14px; height: 14px; color: var(--muted); }
.nav { display: flex; align-items: stretch; height: 100%; margin-left: 6px; }
.nav a { position: relative; display: flex; align-items: center; padding: 0 13px; text-decoration: none; color: var(--muted); font: 600 15px/1 var(--font-sign); letter-spacing: .03em; text-transform: uppercase; font-stretch: semi-condensed; }
.nav a:hover { color: var(--ink); }
.nav a::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 4px; border-radius: 4px 4px 0 0; background: var(--st-working); transform: scaleX(0); transition: transform var(--dur) var(--ease-out); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav__count { margin-left: 6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--st-waiting); color: #111; font: 700 12px/20px var(--font-body); text-align: center; }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.iconbtn { position: relative; width: 40px; height: 40px; display: inline-grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer; text-decoration: none; padding: 0; }
.iconbtn:hover { background: var(--surface); color: var(--ink); }
.iconbtn .i { width: 20px; height: 20px; }
.iconbtn .badge { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--st-working); color: #fff; font: 700 11px/18px var(--font-body); border: 2px solid var(--bg); }
.searchbtn { white-space: nowrap; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); cursor: pointer; min-width: 190px; }
.searchbtn:hover { border-color: var(--line-strong); color: var(--ink); }
.searchbtn .i { width: 16px; height: 16px; }
.kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--bg); font: 600 11px/16px var(--font-mono); color: var(--muted); }
.searchbtn .kbd { margin-left: auto; }
.adminbtn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: var(--r); background: var(--st-live); color: var(--bg); text-decoration: none; font: 600 13px/1 var(--font-sign); text-transform: uppercase; letter-spacing: .05em; font-stretch: semi-condensed; white-space: nowrap; }
.adminbtn:hover { filter: brightness(1.25); color: var(--bg); }
.adminbtn .i { width: 15px; height: 15px; }
.adminbtn[aria-current="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--st-working); }
.presence { display: flex; padding-right: 6px; }
.presence .av { margin-left: -8px; border: 2px solid var(--bg); }
.presence .av:first-child { margin-left: 0; }

/* the bell (templates/partials/bell.html) drawn as an icon button inside the bar */
.bar-right .bell { position: static; display: flex; z-index: auto; }
.bar-right .bell-wrap { position: relative; display: flex; }
.bar-right .bell-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); }
.bar-right .bell-btn:hover, .bar-right .bell-btn[aria-expanded="true"] { background: var(--surface); color: var(--ink); border-color: transparent; }
.bar-right .bell-btn svg { width: 20px; height: 20px; }
.bar-right .bell-count { top: 3px; right: 2px; background: var(--st-working); border: 2px solid var(--bg); font-family: var(--font-body); }

/* avatars: --h comes from the hue class, a person's id modulo 12 */
.av { --h: 18; width: 32px; height: 32px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; background: hsl(var(--h) 70% 92%); color: hsl(var(--h) 55% 30%); font: 700 12px/1 var(--font-body); letter-spacing: .02em; position: relative; }
:root[data-theme="dark"] .av { background: hsl(var(--h) 35% 24%); color: hsl(var(--h) 80% 84%); }
.av--h0 { --h: 18; } .av--h1 { --h: 48; } .av--h2 { --h: 90; } .av--h3 { --h: 140; } .av--h4 { --h: 175; } .av--h5 { --h: 205; }
.av--h6 { --h: 230; } .av--h7 { --h: 262; } .av--h8 { --h: 290; } .av--h9 { --h: 320; } .av--h10 { --h: 348; } .av--h11 { --h: 30; }
.av--sm { width: 24px; height: 24px; font-size: 10px; }
.av--lg { width: 44px; height: 44px; font-size: 15px; }
.av--team { background: var(--slab); color: var(--slab-ink); }
.acct { display: flex; align-items: center; gap: 0; padding: 3px; border: 0; border-radius: 999px; background: none; cursor: pointer; min-height: 44px; }
.acct:hover { background: var(--surface); }
.acct__badge { position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%); padding: 1px 4px; border-radius: 4px; background: var(--st-working); color: #fff; font: 700 8px/1.2 var(--font-sign); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }

.acct-card { display: flex; gap: 10px; align-items: center; padding: 8px 10px 10px; }
.acct-card b { display: block; }
.acct-card__role { display: block; font-size: 13px; color: var(--muted); }
.track--compact { margin: 4px 0 0; }
.track--compact span { display: none; }
.track--compact li.now span, .track--compact li[aria-current="step"] span { display: block; }

/* ---------- Popovers and menus ---------- */
.pop { position: absolute; z-index: 90; min-width: 260px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 8px; opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top; pointer-events: none; visibility: hidden; transition: opacity 160ms ease, transform 220ms var(--ease-spring), visibility 0s linear 220ms; }
.pop.is-open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.pop__title { padding: 8px 10px 6px; font: 600 12px/1 var(--font-sign); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; min-height: 40px; border: 0; border-radius: var(--r); background: none; text-align: left; text-decoration: none; cursor: pointer; font-size: 14px; color: var(--ink); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface); color: var(--ink); }
.menu-item small { color: var(--muted); margin-left: auto; font-size: 12px; }
.menu-item .i { width: 16px; height: 16px; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.pop input[type="search"] { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: var(--r); padding: 0 10px; background: var(--surface); margin-bottom: 6px; }
.pop form { margin: 0; }

/* the AideaMaker sites menu (admins only, skill aideamaker-menu): its tokens mapped onto Transit's, light and dark */
:root,
:root:not([data-theme="light"]),
:root[data-theme="dark"] {
  --am-menu-surface: var(--card);
  --am-menu-text: var(--ink);
  --am-menu-muted: var(--muted);
  --am-menu-rule: var(--line);
  --am-menu-hover: var(--surface);
  --am-menu-accent: var(--st-working);
  --am-menu-radius: var(--r);
}
.topbar .am-sites-menu { z-index: 95; box-shadow: var(--shadow-3); }

/* ---------- Page head and Layer 2 tabs ---------- */
.pagehead { padding: 26px 0 0; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.crumbs a { text-decoration: none; color: inherit; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.pagehead__row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.pagehead h1 { margin: 0; font: 700 38px/1.05 var(--font-sign); letter-spacing: -.005em; }
.pagehead__sub { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.pagehead__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; margin: 18px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { flex: none; position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px; border: 0; background: none; color: var(--muted); text-decoration: none; cursor: pointer; font: 600 15px/1 var(--font-body); scroll-snap-align: start; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs [aria-current="page"], .tabs [aria-selected="true"] { color: var(--ink); }
.tabs [aria-current="page"]::after, .tabs [aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--ink); }
.tabs .count { min-width: 20px; padding: 0 6px; height: 20px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); font: 700 12px/20px var(--font-body); }

/* Layer 3: segmented switch */
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); gap: 2px; overflow: visible; }
.seg button, .seg a { min-height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.seg button + button, .seg a + a, .seg button + a, .seg a + button { border-left: 0; }
.seg button[aria-pressed="true"], .seg .on, .seg a[aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }
.seg .i { width: 15px; height: 15px; }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink-2); cursor: pointer; font-size: 13px; font-weight: 600; text-decoration: none; }
.chip[aria-pressed="true"], .chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip:hover { border-color: var(--line-strong); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--bg); color: var(--ink); font-weight: 600; font-size: 14px; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform 120ms ease, background 160ms ease, box-shadow 160ms ease; }
.btn:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; }
.btn .i { width: 17px; height: 17px; flex: none; }
.btn--primary, .btn-primary { background: var(--st-working); border-color: var(--st-working); color: #fff; }
.btn--primary:hover:not(:disabled), .btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--st-working) 88%, #000); color: #fff; }
.btn--dark { background: var(--st-live); border-color: var(--st-live); color: var(--bg); }
.btn--dark:hover:not(:disabled) { background: color-mix(in srgb, var(--st-live) 85%, var(--bg)); color: var(--bg); }
.btn--ok { background: var(--st-completed); border-color: var(--st-completed); color: #fff; }
.btn--ok:hover:not(:disabled) { background: color-mix(in srgb, var(--st-completed) 88%, #000); color: #fff; }
.btn--bad { color: var(--st-red-ink); border-color: color-mix(in srgb, var(--st-red) 45%, var(--line)); }
.btn--bad:hover:not(:disabled) { background: color-mix(in srgb, var(--st-red) 9%, var(--bg)); color: var(--st-red-ink); }
.btn-danger { background: var(--st-red); border-color: var(--st-red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--st-red) 88%, #000); color: #fff; }
.btn--ghost { border-color: transparent; background: none; }
.btn--ghost:hover:not(:disabled) { background: var(--surface); }
.btn--sm, .btn-sm { min-height: 32px; padding: 0 11px; font-size: 13px; }
.btn--lg { min-height: 48px; padding: 0 22px; font-size: 15px; }
.btn .kbd { margin-left: 2px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 13px; color: var(--ink-2); }
.field input, .field textarea, .field select { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--bg); color: var(--ink); font-size: 14px; }
.field input[type="checkbox"], .field input[type="radio"] { display: inline-block; width: 16px; height: 16px; min-height: 0; margin-right: 8px; accent-color: var(--st-working); }
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, input.search:focus, .feature-search:focus,
.toolbar input[type="search"]:focus, .toolbar select:focus, .toolbar .field input:focus, .toolbar .field select:focus {
  outline: 0;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent);
}

/* ---------- Stage colours ---------- */
.st-live { --st: var(--st-live); --st-ink: var(--st-live); }
.st-concepts { --st: var(--st-concepts); --st-ink: var(--muted); }
.st-working { --st: var(--st-working); --st-ink: var(--st-working-ink); }
.st-waiting { --st: var(--st-waiting); --st-ink: var(--st-waiting-ink); }
.st-building { --st: var(--st-building); --st-ink: var(--st-building-ink); }
.st-completed { --st: var(--st-completed); --st-ink: var(--st-completed-ink); }
.st-declined, .st-archived { --st: var(--st-red); --st-ink: var(--st-red-ink); }

.roundel { --size: 34px; width: var(--size); height: var(--size); border-radius: 50%; border: 6px solid var(--st); background: var(--bg); display: inline-grid; place-items: center; font: 700 13px/1 var(--font-sign); color: var(--ink); flex: none; }
.stage-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 6px; border-radius: 999px; background: color-mix(in srgb, var(--st) 14%, var(--bg)); color: var(--st-ink); font: 700 12px/1 var(--font-sign); letter-spacing: .05em; text-transform: uppercase; font-stretch: semi-condensed; white-space: nowrap; }
.stage-pill::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 3px solid var(--st); background: var(--bg); }
.livestate { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.livestate i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 20%, transparent); }
.livestate.ok { --c: var(--st-completed); color: var(--st-completed-ink); }
.livestate.warn { --c: var(--st-waiting); color: var(--st-waiting-ink); }
.livestate.bad { --c: var(--st-red); color: var(--st-red-ink); }
.livestate.none { --c: var(--st-concepts); color: var(--muted); }
.livestate.ok i { animation: pulse-ok 2.4s ease-out infinite; }
@keyframes pulse-ok { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 45%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- Ticket (request) ---------- */
.ticket { position: relative; display: grid; grid-template-columns: 1fr; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); padding: 12px 14px 12px 20px; text-align: left; transition: transform 220ms var(--ease-spring), box-shadow 200ms ease, border-color 160ms ease; }
.ticket::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; border-radius: var(--r) 0 0 var(--r); background: var(--st); }
.ticket::after { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 6px; background-image: radial-gradient(circle at 3px 3px, var(--surface-2) 2.2px, transparent 2.6px); background-size: 6px 9px; background-repeat: repeat-y; }
.ticket:hover { box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.ticket.is-focus { outline: 3px solid var(--focus); outline-offset: 2px; }
.ticket__top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.ticket__kind { font: 700 11px/1 var(--font-sign); letter-spacing: .06em; text-transform: uppercase; color: var(--st-ink); }
.ticket__title { font-weight: 650; font-size: 14.5px; line-height: 1.35; margin: 0 0 6px; font-family: var(--font-body); }
.ticket__title a { text-decoration: none; color: var(--ink); }
.ticket__title a:hover { text-decoration: underline; }
.ticket__meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.ticket__actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ticket__note { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.taskid { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 4px; background: color-mix(in srgb, var(--st-building) 12%, var(--bg)); color: var(--st-building-ink); font: 600 11.5px/1 var(--font-mono); text-decoration: none; white-space: nowrap; }
.taskid:hover { text-decoration: underline; color: var(--st-building-ink); }
.dupes { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 4px; background: var(--surface-2); font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.conflict { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 4px; background: color-mix(in srgb, var(--st-red) 12%, var(--bg)); color: var(--st-red-ink); font-size: 11.5px; font-weight: 700; }
.risky { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 4px; background: color-mix(in srgb, var(--st-red) 12%, var(--bg)); color: var(--st-red-ink); font-size: 11.5px; font-weight: 700; }
.wtag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; background: color-mix(in srgb, var(--st-building) 12%, var(--bg)); color: var(--st-building-ink); font-size: 11px; font-weight: 700; }
.partly { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 4px; background: color-mix(in srgb, var(--st-waiting) 22%, var(--bg)); color: var(--st-waiting-ink); font-size: 11.5px; font-weight: 700; }
.tk-changes { list-style: none; margin: 6px 0 2px; padding: 0; display: grid; gap: 3px; font-size: 12.5px; }
.tk-changes li { position: relative; padding-left: 16px; }
.tk-changes li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--st-completed); }
.tk-changes li.is-no { color: var(--muted); text-decoration: line-through; }
.tk-changes li.is-no::before { background: var(--st-red); }
.tk-changes li em { text-decoration: none; display: inline-block; font-style: normal; color: var(--st-red-ink); font-weight: 600; }
.ticket.st-concepts::before { background: var(--st-concepts); }

/* Request track: ticket stub with punched steps */
.track { display: flex; align-items: center; gap: 0; margin: 8px 0 2px; list-style: none; padding: 0; }
.track li { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.track li::before { content: ""; position: absolute; top: 6px; left: -50%; right: 50%; height: 3px; background: var(--line); }
.track li:first-child::before { display: none; }
.track li.done::before, .track li.now::before { background: var(--st-ink, var(--ink)); }
.track .hole { position: relative; z-index: 1; width: 15px; height: 15px; border-radius: 50%; border: 2px dashed var(--line-strong); background: var(--bg); }
.track li.done .hole { border: 0; background: var(--st-ink, var(--ink)); box-shadow: inset 0 0 0 4px var(--bg), 0 0 0 2px var(--st-ink, var(--ink)); }
.track li.now .hole { border: 3px solid var(--st); background: var(--bg); box-shadow: 0 0 0 4px color-mix(in srgb, var(--st) 25%, transparent); }
.track li.declined .hole { border: 0; background: var(--st-red); }
.track li.closed .hole { border: 0; background: var(--st-concepts); }
.track li.off { opacity: .35; }
.track li.partly .hole { box-shadow: inset 0 0 0 4px var(--bg), 0 0 0 2px var(--st-waiting); background: linear-gradient(90deg, var(--st-ink) 50%, var(--st-waiting) 50%); }
.track span { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.track li.done span, .track li.now span { color: var(--ink-2); font-weight: 600; }
.track a { text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 100%; color: inherit; }
.track a:hover span { text-decoration: underline; }
.journey { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.journey b { color: var(--ink); }
.journey .i { width: 14px; height: 14px; }
.journey a { color: var(--st-building-ink); }

/* ---------- Departure board ---------- */
.board { background: var(--slab); color: var(--slab-ink); border-radius: var(--r-lg); padding: 16px 18px; font-family: var(--font-mono); box-shadow: var(--shadow-2); position: relative; overflow: hidden; }
.board::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px); }
.board__head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.board__title { margin: 0; font: 700 14px/1 var(--font-sign); letter-spacing: .14em; text-transform: uppercase; color: #fff; }
.board__clock { margin-left: auto; color: var(--slab-dim); font-size: 13px; }
.board__summary { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 15px; color: #fff; }
.board__summary b { color: var(--slab-ink); }
.flap { display: inline-flex; gap: 2px; vertical-align: middle; }
.flap span { display: inline-grid; place-items: center; width: 22px; height: 30px; border-radius: 3px; background: var(--slab-2); color: var(--slab-ink); font: 700 19px/1 var(--font-mono); position: relative; overflow: hidden; }
.flap span::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0, 0, 0, .65); }
.flap span.flip { animation: flap 420ms var(--ease-out); }
@keyframes flap { 0% { transform: rotateX(0); } 45% { transform: rotateX(88deg); filter: brightness(.6); } 55% { transform: rotateX(-88deg); } 100% { transform: rotateX(0); } }
.board__rows { list-style: none; margin: 0; padding: 0; }
.board__row { display: grid; grid-template-columns: 72px 1fr auto auto; gap: 14px; align-items: center; padding: 9px 0; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 13.5px; color: #e9e9ea; position: relative; z-index: 1; }
.board__row .t { color: var(--slab-ink); }
.board__row .what { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-body); font-size: 14px; }
.board__row .plat { color: var(--slab-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.board__row .go { color: var(--slab-ink); text-decoration: none; border: 1px solid rgba(255, 214, 10, .45); padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.board__row .go:hover, .board__row .go:focus-visible { background: var(--slab-ink); color: #111; }
.board__row .blink { animation: blink 1.4s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.board__more { margin-left: 12px; color: var(--slab-ink); font: 700 12px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; text-decoration: none; border: 1px solid rgba(255, 214, 10, .45); padding: 6px 10px; border-radius: 4px; position: relative; z-index: 1; }
.board__more:hover, .board__more:focus-visible { background: var(--slab-ink); color: #111; }

/* ---------- Cards, titles, empty ---------- */
.panel-title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font: 700 15px/1.2 var(--font-sign); letter-spacing: .07em; text-transform: uppercase; font-stretch: semi-condensed; }
.panel-title .count { font-family: var(--font-body); letter-spacing: 0; text-transform: none; font-size: 13px; color: var(--muted); font-weight: 600; }
.empty { padding: 26px 18px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--r-lg); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* Thumbnails: the real picture when there is one, else a quiet blank page */
.thumb { position: relative; aspect-ratio: 16 / 10; border-radius: var(--r); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.thumb--blank::before { content: ""; position: absolute; inset: 12% 10%; border-radius: 4px; background: repeating-linear-gradient(0deg, var(--surface-2) 0 6px, transparent 6px 14px); }
.thumb--concept img { filter: saturate(.3); }
.thumb .lock { position: absolute; right: 8px; top: 8px; width: 26px; height: 26px; border-radius: 50%; background: rgba(17, 17, 17, .8); color: #fff; display: grid; place-items: center; }
.thumb .lock .i { width: 14px; height: 14px; }

/* ---------- Floating theme switch ---------- */
.theme-switch { position: fixed; right: 18px; bottom: 18px; z-index: 95; display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-2); }
.theme-switch button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; }
.theme-switch button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.theme-switch .i { width: 17px; height: 17px; }

/* ---------- Toasts and the live region ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 170; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; min-width: 300px; max-width: min(560px, calc(100vw - 32px)); padding: 10px 10px 10px 16px; border-radius: var(--r-lg); background: var(--st-live); color: var(--bg); box-shadow: var(--shadow-3); font-size: 14px; animation: toast-in 380ms var(--ease-spring); }
.toast__dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--st-completed); }
.toast__dot[data-tone="working"] { background: var(--st-working); }
.toast__dot[data-tone="waiting"] { background: var(--st-waiting); }
.toast__dot[data-tone="building"] { background: var(--st-building); }
.toast__dot[data-tone="red"] { background: var(--st-red); }
.toast__dot[data-tone="neutral"] { background: var(--st-concepts); }
.toast__msg { flex: 1; }
.toast button { border: 0; background: rgba(255, 255, 255, .14); color: inherit; border-radius: var(--r); min-height: 32px; padding: 0 12px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
:root[data-theme="dark"] .toast button { background: rgba(0, 0, 0, .1); }
.toast .kbd { background: transparent; color: inherit; border-color: currentColor; }
.toast.is-out { animation: toast-out 220ms ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ---------- Scrim, palette, dialogs, sheets ---------- */
.scrim { position: fixed; inset: 0; z-index: 140; background: rgba(10, 10, 12, .38); backdrop-filter: blur(3px); display: none; }
.scrim.is-open { display: block; animation: fade 160ms ease; }
@keyframes fade { from { opacity: 0; } }
.palette { position: fixed; z-index: 150; top: 12vh; left: 50%; width: min(640px, calc(100vw - 24px)); transform: translateX(-50%); background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3); overflow: hidden; display: none; }
.palette.is-open { display: block; animation: pal-in 260ms var(--ease-spring); }
@keyframes pal-in { from { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(.97); } }
.palette__input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette__input .i { width: 19px; height: 19px; color: var(--muted); }
.palette__input input { flex: 1; height: 56px; border: 0; background: none; font-size: 17px; outline: none; min-width: 0; }
.palette__list { max-height: 50vh; overflow: auto; padding: 6px; margin: 0; list-style: none; }
.palette__group { padding: 10px 10px 4px; font: 600 11px/1 var(--font-sign); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.palette__item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r); cursor: pointer; font-size: 14.5px; }
.palette__item[aria-selected="true"] { background: var(--surface); }
.palette__item .ico { width: 30px; height: 30px; border-radius: var(--r); display: grid; place-items: center; background: var(--surface-2); flex: none; }
.palette__item .ico .i { width: 16px; height: 16px; }
.palette__item .hint { margin-left: auto; color: var(--muted); font-size: 12px; }
.palette__foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; flex-wrap: wrap; align-items: center; }

.dialog { position: fixed; z-index: 150; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3); padding: 22px; display: none; }
.dialog.is-open { display: block; animation: dlg-in 300ms var(--ease-spring); }
@keyframes dlg-in { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } }
.dialog h2 { margin: 0 0 6px; font: 700 24px/1.1 var(--font-sign); }
.dialog p { color: var(--muted); margin: 0 0 14px; }
.dialog__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.dialog__x { position: absolute; right: 12px; top: 12px; }
.keys { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 22px; margin: 0; }
.keys div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.keys dt { display: flex; gap: 4px; }
.keys dd { margin: 0; color: var(--muted); text-align: right; }
.dialog__link { display: inline-block; margin-top: 12px; font-size: 14px; }

.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 150; background: var(--card); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-3); padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); transform: translateY(105%); visibility: hidden; transition: transform 340ms var(--ease-out), visibility 0s linear 340ms; }
.sheet.is-open { transform: none; visibility: visible; transition-delay: 0s; }
.sheet__grab { width: 42px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 10px; }
.sheet .menu-item { min-height: 48px; font-size: 16px; }
.sheet .menu-item .i { width: 20px; height: 20px; }
.sheet form { margin: 0; }

/* ---------- Phone bottom tabs and title ---------- */
.tabbar { display: none; }
.phone-title { display: none; }

/* ---------- Skeleton ---------- */
.skel { position: relative; overflow: hidden; background: var(--surface); border-radius: var(--r); }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--bg) 65%, transparent), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- Tour ---------- */
.tour { position: fixed; z-index: 145; width: min(360px, calc(100vw - 24px)); background: var(--slab); color: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 16px 18px; display: none; }
.tour.is-open { display: block; animation: dlg-pop 320ms var(--ease-spring); }
@keyframes dlg-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.tour__step { font: 700 11px/1 var(--font-sign); letter-spacing: .14em; color: var(--slab-ink); text-transform: uppercase; }
.tour h3 { margin: 6px 0 6px; font: 700 20px/1.15 var(--font-sign); color: #fff; }
.tour p { margin: 0 0 12px; color: #d4d4d8; font-size: 14px; }
.tour__foot { display: flex; gap: 8px; align-items: center; }
.tour__dots { display: flex; gap: 5px; margin-right: auto; }
.tour__dots i { width: 8px; height: 8px; border-radius: 50%; background: #3f3f46; }
.tour__dots i.on { background: var(--slab-ink); }
.tour .btn { border-color: #3f3f46; background: transparent; color: #fff; }
.tour .btn--primary { background: var(--slab-ink); border-color: var(--slab-ink); color: #111; }
.tour-ring { position: fixed; z-index: 144; border-radius: 14px; box-shadow: 0 0 0 4px var(--slab-ink), 0 0 0 9999px rgba(10, 10, 12, .45); pointer-events: none; display: none; transition: all 380ms var(--ease-out); }
.tour-ring.is-open { display: block; }
.tour-invite { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 16px; margin-bottom: 14px; border-radius: var(--r-lg); border: 1px solid color-mix(in srgb, var(--st-working) 35%, var(--line)); background: color-mix(in srgb, var(--st-working) 7%, var(--bg)); animation: dlg-pop 420ms var(--ease-spring); }
.tour-invite__ico { width: 38px; height: 38px; border-radius: 50%; background: var(--st-working); color: #fff; display: grid; place-items: center; flex: none; }
.tour-invite__ico .i { width: 20px; height: 20px; }
.tour-invite div { flex: 1; min-width: 0; }
.tour-invite b { display: block; }
.tour-invite span { font-size: 13px; color: var(--muted); }
.tour-invite__ico { color: #fff; }

.backbtn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line-strong); color: var(--ink); text-decoration: none; font: 600 13px/1 var(--font-sign); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.backbtn:hover { background: var(--surface); }
.backbtn .i { width: 15px; height: 15px; }

/* ---------- Responsive frame ---------- */
@media (max-width: 1499px) {
  body[data-presence] .searchbtn { min-width: 0; padding: 0 10px; }
  body[data-presence] .searchbtn .lbl, body[data-presence] .searchbtn .kbd { display: none; }
}
@media (max-width: 1279px) {
  .searchbtn { min-width: 0; padding: 0 10px; }
  .searchbtn .lbl, .searchbtn .kbd { display: none; }
  .nav a { padding: 0 9px; font-size: 14px; }
  .presence { display: none; }
}
@media (max-width: 1023px) {
  .nav, .searchbtn, .adminbtn, .bar-right .help-btn, .presence, .brand__name, .brand .logo-word, .brand__chev, .bar-right .acct { display: none; }
  .switcher { max-width: 150px; height: 36px; min-height: 44px; }
  .switcher__name { font-size: 13px; }
  .phone-title { display: block; flex: 1; min-width: 0; text-align: center; font: 700 15px/1 var(--font-sign); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bar-right { margin-left: 0; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a, .tabbar button { position: relative; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; text-decoration: none; color: var(--muted); font: 600 11px/1 var(--font-sign); letter-spacing: .05em; text-transform: uppercase; cursor: pointer; padding: 0; }
  .tabbar .i { width: 22px; height: 22px; }
  .tabbar [aria-current="page"] { color: var(--ink); }
  .tabbar [aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 4px; border-radius: 0 0 4px 4px; background: var(--st-working); }
  .tabbar .badge { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--st-working); color: #fff; font: 700 10px/17px var(--font-body); }
  body { padding-bottom: 72px; }
  .theme-switch { bottom: 76px; right: 12px; }
  .toasts { bottom: 84px; }
  .pagehead h1 { font-size: 30px; }
  .pagehead__actions { margin-left: 0; width: 100%; }
  .tabs a, .tabs button { min-height: 44px; }
  .board__row { grid-template-columns: 58px 1fr auto; }
  .board__row .proj, .board__row .plat { display: none; }
  .keys { grid-template-columns: 1fr; }
  .tour-invite { flex-wrap: wrap; padding-right: 44px; }
  .tour-invite div { flex: 1 1 calc(100% - 60px); }
  .tour-invite .btn { margin-left: 52px; }
  .tour-invite .iconbtn { position: absolute; right: 6px; top: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .livestate.ok i, .board__row .blink { animation: none !important; }
}

/* Phone touch targets: every control in the frame is at least 44 px */
@media (max-width: 600px) {
  .btn, .chip, .iconbtn, .brand, .switcher, .menu-item, .go, .board__more, .taskid, button.pin, select, input:not([type=checkbox]):not([type=radio]) { min-height: 44px; }
  .btn, .chip, .iconbtn, .brand, .go, .board__more, button.pin { min-width: 44px; }
  .btn, .chip, .go, .board__more, .taskid { display: inline-flex; align-items: center; justify-content: center; }
  .nstn { min-width: 44px; min-height: 44px; }
  button:not([class*="ce-"]):not(.tip-btn):not(.theme-switch button), [role=tab], select, summary { min-height: 44px; }
  button:not([class*="ce-"]):not(.tip-btn):not(.btn):not(.theme-switch button) { min-width: 44px; }
  .theme-switch button { width: 44px; height: 44px; }
  .ticket__title a, .crumbs a, .track a, .journey a { display: inline-flex; align-items: center; min-height: 44px; }
  .track a { display: flex; }
  .bar-right .bell-btn { width: 44px; height: 44px; }
}
