/* Freight Radar — one stylesheet for the public pages and the dashboard.
   Look: a control tower. Night-blue navigation, light work area, one signal colour (orange). */

@font-face {
  font-family: "Archivo";
  src: url("/static/fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Colours and sizes ---------------------------------------------------------- */

:root {
  color-scheme: light;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;

  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #e9edf3;
  --line: #e1e6ee;
  --line-strong: #c6cfdb;
  --ink: #0b1322;
  --ink-2: #344054;
  --ink-3: #596579;

  --brand: #f15a1f;
  --brand-strong: #c9440d;
  --brand-hover: #b03a09;
  --brand-soft: #fff0e8;
  --brand-text: #b53b08;
  --on-brand: #ffffff;

  --ok: #0b7a4b;
  --ok-soft: #e3f6ec;
  --warn: #974a05;
  --warn-soft: #fff3de;
  --danger: #c0271c;
  --danger-soft: #fdecea;
  --danger-strong: #c0271c;
  --on-danger: #ffffff;
  --info: #1d4fd6;
  --info-soft: #e9efff;
  --load: #1d4fd6;
  --load-soft: #e7eeff;
  --truck: #6d2fd1;
  --truck-soft: #f1eaff;
  --wa: #0d7a5f;
  --wa-hover: #0a6850;
  --wa-soft: #e2f6ee;
  --wa-text: #0d7a5f;
  --on-wa: #ffffff;
  --tg: #11679f;
  --tg-soft: #e5f2fb;

  --nav-bg: #0b1322;
  --nav-ink: #d3dae6;
  --nav-muted: #8a96aa;
  --nav-line: rgba(255, 255, 255, 0.09);
  --nav-hover: rgba(255, 255, 255, 0.06);
  --nav-active: rgba(255, 255, 255, 0.1);

  --avatar-bg: 70% 90%;
  --avatar-ink: 55% 28%;
  --seg-track: #e9edf3;
  --seg-active: #ffffff;

  --radius: 12px;
  --radius-l: 16px;
  --radius-xl: 24px;
  --shadow-1: 0 1px 2px rgba(11, 19, 34, 0.06);
  --shadow-2: 0 1px 2px rgba(11, 19, 34, 0.05), 0 8px 20px -6px rgba(11, 19, 34, 0.1);
  --shadow-3: 0 24px 56px -16px rgba(11, 19, 34, 0.32);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 32%, transparent);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #080d17;
    --surface: #111927;
    --surface-2: #162031;
    --surface-3: #1e2a40;
    --line: #222e42;
    --line-strong: #36455e;
    --ink: #edf1f7;
    --ink-2: #c5cedb;
    --ink-3: #94a1b5;
    --brand: #ff7a3d;
    --brand-strong: #ff8548;
    --brand-hover: #ff9c69;
    --brand-soft: #2b1a12;
    --brand-text: #ff9460;
    --on-brand: #1a0c04;
    --ok: #4ad295;
    --ok-soft: #0f2a1f;
    --warn: #f3ad4a;
    --warn-soft: #32240d;
    --danger: #ff7f74;
    --danger-soft: #371613;
    --danger-strong: #ff7f74;
    --on-danger: #2a0704;
    --info: #8fb4ff;
    --info-soft: #152445;
    --load: #8fb4ff;
    --load-soft: #172648;
    --truck: #c7abff;
    --truck-soft: #2a1e49;
    --wa: #25d366;
    --wa-hover: #45e07f;
    --wa-soft: #0f2b1d;
    --wa-text: #3ddc7c;
    --on-wa: #04200f;
    --tg: #5cb8f0;
    --tg-soft: #10283a;
    --nav-bg: #060a12;
    --avatar-bg: 35% 24%;
    --avatar-ink: 75% 82%;
    --seg-track: #0d1422;
    --seg-active: #243149;
    --shadow-1: none;
    --shadow-2: 0 8px 20px -8px rgba(0, 0, 0, 0.6);
    --shadow-3: 0 24px 56px -16px rgba(0, 0, 0, 0.8);
  }
  :root:not([data-theme="light"]) .when-light { display: none; }
  :root:not([data-theme="light"]) .when-dark { display: block; }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080d17;
  --surface: #111927;
  --surface-2: #162031;
  --surface-3: #1e2a40;
  --line: #222e42;
  --line-strong: #36455e;
  --ink: #edf1f7;
  --ink-2: #c5cedb;
  --ink-3: #94a1b5;
  --brand: #ff7a3d;
  --brand-strong: #ff8548;
  --brand-hover: #ff9c69;
  --brand-soft: #2b1a12;
  --brand-text: #ff9460;
  --on-brand: #1a0c04;
  --ok: #4ad295;
  --ok-soft: #0f2a1f;
  --warn: #f3ad4a;
  --warn-soft: #32240d;
  --danger: #ff7f74;
  --danger-soft: #371613;
  --danger-strong: #ff7f74;
  --on-danger: #2a0704;
  --info: #8fb4ff;
  --info-soft: #152445;
  --load: #8fb4ff;
  --load-soft: #172648;
  --truck: #c7abff;
  --truck-soft: #2a1e49;
  --wa: #25d366;
  --wa-hover: #45e07f;
  --wa-soft: #0f2b1d;
  --wa-text: #3ddc7c;
  --on-wa: #04200f;
  --tg: #5cb8f0;
  --tg-soft: #10283a;
  --nav-bg: #060a12;
  --avatar-bg: 35% 24%;
  --avatar-ink: 75% 82%;
  --seg-track: #0d1422;
  --seg-active: #243149;
  --shadow-1: none;
  --shadow-2: 0 8px 20px -8px rgba(0, 0, 0, 0.6);
  --shadow-3: 0 24px 56px -16px rgba(0, 0, 0, 0.8);
}
:root[data-theme="dark"] .when-light { display: none; }
:root[data-theme="dark"] .when-dark { display: block; }

/* --- Base ------------------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
strong { font-weight: 700; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--brand) 30%, transparent); }

html:not(.js) .js-only { display: none !important; }
.js .no-js { display: none !important; }
.when-dark { display: none; }

/* A click was taken and the next page is on its way (static/app.js): a thin bar grows across the top of the screen. */
html.is-leaving::before {
  content: "";
  position: fixed;
  z-index: 200;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
  box-shadow: 0 0 8px color-mix(in srgb, var(--brand) 60%, transparent);
  transform-origin: left center;
  animation: leaving 6s cubic-bezier(0.05, 0.7, 0.1, 1) forwards;
  pointer-events: none;
}
html.is-leaving a,
html.is-leaving button { cursor: progress; }
@keyframes leaving {
  from { transform: scaleX(0); }
  to { transform: scaleX(0.94); }
}
@media (prefers-reduced-motion: reduce) {
  html.is-leaving::before { animation: none; transform: scaleX(0.6); }
}

.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.center { text-align: center; }
.stack { display: grid; gap: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { flex: none; width: 1.2em; height: 1.2em; }

/* --- Buttons ---------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  text-decoration: none !important;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.08s;
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 18px; height: 18px; }
.btn.primary { background: var(--brand-strong); color: var(--on-brand); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(11, 19, 34, 0.25); }
.btn.primary:hover { background: var(--brand-hover); }
.btn.secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); box-shadow: var(--shadow-1); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn.ghost { color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.wa { background: var(--wa); color: var(--on-wa); }
.btn.wa:hover { background: var(--wa-hover); }
.btn.danger { color: var(--danger); }
.btn.ghost.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn.solid-danger { background: var(--danger-strong); color: var(--on-danger); }
.btn.small { min-height: 34px; padding: 0 12px; border-radius: 9px; font-size: 14px; }
.btn.small .icon { width: 16px; height: 16px; }
.btn.big { min-height: 50px; padding: 0 22px; border-radius: 12px; font-size: 16px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.is-busy { opacity: 0.85; cursor: progress; }

.icon-btn {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.icon-btn .icon { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.icon-btn.outlined { border-color: var(--line-strong); background: var(--surface); color: var(--ink-2); }
.icon-btn.outlined:hover { border-color: var(--ink-3); background: var(--surface-2); }
.icon-btn.danger:hover { border-color: transparent; background: var(--danger-soft); color: var(--danger); }
.icon-btn.copied { border-color: var(--ok); color: var(--ok); }

/* --- Fields ------------------------------------------------------------------------ */

.field { display: grid; gap: 6px; }
.field-label { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.field-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-3);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-box:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.field-box > .icon { width: 18px; height: 18px; }
.field-box input { flex: 1; min-width: 0; height: 42px; padding: 0; border: 0; outline: 0; background: none; color: var(--ink); }
.field-box.big { min-height: 52px; padding: 0 16px; border-radius: 12px; }
.field-box.big input { height: 50px; font-size: 16px; }
.field-box.big > .icon { width: 20px; height: 20px; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 0.75; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.field-toggle { display: grid; place-items: center; width: 34px; height: 34px; margin-right: -6px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--ink-3); cursor: pointer; }
.field-toggle:hover { background: var(--surface-3); color: var(--ink); }
.field-toggle .icon { width: 18px; height: 18px; }
.field-toggle .when-shown, .field-toggle[aria-pressed="true"] .when-hidden { display: none; }
.field-toggle[aria-pressed="true"] .when-shown { display: block; }

textarea {
  display: block;
  width: 100%;
  min-height: 140px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea:focus { outline: 0; border-color: var(--brand); box-shadow: var(--ring); }
.field-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: -8px; }
.field-foot > :last-child { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }

.choices { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.choices.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choices legend { margin-bottom: 8px; padding: 0; }
.choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.choice:hover { border-color: var(--ink-3); }
.choice input {
  flex: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  transition: border 0.15s;
}
.choice input:checked { border: 6px solid var(--brand-strong); }
.choice input:focus-visible { outline-offset: 3px; }
.choice:has(input:checked) { border-color: var(--brand-strong); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand-strong); }
.choice-body { display: grid; gap: 2px; min-width: 0; }
.choice-body strong { display: flex; align-items: center; gap: 8px; }
.choice-body strong .icon { width: 18px; height: 18px; color: var(--ink-3); }

/* --- Small parts -------------------------------------------------------------------- */

.card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow-1); }
.card h2 + .muted { margin-top: 4px; }
.card.quiet { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; background: none; box-shadow: none; }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  transition: opacity 0.3s, transform 0.3s;
}
.notice > .icon { width: 20px; height: 20px; margin-top: 1px; }
.notice-body { flex: 1; min-width: 0; color: var(--ink); }
.notice a:not(.btn) { color: inherit; font-weight: 600; text-decoration: underline; }
.notice.ok { border-color: color-mix(in srgb, var(--ok) 28%, transparent); background: var(--ok-soft); color: var(--ok); }
.notice.warn { border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: var(--warn-soft); color: var(--warn); }
.notice.error { border-color: color-mix(in srgb, var(--danger) 30%, transparent); background: var(--danger-soft); color: var(--danger); }
.notice.info { border-color: color-mix(in srgb, var(--info) 22%, transparent); background: var(--info-soft); color: var(--info); }
.notice-action { align-self: center; border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.notice-action:hover { border-color: var(--ink-3); }
.notice-close { align-self: flex-start; width: 28px; height: 28px; margin: -3px -6px -3px 0; color: inherit; }
.notice.leaving { opacity: 0; transform: translateY(-4px); }

.dot { position: relative; display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.dot.ok { background: #22c55e; }
.dot.off { background: #ef4444; }
.dot.busy { background: #f59e0b; animation: blink 1.2s ease-in-out infinite; }
.dot.idle { background: #94a3b8; }
.dot.live::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: ping 2.2s cubic-bezier(0, 0, 0.2, 1) infinite; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill .icon { width: 14px; height: 14px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.off { background: var(--danger-soft); color: var(--danger); }
.pill.busy { background: var(--warn-soft); color: var(--warn); }

.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: hsl(var(--hue, 220) var(--avatar-bg));
  color: hsl(var(--hue, 220) var(--avatar-ink));
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.avatar.square { border-radius: 11px; }

.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--brand-strong)); transition: width 0.35s ease; }

.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--seg-track); }
.segmented button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--ink-3); font-size: 14px; font-weight: 600; cursor: pointer; transition: background-color 0.15s, color 0.15s; }
.segmented button:hover { color: var(--ink); }
.segmented button.active { background: var(--seg-active); color: var(--ink); box-shadow: var(--shadow-1); }
.segmented .count { min-width: 20px; height: 20px; background: none; font-size: 11.5px; }
.segmented button.active .count { background: var(--seg-track); }

.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 2px 0 8px; border: 0; border-radius: 999px; background: none; color: var(--ink-3); font-size: 13px; font-weight: 600; cursor: pointer; }
.switch-label { min-width: 62px; text-align: right; }
.switch-track { position: relative; flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); transition: background-color 0.2s; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s cubic-bezier(0.3, 0.7, 0.4, 1.3); }
.switch.on { color: var(--ok); }
.switch.on .switch-track { background: #16a34a; }
.switch.on .switch-thumb { transform: translateX(18px); }
.switch:disabled { opacity: 0.6; cursor: progress; }

.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 40px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-l);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  color: var(--ink-3);
  text-align: center;
}
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 4px; border-radius: 16px; background: var(--brand-soft); color: var(--brand-text); }
.empty-icon .icon { width: 26px; height: 26px; }
.empty strong { color: var(--ink); font-size: 16px; }
.empty p { max-width: 54ch; }
.empty .btn { margin-top: 8px; }

.spinner { display: inline-block; flex: none; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }

dialog.modal { width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); }
dialog.modal::backdrop { background: rgba(6, 10, 18, 0.6); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: pop 0.16s ease-out; }
.modal-body { margin: 0; padding: 24px 24px 6px; font-size: 16px; font-weight: 600; line-height: 1.4; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 22px; }

.toasts { position: fixed; z-index: 60; left: 50%; bottom: 24px; display: grid; justify-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-3); animation: rise 0.2s ease-out; transition: opacity 0.25s; }
.toast.leaving { opacity: 0; }

/* --- Dashboard frame ---------------------------------------------------------------- */

.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.skip { position: absolute; z-index: 100; top: -60px; left: 12px; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); font-weight: 600; }
.skip:focus { top: 12px; }

.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 17px; font-weight: 700; font-stretch: 112%; letter-spacing: -0.01em; text-decoration: none !important; }
.logo-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(140deg, #ff9a3d 0%, #f15a1f 55%, #d2410c 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 10px -3px rgba(241, 90, 31, 0.55);
}
.logo-mark svg { display: block; width: 26px; height: 26px; }

.side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  height: 100dvh;
  padding: 20px 14px 14px;
  background: var(--nav-bg);
  color: var(--nav-ink);
  overflow-y: auto;
}
.side .logo { padding: 0 8px; color: #fff; }

.nav { display: grid; gap: 2px; }
.nav-title { margin: 16px 10px 6px; color: var(--nav-muted); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.nav-title:first-child { margin-top: 0; }
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--nav-ink);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.nav a .icon { width: 18px; height: 18px; color: var(--nav-muted); transition: color 0.15s; }
.nav a:hover { background: var(--nav-hover); color: #fff; }
.nav a:hover .icon { color: #fff; }
.nav a.active { background: var(--nav-active); box-shadow: inset 3px 0 0 var(--brand); color: #fff; font-weight: 600; }
.nav a.active .icon { color: #ff8a52; }
.nav-text { flex: 1; }
.nav-count { min-width: 24px; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 12px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }

.side-foot { display: grid; gap: 12px; margin-top: auto; }
/* "Install the app": only shown where the browser can do it (static/app.js). */
.install { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border: 1px dashed rgba(255, 255, 255, 0.22); border-radius: 10px; background: none; color: var(--nav-ink); font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; transition: background-color 0.15s, color 0.15s, border-color 0.15s; }
.install:hover { border-color: var(--brand); background: var(--nav-hover); color: #fff; }
.install .icon { width: 17px; height: 17px; color: #ff8a52; }
/* On a public page shown inside the installed app on an iPhone, keep clear of the clock and battery line. */
body:not(.app) { padding-top: env(safe-area-inset-top); }
.reader { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); color: var(--nav-ink); font-size: 13px; font-weight: 500; }
.reader.off { background: rgba(239, 68, 68, 0.16); color: #fecaca; }
.account { display: flex; align-items: center; gap: 10px; padding: 12px 4px 0; border-top: 1px solid var(--nav-line); }
.side .avatar { width: 34px; height: 34px; --avatar-bg: 35% 28%; --avatar-ink: 80% 85%; }
.who { display: grid; flex: 1; min-width: 0; font-size: 13px; line-height: 1.3; }
.who strong { overflow: hidden; color: #fff; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.who span { overflow: hidden; color: var(--nav-muted); text-overflow: ellipsis; white-space: nowrap; }
.account form { display: flex; }
.side .icon-btn { width: 32px; height: 32px; color: var(--nav-muted); }
.side .icon-btn:hover { background: var(--nav-hover); color: #fff; }

.content { display: flex; flex-direction: column; min-width: 0; }
.mobile-bar, .tabbar { display: none; }

.main { display: grid; align-content: start; gap: 22px; width: 100%; max-width: 1200px; margin: 0 auto; padding: 30px clamp(16px, 3.2vw, 40px) 72px; }
.main > * { min-width: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.page-title { font-size: clamp(26px, 3vw, 32px); font-weight: 800; font-stretch: 112%; letter-spacing: -0.02em; }
.page-sub { max-width: 72ch; margin-top: 6px; color: var(--ink-3); }
.section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.section-head h2 { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.more { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; }
.more .icon { width: 16px; height: 16px; }
.sub-title { margin-top: 8px; font-size: 17px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* --- Dashboard ---------------------------------------------------------------------- */

.onboarding { display: grid; gap: 16px; border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); background: linear-gradient(180deg, var(--brand-soft), var(--surface) 130px); }
.onboarding-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.onboarding-head .progress { flex: 1 1 200px; max-width: 320px; height: 8px; background: color-mix(in srgb, var(--brand) 16%, var(--surface)); }
.steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.step { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.step-mark { display: grid; flex: none; place-items: center; width: 30px; height: 30px; border: 2px solid var(--line-strong); border-radius: 50%; color: var(--ink-3); font-size: 14px; font-weight: 700; }
.step-mark .icon { width: 16px; height: 16px; stroke-width: 3; }
.step-text { display: grid; flex: 1; min-width: 0; }
.step-text .muted { font-size: 13px; }
.step.current { border-color: var(--brand-strong); box-shadow: 0 0 0 1px var(--brand-strong); }
.step.current .step-mark { border-color: var(--brand-strong); background: var(--brand-strong); color: var(--on-brand); }
.step.done { background: none; }
.step.done .step-mark { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.step.done strong { color: var(--ink-3); font-weight: 600; }
.step.done .step-text .muted { display: none; }

.conns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.conn {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 4px 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
  text-decoration: none !important;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.conn:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.conn-icon { display: grid; grid-row: span 2; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); color: var(--ink-3); }
.conn-icon .icon { width: 22px; height: 22px; }
.conn.ok .conn-icon { background: var(--ok-soft); color: var(--ok); }
.conn.off .conn-icon { background: var(--danger-soft); color: var(--danger); }
.conn.busy .conn-icon { background: var(--warn-soft); color: var(--warn); }
.conn-body { display: grid; gap: 2px; min-width: 0; }
.conn-title { color: var(--ink-3); font-size: 13px; font-weight: 600; }
.conn-state { display: flex; align-items: center; gap: 8px; font-size: 17px; line-height: 1.25; }
.conn-detail { color: var(--ink-3); font-size: 13px; }
.conn-action { display: inline-flex; grid-column: 2; align-items: center; gap: 2px; margin-top: 8px; color: var(--brand-text); font-size: 14px; font-weight: 600; }
.conn-action .icon { width: 16px; height: 16px; transition: transform 0.15s; }
.conn:hover .conn-action .icon { transform: translateX(2px); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { position: relative; display: grid; gap: 2px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow-1); }
.stat-icon { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); color: var(--ink-3); }
.stat-icon .icon { width: 18px; height: 18px; }
.stat.load .stat-icon { background: var(--load-soft); color: var(--load); }
.stat.truck .stat-icon { background: var(--truck-soft); color: var(--truck); }
.stat-value { font-size: 30px; font-weight: 800; font-stretch: 112%; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--ink-3); font-size: 13px; font-weight: 600; }

/* --- Offers ------------------------------------------------------------------------- */

.postings { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; gap: 14px; }
.posting {
  position: relative;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px 16px 14px 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.posting::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--line-strong); }
.posting.load::before { background: var(--load); }
.posting.truck::before { background: var(--truck); }
.posting:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.posting.faded { opacity: 0.5; }
.posting-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.kind { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.kind .icon { width: 14px; height: 14px; }
.kind.load { background: var(--load-soft); color: var(--load); }
.kind.truck { background: var(--truck-soft); color: var(--truck); }
.kind.other { background: var(--surface-3); color: var(--ink-3); }
.kind-note { color: var(--ink-3); }
.posting-time { margin-left: auto; color: var(--ink-3); white-space: nowrap; }

.route { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 20px; font-weight: 700; font-stretch: 106%; line-height: 1.2; letter-spacing: -0.01em; }
.stop { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.stop-name { overflow-wrap: anywhere; }
.stop.unknown { color: var(--ink-3); font-size: 16px; font-weight: 600; font-stretch: 100%; }
.cc { padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--ink-3); font-size: 11px; font-weight: 700; font-stretch: 100%; letter-spacing: 0.04em; line-height: 1.4; }
.route-arrow { display: inline-grid; place-items: center; color: var(--brand); }
.route-arrow .icon { width: 20px; height: 20px; stroke-width: 2.4; }

.facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.facts li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 500; }
.facts .icon { width: 14px; height: 14px; color: var(--ink-3); }
.facts .price { border-color: transparent; background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.facts .price .icon { color: inherit; }
.summary { color: var(--ink-2); font-size: 14px; }

.posting-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.sender { display: flex; flex: 1 1 170px; align-items: center; gap: 10px; min-width: 0; }
.sender-text { display: grid; min-width: 0; font-size: 13px; line-height: 1.35; }
.sender-text strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.sender-phone { color: var(--ink-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.sender-group { overflow: hidden; color: var(--ink-3); text-overflow: ellipsis; white-space: nowrap; }
.posting-actions { display: flex; align-items: center; gap: 6px; }
.posting-actions .icon-btn { width: 34px; height: 34px; border-radius: 9px; }

.original { margin-top: -4px; }
.original summary { display: inline-flex; align-items: center; gap: 6px; margin-left: -4px; padding: 2px 4px; border-radius: 6px; color: var(--ink-3); font-size: 13px; font-weight: 500; list-style: none; cursor: pointer; }
.original summary::-webkit-details-marker { display: none; }
.original summary:hover { color: var(--ink); }
.original summary .icon { width: 14px; height: 14px; }
.original summary .chevron { transition: transform 0.15s; }
.original[open] summary .chevron { transform: rotate(180deg); }
.original pre,
.message-text {
  margin: 8px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message-text { margin: 0; }

/* --- The dashboard's messages: every message in full, with its filters -------------------- */

.feed { display: grid; gap: 14px; }
.feed .section-head { margin-bottom: 0; }
.live { display: inline-flex; align-items: center; gap: 8px; color: var(--ok); font-size: 13px; font-weight: 600; }
.live.paused { color: var(--ink-3); }
.live.paused .dot { background: #94a3b8; }
.live.paused .dot::after { display: none; }
[data-sound-toggle][aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-text); }

.feed-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.feed-tab {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
  text-decoration: none !important;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.feed-tab:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.feed-tab-count { font-size: 24px; font-weight: 800; font-stretch: 112%; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.feed-tab-label { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; font-weight: 600; white-space: nowrap; }
.feed-tab-label .icon { width: 15px; height: 15px; }
.feed-tab.load .icon { color: var(--load); }
.feed-tab.truck .icon { color: var(--truck); }
.feed-tab.active { border-color: var(--brand-strong); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand-strong); }
.feed-tab.active .feed-tab-label { color: var(--ink); }
.feed-legend { margin-top: -4px; color: var(--ink-3); font-size: 13px; }
.feed-legend strong { color: var(--ink-2); }

.feed-filters {
  position: sticky;
  z-index: 10;
  top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow-2);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.filter { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 4px 0 10px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); font-size: 13px; transition: border-color 0.15s, box-shadow 0.15s; }
.filter-label { color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.filter select, .filter input { min-width: 0; height: 34px; padding: 0; border: 0; outline: 0; background: none; color: var(--ink); font-size: 14px; font-weight: 500; }
.filter select { max-width: 200px; cursor: pointer; text-overflow: ellipsis; }
.filter select option, .filter select optgroup { background: var(--surface); color: var(--ink); }
.filter input { width: 150px; padding-right: 8px; }
.filter:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.filter.active { border-color: var(--brand-strong); background: var(--brand-soft); }
.filter.active .filter-label { color: var(--brand-text); }
.filter select:disabled { opacity: 0.45; cursor: not-allowed; }

.feed-new { position: sticky; z-index: 9; top: 72px; justify-self: center; padding: 8px 16px; border: 0; border-radius: 999px; background: var(--brand-strong); color: var(--on-brand); box-shadow: var(--shadow-3); font-size: 14px; font-weight: 700; cursor: pointer; animation: rise 0.2s ease-out; }
.feed-list { display: grid; gap: 12px; overflow-anchor: none; }
.feed-more { justify-self: center; }

.msg {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 14px 16px 12px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.msg::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--line-strong); }
.msg.load::before { background: var(--load); }
.msg.truck::before { background: var(--truck); }
.msg.mixed::before { background: linear-gradient(var(--load) 50%, var(--truck) 50%); }
.msg.pending::before { background: #f59e0b; }
.msg.fresh { animation: arrive 2.4s ease-out; }
.msg-head { display: flex; align-items: center; gap: 10px; }
.msg-who { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.msg-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-meta { display: flex; flex-wrap: wrap; gap: 0 10px; min-width: 0; color: var(--ink-3); font-size: 13px; }
.msg-group { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-side { display: grid; flex: none; justify-items: end; gap: 4px; }
.msg-time { color: var(--ink-3); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill.alert { background: var(--brand-soft); color: var(--brand-text); }

.offers { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.offer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.offer .route { gap: 2px 8px; font-size: 16px; }
.offer .route-arrow .icon { width: 16px; height: 16px; }
.offer .stop.unknown { font-size: 14px; }
.offer .facts li { padding: 2px 8px 2px 6px; background: var(--surface); font-size: 12.5px; }
.offer .facts .price { background: var(--ok-soft); }

.msg-pending { display: inline-flex; align-items: center; gap: 8px; color: var(--warn); font-size: 13px; font-weight: 600; }
.msg-text { color: var(--ink); font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-text.clamped { max-height: 15.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent); }
.msg-more { justify-self: start; margin-top: -4px; padding: 0; border: 0; background: none; color: var(--brand-text); font-size: 14px; font-weight: 600; cursor: pointer; }
.msg-more:hover { text-decoration: underline; }
.msg-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.msg-foot .posting-actions { margin-left: auto; }
.posting .msg-text { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 14px; }

/* --- Search and alerts -------------------------------------------------------------- */

.search-bar { display: flex; gap: 10px; }
.search-bar .field-box { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chips-label { color: var(--ink-3); font-size: 14px; font-weight: 600; }
.chip { padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 14px; text-decoration: none !important; transition: border-color 0.15s, background-color 0.15s, color 0.15s; }
.chip:hover { border-color: var(--brand-strong); background: var(--brand-soft); color: var(--brand-text); }

.results { display: grid; gap: 16px; }
.result-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow-1); }
.understood { display: flex; flex: 1 1 320px; align-items: center; gap: 12px; min-width: 0; }
.understood > div { display: grid; min-width: 0; }
.understood .muted { font-size: 13px; }
.understood-icon { display: grid; flex: none; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-text); }
.understood-icon .icon { width: 20px; height: 20px; }

.searching { display: grid; justify-items: center; gap: 6px; padding: 48px 24px; text-align: center; }
.radar-spin {
  width: 76px;
  height: 76px;
  margin-bottom: 10px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, transparent 0 68%, color-mix(in srgb, var(--brand) 75%, transparent) 100%),
    radial-gradient(circle, var(--brand) 0 6%, transparent 7% 33%, var(--line-strong) 34% 36%, transparent 37%);
  animation: spin 1.3s linear infinite;
}

.alert-list, .post-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.alert-row { display: flex; align-items: flex-start; gap: 14px; padding: 16px; }
.alert-icon { display: grid; flex: none; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-text); }
.alert-icon .icon { width: 20px; height: 20px; }
.alert-body { display: grid; flex: 1; gap: 6px; min-width: 0; }
.alert-body strong { font-size: 16px; overflow-wrap: anywhere; }
.alert-body .muted { font-size: 14px; }
.alert-side { display: flex; flex: none; align-items: center; gap: 12px; }

/* --- Groups ------------------------------------------------------------------------- */

.groups { display: grid; gap: 16px; padding: 0; overflow: hidden; }
.groups-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; padding: 20px 20px 0; }
.groups-summary { display: grid; grid-template-columns: auto auto; align-items: baseline; justify-content: start; gap: 4px 8px; }
.groups-count { font-size: 22px; font-weight: 800; font-stretch: 112%; font-variant-numeric: tabular-nums; }
.groups-summary .progress { grid-column: 1 / -1; width: 220px; margin-top: 4px; }
.groups-filter { display: flex; flex: 1 1 260px; gap: 8px; max-width: 420px; }
.groups-filter .field-box { flex: 1; }
.groups-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px; }
.groups-actions form:last-child { margin-left: auto; }
.group-list { margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.group-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); transition: background-color 0.15s; }
.group-row:last-child { border-bottom: 0; }
.group-row:hover { background: var(--surface-2); }
.row-text { display: grid; flex: 1; min-width: 0; }
.row-text strong { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.group-none { padding: 24px; text-align: center; }
.groups-view .switch { color: var(--ink-2); font-size: 14px; }
.groups-view .switch.on { color: var(--ink); }
.groups-hidden { margin: 0; padding: 0 20px 16px; }
.group-row.leaving { opacity: 0; transition: opacity 0.4s; }
.groups .empty { margin: 0 20px 20px; }

/* --- WhatsApp and Telegram ---------------------------------------------------------- */

.card.wa, .card.tg { display: grid; gap: 20px; }
.wa-state { display: flex; align-items: center; gap: 14px; }
.wa-state > div { display: grid; gap: 2px; min-width: 0; }
.wa-state strong { font-size: 19px; }
.wa-badge { display: grid; flex: none; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--surface-3); color: var(--ink-3); }
.wa-badge .icon { width: 26px; height: 26px; }
.wa-state.open .wa-badge { background: var(--wa-soft); color: var(--wa-text); }
.wa-state.linking .wa-badge, .wa-state.busy .wa-badge { background: var(--warn-soft); color: var(--warn); animation: breathe 1.6s ease-in-out infinite; }
.wa-busy { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink-2); }
.wa-trouble summary { color: var(--ink-3); font-size: 14px; cursor: pointer; }
.wa-trouble summary:hover { color: var(--ink); }
.wa-trouble p { margin: 10px 0; max-width: 70ch; }
.wa-state.open .tg-badge { background: var(--tg-soft); color: var(--tg); }
.wa-facts { display: flex; flex-wrap: wrap; gap: 12px; }
.wa-facts > div { display: grid; min-width: 150px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.wa-facts strong { font-size: 24px; font-weight: 800; font-stretch: 112%; line-height: 1.2; font-variant-numeric: tabular-nums; }
.wa-link { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 28px; }
.qr-box { display: grid; place-items: center; width: 290px; min-height: 290px; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: var(--shadow-2); }
.qr-box img { display: block; width: 256px; height: 256px; image-rendering: pixelated; }
.pair-code { color: #0b1322; font: 800 34px/1.2 var(--mono); letter-spacing: 4px; }
.waiting { display: flex; align-items: center; gap: 10px; color: #596579; }
.wa-howto { display: grid; justify-items: start; gap: 14px; }
.howto { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: howto; }
.howto li { position: relative; min-height: 28px; padding: 3px 0 0 40px; counter-increment: howto; }
.howto li::before { content: counter(howto); position: absolute; top: 0; left: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); font-size: 13px; font-weight: 700; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.option { display: grid; align-content: start; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface-2); }
.option .btn { justify-self: start; margin-top: 4px; }
.option-icon { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink-2); }
.option-icon .icon { width: 20px; height: 20px; }

.commands { display: grid; margin: 0; }
.commands > div { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); align-items: baseline; gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.commands > div:first-child { padding-top: 0; border-top: 0; }
.commands dt { justify-self: start; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink); font: 600 13px/1.5 var(--mono); }
.commands dd { margin: 0; color: var(--ink-2); font-size: 14px; }

/* --- Posting to groups -------------------------------------------------------------- */

.composer { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px 24px; }
.notice + .composer { margin-top: 16px; }
.composer-preview { display: grid; grid-template-rows: auto 1fr; min-height: 240px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.preview-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #075e54; color: #fff; font-size: 13px; font-weight: 600; }
.preview-head .icon { width: 18px; height: 18px; }
.preview-body { display: flex; align-items: flex-end; justify-content: flex-end; padding: 16px; background: #e9e1d8; }
.bubble { max-width: 92%; padding: 8px 12px; border-radius: 12px; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12); font-size: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.out { border-top-right-radius: 4px; background: #d9fdd3; color: #111b21; }
.bubble:empty::before { content: attr(data-empty); color: #4f5e67; }
.composer-foot { display: flex; grid-column: 1 / -1; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.composer-foot p { flex: 1 1 320px; max-width: 74ch; }
.post-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; }
.post-body { display: grid; flex: 1; gap: 6px; min-width: 0; }
.post-text { display: -webkit-box; overflow: hidden; font-weight: 500; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; }
.post-row .progress { max-width: 260px; }

/* --- Public pages ------------------------------------------------------------------- */

.public { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: radial-gradient(1100px 520px at 88% -12%, color-mix(in srgb, var(--brand) 13%, transparent), transparent 70%) no-repeat, var(--bg); }
.public { overflow-x: clip; }
.public > main { flex: 1; padding-bottom: 56px; }
.top { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px clamp(16px, 5vw, 64px); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); }
.top-nav { display: flex; gap: 8px; }
.hero, .langs, .features, .how, .cta-band { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: clamp(16px, 5vw, 64px); }

.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); align-items: center; gap: 56px; padding-block: 56px 40px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 18px; padding: 6px 14px 6px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.hero h1 { font-size: clamp(34px, 5.2vw, 60px); font-weight: 800; font-stretch: 112%; line-height: 1.04; letter-spacing: -0.03em; }
.hero h1 em { background: linear-gradient(95deg, #ff8a3d, #dd470b); -webkit-background-clip: text; background-clip: text; color: transparent; font-style: normal; }
.lead { max-width: 54ch; margin-top: 20px; color: var(--ink-2); font-size: 18px; line-height: 1.55; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-points { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 22px 0 0; padding: 0; color: var(--ink-3); font-size: 14px; font-weight: 500; list-style: none; }
.hero-points li { display: inline-flex; align-items: center; gap: 6px; }
.hero-points .icon { width: 16px; height: 16px; color: var(--ok); stroke-width: 3; }

.hero-demo { position: relative; display: grid; place-items: center; padding: 20px 0; }
.radar-rings { position: absolute; inset: -8% -6%; border-radius: 50%; overflow: hidden; background: repeating-radial-gradient(circle, transparent 0 62px, color-mix(in srgb, var(--brand) 26%, transparent) 62px 63px); -webkit-mask-image: radial-gradient(circle, #000 0, transparent 68%); mask-image: radial-gradient(circle, #000 0, transparent 68%); }
.radar-rings::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 76%, color-mix(in srgb, var(--brand) 34%, transparent) 100%); animation: spin 7s linear infinite; }
.chat { position: relative; width: min(100%, 410px); border: 1px solid var(--line); border-radius: 26px; background: var(--surface); box-shadow: var(--shadow-3); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-head > div { display: grid; line-height: 1.25; }
.chat-head span { color: var(--ink-3); font-size: 12.5px; }
.chat-body { display: grid; gap: 10px; padding: 16px; background: var(--surface-2); }
.chat-body .bubble { box-shadow: none; }
.chat-body .bubble.out { justify-self: end; padding: 10px 14px; border-radius: 16px 16px 4px 16px; background: var(--brand-strong); color: var(--on-brand); font-weight: 600; }
.chat-body .bubble.note { display: flex; justify-self: start; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; background: var(--surface); color: var(--ink-2); font-size: 13.5px; }
.bubble.note .icon { width: 16px; height: 16px; color: var(--brand); }
.chat-body .posting { box-shadow: none; }
.chat-body .posting:hover { border-color: var(--line); }

.langs { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; padding-block: 8px 16px; color: var(--ink-3); font-size: 14px; }
.lang { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600; }

.features, .how { padding-block: 48px 8px; }
.features h2, .how h2, .cta-band h2 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 800; font-stretch: 112%; letter-spacing: -0.02em; }
.section-lead { max-width: 60ch; margin-top: 10px; color: var(--ink-3); font-size: 17px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
.feature { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow-1); transition: transform 0.2s, box-shadow 0.2s; }
.feature:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.feature-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 14px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-text); }
.feature-icon .icon { width: 22px; height: 22px; }
.feature h3 { margin-bottom: 6px; font-size: 17px; }
.feature p { color: var(--ink-3); }

.how-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 28px 0 0; padding: 0; list-style: none; }
.how-steps li { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow-1); }
.how-number { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 16px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 18px; font-weight: 800; }
.how-steps h3 { margin-bottom: 6px; font-size: 18px; }
.how-steps p { color: var(--ink-3); }

.cta-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 40px; width: auto; max-width: 1072px; margin: 56px auto 8px; padding: 34px clamp(20px, 4vw, 44px); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: var(--radius-xl); background: radial-gradient(600px 260px at 100% 0, rgba(241, 90, 31, 0.34), transparent 70%), #0b1322; color: #fff; }
.cta-band p { margin-top: 8px; color: #b8c2d3; font-size: 17px; }
.cta-band .btn.primary { background: #f15a1f; color: #160a03; }
.cta-band .btn.primary:hover { background: #ff7a3d; }

.foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 22px clamp(16px, 5vw, 64px); border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; }
.foot .logo { font-size: 15px; }
.foot .logo-mark { width: 28px; height: 28px; border-radius: 8px; }
.foot .logo-mark svg { width: 22px; height: 22px; }

.auth-page { background: radial-gradient(900px 440px at 50% -10%, color-mix(in srgb, var(--brand) 15%, transparent), transparent 70%) no-repeat, var(--bg); }
.auth-page .top { position: static; justify-content: center; padding-top: 28px; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.auth { display: grid; flex: 1; place-items: start center; padding: 16px 16px 64px; }
.auth-card { display: grid; gap: 16px; width: min(440px, 100%); padding: 28px; border-radius: var(--radius-xl); box-shadow: var(--shadow-2); }
.auth-card h1 { font-size: 26px; font-weight: 800; font-stretch: 112%; letter-spacing: -0.02em; }
.auth-card h1 + .muted { margin-top: -8px; }
.auth-card.center { justify-items: center; text-align: center; }
.auth-switch { font-size: 14px; }
.auth-switch a { font-weight: 600; }

/* --- Phones and small tablets -------------------------------------------------------- */

@media (max-width: 1100px) {
  .conns { grid-template-columns: minmax(0, 1fr); }
  .conn { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
  .conn-icon { grid-row: auto; }
  .conn-action { grid-column: auto; margin-top: 0; }
  .choices.three { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .app { display: block; }
  .side { display: none; }

  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: env(safe-area-inset-top) 16px 0;
    background: var(--nav-bg);
    color: #fff;
  }
  .mobile-bar .logo { color: #fff; font-size: 16px; }
  .mobile-bar .logo-mark { width: 30px; height: 30px; border-radius: 9px; }
  .mobile-bar .logo-mark svg { width: 23px; height: 23px; }
  .menu { position: relative; }
  .menu summary { position: relative; display: grid; place-items: center; border-radius: 50%; list-style: none; cursor: pointer; }
  .menu summary::-webkit-details-marker { display: none; }
  .menu summary .avatar { width: 34px; height: 34px; --avatar-bg: 35% 28%; --avatar-ink: 80% 85%; }
  .menu-flag { position: absolute; top: -2px; right: -2px; width: 11px; height: 11px; border: 2px solid var(--nav-bg); border-radius: 50%; background: #f59e0b; }
  .menu-panel { position: absolute; z-index: 40; top: calc(100% + 10px); right: 0; display: grid; gap: 2px; width: min(310px, calc(100vw - 32px)); padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); animation: pop 0.14s ease-out; }
  .menu-who { display: grid; margin-bottom: 4px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); line-height: 1.35; }
  .menu-who span { color: var(--ink-3); font-size: 13px; }
  .menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); font-weight: 500; text-align: left; text-decoration: none !important; cursor: pointer; }
  .menu-item:hover { background: var(--surface-3); }
  .menu-item .icon { width: 18px; height: 18px; color: var(--ink-3); }
  .menu-item > span:not(.pill) { flex: 1; }

  /* --lift is set by static/app.js when something from outside the page (a hosting badge, a chat bubble)
     sits in a bottom corner: the tab bar floats just above it, so every tab stays reachable. */
  .main { gap: 18px; padding: 20px 16px calc(104px + env(safe-area-inset-bottom) + var(--lift, 0px)); }
  .page-title { font-size: 26px; }
  .page-actions { display: none; }

  .tabbar {
    position: fixed;
    z-index: 30;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom) + var(--lift, 0px));
    left: 10px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    box-shadow: var(--shadow-3);
    backdrop-filter: saturate(1.5) blur(16px);
    -webkit-backdrop-filter: saturate(1.5) blur(16px);
    transition: bottom 0.25s ease;
  }
  .tabbar a { display: grid; justify-items: center; gap: 2px; min-height: 50px; padding: 4px 2px; border-radius: 14px; color: var(--ink-3); font-size: 11px; font-weight: 600; text-decoration: none; }
  .tabbar .icon { width: 52px; height: 28px; padding: 3px 15px; border-radius: 999px; transition: background-color 0.15s; }
  .tabbar a.active { color: var(--brand-text); }
  .tabbar a.active .icon { background: var(--brand-soft); }
  .toasts { bottom: calc(88px + env(safe-area-inset-bottom) + var(--lift, 0px)); }

  .notice { flex-wrap: wrap; }
  .notice-body { flex-basis: calc(100% - 64px); }
  .notice-action { margin-left: 32px; }
  .result-head form, .result-head .btn { width: 100%; }

  input, textarea { font-size: 16px; }
  .btn { min-height: 44px; }
  .btn.small { min-height: 38px; }
  .icon-btn { width: 40px; height: 40px; }
  .posting-actions .icon-btn { width: 38px; height: 38px; }

  /* The three connections fit in one row: what matters on a phone is the offers below. */
  .conns { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .conn { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px; }
  .conn-icon { width: 34px; height: 34px; border-radius: 10px; }
  .conn-icon .icon { width: 18px; height: 18px; }
  .conn-title { font-size: 12px; }
  .conn-state { font-size: 13.5px; }
  .conn-state .dot, .conn-detail, .conn-action { display: none; }

  /* The message filters stay under the top bar; tabs and drop-downs scroll sideways instead of piling up. */
  .feed-tabs { display: flex; gap: 8px; margin: 0 -16px; padding: 2px 16px; overflow-x: auto; scrollbar-width: none; }
  .feed-tabs::-webkit-scrollbar { display: none; }
  .feed-tab { flex: 1 0 auto; min-width: 96px; padding: 10px 12px; }
  .feed-tab-count { font-size: 20px; }
  .feed-filters { top: calc(56px + env(safe-area-inset-top)); flex-wrap: nowrap; margin: 0 -16px; padding: 8px 16px; border-width: 1px 0; border-radius: 0; overflow-x: auto; scrollbar-width: none; }
  .feed-filters::-webkit-scrollbar { display: none; }
  .filter { flex: none; min-height: 40px; }
  .filter select, .filter input { height: 38px; }
  .feed-new { top: calc(120px + env(safe-area-inset-top)); }
  .msg { padding: 12px 14px 12px 18px; }
  .msg-foot .posting-actions { width: 100%; }
  .msg-foot .posting-actions .btn.wa { flex: 1; }

  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-value { font-size: 26px; }
  .postings { grid-template-columns: minmax(0, 1fr); }
  .posting-foot { flex-direction: column; align-items: stretch; }
  .sender { flex: none; }
  .posting-actions .btn.wa { flex: 1; }
  .section-head .more { display: none; }
  .search-bar { flex-direction: column; }
  .step { flex-wrap: wrap; }
  .step .btn { margin-left: 44px; }
  .alert-row { flex-wrap: wrap; }
  .alert-side { width: 100%; justify-content: space-between; padding-left: 54px; }
  .wa-link { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .wa-howto { justify-self: stretch; }
  .qr-box { width: min(290px, 100%); }
  .composer { grid-template-columns: minmax(0, 1fr); }
  .composer-preview { min-height: 160px; }
  .commands > div { grid-template-columns: minmax(0, 1fr); }
  .groups-head { padding: 16px 16px 0; }
  .groups-actions { padding: 0 16px; }
  .groups-actions form:last-child { margin-left: 0; }
  .groups-filter { max-width: none; }
  .group-row { padding: 10px 16px; }
  .switch-label { display: none; }

  .hero { grid-template-columns: minmax(0, 1fr); gap: 36px; padding-block: 28px 24px; }
  .feature-grid, .how-steps { grid-template-columns: minmax(0, 1fr); }
  .cta-band { margin-inline: 16px; }
  .top-nav .btn.ghost { display: none; }
}

@media (max-width: 420px) {
  .card { padding: 16px; }
  .groups { padding: 0; }
  .route { font-size: 18px; }
  .kind-note { display: none; }
  .auth-card { padding: 22px 18px; }
}

/* --- Motion -------------------------------------------------------------------------- */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { 0% { opacity: 0.7; transform: scale(1); } 80%, 100% { opacity: 0; transform: scale(2.8); } }
@keyframes blink { 50% { opacity: 0.35; } }
@keyframes breathe { 50% { transform: scale(0.94); } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes arrive { 0%, 35% { background: var(--brand-soft); box-shadow: 0 0 0 2px var(--brand); } }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
