/* YorWA — application stylesheet.
   One layer only: tokens → base → shell → components → pages.
   Views must not carry their own <style> blocks; add a class here instead. */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-2: #f0f2ee;
  --surface-3: #e7eae5;
  --line: #e1e5df;
  --line-strong: #cfd5cd;
  --text: #17211c;
  --muted: #5e6b64;
  --faint: #8a958f;
  --accent: #0e8a5d;
  --accent-hover: #0b774f;
  --accent-ink: #ffffff;
  --accent-soft: #e2f3eb;
  --accent-text: #0b6f4b;
  --warn: #9a6400;
  --warn-soft: #fdf1d8;
  --danger: #c23b3b;
  --danger-soft: #fbe6e5;
  --chat-bg: #ecefe9;
  --bubble-out: #d6f2e3;
  --bubble-in: #ffffff;
  --focus: 0 0 0 3px rgba(14, 138, 93, .28);
  --shadow-sm: 0 1px 2px rgba(20, 30, 25, .06);
  --shadow: 0 1px 2px rgba(20, 30, 25, .05), 0 6px 20px rgba(20, 30, 25, .06);
  --shadow-lg: 0 12px 40px rgba(20, 30, 25, .16);
  --av-0: #0e8a5d; --av-1: #1f6fb2; --av-2: #7b4bc4; --av-3: #c2477a;
  --av-4: #c9612b; --av-5: #8a7a12; --av-6: #178a97; --av-7: #4d6a2f;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --nav-w: 232px;
  --list-w: 340px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1210; --surface: #141a17; --surface-2: #1a221e; --surface-3: #222b26;
    --line: #242d28; --line-strong: #333e38;
    --text: #e6ece8; --muted: #98a59e; --faint: #6f7b75;
    --accent: #2fbf85; --accent-hover: #45cf96; --accent-ink: #04130c;
    --accent-soft: rgba(47, 191, 133, .14); --accent-text: #5fd6a3;
    --warn: #e0b04f; --warn-soft: rgba(224, 176, 79, .14);
    --danger: #ef6b6b; --danger-soft: rgba(239, 107, 107, .14);
    --chat-bg: #0a0e0c; --bubble-out: #16402d; --bubble-in: #1a221e;
    --focus: 0 0 0 3px rgba(47, 191, 133, .35);
    --shadow-sm: none; --shadow: 0 1px 0 rgba(255, 255, 255, .02);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
    --av-0: #1f9d6c; --av-1: #3a82c4; --av-2: #8a62d0; --av-3: #cc5a8a;
    --av-4: #d0733f; --av-5: #a39330; --av-6: #2a9cab; --av-7: #6a8a45;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1210; --surface: #141a17; --surface-2: #1a221e; --surface-3: #222b26;
  --line: #242d28; --line-strong: #333e38;
  --text: #e6ece8; --muted: #98a59e; --faint: #6f7b75;
  --accent: #2fbf85; --accent-hover: #45cf96; --accent-ink: #04130c;
  --accent-soft: rgba(47, 191, 133, .14); --accent-text: #5fd6a3;
  --warn: #e0b04f; --warn-soft: rgba(224, 176, 79, .14);
  --danger: #ef6b6b; --danger-soft: rgba(239, 107, 107, .14);
  --chat-bg: #0a0e0c; --bubble-out: #16402d; --bubble-in: #1a221e;
  --focus: 0 0 0 3px rgba(47, 191, 133, .35);
  --shadow-sm: none; --shadow: 0 1px 0 rgba(255, 255, 255, .02);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
  --av-0: #1f9d6c; --av-1: #3a82c4; --av-2: #8a62d0; --av-3: #cc5a8a;
  --av-4: #d0733f; --av-5: #a39330; --av-6: #2a9cab; --av-7: #6a8a45;
  color-scheme: dark;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; line-height: 1.3; font-weight: 620; }
h3 { font-size: 14px; font-weight: 620; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { flex-shrink: 0; }
[hidden] { display: none !important; } /* the one allowed: `hidden` must always win */
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
::selection { background: var(--accent-soft); }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-lg { margin-bottom: 20px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ── App shell ──────────────────────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}
.shell-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }

/* Navigation */
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  padding: 16px 12px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.nav-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand-name small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  padding: 14px 10px 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint);
}
.nav-account {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 0 6px; padding: 8px 10px;
  border-radius: var(--radius-sm); background: var(--surface-2);
  min-width: 0;
}
.nav-account span { min-width: 0; }
.nav-account strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-account small { display: block; font-size: 11.5px; color: var(--muted); }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 8px 10px;
  border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--muted); font-size: 13.5px; font-weight: 520; text-align: left;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-spacer { flex: 1; }
.nav-foot { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.nav-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; min-width: 0; }
.nav-user strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-user small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-user > span { min-width: 0; }
.nav form { margin: 0; }

/* Top progress bar shown while navigating */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 100;
  background: var(--accent); transform-origin: left; transform: scaleX(0); opacity: 0;
  pointer-events: none;
}
.progress.is-active { opacity: 1; animation: progress 8s cubic-bezier(.1, .7, .2, 1) forwards; }
@keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(.92); } }

/* ── Page container (single-column screens) ─────────────────────────────── */
.page { flex: 1; min-height: 0; overflow-y: auto; }
.page-inner { width: 100%; max-width: 1080px; margin: 0 auto; padding: 32px 32px 48px; }
.page-inner.narrow { max-width: 640px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head p { margin-top: 4px; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--accent-text); }
.profile-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px; color: var(--muted); font-size: 13px; font-weight: 520; }
.back-link:hover { color: var(--text); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-head.flush { margin-top: 0; }
.section-head h2 { display: flex; align-items: center; gap: 8px; }

/* ── Split (list + detail) screens ──────────────────────────────────────── */
.split { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--list-w) minmax(0, 1fr); }
.split-list {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-right: 1px solid var(--line);
}
.split-list-head { padding: 18px 16px 12px; border-bottom: 1px solid var(--line); }
.split-list-head h1 { font-size: 18px; margin-bottom: 12px; }
.split-list-body { flex: 1; min-height: 0; padding: 6px; }
.split-detail { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  cursor: pointer; transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { opacity: .9; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-block { width: 100%; height: 42px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--muted); cursor: pointer; transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn .spinner, .icon-btn .spinner { width: 15px; height: 15px; border-width: 2px; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .field-label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 14px;
  transition: border-color .12s, box-shadow .12s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
.field.has-error .input, .field.has-error .textarea, .field.has-error .select { border-color: var(--danger); }
.error-text { font-size: 12.5px; color: var(--danger); }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input { padding-left: 36px; min-height: 38px; background: var(--surface-2); border-color: transparent; }
.search .input:focus { background: var(--surface); }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); }
.check strong { display: block; font-size: 13.5px; font-weight: 600; }
.check small { display: block; font-size: 12.5px; color: var(--muted); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch-track { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background .15s; }
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus); }

/* ── Surfaces ───────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { padding: 16px 18px; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 520; }
.stat-value { margin-top: 4px; font-size: 26px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; margin-bottom: 16px;
  border-radius: var(--radius-sm); font-size: 13.5px;
  background: var(--accent-soft); color: var(--accent-text);
}
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert .btn { margin-left: auto; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--accent-soft); color: var(--accent-text); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* Avatars */
.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 50%;
  color: #fff; font-weight: 650; font-size: 15px; user-select: none;
}
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.av-0 { background: var(--av-0); } .av-1 { background: var(--av-1); }
.av-2 { background: var(--av-2); } .av-3 { background: var(--av-3); }
.av-4 { background: var(--av-4); } .av-5 { background: var(--av-5); }
.av-6 { background: var(--av-6); } .av-7 { background: var(--av-7); }

/* Rows (lists of accounts, chats, users, schedules) */
.rows { display: flex; flex-direction: column; }
.rows.card > .row + .row { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; min-width: 0; }
a.row:hover, .row.is-link:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; display: block; }
.row-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; margin: -14px 0 -14px -18px; padding: 14px 0 14px 18px; border-radius: var(--radius) 0 0 var(--radius); }
.row-link:hover .row-title > span:first-child { color: var(--accent-text); }
.row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; min-width: 0; }
.row-title > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: flex; align-items: center; gap: 14px; flex-shrink: 0; color: var(--muted); font-size: 12.5px; }
.row-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.row-actions form { margin: 0; }
.row-msg { margin-top: 6px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.count { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }

/* Conversation list items (sidebar) */
.convo {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: var(--radius-sm);
  transition: background .1s;
}
.convo:hover { background: var(--surface-2); }
button.convo { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }
button.convo[aria-current="true"] { background: var(--accent-soft); }
.convo-preview.is-on { color: var(--accent-text); font-weight: 550; }
.convo[aria-current="true"] { background: var(--accent-soft); }
.convo-main { flex: 1; min-width: 0; }
.convo-top { display: flex; align-items: baseline; gap: 8px; }
.convo-name { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-time { flex-shrink: 0; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.convo-preview { margin-top: 1px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-preview em { color: var(--faint); }
.convo.is-flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.list-empty { padding: 32px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* Empty states */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 24px; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 6px; border-radius: 14px; background: var(--surface-2); color: var(--faint); }
.empty strong { color: var(--text); font-size: 15px; }
.empty p { max-width: 360px; font-size: 13.5px; }
.empty .btn { margin-top: 10px; }
.empty-fill { flex: 1; justify-content: center; }

/* Skeleton + spinner */
.skeleton { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 400% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.spinner { display: inline-block; width: 22px; height: 22px; border: 2.5px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toasts */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  max-width: min(92vw, 440px); padding: 10px 16px; border-radius: 10px;
  background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 520;
  box-shadow: var(--shadow-lg); animation: toast-in .18s ease-out;
}
.toast-error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Chat ───────────────────────────────────────────────────────────────── */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--chat-bg); }
.chat-head {
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 10px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.chat-head-main { flex: 1; min-width: 0; }
.chat-head-name { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-btn { display: none; }
.chat-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.messages { flex: 1; min-height: 0; padding: 16px max(20px, 6%) 20px; display: flex; flex-direction: column; }
.day { align-self: center; margin: 14px 0 8px; padding: 3px 12px; border-radius: 99px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 550; box-shadow: var(--shadow-sm); }
.msg { display: flex; margin-top: 8px; }
.msg.is-grouped { margin-top: 2px; }
.msg.out { justify-content: flex-end; }
.msg-bubble {
  max-width: min(72%, 600px); padding: 7px 10px 5px;
  border-radius: 12px; background: var(--bubble-in); box-shadow: var(--shadow-sm);
  word-break: break-word;
}
.msg.in:not(.is-grouped) .msg-bubble { border-top-left-radius: 4px; }
.msg.out .msg-bubble { background: var(--bubble-out); }
.msg.out:not(.is-grouped) .msg-bubble { border-top-right-radius: 4px; }
.msg-sender { font-size: 12.5px; font-weight: 650; margin-bottom: 1px; }
.msg-sender.av-0, .msg-sender.av-1, .msg-sender.av-2, .msg-sender.av-3,
.msg-sender.av-4, .msg-sender.av-5, .msg-sender.av-6, .msg-sender.av-7 { background: none; }
.msg-sender.av-0 { color: var(--av-0); } .msg-sender.av-1 { color: var(--av-1); }
.msg-sender.av-2 { color: var(--av-2); } .msg-sender.av-3 { color: var(--av-3); }
.msg-sender.av-4 { color: var(--av-4); } .msg-sender.av-5 { color: var(--av-5); }
.msg-sender.av-6 { color: var(--av-6); } .msg-sender.av-7 { color: var(--av-7); }
.msg-text { white-space: pre-wrap; font-size: 14px; line-height: 1.45; }
.msg-media { font-style: italic; color: var(--muted); font-size: 13.5px; }
.msg-time { float: right; margin: 6px 0 -2px 12px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg-bubble::after { content: ""; display: block; clear: both; }
.messages-state { margin: auto; color: var(--muted); font-size: 13.5px; text-align: center; }

.jump {
  position: absolute; right: 20px; bottom: 16px; z-index: 5;
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 99px;
  background: var(--surface); color: var(--text); font-size: 12.5px; font-weight: 600;
  box-shadow: var(--shadow-lg); cursor: pointer;
}
.jump b { color: var(--accent-text); }

.composer {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 12px 20px 14px; background: var(--surface); border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; min-height: 42px; max-height: 160px; padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: 21px; background: var(--surface-2);
  resize: none; line-height: 1.45; font-size: 14px;
}
.composer textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: var(--focus); }
.send-btn {
  display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0;
  border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); cursor: pointer;
  transition: background .12s, opacity .12s;
}
.send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.send-btn:disabled { opacity: .4; cursor: default; }

/* ── Contacts ───────────────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 28px 0 12px; }
.toolbar .search { width: min(100%, 320px); }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.contact { display: flex; align-items: center; gap: 12px; padding: 14px; transition: border-color .12s, background .12s; }
.contact:hover { border-color: var(--accent); }
.contact .row-main { min-width: 0; }

/* ── AI settings ────────────────────────────────────────────────────────── */
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pane .chat-head { background: var(--surface); }
.detail-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.detail-inner { max-width: 820px; margin: 0 auto; padding: 28px 32px 40px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.setting-row strong { display: block; font-size: 14px; font-weight: 620; }
.setting-row small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.ai-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
.note { padding: 16px; font-size: 13px; color: var(--muted); }
.note h3 { color: var(--text); margin-bottom: 6px; }
.note ul { margin: 0; padding-left: 18px; }
.note li + li { margin-top: 4px; }
.char-count { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.save-bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 16px; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps b { display: grid; place-items: center; width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; }
.steps strong { display: block; color: var(--text); font-size: 13.5px; }

/* ── Schedule ───────────────────────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.row.is-past { opacity: .72; }

/* ── QR linking ─────────────────────────────────────────────────────────── */
.qr-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; align-items: center; }
.qr-frame {
  position: relative; display: grid; place-items: center;
  width: 300px; height: 300px; border-radius: var(--radius-lg);
  background: #fff; border: 1px solid var(--line);
}
.qr-frame img { width: 264px; height: 264px; image-rendering: pixelated; }
.qr-state { display: flex; flex-direction: column; align-items: center; gap: 12px; color: #55625b; font-size: 13px; text-align: center; padding: 20px; }
.qr-ok { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: #e2f3eb; color: #0e8a5d; }
.qr-caption { margin-top: 12px; text-align: center; font-size: 13px; color: var(--muted); }

/* ── Auth pages ─────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 24px; }
.auth-card .card-body { padding: 28px; }
.auth-card h1 { font-size: 20px; }
.auth-card .lead { margin: 6px 0 22px; color: var(--muted); }
.auth-foot { margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted); }
.auth-foot a, .link { color: var(--accent-text); font-weight: 600; }
.auth-foot a:hover, .link:hover { text-decoration: underline; }
.otp { border: 0; padding: 0; min-width: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 0 0 16px; }
.otp input { height: 52px; text-align: center; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; padding: 0; }
.otp-error { margin: -6px 0 14px; }
.auth-foot form { display: inline; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-text); font-weight: 600; cursor: pointer; }

/* ── Landing (public marketing page, prefix lp-) ────────────────────────── */
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 10px; }
body.landing { height: auto; font-size: 15px; }
.landing h1, .landing h2 { letter-spacing: -.025em; }
.lp-wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.lp-brand { display: inline-flex; align-items: center; gap: 10px; }
html:has(body.landing) { scroll-behavior: smooth; scroll-padding-top: 76px; }

.lp-top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.lp-top-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.lp-links { display: flex; gap: 4px; margin-left: 16px; }
.lp-links a { padding: 6px 12px; border-radius: var(--radius-sm); color: var(--muted); font-size: 14px; font-weight: 550; }
.lp-links a:hover { color: var(--text); background: var(--surface-2); }
.lp-top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* Hero */
.lp-hero { position: relative; padding: 72px 0 88px; overflow: hidden; }
.lp-hero::before {
  content: ""; position: absolute; inset: -30% -10% auto 35%; height: 720px; z-index: -1;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
}
.lp-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 56px; align-items: center; }
.lp-kicker { display: block; margin-bottom: 20px; }
.lp-hero h1 { font-size: clamp(34px, 4.6vw, 54px); line-height: 1.06; font-weight: 720; }
.lp-hero h1 em { font-style: normal; color: var(--accent-text); }
.lp-lead { margin-top: 20px; max-width: 520px; font-size: 17px; line-height: 1.6; color: var(--muted); }
.lp-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.lp-proof { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; color: var(--muted); font-size: 13.5px; }
.lp-proof li { display: inline-flex; align-items: center; gap: 7px; }
.lp-proof svg { color: var(--accent); }

/* Hero preview: a scaled-down copy of the real app */
.lp-preview { position: relative; padding: 18px 0 30px; }
.lp-window {
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-lg);
}
.lp-window-bar { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.lp-window-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.lp-window-bar span { margin-left: 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.lp-window-body { display: grid; grid-template-columns: 210px minmax(0, 1fr); height: 380px; }
.lp-mini-list { padding: 8px 6px; border-right: 1px solid var(--line); overflow: hidden; }
.lp-mini-list .convo { padding: 8px; gap: 10px; }
.lp-mini-list .convo-name { font-size: 13px; }
.lp-mini-list .convo-preview { font-size: 12px; }
.lp-mini-search { display: flex; align-items: center; gap: 7px; height: 32px; margin: 2px 4px 8px; padding: 0 10px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--faint); font-size: 12px; }
.lp-mini-chat { min-width: 0; }
.lp-mini-chat .chat-head { min-height: 52px; padding: 8px 14px; }
.lp-mini-chat .chat-head-name { font-size: 13.5px; }
.lp-mini-chat .chat-head-sub { font-size: 11.5px; color: var(--accent-text); }
.lp-mini-chat .messages { flex: 1; display: flex; flex-direction: column; padding: 12px 14px; overflow: hidden; }
.lp-mini-chat .msg-bubble { max-width: 82%; }
.lp-mini-chat .msg-text { font-size: 12.5px; }
.lp-mini-chat .msg-time { font-size: 10px; }
.lp-ai-msg { margin-top: 6px; }
.lp-ai-msg .msg-bubble { box-shadow: 0 0 0 1px var(--accent) inset; }
.lp-ai-tag { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; font-size: 10.5px; font-weight: 700; color: var(--accent-text); text-transform: uppercase; letter-spacing: .04em; }
.lp-mini-composer { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border-top: 1px solid var(--line); }
.lp-mini-composer > span:first-child { flex: 1; height: 32px; display: flex; align-items: center; padding: 0 12px; border-radius: 99px; background: var(--surface-2); color: var(--faint); font-size: 12px; }
.lp-mini-composer .send-btn { width: 32px; height: 32px; }

.lp-float {
  position: absolute; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px 10px 10px; box-shadow: var(--shadow-lg); font-size: 12px;
}
.lp-float strong { display: block; font-size: 12.5px; }
.lp-float small { display: block; color: var(--muted); }
.lp-float-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); }
.lp-float-a { left: -28px; bottom: 0; }
.lp-float-b { right: -16px; top: 0; }

/* Sections */
.lp-section { padding: 88px 0; }
.lp-band { background: var(--surface); border-block: 1px solid var(--line); }
.lp-head { max-width: 620px; margin: 0 auto 44px; text-align: center; }
.lp-head h2, .lp-control h2, .lp-final h2 { font-size: clamp(26px, 3vw, 36px); line-height: 1.15; font-weight: 700; }
.lp-head p { margin-top: 12px; font-size: 16px; color: var(--muted); }
.lp-head .eyebrow { margin-bottom: 10px; }
.lp-head-left { margin: 0; text-align: left; }
.lp-head-left .btn { margin-top: 24px; }

.lp-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lp-feature { padding: 24px; transition: border-color .15s, transform .15s; }
.lp-feature:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.lp-feature h3 { margin: 16px 0 6px; font-size: 16px; }
.lp-feature p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.lp-feature-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-text); }

.lp-how { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 64px; align-items: start; }
.lp-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.lp-steps li { position: relative; display: flex; gap: 18px; padding-bottom: 28px; }
.lp-steps li:last-child { padding-bottom: 0; }
.lp-steps li:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 40px; bottom: 4px; width: 2px; background: var(--line); }
.lp-steps b { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 14px; }
.lp-steps h3 { font-size: 16px; margin: 6px 0 4px; }
.lp-steps p { color: var(--muted); line-height: 1.6; }

.lp-control { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; padding: 44px; }
.lp-control h2 { margin: 18px 0 10px; }
.lp-control p { color: var(--muted); font-size: 16px; line-height: 1.6; }
.lp-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.lp-checks li { display: flex; gap: 12px; }
.lp-checks svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.lp-checks strong { display: block; margin-bottom: 2px; font-size: 15px; }
.lp-checks span { color: var(--muted); line-height: 1.55; }
.lp-checks strong { color: var(--text); }

.lp-final { padding-top: 24px; text-align: center; }
.lp-final p { margin: 12px 0 28px; color: var(--muted); font-size: 16px; }

.lp-foot { border-top: 1px solid var(--line); background: var(--surface); padding: 48px 0 24px; font-size: 14px; }
.lp-foot-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; }
.lp-foot-grid p { margin-top: 14px; max-width: 300px; color: var(--muted); line-height: 1.6; }
.lp-foot nav { display: flex; flex-direction: column; gap: 10px; }
.lp-foot h3 { font-size: 13px; margin-bottom: 4px; }
.lp-foot nav a { color: var(--muted); }
.lp-foot nav a:hover { color: var(--text); }
.lp-foot-bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--faint); font-size: 13px; }

@media (max-width: 980px) {
  .lp-links { display: none; }
  .lp-hero { padding: 48px 0 64px; }
  .lp-hero-grid, .lp-how, .lp-control { grid-template-columns: 1fr; gap: 40px; }
  .lp-preview { max-width: 640px; }
  .lp-float-a { left: -8px; }
  .lp-float-b { right: -8px; }
  .lp-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lp-foot-grid { grid-template-columns: 1fr 1fr 1fr; }
  .lp-foot-grid > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .lp-wrap { padding: 0 16px; }
  .lp-top-inner { gap: 8px; }
  .lp-top .lp-signin { display: none; }
  .lp-lead { font-size: 16px; }
  .lp-cta .btn { flex: 1 1 auto; }
  .lp-window-body { grid-template-columns: 1fr; height: 340px; }
  .lp-mini-list { display: none; }
  .lp-float-a { left: 8px; bottom: 4px; }
  .lp-float-b { display: none; }
  .lp-section { padding: 64px 0; }
  .lp-features { grid-template-columns: 1fr; }
  .lp-control { padding: 24px; }
  .lp-foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .lp-brand .brand-name small { display: none; }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  :root { --nav-w: 72px; --list-w: 300px; }
  .nav { padding: 14px 10px; align-items: center; }
  .nav-brand { padding: 2px 0 14px; }
  .brand-name, .nav-label, .nav-link span, .nav-account span, .nav-user > span { display: none; }
  .nav-section, .nav-foot { align-items: center; width: 100%; }
  .nav-link { justify-content: center; width: 44px; height: 42px; padding: 0; }
  .nav-account { padding: 6px; margin: 10px 0 6px; background: none; }
  .nav-user { padding: 6px 0 8px; }
  .ai-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .shell-main { grid-row: 1; }
  .nav {
    grid-row: 2; flex-direction: row; align-items: stretch; justify-content: space-around;
    gap: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line);
  }
  .nav-brand, .nav-label, .nav-account, .nav-spacer, .nav-user, .nav-desktop-only { display: none; }
  .nav-section, .nav-foot { flex-direction: row; flex: 1 1 auto; justify-content: space-around; border: 0; padding: 0; gap: 0; }
  .nav-section[data-section="account"] { flex: 4 1 auto; }
  .nav-link {
    flex: 1; flex-direction: column; justify-content: center; gap: 2px;
    width: auto; min-width: 0; height: 54px; padding: 4px 2px;
    font-size: 10.5px; font-weight: 550;
  }
  .nav-link span { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-link[aria-current="page"] { background: none; }
  .nav-link[aria-current="page"] svg { background: var(--accent-soft); border-radius: 99px; width: 44px; padding: 2px 0; height: 24px; }

  .page-inner, .detail-inner { padding: 20px 16px 32px; }
  h1 { font-size: 20px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 20px; }
  .row { padding: 12px 14px; gap: 12px; }
  .row-meta .count { display: none; }
  .toasts { bottom: 84px; }

  /* Split screens show one pane at a time */
  .split { grid-template-columns: 1fr; }
  .split[data-view="list"] .split-detail { display: none; }
  .split[data-view="detail"] .split-list { display: none; }
  .split-list { border-right: 0; }
  .back-btn { display: inline-grid; margin-left: -8px; }
  .chat-head { padding: 8px 12px; min-height: 58px; }
  .messages { padding: 12px 12px 16px; }
  .msg-bubble { max-width: 86%; }
  .composer { padding: 10px 12px; }
  .jump { right: 12px; }

  .qr-layout { grid-template-columns: 1fr; justify-items: center; }
  .qr-frame { width: min(300px, 100%); aspect-ratio: 1; height: auto; }
  .qr-frame img { width: 88%; height: auto; }
}

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