/* ═══════════════════════════════════════════════════════════════════════════════
   T-Mayee WhatsApp Dashboard — design system

   Structure:
     1. Tokens (light + dark)
     2. Reset & base
     3. Primitives (buttons, fields, chips, cards, tables)
     4. App shell (rail + views)
     5. Inbox (list, chat, message bubbles, composer, details)
     6. Marketing / Automation / Contacts / Analytics / Settings
     7. Overlays (modal, lightbox, toast, menu)
     8. Responsive

   Themes: `:root` holds the light palette. Dark is applied both by
   `[data-theme="dark"]` (explicit choice) and by prefers-color-scheme when no
   explicit choice was made, so "System" genuinely follows the OS.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── 1. Tokens ────────────────────────────────────────────────────────────── */
:root {
  /* Surfaces, light */
  --bg:            #f4f6f8;
  --surface:       #ffffff;
  --surface-2:     #eef1f5;
  --surface-3:     #e4e9ef;
  --border:        #dde3ea;
  --border-strong: #c6d0da;

  /* Text */
  --text:          #10161d;
  --text-2:        #46535f;
  --text-muted:    #74838f;
  --text-inverse:  #ffffff;

  /* Brand */
  --accent:        #00a37a;
  --accent-hover:  #008a68;
  --accent-soft:   rgba(0, 163, 122, .12);
  --accent-fg:     #ffffff;
  --accent-2:      #0284a8;

  /* Status */
  --success:       #0f9d58;
  --success-soft:  rgba(15, 157, 88, .12);
  --warning:       #c77700;
  --warning-soft:  rgba(199, 119, 0, .12);
  --danger:        #d92d20;
  --danger-soft:   rgba(217, 45, 32, .10);
  --info:          #0284a8;
  --info-soft:     rgba(2, 132, 168, .12);
  --vip:           #8b5cf6;
  --vip-soft:      rgba(139, 92, 246, .12);

  /* Chat bubbles */
  --bubble-in:     #ffffff;
  --bubble-in-text:#10161d;
  --bubble-out:    #d7f5e9;
  --bubble-out-text:#07301f;
  --chat-bg:       #eceff3;

  /* Geometry */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --rail-w: 76px;
  --list-w: 344px;
  --details-w: 320px;

  /* Elevation */
  --shadow-1: 0 1px 2px rgba(16, 22, 29, .06), 0 1px 3px rgba(16, 22, 29, .04);
  --shadow-2: 0 4px 12px rgba(16, 22, 29, .08), 0 2px 4px rgba(16, 22, 29, .04);
  --shadow-3: 0 16px 48px rgba(16, 22, 29, .18);

  /* Type */
  --font-brand: 'Syne', system-ui, sans-serif;
  --font-ui:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --speed: .18s;
  color-scheme: light;
}

/* Dark — explicit choice */
:root[data-theme="dark"] {
  --bg:            #0b1014;
  --surface:       #131b22;
  --surface-2:     #1a242d;
  --surface-3:     #223039;
  --border:        #24313c;
  --border-strong: #354653;

  --text:          #e8eef4;
  --text-2:        #aebac6;
  --text-muted:    #7b8b99;
  --text-inverse:  #0b1014;

  --accent:        #00e0a4;
  --accent-hover:  #3dffc4;
  --accent-soft:   rgba(0, 224, 164, .14);
  --accent-fg:     #062018;
  --accent-2:      #38bdf8;

  --success:       #2ecc8f;
  --success-soft:  rgba(46, 204, 143, .14);
  --warning:       #f0a92e;
  --warning-soft:  rgba(240, 169, 46, .14);
  --danger:        #ff5c52;
  --danger-soft:   rgba(255, 92, 82, .14);
  --info:          #38bdf8;
  --info-soft:     rgba(56, 189, 248, .14);
  --vip:           #a78bfa;
  --vip-soft:      rgba(167, 139, 250, .14);

  --bubble-in:     #1c272f;
  --bubble-in-text:#e8eef4;
  --bubble-out:    #0c4b3c;
  --bubble-out-text:#d8f7ec;
  --chat-bg:       #0e161c;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, .40);
  --shadow-3: 0 20px 56px rgba(0, 0, 0, .60);

  color-scheme: dark;
}

/* Dark — following the OS, only when the user has not chosen explicitly */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0b1014;
    --surface:       #131b22;
    --surface-2:     #1a242d;
    --surface-3:     #223039;
    --border:        #24313c;
    --border-strong: #354653;

    --text:          #e8eef4;
    --text-2:        #aebac6;
    --text-muted:    #7b8b99;
    --text-inverse:  #0b1014;

    --accent:        #00e0a4;
    --accent-hover:  #3dffc4;
    --accent-soft:   rgba(0, 224, 164, .14);
    --accent-fg:     #062018;
    --accent-2:      #38bdf8;

    --success:       #2ecc8f;
    --success-soft:  rgba(46, 204, 143, .14);
    --warning:       #f0a92e;
    --warning-soft:  rgba(240, 169, 46, .14);
    --danger:        #ff5c52;
    --danger-soft:   rgba(255, 92, 82, .14);
    --info:          #38bdf8;
    --info-soft:     rgba(56, 189, 248, .14);
    --vip:           #a78bfa;
    --vip-soft:      rgba(167, 139, 250, .14);

    --bubble-in:     #1c272f;
    --bubble-in-text:#e8eef4;
    --bubble-out:    #0c4b3c;
    --bubble-out-text:#d8f7ec;
    --chat-bg:       #0e161c;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-2: 0 4px 14px rgba(0, 0, 0, .40);
    --shadow-3: 0 20px 56px rgba(0, 0, 0, .60);

    color-scheme: dark;
  }
}

/* ─── 2. Reset & base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

/* The `hidden` attribute only sets display:none at the UA level, so ANY class
   that sets a display (.empty is display:flex, .overlay is display:flex) wins
   and the element stays on screen. That is why the "No conversation selected"
   panel was still visible above an open chat. Make hidden authoritative. */
[hidden] { display: none !important; }

body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Respect the OS "reduce motion" setting rather than animating regardless. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: content-box; }

.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;
}

.scroll-y { overflow-y: auto; overscroll-behavior: contain; }

/* ─── 3. Primitives ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background var(--speed), border-color var(--speed), color var(--speed), transform var(--speed);
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger { color: var(--danger); border-color: var(--border); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: 36px; padding: 0; flex-shrink: 0; }
.btn-block { width: 100%; }
.btn.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted);
}
.field .hint { font-size: 12px; color: var(--text-muted); line-height: 1.45; }

.input, .textarea, .select {
  width: 100%; padding: 9px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r);
  font-size: 14px; outline: none;
  transition: border-color var(--speed), box-shadow var(--speed);
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
.select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2374838f' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}

.checkbox { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13px; line-height: 1.45; }
.checkbox input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px;
}
.card-title {
  font-family: var(--font-brand); font-weight: 700; font-size: 14px;
  margin-bottom: 4px; display: flex; align-items: center; gap: 8px;
}
.card-sub { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.chip-pending   { background: var(--warning-soft); color: var(--warning); border-color: var(--warning); }
.chip-resolved  { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.chip-urgent    { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger); }
.chip-vip       { background: var(--vip-soft);     color: var(--vip);     border-color: var(--vip); }
.chip-dispute   { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger); }
.chip-wholesale { background: var(--info-soft);    color: var(--info);    border-color: var(--info); }
.chip-neutral   { background: var(--surface-2);    color: var(--text-2);  border-color: var(--border); }
.chip-muted     { background: transparent;         color: var(--text-muted); border-color: var(--border); }

.chip-toggle { cursor: pointer; opacity: .55; transition: opacity var(--speed); }
.chip-toggle:hover { opacity: .85; }
.chip-toggle.is-on { opacity: 1; }

.tag-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-brand); font-weight: 700; font-size: 14px;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--border);
  text-transform: uppercase; user-select: none;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }

.section-label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 10px;
}

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 56px 24px; text-align: center; color: var(--text-muted);
}
.empty-icon { font-size: 40px; opacity: .5; line-height: 1; }
.empty-title { font-family: var(--font-brand); font-weight: 700; font-size: 15px; color: var(--text-2); }
.empty p { font-size: 13px; max-width: 340px; line-height: 1.6; }

.spinner {
  width: 18px; height: 18px; flex-shrink: 0;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.bar { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .4s ease; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 9px 12px; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }

.mono { font-family: var(--font-mono); font-size: .92em; }

/* ─── 4. App shell ─────────────────────────────────────────────────────────── */
.app { display: flex; height: 100dvh; overflow: hidden; }

.rail {
  width: var(--rail-w); flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 0 10px; gap: 4px; z-index: 20;
}

.rail-logo {
  width: 40px; height: 40px; border-radius: 12px; margin-bottom: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-brand); font-weight: 700; font-size: 15px;
  color: var(--accent-fg); flex-shrink: 0; user-select: none;
}

.rail-btn {
  width: 56px; padding: 8px 0 6px; border-radius: var(--r);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text-muted); position: relative;
  transition: background var(--speed), color var(--speed);
}
.rail-btn:hover { background: var(--surface-2); color: var(--text-2); }
.rail-btn.is-active { color: var(--accent); background: var(--accent-soft); }
.rail-btn svg { width: 20px; height: 20px; stroke-width: 1.8; }
.rail-label { font-size: 10px; font-weight: 600; letter-spacing: .01em; }

.rail-badge {
  position: absolute; top: 4px; right: 8px;
  min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
}
.rail-badge:empty, .rail-badge[hidden] { display: none; }

.rail-spacer { flex: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.view { flex: 1; min-height: 0; display: none; }
.view.is-active { display: flex; }

/* Standard header shared by every non-inbox view */
.view-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 26px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0;
}
.view-title { font-family: var(--font-brand); font-weight: 700; font-size: 19px; }
.view-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.view-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.view-body { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 26px 40px; }

.panel-stack { display: flex; flex-direction: column; gap: 18px; max-width: 1100px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }

/* ─── 5. Inbox ─────────────────────────────────────────────────────────────── */
.inbox { display: flex; width: 100%; min-width: 0; }

/* -- conversation list -- */
.conv-pane {
  width: var(--list-w); flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.conv-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.conv-head-top { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.conv-head-title { font-family: var(--font-brand); font-weight: 700; font-size: 16px; }
.conv-count { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); }

.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-muted); pointer-events: none;
}
.search-wrap .input { padding-left: 34px; height: 36px; background: var(--surface-2); }

.conv-filters {
  display: flex; gap: 6px; padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; flex-shrink: 0;
  /* A visible scroll track under six pills looks like a rendering fault. */
  scrollbar-width: none; -ms-overflow-style: none;
}
.conv-filters::-webkit-scrollbar { display: none; width: 0; height: 0; }
.filter-pill {
  padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap;
  background: var(--surface); transition: all var(--speed);
}
.filter-pill:hover { border-color: var(--border-strong); }
.filter-pill.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

.conv-list { flex: 1; min-height: 0; overflow-y: auto; }

.conv-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 16px; text-align: left; cursor: pointer;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: background var(--speed);
}
.conv-item:hover { background: var(--surface-2); }
.conv-item.is-active { background: var(--accent-soft); border-left-color: var(--accent); }
.conv-body { flex: 1; min-width: 0; }
.conv-row { display: flex; align-items: baseline; gap: 7px; }
.conv-name {
  font-weight: 600; font-size: 13.5px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-time { font-size: 10.5px; color: var(--text-muted); font-family: var(--font-mono); flex-shrink: 0; }
.conv-preview {
  font-size: 12.5px; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* No preview text yet — collapse the line instead of leaving a dead gap that
   makes every row taller for no reason. */
.conv-preview:empty { display: none; }

/* Unread deserves weight, not just a badge. */
.conv-item.is-unread .conv-name { font-weight: 700; }
.conv-item.is-unread .conv-preview { color: var(--text-2); font-weight: 500; }
.conv-item.is-unread .conv-time { color: var(--accent); font-weight: 600; }
.conv-tail { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.conv-dots { display: flex; gap: 3px; }
.badge {
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg);
  font-size: 11px; font-weight: 700; line-height: 19px; text-align: center;
}

/* -- chat -- */
.chat-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--chat-bg); }

/* The live chat is a wrapper around header + scroller + composer, so it has to
   be a full-height flex column itself — otherwise the message list does not
   claim the leftover space and the composer floats mid-pane. */
#chat-live { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* Centre the empty state in the pane rather than pinning it to the top. */
.chat-pane > .empty { flex: 1; justify-content: center; }

.chat-head {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 18px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-shrink: 0; z-index: 5;
}
.chat-back { display: none; }
.chat-id { min-width: 0; flex: 1; }
.chat-name { font-family: var(--font-brand); font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-meta { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); display: flex; align-items: center; gap: 7px; }
.chat-actions { display: flex; gap: 6px; flex-shrink: 0; }

.chat-notice {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 18px; font-size: 12.5px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.chat-notice-warn { background: var(--warning-soft); color: var(--warning); }
.chat-notice-danger { background: var(--danger-soft); color: var(--danger); }
.chat-notice .btn { margin-left: auto; }

.msg-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 18px 22px 8px;
  display: flex; flex-direction: column; gap: 3px;
}

.load-more { align-self: center; margin-bottom: 12px; }

.day-sep { display: flex; align-items: center; gap: 12px; margin: 16px 0 10px; }
.day-sep::before, .day-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.day-sep span {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: var(--surface-2); padding: 3px 12px; border-radius: 999px;
}

/* -- message rows -- */
.msg { display: flex; max-width: 100%; animation: msgIn .16s ease-out; }
.msg.out { justify-content: flex-end; }
@keyframes msgIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.bubble {
  position: relative; max-width: min(600px, 74%);
  padding: 8px 11px 6px; border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); word-break: break-word; overflow-wrap: anywhere;
}
.msg.in  .bubble { background: var(--bubble-in);  color: var(--bubble-in-text);  border-top-left-radius: 4px; }
.msg.out .bubble { background: var(--bubble-out); color: var(--bubble-out-text); border-top-right-radius: 4px; }

.bubble-author { font-size: 11px; font-weight: 700; color: var(--accent); margin-bottom: 3px; }
.bubble-author.is-bot  { color: var(--info); }
.bubble-author.is-auto { color: var(--text-muted); }

.bubble-text { font-size: 14px; line-height: 1.48; white-space: pre-wrap; }
.bubble-text a { text-decoration: underline; }

.bubble-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 4px;
  margin-top: 3px; font-size: 10.5px; color: var(--text-muted); font-family: var(--font-mono);
}
.msg.out .bubble-foot { color: color-mix(in srgb, var(--bubble-out-text) 62%, transparent); }
.tick { font-size: 12px; letter-spacing: -2px; }
.tick.read { color: var(--info); }
.tick.failed { color: var(--danger); letter-spacing: 0; }

/* Reply / forward context */
.quote {
  display: block; width: 100%; text-align: left;
  border-left: 3px solid var(--accent); border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--text) 6%, transparent);
  padding: 5px 9px; margin-bottom: 6px; cursor: pointer;
}
.quote-who { font-size: 11px; font-weight: 700; color: var(--accent); }
.quote-text { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.forward-flag { font-size: 11px; font-style: italic; color: var(--text-muted); margin-bottom: 3px; display: flex; align-items: center; gap: 4px; }

/* Media inside bubbles */
.media-img {
  display: block; max-width: 100%; max-height: 300px;
  border-radius: var(--r); margin-bottom: 5px; cursor: zoom-in;
  background: var(--surface-3); object-fit: cover;
}
.media-sticker { max-width: 140px; max-height: 140px; background: none; cursor: default; box-shadow: none; }
.media-video { display: block; max-width: 100%; max-height: 300px; border-radius: var(--r); margin-bottom: 5px; background: #000; }
.media-audio { display: block; width: min(280px, 100%); margin-bottom: 5px; }

.media-doc {
  display: flex; align-items: center; gap: 10px; margin-bottom: 5px;
  padding: 9px 11px; border-radius: var(--r); text-decoration: none; color: inherit;
  background: color-mix(in srgb, var(--text) 6%, transparent);
}
.media-doc:hover { background: color-mix(in srgb, var(--text) 11%, transparent); text-decoration: none; }
.media-doc-icon { font-size: 24px; flex-shrink: 0; line-height: 1; }
.media-doc-name { font-size: 13px; font-weight: 600; word-break: break-all; }
.media-doc-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* Rich message cards (location, contact, order, flow, system, unsupported) */
.msg-card {
  display: block; width: 100%; text-align: left;
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  border-radius: var(--r); padding: 10px 12px; margin-bottom: 5px;
  background: color-mix(in srgb, var(--text) 4%, transparent);
  text-decoration: none; color: inherit;
}
a.msg-card:hover { background: color-mix(in srgb, var(--text) 9%, transparent); text-decoration: none; }
.msg-card-head { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.msg-card-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 2px 0; }
.msg-card-row span:last-child { color: var(--text-2); text-align: right; }
.msg-card-total { border-top: 1px solid color-mix(in srgb, var(--text) 14%, transparent); margin-top: 6px; padding-top: 6px; font-weight: 700; }
.msg-card-note { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; line-height: 1.45; }

.msg-map { width: 100%; height: 108px; border-radius: var(--r-sm); margin-bottom: 7px;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  display: flex; align-items: center; justify-content: center; font-size: 30px; }

/* System / reaction rows sit centred, not as bubbles */
.msg.system { justify-content: center; margin: 8px 0; }
.msg.system .sys-pill {
  font-size: 11.5px; color: var(--text-muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 13px; text-align: center;
}

.reaction-strip { display: flex; gap: 4px; margin-top: -2px; padding-left: 6px; }
.reaction-bubble {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 1px 7px; font-size: 12px; box-shadow: var(--shadow-1);
}

.msg-error {
  margin-top: 5px; padding: 6px 9px; border-radius: var(--r-sm);
  background: var(--danger-soft); color: var(--danger);
  font-size: 11.5px; line-height: 1.45;
}

/* Hover actions on a message */
.msg-tools {
  display: flex; align-items: center; gap: 2px; align-self: flex-end;
  padding: 0 4px; opacity: 0; transition: opacity var(--speed);
}
.msg:hover .msg-tools, .msg:focus-within .msg-tools { opacity: 1; }
.msg-tool {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 13px;
}
.msg-tool:hover { background: var(--surface-2); color: var(--text); }

/* -- composer -- */
.composer { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 18px 12px; flex-shrink: 0; }

.reply-bar, .file-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
  padding: 7px 11px; border-radius: var(--r);
  background: var(--surface-2); border-left: 3px solid var(--accent);
  font-size: 12.5px;
}
.reply-bar .grow, .file-bar .grow { flex: 1; min-width: 0; }
.reply-bar .who { font-weight: 700; color: var(--accent); font-size: 11.5px; }
.reply-bar .txt, .file-bar .txt { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-bar img { width: 34px; height: 34px; border-radius: var(--r-sm); object-fit: cover; }

.qr-strip { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 9px; }
.qr-chip {
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); font-size: 12.5px; font-weight: 500;
  transition: all var(--speed); max-width: 220px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qr-chip:hover { border-color: var(--accent); color: var(--accent); }

.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-input {
  flex: 1; min-height: 40px; max-height: 150px; padding: 9px 13px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg);
  font-size: 14px; line-height: 1.5; resize: none; outline: none;
  transition: border-color var(--speed);
}
.composer-input:focus { border-color: var(--accent); }
.composer-btn {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border);
  transition: all var(--speed);
}
.composer-btn:hover { color: var(--accent); border-color: var(--accent); }
.composer-btn svg { width: 18px; height: 18px; }
.composer-send { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.composer-send:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }
.composer-send:disabled { opacity: .45; cursor: not-allowed; }

.composer-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; text-align: center; }
.composer-locked {
  display: flex; align-items: center; gap: 9px; padding: 12px 14px;
  background: var(--warning-soft); border: 1px solid var(--warning);
  border-radius: var(--r); font-size: 12.5px; color: var(--warning); line-height: 1.5;
}

/* -- details panel -- */
.details-pane {
  width: var(--details-w); flex-shrink: 0;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.details-pane[hidden] { display: none; }
.details-head {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.details-title { font-family: var(--font-brand); font-weight: 700; font-size: 14px; flex: 1; }
.details-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.details-block { display: flex; flex-direction: column; gap: 9px; }
.details-block + .details-block { padding-top: 16px; border-top: 1px solid var(--border); }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 3px 0; }
.kv dt { color: var(--text-muted); }
.kv dd { color: var(--text); text-align: right; font-weight: 500; word-break: break-word; }

/* ─── 6. Feature views ─────────────────────────────────────────────────────── */

/* Stat tiles */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 15px 16px;
}
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.stat-value { font-family: var(--font-brand); font-weight: 700; font-size: 26px; line-height: 1.15; margin-top: 5px; }
.stat-note { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.stat-accent .stat-value { color: var(--accent); }
.stat-danger .stat-value { color: var(--danger); }
.stat-warn   .stat-value { color: var(--warning); }

/* Wizard (campaign builder) */
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 22px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.step-dot {
  width: 25px; height: 25px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); font-size: 11.5px; font-weight: 700;
  background: var(--surface);
}
.step.is-active { color: var(--text); font-weight: 600; }
.step.is-active .step-dot { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.step.is-done .step-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.step-line { width: 34px; height: 1.5px; background: var(--border); margin: 0 10px; }

.wizard-step { display: none; }
.wizard-step.is-active { display: block; }

.pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; padding-right: 4px; }
.pick {
  display: flex; align-items: flex-start; gap: 11px; width: 100%; text-align: left;
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--r);
  background: var(--surface); transition: all var(--speed);
}
.pick:hover { border-color: var(--border-strong); background: var(--surface-2); }
.pick.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.pick-body { flex: 1; min-width: 0; }
.pick-title { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pick-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; white-space: pre-wrap; }

.template-preview {
  background: var(--bubble-out); color: var(--bubble-out-text);
  border-radius: var(--r-lg); border-top-right-radius: 4px;
  padding: 11px 13px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap;
  box-shadow: var(--shadow-1); max-width: 420px;
}
.preview-frame { background: var(--chat-bg); border-radius: var(--r-lg); padding: 16px; display: flex; justify-content: flex-end; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  padding: 28px 20px; text-align: center; cursor: pointer;
  transition: all var(--speed); background: var(--surface-2);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon { font-size: 30px; margin-bottom: 8px; }

.audience-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.audience-cell { padding: 11px 13px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.audience-cell b { display: block; font-family: var(--font-brand); font-size: 20px; line-height: 1.2; }
.audience-cell span { font-size: 11.5px; color: var(--text-muted); }
.audience-cell.warn { background: var(--warning-soft); border-color: var(--warning); }
.audience-cell.warn b { color: var(--warning); }
.audience-cell.ok b { color: var(--accent); }

.progress-card { display: flex; flex-direction: column; gap: 9px; }
.progress-row { display: flex; justify-content: space-between; font-size: 12.5px; }

/* Toggle switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 40px; height: 22px; border-radius: 999px; flex-shrink: 0;
  background: var(--surface-3); border: 1px solid var(--border);
  position: relative; transition: background var(--speed), border-color var(--speed);
}
.switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--surface);
  box-shadow: var(--shadow-1); transition: transform var(--speed);
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Theme selector */
.theme-picker { display: inline-flex; padding: 3px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.theme-opt { padding: 5px 13px; border-radius: var(--r-sm); font-size: 12.5px; font-weight: 500; color: var(--text-muted); transition: all var(--speed); }
.theme-opt:hover { color: var(--text-2); }
.theme-opt.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); font-weight: 600; }

/* Compliance checklist */
.check-row {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.check-row:last-child { border-bottom: none; }
.check-mark {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.check-mark.ok { background: var(--success-soft); color: var(--success); }
.check-mark.no { background: var(--danger-soft);  color: var(--danger); }
.check-body { flex: 1; }
.check-title { font-size: 13.5px; font-weight: 600; }
.check-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.5; }

/* Simple bar chart */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 10px; }
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 0; height: 100%; }
.chart-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; transition: height .4s ease; }
.chart-bar.in  { background: var(--accent); }
.chart-bar.out { background: var(--info); }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); margin-top: 12px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; }

/* ─── 7. Overlays ──────────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 12, 16, .55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .15s ease;
}
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-3);
  width: 480px; max-width: 100%; max-height: 88dvh;
  display: flex; flex-direction: column; animation: rise .2s ease;
}
.modal-wide { width: 720px; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-title { font-family: var(--font-brand); font-weight: 700; font-size: 16px; flex: 1; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot {
  display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap;
  padding: 14px 22px 18px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.modal-foot .spread { margin-right: auto; }

#lightbox { background: rgba(0, 0, 0, .92); cursor: zoom-out; }
#lightbox img, #lightbox video { max-width: 94vw; max-height: 90dvh; border-radius: var(--r); object-fit: contain; }
.lightbox-close { position: absolute; top: 16px; right: 20px; font-size: 26px; color: #fff; line-height: 1; padding: 8px; }

.toast-stack {
  position: fixed; top: 16px; right: 16px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  max-width: min(360px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 14px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-2); font-size: 13px; line-height: 1.45;
  pointer-events: auto; animation: toastIn .22s ease;
}
.toast.is-error { border-left-color: var(--danger); }
.toast.is-warn  { border-left-color: var(--warning); }
.toast.is-out   { animation: toastOut .18s ease forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(18px); } }

.conn-pill {
  position: fixed; bottom: 14px; right: 14px; z-index: 60;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  font-size: 11px; font-family: var(--font-mono); color: var(--text-muted);
  transition: opacity var(--speed);
}
.conn-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.conn-pill.is-live { opacity: 0; pointer-events: none; }
.conn-pill.is-live .dot { background: var(--success); }
.conn-pill.is-down { border-color: var(--danger); color: var(--danger); opacity: 1; }
.conn-pill.is-down .dot { background: var(--danger); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.menu {
  position: fixed; z-index: 150; min-width: 180px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-3); padding: 5px;
}
.menu[hidden] { display: none; }
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 11px; border-radius: var(--r-sm);
  font-size: 13px; text-align: left; color: var(--text);
}
.menu-item:hover { background: var(--surface-2); }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger:hover { background: var(--danger-soft); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 0; }

/* ─── Login page ───────────────────────────────────────────────────────────── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; padding: 24px; overflow: auto;
  background:
    radial-gradient(ellipse 70% 55% at 50% 0%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.login-card {
  width: 400px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-2); padding: 34px 30px;
}
.login-logo {
  width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-brand); font-weight: 700; font-size: 19px; color: var(--accent-fg);
}
.login-title { font-family: var(--font-brand); font-weight: 700; font-size: 21px; text-align: center; }
.login-sub { font-size: 13px; color: var(--text-muted); text-align: center; margin: 6px 0 26px; }
.login-error {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; margin-bottom: 16px; border-radius: var(--r);
  background: var(--danger-soft); border: 1px solid var(--danger);
  color: var(--danger); font-size: 12.5px; line-height: 1.45;
}
.login-error[hidden] { display: none; }
.login-foot { margin-top: 22px; text-align: center; font-size: 11.5px; color: var(--text-muted); line-height: 1.6; }

.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; color: var(--text-muted);
}
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }

/* ─── 8. Responsive ────────────────────────────────────────────────────────── */

/* Details panel becomes an overlay once there is no room for three columns. */
@media (max-width: 1180px) {
  .details-pane {
    position: absolute; top: 0; right: 0; bottom: 0; z-index: 30;
    box-shadow: var(--shadow-3); width: min(340px, 88vw);
  }
  .inbox { position: relative; }
}

@media (max-width: 1024px) {
  :root { --list-w: 300px; }
  .view-body { padding: 18px 20px 36px; }
  .view-head { padding: 15px 20px; }
}

/* Phone: single pane at a time, nav moves to the bottom. */
@media (max-width: 760px) {
  .app { flex-direction: column-reverse; }

  .rail {
    width: 100%; height: 58px; flex-direction: row;
    justify-content: space-around; align-items: center;
    border-right: none; border-top: 1px solid var(--border);
    padding: 0 4px; gap: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    height: calc(58px + env(safe-area-inset-bottom, 0px));
  }
  .rail-logo, .rail-spacer { display: none; }
  .rail-btn { width: auto; flex: 1; max-width: 76px; padding: 6px 0 4px; }
  .rail-label { font-size: 9.5px; }
  .rail-btn svg { width: 19px; height: 19px; }

  .conv-pane { width: 100%; border-right: none; }
  .details-pane { width: 100%; max-width: 100%; }

  /* `data-pane` on .inbox decides which single column is visible. */
  .inbox[data-pane="list"] .chat-pane { display: none; }
  .inbox[data-pane="chat"] .conv-pane { display: none; }
  .chat-back { display: flex; }

  .bubble { max-width: 86%; }
  .msg-scroll { padding: 14px 12px 6px; }
  .composer { padding: 9px 12px 11px; }
  .chat-head { padding: 10px 12px; }
  .conv-head { padding: 12px 14px 9px; }
  .conv-item { padding: 11px 14px; }
  .view-head { padding: 13px 16px; }
  .view-body { padding: 16px 14px 32px; }
  .modal { border-radius: var(--r-lg); max-height: 92dvh; }
  .overlay { padding: 12px; }
  .toast-stack { top: 10px; right: 10px; left: 10px; max-width: none; }
  .conn-pill { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
  .grid-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .stat-value { font-size: 22px; }
  .steps { gap: 4px; }
  .step-line { width: 16px; margin: 0 4px; }
  .step span:not(.step-dot) { display: none; }
}

@media (max-width: 400px) {
  .rail-label { display: none; }
  .rail-btn { padding: 10px 0; }
}

/* Print — a chat transcript should be readable on paper for a dispute. */
@media print {
  .rail, .conv-pane, .composer, .chat-actions, .details-pane, .conn-pill, .toast-stack { display: none !important; }
  body, .app, .msg-scroll { overflow: visible !important; height: auto !important; }
  .bubble { box-shadow: none; border: 1px solid #ccc; max-width: 100%; }
}

/* The CSP forbids inline style attributes, so these two live here instead. */
.icon-sprite { position: absolute; width: 0; height: 0; }
.select-auto { width: auto; }

/* Outbound message still in flight. */
.tick.sending { color: var(--text-muted); font-size: 10px; letter-spacing: 0; }
.msg.out .bubble:has(.tick.sending) { opacity: .72; }
