/* Ship Auto Now Phone
   Palette: interstate navy rail, white work surfaces, road-sign amber for anything
   that needs the broker's eye (unread, active, route line), go-green / stop-red for calls. */
:root {
  --rail: #12213a;
  --rail-2: #1b2e4d;
  --rail-ink: #a9b6cc;
  --rail-ink-strong: #ffffff;
  --canvas: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --line: #dde2ea;
  --ink: #17202e;
  --muted: #5d697c;
  --accent: #2457e6;
  --accent-soft: #e6edfd;
  --signal: #f0a81c;
  --signal-ink: #5a3d00;
  --go: #12864d;
  --stop: #d23a3a;
  --bubble-out: #2457e6;
  --bubble-out-ink: #ffffff;
  --bubble-in: #ffffff;
  --focus: 0 0 0 3px #2457e64d;
  --shadow-float: 0 18px 50px -12px #0b162b59, 0 4px 14px -6px #0b162b33;
  --font: "Inter", ui-sans-serif, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --rail: #0b1526;
    --rail-2: #16243c;
    --canvas: #0f1622;
    --surface: #161f2e;
    --surface-2: #1c2738;
    --line: #2a364a;
    --ink: #e7ecf4;
    --muted: #9aa7bb;
    --accent: #5a83ff;
    --accent-soft: #1e2d4f;
    --signal: #f4b63a;
    --go: #22a463;
    --stop: #e25555;
    --bubble-out: #3a66ea;
    --bubble-in: #1f2a3d;
    --focus: 0 0 0 3px #5a83ff66;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.45 var(--font);
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.error { color: var(--stop); margin: 0; font-size: 13px; }
.error:empty { display: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
h1, h2 { margin: 0; letter-spacing: -0.01em; }

input, textarea {
  font: inherit; color: inherit;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
}
textarea { resize: none; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
:is(input, textarea, button, summary):focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- icons ---------- */
.ico { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ico svg { width: 100%; height: 100%; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600;
  border: 1px solid transparent; border-radius: 9px;
  padding: 9px 16px;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, filter .15s ease;
}
.btn .ico { width: 18px; height: 18px; }
.btn:hover { filter: brightness(1.07); }
.btn:active { filter: brightness(.93); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-go { background: var(--go); color: #fff; }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); filter: none; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 9px;
  border: 0; background: transparent; color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.icon-btn-solid { background: var(--accent); color: #fff; }
.icon-btn-solid:hover { background: var(--accent); color: #fff; filter: brightness(1.08); }

.round-btn {
  display: inline-grid; place-items: center;
  width: 52px; height: 52px; border-radius: 50%;
  border: 0; cursor: pointer;
  transition: transform .12s ease, filter .15s ease, background-color .15s ease;
}
.round-btn:active { transform: scale(.94); }
.round-btn:disabled { opacity: .4; cursor: not-allowed; }
.round-lg { width: 64px; height: 64px; }
.round-lg .ico { width: 26px; height: 26px; }
.round-go { background: var(--go); color: #fff; }
.round-stop { background: var(--stop); color: #fff; }
.round-soft { background: var(--surface-2); color: var(--ink); }
.round-ghost { background: #ffffff1c; color: #fff; }
.round-ghost[aria-pressed="true"], .round-ghost[aria-expanded="true"] { background: #fff; color: var(--rail); }
@media (prefers-reduced-motion: reduce) { .round-btn { transition: none; } }

/* ---------- brand mark: an amber road sign with a lane line ---------- */
.mark {
  position: relative; display: inline-block;
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--signal);
  overflow: hidden;
}
.mark::before {
  content: ""; position: absolute; inset: 7px 13px;
  border-radius: 3px;
  background: var(--rail);
  transform: skewX(-14deg);
}
.mark::after {
  content: ""; position: absolute; left: 50%; top: 9px; bottom: 9px; width: 2px; margin-left: -1px;
  background: repeating-linear-gradient(var(--signal) 0 4px, transparent 4px 7px);
  transform: skewX(-14deg);
}

/* ---------- login ---------- */
.login {
  min-height: 100%;
  display: grid; place-items: center;
  padding: 16px;
  background:
    linear-gradient(180deg, transparent 0 60%, var(--canvas) 60%),
    var(--rail);
}
.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  display: grid; gap: 10px;
  box-shadow: var(--shadow-float);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.login-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.login-card label { font-size: 13px; font-weight: 600; }

/* ---------- shell ---------- */
.shell {
  height: 100%;
  display: grid;
  grid-template-columns: 84px 340px minmax(0, 1fr);
}

/* rail */
.rail {
  background: var(--rail);
  color: var(--rail-ink);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 8px;
}
.rail-mark { margin-bottom: 14px; }
.rail-btn {
  position: relative;
  width: 68px;
  display: grid; justify-items: center; gap: 3px;
  padding: 9px 0 7px;
  border: 0; border-radius: 10px;
  background: transparent; color: inherit;
  font: 600 11px var(--font);
  cursor: pointer;
}
.rail-btn .ico { width: 22px; height: 22px; }
.rail-btn:hover { background: var(--rail-2); color: var(--rail-ink-strong); }
.rail-btn[aria-current="page"] { background: var(--rail-2); color: var(--rail-ink-strong); }
.rail-btn[aria-current="page"]::before {
  content: ""; position: absolute; left: -8px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--signal);
}
.rail-keypad { margin-top: 10px; background: var(--rail-2); color: var(--rail-ink-strong); }
.rail-keypad[aria-expanded="true"] { background: var(--signal); color: var(--rail); }
.rail-count {
  position: absolute; top: 4px; right: 12px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--signal); color: var(--signal-ink);
  font: 600 11px/18px var(--font); text-align: center;
}
.rail-foot { margin-top: auto; display: grid; justify-items: center; gap: 4px; }
.rail-small { padding: 7px 0 5px; }
.rail-small .ico { width: 19px; height: 19px; }
.line {
  display: grid; justify-items: center; gap: 4px;
  font: 600 10px var(--font);
  padding: 6px 0 10px;
  text-align: center;
}
.line-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rail-ink); box-shadow: 0 0 0 3px #ffffff14; }
.line[data-state="ready"] .line-dot { background: #2fd07f; }
.line[data-state="busy"] .line-dot { background: var(--signal); }
.line[data-state="error"] .line-dot { background: #ff6b6b; }
.line[data-state="connecting"] .line-dot { animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .line-dot { animation: none !important; } }

/* list pane */
.listpane {
  min-height: 0;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.listpane-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px 10px 20px;
}
.listpane-head h1 { font-size: 22px; font-weight: 600; }
.search {
  position: relative;
  margin: 0 16px 8px;
}
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.search input { padding-left: 36px; background: var(--surface-2); border-color: transparent; }
.search input:focus { background: var(--surface); border-color: var(--line); }

.list { list-style: none; margin: 0; padding: 2px 8px 8px; overflow-y: auto; flex: 1; }
.row {
  width: 100%;
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 0 12px; align-items: center;
  padding: 10px 10px;
  border: 0; border-radius: 10px;
  background: transparent; color: inherit;
  font: inherit; text-align: left;
  cursor: pointer;
}
.row:hover { background: var(--surface-2); }
.row[aria-current="true"] { background: var(--accent-soft); }
.row-main { min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub {
  font-size: 13px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-side { display: grid; justify-items: end; gap: 4px; font-size: 12px; color: var(--muted); }
.row-unread .row-title, .row-unread .row-sub { color: var(--ink); }
.row-unread .row-sub { font-weight: 600; }
.unread-dot {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--signal); color: var(--signal-ink);
  font: 600 11px/18px var(--font); text-align: center;
}
.row-missed .row-title { color: var(--stop); }
.call-dir { display: inline-flex; align-items: center; gap: 5px; }
.call-dir .ico { width: 14px; height: 14px; }
.row-callback {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: var(--surface-2); color: var(--go);
  cursor: pointer;
}
.row-callback:hover { background: var(--go); color: #fff; }
.row-callback .ico { width: 17px; height: 17px; }
.list-empty { padding: 24px 24px; color: var(--muted); font-size: 14px; }
.list-empty strong { display: block; color: var(--ink); margin-bottom: 4px; }
.my-number {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.my-number .num { color: var(--ink); font-weight: 600; margin-left: 4px; }

/* avatars */
.avatar {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  font: 600 14px var(--font);
  color: var(--av-ink, #1d3b8f);
  background: var(--av-bg, #dfe7fb);
  flex: none;
}
.avatar .ico { width: 20px; height: 20px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }

/* ---------- detail ---------- */
.detail { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.detail-empty {
  margin: auto; padding: 24px;
  display: grid; justify-items: center; gap: 8px; text-align: center;
}
.detail-empty h2 { font-size: 20px; font-weight: 600; }
.detail-empty p { margin: 0 0 8px; }
.empty-road {
  width: 140px; height: 90px; margin-bottom: 10px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, transparent 0 47%, var(--signal) 47% 53%, transparent 53%) 0 0 / 100% 22px repeat-y,
    linear-gradient(90deg, transparent 0 14%, var(--rail) 14% 86%, transparent 86%);
  -webkit-mask: linear-gradient(transparent, #000 20%, #000 80%, transparent);
          mask: linear-gradient(transparent, #000 20%, #000 80%, transparent);
  transform: perspective(160px) rotateX(38deg);
  opacity: .9;
}

.convo { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.convo-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.convo-id { flex: 1; min-width: 0; }
.convo-name { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-sub { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.badge-stop { background: color-mix(in srgb, var(--stop) 14%, transparent); color: var(--stop); }
.back-btn { display: none; }

.convo-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.convo-body.card-hidden { grid-template-columns: minmax(0, 1fr); }
.convo-body.card-hidden .loadcard { display: none; }
.thread-col { min-width: 0; min-height: 0; display: flex; flex-direction: column; }

.timeline {
  list-style: none; margin: 0;
  padding: 20px 24px;
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.day {
  align-self: center;
  margin: 14px 0 8px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.bubble {
  max-width: min(72%, 520px);
  padding: 9px 13px 7px;
  border-radius: 16px;
  white-space: pre-wrap; overflow-wrap: anywhere;
  box-shadow: 0 1px 0 #0b162b0f;
}
.bubble + .bubble { margin-top: 2px; }
.bubble-in { align-self: flex-start; background: var(--bubble-in); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bubble-out { align-self: flex-end; background: var(--bubble-out); color: var(--bubble-out-ink); border-bottom-right-radius: 5px; }
.bubble-meta { display: flex; justify-content: flex-end; gap: 6px; font-size: 11px; opacity: .72; margin-top: 2px; }
.bubble-failed { background: color-mix(in srgb, var(--stop) 12%, var(--surface)); color: var(--ink); border: 1px solid color-mix(in srgb, var(--stop) 35%, transparent); }
.bubble-failed .bubble-meta { color: var(--stop); opacity: 1; font-weight: 600; }
.call-event {
  align-self: center;
  display: inline-flex; align-items: center; gap: 8px;
  margin: 8px 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.call-event .ico { width: 15px; height: 15px; color: var(--go); }
.call-event.missed .ico { color: var(--stop); }
.call-event b { color: var(--ink); font-weight: 600; }

/* composer */
.composer {
  padding: 10px 24px 16px;
  display: grid; gap: 8px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: 500 12px var(--font);
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.consent {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--signal) 16%, var(--surface));
  font-size: 13px; font-weight: 600;
}
.consent input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.composer-box {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 6px 6px 6px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.composer-box:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.composer-box textarea {
  border: 0; padding: 8px 0; background: transparent;
  max-height: 160px; min-height: 38px;
}
.composer-box textarea:focus-visible { box-shadow: none; }
.send-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  border: 0; background: var(--accent); color: #fff;
  cursor: pointer;
}
.send-btn:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.send-btn .ico { width: 18px; height: 18px; }
.composer-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; min-height: 16px; }

/* ---------- load card: the one bold element ---------- */
.loadcard {
  min-height: 0; overflow-y: auto;
  padding: 18px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 14px;
}
.loadcard label, .field label {
  display: block;
  font-size: 12px; font-weight: 600; color: var(--muted);
  margin-bottom: 4px;
}
.ticket {
  position: relative;
  padding: 16px 16px 14px;
  border-radius: 14px;
  background: var(--rail);
  color: #fff;
  display: grid; gap: 14px;
}
/* perforation between quote and route, like a carrier ticket stub */
.ticket::before, .ticket::after {
  content: ""; position: absolute; top: 76px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface);
}
.ticket::before { left: -8px; }
.ticket::after { right: -8px; }
.ticket label { color: #9fb0cc; }
.ticket input {
  background: #ffffff12; border-color: #ffffff1f; color: #fff;
}
.ticket input::placeholder { color: #ffffff59; }
.ticket input:focus { background: #ffffff1c; border-color: #ffffff40; }
.ticket-price { padding-bottom: 14px; border-bottom: 2px dashed #ffffff26; }
.price-input { display: flex; align-items: baseline; gap: 2px; }
.price-input span { font-size: 26px; font-weight: 600; color: var(--signal); }
.ticket .price-input input {
  font-size: 30px; font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  padding: 0 4px; background: transparent; border-color: transparent;
  color: var(--signal);
}
.ticket .price-input input:focus { border-color: #ffffff33; background: #ffffff10; }
.route { position: relative; display: grid; gap: 10px; padding-left: 22px; }
.route::before {
  content: ""; position: absolute; left: 5px; top: 30px; bottom: 30px; width: 2px;
  background: repeating-linear-gradient(var(--signal) 0 6px, transparent 6px 11px);
}
.route-stop { position: relative; }
.route-pin {
  position: absolute; left: -22px; top: 30px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 3px solid var(--signal); background: var(--rail);
}
.route-pin-b { background: var(--signal); }
.field textarea { resize: vertical; }
.card-actions { display: grid; gap: 6px; }
.save-state { font-size: 12px; text-align: center; min-height: 16px; }
.consent-facts { margin: 0; font-size: 13px; }
.consent-facts div { display: flex; justify-content: space-between; gap: 8px; }
.consent-facts dt { color: var(--muted); }
.consent-facts dd { margin: 0; font-weight: 600; text-align: right; }

/* ---------- dialer panel ---------- */
.dialer {
  position: fixed; left: 96px; bottom: 16px; z-index: 30;
  width: 300px;
  padding: 14px 18px 20px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-float);
  animation: rise .16s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .dialer, .callcard { animation: none !important; } }
.dialer-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 6px; }
.dial-input {
  font-size: 26px; font-weight: 600; text-align: center;
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
  border: 0; background: transparent; padding: 6px 0;
}
.dial-input:focus-visible { box-shadow: none; }
.dial-match { text-align: center; font-size: 13px; min-height: 19px; margin-bottom: 8px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 14px; justify-items: center; }
.keypad button {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-content: center;
  border: 0; background: var(--surface-2); color: var(--ink);
  font: 600 24px/1 var(--font);
  cursor: pointer;
  transition: background-color .12s ease;
}
.keypad button:hover { background: var(--line); }
.keypad button:active { background: var(--accent-soft); }
.keypad button small { display: block; margin-top: 3px; font-size: 9px; font-weight: 600; letter-spacing: .14em; color: var(--muted); }
.dialer .error { text-align: center; margin-top: 10px; }
.dial-actions { display: flex; justify-content: center; align-items: center; gap: 22px; margin-top: 16px; }

/* ---------- live call card ---------- */
.callcard {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  width: 300px;
  padding: 18px;
  border-radius: 20px;
  background: var(--rail);
  color: #fff;
  box-shadow: var(--shadow-float);
  animation: rise .18s ease-out;
}
.callcard[data-incoming="true"] { box-shadow: var(--shadow-float), 0 0 0 3px var(--signal); }
.callcard-top { display: flex; gap: 12px; align-items: center; }
.callcard .avatar { --av-bg: #ffffff1f; --av-ink: #fff; }
.callcard-id { min-width: 0; }
.call-name { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-sub { font-size: 13px; color: #a9b6cc; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-status {
  display: flex; justify-content: space-between;
  margin: 16px 0 14px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #ffffff12;
  font-size: 13px; font-weight: 600;
}
.call-status #call-timer { color: var(--signal); }
.keypad-dark { margin-bottom: 14px; gap: 6px 10px; }
.keypad-dark button { width: 54px; height: 54px; font-size: 20px; background: #ffffff14; color: #fff; }
.keypad-dark button:hover { background: #ffffff26; }
.keypad-dark button small { color: #a9b6cc; }
.call-actions { display: flex; justify-content: space-between; align-items: center; }

/* ---------- dialogs ---------- */
.dialog {
  width: min(440px, calc(100% - 32px));
  border: 0; border-radius: 16px;
  padding: 20px;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-float);
}
.dialog-wide { width: min(640px, calc(100% - 32px)); }
.dialog::backdrop { background: #0b162b8c; }
.dialog-form { display: grid; gap: 12px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.dialog-head h2 { font-size: 19px; font-weight: 600; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.template-editor { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 12px; }
.template-editor li { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.template-editor textarea { resize: vertical; }
.template-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.template-actions .muted { margin-right: auto; font-size: 13px; }

/* ---------- medium screens: load card slides under the header ---------- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 84px 300px minmax(0, 1fr); }
  .convo-body { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 980px) {
  .convo-body { grid-template-columns: minmax(0, 1fr); }
  .convo-body .loadcard {
    position: absolute; right: 0; top: 0; bottom: 0; z-index: 5;
    width: min(320px, 100%);
    box-shadow: var(--shadow-float);
  }
  .convo-body { position: relative; }
}

/* ---------- phones: rail becomes a bottom tab bar ---------- */
@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .rail {
    grid-row: 2;
    flex-direction: row; justify-content: space-around; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .rail-mark, .rail-foot .line, #manage-templates { display: none; }
  .rail-foot { margin: 0; display: contents; }
  .rail-btn { width: auto; flex: 1; padding: 6px 0 4px; }
  .rail-btn[aria-current="page"]::before { left: 25%; right: 25%; top: -6px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .rail-keypad { margin: 0; }
  .rail-count { right: calc(50% - 22px); }
  .listpane, .detail { grid-row: 1; grid-column: 1; }
  .shell[data-view="convo"] .listpane { display: none; }
  .shell[data-view="list"] .detail { display: none; }
  .back-btn { display: inline-grid; }
  .convo-head { padding: 10px 12px; gap: 8px; }
  #convo-call span:last-child { display: none; }
  #convo-call { padding: 9px 12px; }
  .timeline { padding: 14px 14px; }
  .composer { padding: 8px 12px 12px; }
  .bubble { max-width: 86%; }
  .dialer { left: 8px; right: 8px; bottom: 78px; width: auto; }
  .callcard { left: 8px; right: 8px; bottom: 78px; width: auto; }
}

/* ---------- status & follow-ups ---------- */
.convo-name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.status-tag {
  flex: none;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: var(--st-bg, var(--surface-2)); color: var(--st-ink, var(--muted));
}
.status-tag:empty { display: none; }
[data-st="new"] { --st-bg: var(--surface-2); --st-ink: var(--muted); }
[data-st="quoted"] { --st-bg: var(--accent-soft); --st-ink: var(--accent); }
[data-st="follow_up"] { --st-bg: color-mix(in srgb, var(--signal) 22%, var(--surface)); --st-ink: var(--signal-ink); }
[data-st="booked"] { --st-bg: color-mix(in srgb, var(--go) 15%, var(--surface)); --st-ink: var(--go); }
[data-st="lost"] { --st-bg: color-mix(in srgb, var(--stop) 12%, var(--surface)); --st-ink: var(--stop); }
@media (prefers-color-scheme: dark) { [data-st="follow_up"] { --st-ink: var(--signal); } }

/* Deal stage: four stops on a road. Passed stops are amber, the current stop is ringed. */
.stage {
  --progress: 0;
  --stop-size: 16px;
  padding: 12px 12px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.stage-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.stage-title { font-size: 12px; font-weight: 600; color: var(--muted); }
.stage-now {
  font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: 999px;
  color: var(--stop); background: color-mix(in srgb, var(--stop) 12%, transparent);
}
.stage-now:empty { display: none; }
.stage-lost {
  margin-left: auto;
  font: 500 12px var(--font);
  padding: 3px 8px; border-radius: 7px;
  border: 0; background: transparent; color: var(--muted);
  cursor: pointer;
}
.stage-lost:hover { color: var(--stop); background: color-mix(in srgb, var(--stop) 9%, transparent); }
.stage[data-lost="true"] .stage-lost { color: var(--accent); }
.stage[data-lost="true"] .stage-lost:hover { background: var(--accent-soft); }

.stage-track {
  position: relative;
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
}
/* road: grey base with an amber fill up to the current stop */
.stage-track::before, .stage-track::after {
  content: ""; position: absolute;
  top: calc(var(--stop-size) / 2 - 1.5px); height: 3px;
  left: 12.5%; border-radius: 3px;
}
.stage-track::before { right: 12.5%; background: var(--line); }
.stage-track::after {
  width: calc(75% * var(--progress));
  background: var(--signal);
  transition: width .25s ease;
}
@media (prefers-reduced-motion: reduce) { .stage-track::after { transition: none; } }

.stage-track button {
  position: relative; z-index: 1;
  width: 100%;
  display: grid; justify-items: center; gap: 6px;
  padding: 0 0 2px;
  border: 0; background: transparent;
  font: 500 11px var(--font); color: var(--muted);
  cursor: pointer;
}
.stage-track .node {
  width: var(--stop-size); height: var(--stop-size); border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--line);
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.stage-track button:hover .node { border-color: var(--muted); }
.stage-track button:hover { color: var(--ink); }
.stage-track .lbl { white-space: nowrap; }

.stage-track li[data-state="done"] .node { background: var(--signal); border-color: var(--signal); }
.stage-track li[data-state="done"] button { color: var(--ink); }
.stage-track li[data-state="now"] .node {
  background: var(--surface);
  border-color: var(--signal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 28%, transparent);
  transform: scale(1.12);
}
.stage-track li[data-state="now"] button { color: var(--ink); font-weight: 600; }
/* Booked is the finish line: go green */
.stage[data-st="booked"] .stage-track::after { background: var(--go); }
.stage[data-st="booked"] li[data-state="done"] .node { background: var(--go); border-color: var(--go); }
.stage[data-st="booked"] li[data-state="now"] .node {
  background: var(--go); border-color: var(--go);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--go) 25%, transparent);
}
.stage[data-st="booked"] li[data-state="now"] button { color: var(--go); }
/* Lost: road greys out */
.stage[data-lost="true"] .stage-track { opacity: .45; }
.stage[data-lost="true"] { background: color-mix(in srgb, var(--stop) 4%, var(--surface)); }
@media (prefers-reduced-motion: reduce) { .stage-track .node { transition: none; } }

.fu-block {
  display: grid; gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.fu-block[data-due="overdue"] { border-color: color-mix(in srgb, var(--stop) 45%, transparent); background: color-mix(in srgb, var(--stop) 6%, var(--surface)); }
.fu-block[data-due="today"] { border-color: color-mix(in srgb, var(--signal) 70%, transparent); background: color-mix(in srgb, var(--signal) 10%, var(--surface)); }
.fu-block[data-closed="true"] { opacity: .55; }
.fu-head { display: flex; align-items: center; gap: 10px; }
.fu-head > .ico { color: var(--muted); }
.fu-block[data-due="overdue"] .fu-head > .ico { color: var(--stop); }
.fu-block[data-due="today"] .fu-head > .ico { color: var(--signal-ink); }
.fu-when-wrap { flex: 1; min-width: 0; }
.fu-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.fu-when { font-weight: 600; }
.fu-clear { padding: 4px 8px; font-size: 12px; }
.fu-quick { display: flex; flex-wrap: wrap; gap: 6px; }
#fu-pick { font-size: 13px; padding: 7px 9px; }

.group-head {
  display: flex; justify-content: space-between;
  padding: 14px 10px 6px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.group-head[data-group="overdue"] { color: var(--stop); }
.group-head[data-group="today"] { color: var(--signal-ink); }
@media (prefers-color-scheme: dark) { .group-head[data-group="today"] { color: var(--signal); } }
.due { font-size: 12px; font-weight: 600; white-space: nowrap; }
.due-overdue { color: var(--stop); }
.due-today { color: var(--signal-ink); }
@media (prefers-color-scheme: dark) { .due-today { color: var(--signal); } }
.row-fu { grid-template-columns: 40px minmax(0, 1fr) auto auto; }

/* ---------- labels ---------- */
[data-color="blue"]   { --lb: #2457e6; }
[data-color="green"]  { --lb: #12864d; }
[data-color="amber"]  { --lb: #b67a00; }
[data-color="red"]    { --lb: #d23a3a; }
[data-color="purple"] { --lb: #6b46c1; }
[data-color="teal"]   { --lb: #0f7f8c; }
[data-color="pink"]   { --lb: #c2417a; }
[data-color="slate"]  { --lb: #5d697c; }
@media (prefers-color-scheme: dark) {
  [data-color="blue"]   { --lb: #6d93ff; }
  [data-color="green"]  { --lb: #3cc27f; }
  [data-color="amber"]  { --lb: #f4b63a; }
  [data-color="red"]    { --lb: #f07070; }
  [data-color="purple"] { --lb: #a58bf0; }
  [data-color="teal"]   { --lb: #3cc3d1; }
  [data-color="pink"]   { --lb: #ef7fae; }
  [data-color="slate"]  { --lb: #a4afc0; }
}

.label-pills { display: inline-flex; gap: 4px; min-width: 0; overflow: hidden; }
.label-pills:empty { display: none; }
.lpill {
  display: inline-flex; align-items: center; gap: 4px;
  flex: none;
  font-size: 11px; font-weight: 600;
  padding: 1px 7px 1px 6px;
  border-radius: 999px;
  color: var(--lb);
  background: color-mix(in srgb, var(--lb) 13%, transparent);
  white-space: nowrap;
}
.lpill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--lb); }
.lpill-more { color: var(--muted); background: var(--surface-2); }
.lpill-more::before { display: none; }
.row-title-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-title-line .row-title { flex: 0 1 auto; min-width: 0; }
.row-title-line .label-pills { flex: 0 10000 auto; }

.label-filter {
  display: flex; gap: 6px;
  padding: 2px 16px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.label-filter::-webkit-scrollbar { display: none; }
.label-filter:empty { display: none; }
.fchip {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 12px var(--font);
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  cursor: pointer;
}
.fchip[data-color]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lb); }
.fchip:hover { border-color: var(--muted); }
.fchip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.fchip[aria-pressed="true"][data-color] { background: var(--lb); border-color: var(--lb); color: #fff; }
.fchip[aria-pressed="true"][data-color]::before { background: #fff; }

.label-menu-wrap { position: relative; }
.label-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  width: 240px;
  padding: 8px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-float);
}
.label-menu-title { padding: 6px 8px 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.label-menu-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; }
.label-menu-list label {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px;
  font-weight: 600; cursor: pointer;
}
.label-menu-list label:hover { background: var(--surface-2); }
.label-menu-list input { width: 16px; height: 16px; margin: 0; accent-color: var(--lb); flex: none; }
.label-menu-list .swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--lb); flex: none; }
.label-menu-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-menu-manage { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }

.label-editor { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; }
.label-editor li {
  display: grid; gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px;
}
.label-edit-top { display: flex; gap: 8px; align-items: center; }
.label-edit-top .uses { font-size: 12px; color: var(--muted); white-space: nowrap; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid transparent;
  background: var(--lb);
  cursor: pointer;
}
.swatches button[aria-checked="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--lb); }
.label-edit-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.label-edit-actions .muted { margin-right: auto; font-size: 13px; }
.btn-danger-ghost { background: transparent; color: var(--stop); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--stop) 10%, transparent); filter: none; }

@media (max-width: 760px) {
  .convo-name-row .label-pills { display: none; }
  .label-menu { right: -44px; }
}

/* ---------- text from sheet ---------- */
.listpane-head { gap: 8px; }
.listpane-head h1 { margin-right: auto; }
.import-btn { position: relative; padding: 7px 11px; font-size: 13px; }
.import-btn .ico { width: 17px; height: 17px; }
.watch-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--go);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--go) 22%, transparent);
  flex: none;
}
.import-btn .watch-dot { position: absolute; top: -2px; right: -2px; }

.imp-watching {
  display: flex; align-items: center; gap: 12px;
  margin: 4px 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--go) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--go) 30%, transparent);
}
.imp-watching-text { flex: 1; min-width: 0; display: grid; font-size: 13px; }
.imp-source { display: grid; gap: 12px; margin-top: 8px; }
.imp-card {
  display: grid; gap: 8px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.imp-card > label { font-size: 13px; font-weight: 600; }
.imp-link-row { display: flex; gap: 8px; }
.imp-hint { margin: 0; font-size: 13px; }
.imp-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 600; }
.imp-or::before, .imp-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.imp-file {
  justify-items: center; text-align: center;
  border-style: dashed; border-width: 2px;
  cursor: pointer;
}
.imp-file:hover, .imp-file:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.imp-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.imp-file .ico { width: 26px; height: 26px; color: var(--accent); }
.imp-file .muted { font-size: 13px; }

.imp-review { display: grid; gap: 14px; margin-top: 4px; }
.imp-count { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.imp-count strong { font-size: 18px; font-weight: 600; }
.imp-count .btn { padding: 6px 10px; font-size: 13px; }
.imp-map {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
}
.imp-map label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
select {
  font: inherit; color: inherit;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
}
select:focus-visible { outline: none; box-shadow: var(--focus); }
.imp-sample { display: grid; gap: 4px; }
.imp-sample .to { font-size: 12px; font-weight: 600; color: var(--muted); }
.imp-sample .bubble { max-width: 100%; align-self: auto; justify-self: end; }
.imp-skipped { font-size: 13px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; }
.imp-skipped summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
.imp-skipped ul { list-style: none; margin: 0 0 10px; padding: 0; max-height: 180px; overflow-y: auto; display: grid; gap: 4px; }
.imp-skipped li { display: flex; justify-content: space-between; gap: 10px; }
.imp-skipped li span:last-child { color: var(--muted); white-space: nowrap; }
.imp-watch {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 13px;
  cursor: pointer;
}
.imp-watch input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--go); flex: none; }
.imp-progress { display: grid; gap: 12px; margin-top: 8px; }
.imp-progress-text { font-size: 17px; font-weight: 600; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--go); transition: width .3s ease; }
@media (prefers-reduced-motion: reduce) { .bar span { transition: none; } }
.imp-failures { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--stop); display: grid; gap: 4px; }

@media (max-width: 760px) {
  .import-btn span:not(.ico):not(.watch-dot) { display: none; }
  .imp-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Sheets section ---------- */
.rail-live {
  position: absolute; top: 6px; right: 18px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #2fd07f;
  box-shadow: 0 0 0 2px var(--rail);
}
@media (max-width: 760px) { .rail-live { right: calc(50% - 16px); } }
.sheets { display: grid; gap: 12px; padding: 4px 8px 12px; }
.sheet-card {
  display: grid; gap: 10px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.sheet-card h2 { font-size: 14px; font-weight: 600; }
.sheet-card p { margin: 0; font-size: 13px; color: var(--muted); }
.sheet-card-head { display: flex; align-items: center; gap: 10px; }
.sheet-card-head h2 { flex: 1; }
.sheet-live { border-color: color-mix(in srgb, var(--go) 35%, transparent); background: color-mix(in srgb, var(--go) 6%, var(--surface)); }
.sheet-live .state { color: var(--go); font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.sheet-link {
  font-size: 12px; color: var(--accent);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sheet-template {
  font-size: 13px; line-height: 1.5;
  padding: 10px 12px;
  border-radius: 12px 12px 4px 12px;
  background: var(--bubble-out); color: var(--bubble-out-ink);
  white-space: pre-wrap;
}
.sheet-template mark { background: #ffffff2e; color: inherit; border-radius: 4px; padding: 0 3px; }
.sheet-history { list-style: none; margin: 0; padding: 0; display: grid; }
.sheet-history li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.sheet-history li:first-child { border-top: 0; }
.sheet-history .src { color: var(--muted); }
.sheet-history .ok { font-weight: 600; }
.sheet-history .bad { color: var(--stop); font-weight: 600; }

.shell[data-section="sheets"] .search,
.shell[data-section="sheets"] .label-filter { display: none; }

/* =========================================================
   Type and spacing system
   One family (Inter), three weights: 400 text, 500 controls
   and labels, 600 titles. Scale: 12 / 13 / 14 / 16 / 20 / 28.
   Spacing on a 4px grid.
   ========================================================= */
:root {
  --ink: #1a2233;
  --muted: #5b6677;
  --line: #e3e7ee;
  --canvas: #f6f8fa;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #e7ecf4; --muted: #98a3b5; --line: #273246; --canvas: #0f1622; }
}
body {
  font: 400 14px/1.5 var(--font);
  letter-spacing: -0.006em;
  font-feature-settings: "cv11", "ss03";
}
input, textarea, select, button { letter-spacing: inherit; }

/* titles */
.listpane-head { padding: 20px 16px 12px 20px; }
.listpane-head h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.022em; }
.convo-name { font-size: 16px; font-weight: 600; letter-spacing: -0.014em; }
.dialog-head h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.018em; }
.detail-empty h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.018em; }
.sheet-card h2 { font-size: 14px; font-weight: 600; }
.login-title { font-size: 18px; font-weight: 600; letter-spacing: -0.018em; }
.call-name { font-size: 16px; font-weight: 600; }
.imp-count strong { font-size: 16px; font-weight: 600; }
.imp-progress-text { font-size: 16px; font-weight: 600; }

/* body text */
.row { padding: 10px 12px; gap: 0 12px; border-radius: 8px; }
.row-title { font-size: 14px; font-weight: 500; }
.row-unread .row-title { font-weight: 600; }
.row-sub, .convo-sub, .call-sub { font-size: 13px; }
.row-side, .thread-time { font-size: 12px; }
.bubble { font-size: 14px; line-height: 1.45; padding: 8px 12px 6px; }
.bubble-meta { font-size: 11px; }
.call-event { font-size: 12px; }
.call-event b { font-weight: 500; }
.day { font-size: 12px; font-weight: 500; }

/* labels: small, medium weight, muted, no shouting */
.field label, .loadcard label, .imp-map label, .fu-label, .stage-title,
.login-card label, .imp-card > label, .group-head {
  font-size: 12px; font-weight: 500; letter-spacing: 0;
}
.fu-when { font-size: 14px; font-weight: 600; }

/* controls */
.btn { font-size: 14px; font-weight: 500; padding: 8px 14px; border-radius: 8px; }
.btn .ico { width: 16px; height: 16px; }
.chip, .fchip { font-weight: 500; }
.rail-btn { font-weight: 500; }
.badge, .status-tag, .lpill { font-weight: 500; }
.unread-dot, .rail-count { font-weight: 600; }
input, textarea, select { padding: 8px 10px; border-radius: 8px; }
.search input { padding-left: 34px; }

/* cards & panels breathe a little more */
.loadcard { padding: 20px; gap: 16px; }
.convo-head { padding: 12px 20px; min-height: 64px; }
.timeline { padding: 24px; gap: 6px; }
.composer { padding: 12px 24px 20px; }
.ticket { padding: 16px; }
.ticket .price-input input { font-size: 28px; font-weight: 600; letter-spacing: -0.025em; }
.price-input span { font-size: 22px; font-weight: 600; }
.sheet-card { padding: 16px; gap: 12px; }
.dialog { padding: 24px; }

/* ---------- keypad: opens in the middle, drag by the header ---------- */
.dialer {
  left: 50%; top: 50%; bottom: auto;
  translate: -50% -50%;
  width: 312px;
  padding: 12px 20px 22px;
  border-radius: 16px;
  animation: pop .16s ease-out;
}
.dialer.moved { translate: none; }
.dialer.dragging { user-select: none; box-shadow: 0 28px 70px -14px #0b162b66, 0 6px 18px -6px #0b162b40; }
@keyframes pop { from { opacity: 0; scale: .97; } }
.dialer-head {
  margin: 0 -8px 8px; padding: 4px 8px;
  border-radius: 8px;
  font-size: 14px; font-weight: 600;
  cursor: grab;
  justify-content: flex-start; gap: 8px;
  touch-action: none;
}
.dialer-head > span:not(.grip) { flex: 1; }
.dialer.dragging .dialer-head { cursor: grabbing; }
.grip {
  width: 10px; height: 14px;
  background: radial-gradient(circle, var(--muted) 1.2px, transparent 1.4px) 0 0 / 5px 5px;
  opacity: .6;
}
.dial-input { font-size: 24px; font-weight: 500; letter-spacing: 0; }
.keypad button { font-weight: 400; font-size: 22px; }
.keypad button small { font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .dialer { animation: none !important; } }
@media (max-width: 760px) {
  .dialer, .dialer.moved { left: 8px; right: 8px; top: auto; bottom: 78px; translate: none; width: auto; }
  .dialer-head { cursor: default; }
  .grip { display: none; }
}

/* ---------- login steps ---------- */
.login-step { display: grid; gap: 8px; }
.login-lead { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.login-setup { display: grid; gap: 10px; justify-items: center; text-align: center; }
.login-foot { margin: 6px 0 0; font-size: 12px; text-align: center; }
.qr {
  width: 180px; height: 180px;
  padding: 8px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line);
  image-rendering: pixelated;
}
.secret-details { font-size: 12px; color: var(--muted); }
.secret-details summary { cursor: pointer; }
.secret {
  display: block; margin-top: 6px;
  padding: 8px 10px; border-radius: 8px;
  background: var(--surface-2); color: var(--ink);
  font: 500 13px ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: .08em; word-break: break-all;
}
.code-input { font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
#totp-setup { display: grid; gap: 10px; justify-items: center; text-align: center; }
#totp-setup p { margin: 0; }

/* ---------- account button & menu ---------- */
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.rail-account { padding: 6px 0; }
.account-menu {
  position: fixed; left: 92px; bottom: 16px; z-index: 35;
  width: 300px;
  padding: 16px;
  display: grid; gap: 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-float);
}
.account-id { display: flex; gap: 12px; align-items: center; }
.account-id .muted { font-size: 13px; word-break: break-all; }
.account-name { font-weight: 600; }
.account-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px; border-radius: 10px; background: var(--surface-2);
}
.account-row-title { font-weight: 500; }
.account-row .muted { font-size: 12px; }
.account-note { margin: 0; font-size: 12px; }
.account-logout { justify-content: flex-start; }

/* ---------- users ---------- */
.tag {
  font-size: 11px; font-weight: 500;
  padding: 1px 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  white-space: nowrap;
}
.tag-admin { background: var(--accent-soft); color: var(--accent); }
.tag-suspended { background: color-mix(in srgb, var(--stop) 12%, transparent); color: var(--stop); }
.tag-2fa { background: color-mix(in srgb, var(--go) 13%, transparent); color: var(--go); }
.row-suspended .avatar { opacity: .5; }
.row-suspended .row-title { color: var(--muted); }

.user-panel { flex: 1; min-height: 0; overflow-y: auto; }
.user-panel-inner { max-width: 560px; margin: 0 auto; padding: 32px 24px; display: grid; gap: 20px; }
.user-head { display: flex; gap: 14px; align-items: center; }
.user-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.user-head .tags { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.panel-card {
  display: grid; gap: 12px;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.panel-card h3 { margin: 0; font-size: 14px; font-weight: 600; }
.panel-card p { margin: 0; font-size: 13px; color: var(--muted); }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.panel-actions .muted { font-size: 13px; }
.check-row { display: flex; gap: 10px; align-items: center; font-size: 14px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.danger-card { border-color: color-mix(in srgb, var(--stop) 30%, var(--line)); }
.btn-danger { background: var(--stop); color: #fff; }
.creds { margin: 8px 0; display: grid; gap: 8px; }
.creds div { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: baseline; }
.creds dt { font-size: 12px; color: var(--muted); }
.creds dd { margin: 0; font-weight: 500; word-break: break-all; }
.creds-pass { font: 600 15px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .03em; }
.sent-by { opacity: .85; }

@media (max-width: 760px) {
  .account-menu { left: 8px; right: 8px; bottom: 78px; width: auto; }
  #rail-users .rail-label { font-size: 10px; }
  .user-panel-inner { padding: 20px 16px; }
}

/* phones: many sections, so the tab bar scrolls sideways instead of squashing */
@media (max-width: 760px) {
  .rail { overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .rail::-webkit-scrollbar { display: none; }
  .rail-btn { flex: 0 0 auto; min-width: 62px; }
  #manage-templates { display: none; }
}

.shell[data-section="users"] .label-filter { display: none; }

/* ---------- settings ---------- */
.shell[data-section="settings"] .search,
.shell[data-section="settings"] .label-filter,
.shell[data-section="settings"] #list-action { display: none; }
.tag-ready { background: color-mix(in srgb, var(--go) 13%, transparent); color: var(--go); }
.tag-off { background: color-mix(in srgb, var(--signal) 22%, transparent); color: var(--signal-ink); }
.key-row { display: flex; gap: 8px; }
.key-row input { flex: 1; min-width: 0; }
.saved-line { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.saved-line code {
  font: 500 12px ui-monospace, "SF Mono", Menlo, monospace;
  padding: 2px 6px; border-radius: 6px; background: var(--surface-2);
}
.how { font-size: 12px; color: var(--muted); margin: 0; }
.how b { color: var(--ink); font-weight: 500; }
.webhook-url {
  display: block;
  font: 500 12px ui-monospace, "SF Mono", Menlo, monospace;
  padding: 8px 10px; border-radius: 8px;
  background: var(--surface-2); word-break: break-all;
}
.numbers { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.number {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 12px; border-radius: 10px; border: 1px solid var(--line);
}
.number.in-use { border-color: color-mix(in srgb, var(--go) 45%, transparent); background: color-mix(in srgb, var(--go) 6%, var(--surface)); }
.number-num { font-weight: 600; font-variant-numeric: tabular-nums; }
.number-meta { grid-column: 1; font-size: 12px; color: var(--muted); }
.number .btn, .number .tag { grid-row: 1 / span 2; grid-column: 2; }
.settings-list-card { padding: 12px 16px; font-size: 13px; color: var(--muted); }
