/* Fahim shared base — design tokens, self-hosted fonts, and the operational
   console (login / inbox / thread / knowledge). Class hooks are preserved exactly
   (the inbox polling script + e2e/Playwright tests depend on them). */

@font-face { font-family: 'Reem Kufi'; font-weight: 700; font-display: swap; src: url('/static/css/fonts/reemkufi-700.woff2') format('woff2'); }
@font-face { font-family: 'Tajawal'; font-weight: 400; font-display: swap; src: url('/static/css/fonts/tajawal-400.woff2') format('woff2'); }
@font-face { font-family: 'Tajawal'; font-weight: 500; font-display: swap; src: url('/static/css/fonts/tajawal-500.woff2') format('woff2'); }
@font-face { font-family: 'Tajawal'; font-weight: 700; font-display: swap; src: url('/static/css/fonts/tajawal-700.woff2') format('woff2'); }

:root {
  --nile: #0c5c4f;
  --nile-deep: #073f37;
  --gold: #d99a2b;
  --gold-soft: #f4cd72;
  --paper: #faf5ec;
  --paper-2: #f3ecdd;
  --ink: #182723;
  --muted: #5d6f69;
  --card: #ffffff;
  --line: rgba(12, 92, 79, 0.14);
  --shadow: 0 18px 50px -24px rgba(7, 63, 55, 0.45);
  --radius: 16px;
  --display: 'Reem Kufi', 'Tajawal', system-ui, sans-serif;
  --body: 'Tajawal', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(120% 70% at 100% 0%, rgba(217, 154, 43, 0.10), transparent 55%),
    var(--paper);
  min-height: 100vh;
}

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.25; color: var(--nile); }
a { color: var(--nile); }

.container { max-width: 540px; margin: 0 auto; padding: 20px 16px 40px; }

h1 { font-size: 1.5rem; margin-bottom: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px -20px rgba(7, 63, 55, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

input, button, textarea {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
  background: var(--paper);
}
input:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); background: #fff; }

button {
  font-family: var(--display); font-weight: 700;
  background: var(--nile); color: #fff; border: none; cursor: pointer;
  border-radius: 999px; padding: 12px 20px;
  transition: transform 0.15s ease, background 0.15s ease;
}
button:hover { transform: translateY(-1px); background: var(--nile-deep); }
button:disabled { background: #9aa8a3; transform: none; cursor: default; }

label { font-weight: 700; }

.preview { color: var(--muted); margin: 4px 0; }
.meta { display: flex; align-items: center; justify-content: space-between; font-size: 0.82rem; color: var(--muted); }

/* Status colors (class names match status.toLowerCase().replace('_','-') in the views). */
.status-bot-active { color: #1f9d57; }
.status-human-active { color: #d9821f; }
.status-pending-handoff { color: #d6452f; }

.logout-form { text-align: left; margin-bottom: 8px; }
.logout-form button { width: auto; padding: 8px 16px; background: transparent; color: var(--muted); border: 1px solid var(--line); }
.logout-form button:hover { background: #fff; color: var(--ink); transform: none; }

/* Thread message bubbles */
.msg { max-width: 85%; margin-bottom: 10px; padding: 10px 14px; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.msg-customer { margin-inline-end: auto; background: var(--paper-2); border-top-right-radius: 5px; }
.msg-bot { margin-inline: auto; background: #dcf3e4; text-align: center; }
.msg-human { margin-inline-start: auto; background: #d7ebe6; border-top-left-radius: 5px; }
.msg time { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }

/* No border-radius: rounding clips the QR corners/quiet zone (where WhatsApp's
   finder patterns sit) and breaks scanning. White padding preserves the quiet
   zone against the card background; max-width matches the 360px source so the
   image is never upscaled (upscaling blurs the modules → won't scan). */
.qr-img { width: 100%; max-width: 320px; display: block; margin: 10px auto; padding: 8px; background: #fff; border: 1px solid var(--line); }

/* Knowledge page niceties (forms keep their action/name hooks) */
.question { color: var(--nile); }
details { margin: 8px 0; }
summary { cursor: pointer; font-weight: 700; color: var(--nile); }
code { background: var(--paper-2); padding: 2px 6px; border-radius: 6px; font-size: 0.9em; }

/* ════════════ Merchant console — clean, professional SaaS theme ════════════
   Scoped to body.app (the authenticated console). Re-maps the warm tokens to a
   light white/green palette and a flat, generous-whitespace layout. The landing
   site uses a different layout and is untouched. */
body.app {
  --nile: #0e8f6e;
  --nile-deep: #0a7558;
  --gold: #0e8f6e;
  --gold-soft: #e3f3ec;
  --ink: #102420;
  --muted: #6a7c76;
  --line: #e7edea;
  --card: #ffffff;
  --display: 'Tajawal', system-ui, -apple-system, sans-serif;
  --shadow: 0 18px 40px -28px rgba(16, 40, 34, 0.45);
  --topnav-h: 62px; /* top bar height — the mobile thread height calcs subtract it */
  background: #f3f6f5;
}
body.app h1, body.app h2, body.app h3 { color: var(--ink); font-weight: 700; letter-spacing: -0.01em; }
body.app .card { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(16, 40, 34, 0.04); }

/* Top nav — light, flat, sticky */
.topnav { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.topnav-inner { max-width: 900px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 18px; min-height: calc(var(--topnav-h, 62px) - 1px); } /* -1px: .topnav's border, so the header is exactly --topnav-h */
.topnav .brand { font-weight: 700; font-size: 1.2rem; color: var(--nile); display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.topnav .brand .brand-mark { height: 22px; width: auto; display: inline-block; vertical-align: middle; }
.topnav-links { display: flex; gap: 2px; margin-inline-start: auto; }
.topnav-links a { color: var(--muted); text-decoration: none; font-weight: 600; padding: 8px 14px; border-radius: 9px; font-size: 0.92rem; }
.topnav-links a:hover { color: var(--ink); background: #f1f5f3; }
.topnav-links a.on { color: var(--nile); background: var(--gold-soft); }
/* B.0: pending KB-gap count on the knowledge nav link */
.nav-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-inline-start: 4px; border-radius: 9px; background: var(--nile); color: #fff; font-size: 0.72rem; line-height: 18px; text-align: center; vertical-align: middle; }
.nav-logout { margin: 0; }
.nav-logout button { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; padding: 7px 13px; cursor: pointer; font: inherit; font-size: 0.88rem; }
.nav-logout button:hover { color: var(--ink); border-color: #cdd8d3; }
.console { max-width: 900px; margin: 0 auto; padding: 28px 20px 56px; }

/* Mobile menu (≤900px). Scoped to body.app: the landing page loads this file and owns its own .nav-burger. */
body.app .topnav-inner { position: relative; }
body.app .nav-burger { display: none; } /* hidden on desktop, so it is not a tab stop there */
@media (max-width: 900px), (pointer: coarse) and (max-height: 500px) { /* + large phones in landscape */
  body.app .topnav { z-index: 30; } /* the menu panel lives in this stacking context; must sit above .emoji-panel (20) */
  body.app .nav-burger { /* resets the global pill `button` */
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; position: relative;
    width: 44px; height: 44px; margin: 0; margin-inline-start: auto; padding: 0; border-radius: 10px; cursor: pointer;
    color: var(--ink); border: 1px solid var(--line); background: #fff;
  }
  body.app .nav-burger:hover { transform: none; background: #f1f5f3; }
  body.app .nav-burger svg { width: 22px; height: 22px; }
  body.app .topnav.nav-open .nav-burger { background: var(--gold-soft); color: var(--nile); border-color: #b8e0cf; }
  body.app .nav-burger:focus-visible { outline: 2px solid var(--nile); outline-offset: 2px; }
  body.app .burger-badge { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--nile); color: #fff; font-size: 0.72rem; font-weight: 700; line-height: 18px; text-align: center; }
  body.app .topnav-links {
    display: none; position: absolute; top: 100%; inset-inline: 0;
    flex-direction: column; gap: 2px; margin: 0; padding: 8px 12px 12px;
    background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
    max-height: calc(100vh - var(--topnav-h, 62px)); max-height: calc(100dvh - var(--topnav-h, 62px)); overflow-y: auto; overscroll-behavior: contain;
  }
  body.app .topnav.nav-open .topnav-links { display: flex; }
  body.app .topnav-links a { display: flex; align-items: center; min-height: 48px; padding: 0 14px; font-size: 1rem; }
}
@media (max-width: 720px) {
  body.app .topnav-inner { padding: 0 12px; gap: 10px; }
  body.app .console { padding: 16px 12px 32px; }
}

/* Dashboard */
.dash-hero { margin-bottom: 22px; }
.dash-eyebrow { font-size: 0.78rem; letter-spacing: 0.04em; color: var(--nile); font-weight: 700; }
.dash-hero h1 { font-size: 1.75rem; margin: 4px 0 6px; }
.dash-sub { color: var(--muted); }
.dash-alert { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-inline-start: 3px solid var(--nile); border-radius: 14px; padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(16, 40, 34, 0.04); }
.dash-alert strong { color: var(--ink); }
.dash-alert p { color: var(--muted); margin-top: 3px; font-size: 0.9rem; }
/* Danger modifier: a broken integration must not read as an informational notice. Same box, red
   leading rule + tinted ground, so "your booking link is dead" is distinguishable at a glance from
   "you cancelled" or "ask the admin". Matches .btn-danger's #b3261e. */
.dash-alert-danger { border-inline-start-color: #b3261e; background: #fdf6f5; }
.dash-alert-danger strong { color: #b3261e; }
.btn-gold { background: var(--nile); color: #fff; font-weight: 700; text-decoration: none; padding: 11px 20px; border-radius: 10px; white-space: nowrap; }
.btn-gold:hover { background: var(--nile-deep); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.dash-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: 0 1px 2px rgba(16, 40, 34, 0.04); }
.dash-card-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.dash-card-value { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--ink); margin-top: 6px; }
.dash-card-meta { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.dash-card-meta.ok-text { color: var(--nile); } .dash-card-meta.warn-text { color: #c2410c; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.ok { background: #16a34a; } .status-dot.off { background: #b8c2bd; }
.dash-links { display: grid; gap: 12px; margin-bottom: 18px; }
.dash-link { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; text-decoration: none; box-shadow: 0 1px 2px rgba(16, 40, 34, 0.04); transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.dash-link:hover { border-color: #cfe3da; box-shadow: 0 12px 30px -22px rgba(16, 40, 34, 0.4); }
.dash-link strong { color: var(--ink); font-size: 1.05rem; font-weight: 700; }
.dash-link p { color: var(--muted); font-size: 0.86rem; margin-top: 2px; }
.dash-link-stat { font-weight: 700; font-size: 1.5rem; color: var(--nile); display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.badge-handoff { font-size: 0.7rem; font-weight: 700; color: #fff; background: #dc2626; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.dash-link-arrow { font-size: 1.3rem; color: #b8c2bd; }
.dash-commands h2 { font-size: 1.1rem; margin-bottom: 4px; }
.cmd-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 9px 18px; margin-top: 14px; }
.cmd-list li { font-size: 0.9rem; color: var(--muted); }
.cmd-list code { margin-inline-end: 6px; color: var(--nile); background: var(--gold-soft); }
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.empty-state strong { display: block; color: var(--ink); font-size: 1.1rem; margin-bottom: 6px; }

/* Dashboard notice + settings */
.dash-notice { background: var(--gold-soft); border: 1px solid #b8e0cf; color: var(--nile-deep); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 0.92rem; font-weight: 500; }
.dash-settings h2 { font-size: 1.1rem; margin-bottom: 8px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--line); }
.setting-row:first-of-type { border-top: none; }
.setting-text strong { color: var(--ink); }
.setting-text p { color: var(--muted); font-size: 0.86rem; margin-top: 3px; max-width: 52ch; }
.rec { font-size: 0.7rem; font-weight: 700; color: var(--nile); background: var(--gold-soft); border-radius: 999px; padding: 2px 9px; margin-inline-start: 6px; }
.owner-phone-form { display: flex; gap: 8px; }
.owner-phone-form input { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 0.9rem; min-width: 180px; }
.owner-phone-form .btn-gold { padding: 9px 18px; }
.unlink-form { margin: 0; }
.btn-danger { background: #fff; color: #b3261e; border: 1px solid #f0c0bc; border-radius: 10px; padding: 9px 16px; cursor: pointer; font: inherit; font-weight: 600; }
.btn-danger:hover { background: #b3261e; color: #fff; border-color: #b3261e; }

/* ─────────────── Team management ─────────────── */
.team-invite { margin-bottom: 16px; }
.team-invite h2, .team-list h2 { font-size: 1.1rem; margin-bottom: 8px; }
/* Add-member method chooser (phone-OTP vs username/password). Without these, the global
   `input{width:100%}` and `label{font-weight:700}` rules render each radio as a full-width
   box detached from its (heading-weight) text. */
.method-choice { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.method-label { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 400; cursor: pointer; }
.method-label input[type="radio"] { width: 20px; height: 20px; margin: 0; padding: 0; flex: 0 0 auto; accent-color: var(--nile); }

.team-invite-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.team-invite-form input { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 0.9rem; min-width: 180px; }
.team-invite-form .btn-gold { padding: 9px 18px; min-height: 44px; }
.team-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--line); }
.team-row:first-of-type { border-top: none; }
.team-info { display: flex; flex-direction: column; gap: 2px; min-width: 160px; }
.team-name { color: var(--ink); }
.team-phone, .team-resource { font-size: 0.85rem; color: var(--muted); }
.team-tags { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.role-pill { font-size: 0.7rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.role-pill.owner { background: var(--gold-soft); color: var(--nile-deep); }
.role-pill.staff { background: #eef2f0; color: var(--muted); }
.team-pending { font-size: 0.7rem; font-weight: 700; color: #c2740c; background: #fef3e2; padding: 2px 10px; border-radius: 999px; }
.team-cred-badge { font-size: 0.7rem; font-weight: 700; color: var(--muted); background: #eef2f0; padding: 2px 10px; border-radius: 999px; white-space: nowrap; } /* one line on phones (D11) */
.team-actions { display: flex; gap: 8px; }
.btn-quiet { background: #fff; color: var(--nile-deep); border: 1px solid var(--line); border-radius: 10px; padding: 9px 16px; cursor: pointer; font: inherit; font-weight: 600; }
.btn-quiet:hover { background: var(--gold-soft); border-color: #b8e0cf; }

/* ─────────────── Two-pane inbox ─────────────── */
body.app .topnav-inner, body.app .console { max-width: 1040px; }
.inbox-head { margin-bottom: 14px; }
.inbox-head h1 { font-size: 1.35rem; }
.inbox-sub { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.inbox { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 210px); min-height: 460px; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(16, 40, 34, 0.04); }

.convo-pane { border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.convo-search { padding: 14px 14px 10px; display: flex; align-items: center; gap: 8px; }
.convo-search [data-handoff-badge] { display: none; } /* only the landscape thread rule below shows it */
.convo-search input { width: 100%; border: 1px solid var(--line); background: #f7faf9; border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 0.9rem; }
.convo-list { overflow-y: auto; flex: 1; }
.convo-empty { padding: 28px 18px; color: var(--muted); font-size: 0.88rem; text-align: center; }
.convo { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid #eef2f0; cursor: pointer; align-items: center; text-decoration: none; }
.convo:hover { background: #f7faf9; }
.convo.active { background: var(--gold-soft); }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, #16a37a, #0a7558); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.95rem; flex: 0 0 auto; }
.convo-body { flex: 1; min-width: 0; }
.convo-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.convo-name { font-weight: 700; font-size: 0.92rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-time { font-size: 0.72rem; color: var(--muted); flex: 0 0 auto; }
.convo-prev { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
.convo-msg { flex: 1 1 auto; min-width: 0; font-size: 0.84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* min-width:0 lets the ellipsis fire (D7) */
.pill { font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex: 0 0 auto; white-space: nowrap; }
.pill.bot { background: #e9f7ef; color: #16a34a; }
.pill.human { background: #fef3e2; color: #c2740c; }
.pill.handoff { background: #fdeaea; color: #dc2626; }
/* B.0.5: archived-list CSAT score badge + read-only thread footer. */
.pill.csat { background: #fff3cd; color: #7a5b00; }
.composer-readonly { padding: 13px 16px; border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 0.85rem; text-align: center; }

.thread { display: flex; flex-direction: column; min-height: 0; }
.thread-empty { align-items: center; justify-content: center; color: var(--muted); }
.thread-placeholder { text-align: center; margin: auto; padding: 24px; }
.thread-placeholder strong { display: block; color: var(--ink); font-size: 1.1rem; margin-bottom: 4px; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.thread-head .avatar { width: 38px; height: 38px; font-size: 0.88rem; }
.thread-who { flex: 1; min-width: 0; }
.thread-who .n { font-weight: 700; color: var(--ink); }
.thread-who .s { font-size: 0.78rem; color: var(--muted); }
.thread-actions form { margin: 0; }
.btn-sm { font: inherit; font-size: 0.82rem; font-weight: 600; border-radius: 9px; padding: 7px 14px; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.btn-sm.primary { background: var(--nile); color: #fff; border-color: var(--nile); }
.msgs { flex: 1; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 10px; background: #f7faf9; }
.load-older { align-self: center; font-size: 0.82rem; color: var(--nile); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; margin-bottom: 6px; }
.msg { max-width: 74%; padding: 9px 13px; border-radius: 14px; font-size: 0.92rem; line-height: 1.55; box-shadow: 0 1px 1px rgba(16, 40, 34, 0.05); }
.msg .body { display: block; }
.msg .t { display: block; font-size: 0.68rem; color: var(--muted); margin-top: 4px; }
.msg .who { display: block; font-size: 0.66rem; font-weight: 700; color: var(--nile-deep); margin-bottom: 2px; }
.msg.in { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-top-right-radius: 4px; }
.msg.out { align-self: flex-end; background: #d8f3e6; border-top-left-radius: 4px; }
.composer { display: flex; gap: 10px; padding: 13px 16px; border-top: 1px solid var(--line); background: #fff; align-items: flex-end; position: relative; }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; font: inherit; font-size: 0.92rem; max-height: 120px; line-height: 1.4; }
.composer .send { background: var(--nile); color: #fff; border: none; border-radius: 12px; width: 46px; height: 46px; cursor: pointer; font-size: 1.2rem; flex: 0 0 auto; }

/* E.20: shared utility */
.hidden { display: none !important; }
/* CR 2026-07-22: Meta 24h-window composer advisory (thread page). Amber tokens (--amber/--amber-soft,
   defined on body.app) — same source as the KB-suggestion amber surfaces, so a palette change stays
   one edit. Both rules only render inside body.app pages. */
.window-closed-note { padding: 10px 16px; border-top: 1px solid var(--line); background: var(--amber-soft); color: var(--amber); font-size: 0.85rem; text-align: center; }
/* CR 2026-07-22: in-thread escalation divider — marks where the handoff flag was raised */
.esc-divider { margin: 10px 0; padding: 6px 12px; background: var(--amber-soft); color: var(--amber); border: 1px dashed var(--amber); border-radius: 8px; font-size: 0.8rem; text-align: center; }
.composer textarea:disabled, .composer .send:disabled { opacity: 0.5; cursor: not-allowed; }
.search-hidden { display: none !important; }

/* E.20#2: escalation attention — highlight handoff rows + a head count badge */
.convo.handoff { background: #fff7f7; box-shadow: inset 3px 0 0 #dc2626; }
.handoff-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; font-size: 0.78rem; font-weight: 700; color: #fff; background: #dc2626; border-radius: 999px; vertical-align: middle; }

/* E.20#4: emoji picker */
.emoji-toggle { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 12px; width: 46px; height: 46px; flex: 0 0 auto; cursor: pointer; font-size: 1.2rem; }
.emoji-toggle:hover { background: #f7faf9; transform: none; }
.emoji-panel { position: absolute; bottom: 64px; inset-inline-start: 16px; width: 280px; max-height: 180px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 24px rgba(16, 40, 34, 0.14); padding: 8px; display: flex; flex-wrap: wrap; gap: 2px; z-index: 20; }
.emoji-panel .emoji { background: transparent; border: none; width: 34px; height: 34px; font-size: 1.15rem; cursor: pointer; border-radius: 8px; padding: 0; }
.emoji-panel .emoji:hover { background: #f1f6f4; transform: none; }

/* Back-to-list link in the thread head — phones only (the list pane is hidden there). */
.thread-back { display: none; align-items: center; justify-content: center; flex: 0 0 auto; min-width: 44px; min-height: 44px; margin-inline-start: -10px; border-radius: 10px; color: var(--ink); font-size: 1.3rem; text-decoration: none; }
.thread-back:hover { background: #f1f5f3; }
.thread-back .handoff-badge { min-width: 20px; height: 20px; margin-inline-start: 2px; padding: 0 6px; font-size: 0.72rem; } /* chats waiting in the (hidden) list */

/* Phones: list pages show only the list; thread pages (.inbox-thread) show only the thread, full height. */
@media (max-width: 720px) {
  .inbox { grid-template-columns: minmax(0, 1fr); } /* minmax: a long preview must not widen the card past the screen (D7) */
  .inbox:not(.inbox-thread) .thread { display: none; }
  .inbox:not(.inbox-thread) { height: auto; min-height: 0; } /* list pages: the page scrolls, not an inner box (D7) */
  .inbox:not(.inbox-thread) .convo-list { overflow-y: visible; }
  .inbox-thread .convo-pane { display: none; }
  .inbox-head-thread { display: none; }
  .thread-back { display: inline-flex; }
  .thread-head { padding: 8px 12px; gap: 10px; }
  .thread-head .avatar, .thread-head .avatar-wrap { display: none; } /* repeats the number's last digits; the back link takes its slot (the channel shows in .channel-tag) */
  .thread-who .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .msgs { padding: 14px 12px; }
  .composer { padding: 10px 12px; }
  .inbox-thread {
    height: calc(100vh - var(--topnav-h, 62px) - 48px); /* 48 = the ≤720px .console padding (16 top + 32 bottom) */
    height: calc(100dvh - var(--topnav-h, 62px) - 48px);
    min-height: 0; border-radius: 12px;
  }
}

/* Landscape phones: fit the thread to the screen and compact its chrome so messages + composer share one screen. */
@media (max-height: 500px) and (pointer: coarse) {
  .inbox-head-thread { display: none; }
  .inbox-thread .activity-log { display: none; } /* owner audit trail; still shown in portrait */
  .inbox-thread .convo-search [data-handoff-badge] { display: inline-flex; flex: 0 0 auto; } /* the hidden page head carried the waiting count */
  .thread-head { padding: 6px 14px; }
  .thread-head .avatar { width: 32px; height: 32px; font-size: 0.8rem; }
  .composer { padding: 8px 12px; }
  .composer .send, .emoji-toggle { width: 44px; height: 44px; }
  .window-closed-note { padding: 6px 12px; font-size: 0.8rem; }
  .inbox-thread {
    height: calc(100vh - var(--topnav-h, 62px) - 24px);
    height: calc(100dvh - var(--topnav-h, 62px) - 24px);
    min-height: 0;
  }
  body.app .console { padding-top: 12px; padding-bottom: 12px; }
}

/* Touch screens: iOS zooms into any field under 16px; !important beats the page-scoped field rules. */
@media (pointer: coarse) {
  body.app input:not([type=checkbox]):not([type=radio]), body.app select, body.app textarea { font-size: 16px !important; }
  .flag-control > summary { display: inline-flex; align-items: center; min-height: 44px; }
  .thread-actions .btn-sm { min-height: 44px; }
}

/* E.19: owner-only per-conversation audit trail (collapsible) */
.activity-log { margin: 0 14px 10px; border: 1px solid var(--paper-2); border-radius: 8px; background: var(--paper); font-size: 0.85rem; }
.activity-log > summary { cursor: pointer; padding: 7px 12px; color: var(--muted); font-weight: 600; list-style: none; }
.activity-log > summary::-webkit-details-marker { display: none; }
.activity-log[open] > summary { border-bottom: 1px solid var(--paper-2); }
.activity-empty { padding: 8px 12px; color: var(--muted); margin: 0; }
.activity-list { list-style: none; margin: 0; padding: 4px 0; max-height: min(40vh, 240px); overflow-y: auto; } /* a long trail must not push the composer out of the fixed-height thread */
.activity-list li { display: flex; gap: 8px; align-items: baseline; padding: 4px 12px; }
.activity-list li .who { font-weight: 600; color: var(--ink); }
.activity-list li .what { color: var(--nile); }
.activity-list li .t { margin-inline-start: auto; color: var(--muted); font-size: 0.78rem; }

/* ════════════ Knowledge base — entry links, suggestions, record form ════════════
   EVERY selector is prefixed body.app so nothing leaks onto the landing/signup
   (non-app) pages. Generic hooks (.field/.error/.err/
   .custom/.tpl/.count-pill) are KB-only in the console but stay body.app-scoped. */
body.app { --amber: #c2740c; --amber-soft: #fef3e2; }

/* list header + entry actions */
body.app .kb-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
body.app .kb-head h1 { font-size: 1.5rem; }
body.app .kb-sub { color: var(--muted); font-size: 0.92rem; margin-top: 3px; max-width: 56ch; }
body.app .kb-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
body.app .kb-head-actions a, body.app .kb-faq-acts a { text-decoration: none; }
/* one box for the three header buttons, so .btn-gold and .btn-quiet render the same height */
body.app .kb-head-actions a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; box-sizing: border-box; }

body.app .kb-suggest-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-inline-start: 3px solid var(--amber); border-radius: 14px; padding: 15px 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(16, 40, 34, 0.04); text-decoration: none; }
body.app .kb-suggest-banner .lead { display: flex; align-items: center; gap: 13px; min-width: 0; }
body.app .kb-suggest-banner .ico { width: 40px; height: 40px; border-radius: 11px; background: var(--amber-soft); color: var(--amber); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex: 0 0 auto; }
body.app .kb-suggest-banner strong { color: var(--ink); font-size: 1.02rem; display: block; }
body.app .kb-banner-sub { color: var(--muted); font-size: 0.88rem; }
body.app .kb-suggest-banner .cta { display: inline-flex; align-items: center; gap: 8px; background: var(--amber); color: #fff; font-weight: 700; padding: 10px 18px; border-radius: 10px; white-space: nowrap; }
body.app .count-pill { background: #fff; color: var(--amber); border-radius: 999px; padding: 0 8px; font-size: 0.82rem; line-height: 20px; font-weight: 700; }

/* E.167 records table: tabs, table, pager */
body.app .kb-viewonly { margin-bottom: 12px; }
body.app .kb-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
body.app .kb-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; background: #eef2f0; padding: 4px; border-radius: 12px; }
body.app .kb-search { flex: 1 1 280px; max-width: 420px; margin: 0; }
body.app .kb-search input { width: 100%; min-height: 44px; margin: 0; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; }
body.app .kb-search input:focus { outline: 2px solid var(--nile); border-color: var(--nile); }
body.app .kb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.app .kb-sort { color: inherit; text-decoration: none; }
body.app .kb-sort:hover { color: var(--nile); }
body.app .kb-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 9px; border: 1px solid transparent; color: var(--muted); font-weight: 700; font-size: 0.92rem; text-decoration: none; }
body.app .kb-tab:hover { color: var(--ink); background: #fff; }
body.app .kb-tab.on { background: #fff; border-color: var(--line); color: var(--nile); }
body.app .kb-tab .n { font-size: 0.78rem; background: var(--line); color: var(--ink); border-radius: 999px; padding: 0 8px; line-height: 20px; }
body.app .kb-tab.on .n { background: var(--nile); color: #fff; }
body.app .kb-table-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(16, 40, 34, 0.04); overflow: hidden; }
body.app .kb-table-scroll { overflow-x: auto; }
body.app .kb-table { width: 100%; min-width: 720px; border-collapse: collapse; }
body.app .kb-table th { text-align: start; padding: 10px 14px; font-size: 0.8rem; color: var(--muted); background: #f4f8f6; border-bottom: 1px solid var(--line); white-space: nowrap; }
body.app .kb-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 0.92rem; }
body.app .kb-table tbody tr:hover td { background: #fafcfb; }
body.app .kb-title { font-weight: 700; color: var(--ink); }
body.app .kb-detail { color: #4a5d57; }
body.app .kb-detail .clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.app .kb-detail .lbl { color: var(--muted); font-size: 0.82rem; margin-inline-end: 6px; }
body.app .kb-date { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
body.app .kb-badge { display: inline-block; font-size: 0.76rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
body.app .kb-badge.rec { background: var(--gold-soft); color: var(--nile-deep); }
body.app .kb-badge.faq { background: #eef2f0; color: #4a5d57; }
body.app .kb-actions { white-space: nowrap; padding-block: 6px; }
body.app .kb-actions form { display: inline; }
/* `.kb-act` resets the global pill `button` (full width, filled) so the edit link and the delete button read alike */
body.app .kb-act { display: inline-flex; align-items: center; width: auto; min-height: 36px; margin: 0; padding: 0 10px; background: none; border: 0; border-radius: 8px; color: var(--nile); font: inherit; font-weight: 700; font-size: 0.88rem; text-decoration: none; cursor: pointer; }
body.app .kb-act:hover { background: var(--gold-soft); transform: none; }
body.app .kb-act.danger { color: #b3261e; }
body.app .kb-act.danger:hover { background: #fdeaea; }
body.app .kb-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); background: #fafcfb; }
body.app .kb-range { color: var(--muted); font-size: 0.85rem; }
body.app .kb-pager-info { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
body.app .kb-size { margin: 0; color: var(--muted); font-size: 0.85rem; }
body.app .kb-size label { display: inline-flex; align-items: center; gap: 8px; }
body.app .kb-size select { min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; color: var(--ink); }
body.app .kb-pages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
body.app .pg { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 700; font-size: 0.9rem; text-decoration: none; }
body.app .pg:hover { border-color: var(--nile); color: var(--nile); }
body.app .pg.on { background: var(--nile); border-color: var(--nile); color: #fff; }
body.app .pg.off { color: #9aa8a3; }
body.app .pg.off:hover { border-color: var(--line); color: #9aa8a3; }
body.app .pg-gap { min-width: 24px; text-align: center; color: var(--muted); }
body.app .kb-empty { padding: 28px 20px; text-align: center; }
body.app .kb-empty .btn-quiet { display: inline-flex; margin-top: 8px; text-decoration: none; }
body.app .kb-empty-sub { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }
body.app .kb-faq-form label { display: block; margin-bottom: 4px; }
body.app .kb-faq-acts { display: flex; align-items: center; gap: 12px; }
body.app .kb-faq-acts button { width: auto; margin: 0; }

/* suggestions review cards */
body.app .sug { margin-bottom: 13px; }
body.app .sug .sug-q { display: flex; gap: 11px; align-items: flex-start; margin-bottom: 12px; }
body.app .sug .sug-q .qi { width: 34px; height: 34px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); display: flex; align-items: center; justify-content: center; font-size: 1rem; flex: 0 0 auto; margin-top: 24px; }
body.app .sug-q-field { flex: 1; min-width: 0; }
body.app .sug-q-field label { font-size: 0.8rem; color: var(--muted); }
body.app .sug-q-field input { font-size: 1.05rem; font-weight: 700; color: var(--ink); } /* editable, but reads as the card's subject */
body.app .sug-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 13px; }
body.app .meta-chip { display: inline-flex; align-items: center; gap: 5px; background: #f4f8f6; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 0.8rem; color: var(--muted); }
body.app .meta-chip.link { color: var(--nile); background: #fff; }
body.app .meta-chip .hot { color: var(--amber); font-weight: 700; }
body.app .sug-acts { display: flex; gap: 9px; margin-top: 4px; flex-wrap: wrap; }
body.app .sug-acts .secondary { background: #fff; color: var(--nile-deep); border: 1px solid var(--line); }
body.app .sug-acts .secondary:hover { background: var(--gold-soft); border-color: #b8e0cf; }
body.app details.sug-item { margin: 0; }
body.app { --sug-collapse: 0; } /* the suggestions script reads this flag; 1 = phones start collapsed */
body.app .sug-sum { display: list-item; min-height: 44px; padding: 10px 0; box-sizing: border-box; color: var(--ink); font-weight: 700; }
body.app details.sug-item[open] > .sug-sum { display: none; } /* an open item shows its form; a closed one always keeps its tap row */
body.app .kb-sort-mobile { display: none; }

/* Import review: the action bar stays pinned while 200+ drafts scroll (D8) */
body.app .import-acts { position: sticky; bottom: 0; z-index: 5; align-items: center; background: #fff; border-top: 1px solid var(--line); padding: 8px 4px 10px; }
body.app .import-acts #batch-msg { flex-basis: 100%; margin: 0; }
body.app .import-count { flex-basis: 100%; color: var(--nile); font-weight: 700; font-size: 0.9rem; }
body.app .import-acts button { flex: 1 1 0; width: auto; margin: 0; }
body.app .pick-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; cursor: pointer; }
body.app .pick-row .pick { width: 24px; height: 24px; margin: 0; padding: 0; flex: 0 0 auto; accent-color: var(--nile); } /* the global input rule would stretch it full width */
body.app .import-batch { position: relative; }
body.app .import-batch > a::after { content: ''; position: absolute; inset: 0; } /* the whole card opens the batch (D18) */

/* Phones: KB table rows become cards, suggestions collapse to their question, settings forms stack (D4, D5, D6) */
@media (max-width: 720px) {
  body.app .kb-table-scroll { overflow-x: visible; }
  body.app .kb-table { min-width: 0; }
  body.app .kb-table thead { display: none; }
  body.app .kb-table tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  body.app .kb-table td { display: block; padding: 0; border: 0; }
  body.app .kb-table tbody tr:hover td { background: none; }
  body.app .kb-table td.kb-date { order: 1; margin-inline-start: auto; }
  body.app .kb-table td.kb-title { order: 2; flex-basis: 100%; }
  body.app .kb-table td.kb-detail { order: 3; flex-basis: 100%; }
  body.app .kb-table td.kb-actions { order: 4; flex-basis: 100%; display: flex; gap: 8px; padding-top: 4px; }
  body.app .kb-actions .kb-act { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); }
  body.app .kb-sort-mobile { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-height: 44px; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; font-weight: 700; text-decoration: none; background: #f4f8f6; }
  body.app { --sug-collapse: 1; }
  body.app details.sug-item[open] > .sug-sum { display: list-item; } /* phones keep the row as the close toggle */
  body.app .sug-sum-q { overflow-wrap: anywhere; }
  body.app .sug-acts { flex-wrap: nowrap; }
  body.app .sug-acts button { flex: 1 1 0; width: auto; margin: 0; }
  body.app .import-acts { flex-wrap: wrap; }
  body.app .setting-row .owner-phone-form { flex: 1 1 100%; flex-direction: column; min-width: 0; }
  body.app .setting-row .owner-phone-form input, body.app .setting-row .owner-phone-form textarea { min-width: 0; width: 100%; margin: 0; }
  body.app .setting-row .owner-phone-form textarea { field-sizing: content; min-height: 6.5em; max-height: 50vh; }
  body.app .setting-row .owner-phone-form .btn-gold { min-height: 44px; }
}

/* Touch: primary links get a 44px target (D18) */
@media (pointer: coarse) {
  body.app .dash-notice a { display: inline-flex; align-items: center; min-height: 44px; }
  body.app .kb-tab, body.app .kb-pages .pg, body.app .kb-size select { min-height: 44px; min-width: 44px; justify-content: center; }
  body.app .meta-chip.link { min-height: 44px; padding: 0 14px; }
  body.app .kb-act, body.app .kb-sort { min-height: 44px; } /* tablets keep the table layout */
  body.app #drafts:has(.q:focus, .a:focus) .import-acts { position: static; } /* while a draft field is typed in, the bar returns to the list end so the keyboard cannot hide the field */
  body.app .kb-sort { display: inline-flex; align-items: center; }
  .auth-foot a, .legal-foot a { display: inline-flex; align-items: center; min-height: 44px; } /* login/recover/legal pages load only this file */
}

/* ONE error-text rule shared by the suggestions `.error` block-notice and the record-form
   inline `.err` (DRY — do not redefine the red elsewhere). */
body.app .error { color: #b3261e; background: #fdeaea; border: 1px solid #f0c0bc; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
body.app .err { color: #b3261e; font-size: 0.82rem; display: block; margin-top: 4px; }

/* record form (add template data) */
body.app .rec-head { margin-bottom: 16px; }
body.app .rec-head h1 { font-size: 1.5rem; display: inline-block; margin-inline-end: 10px; }
body.app .rec-head .sub { color: var(--muted); font-size: 0.9rem; margin-top: 5px; max-width: 60ch; }
body.app .tpl { display: inline-flex; align-items: center; gap: 6px; background: var(--gold-soft); color: var(--nile-deep); border: 1px solid #bfe0d3; border-radius: 999px; padding: 4px 13px; font-size: 0.83rem; font-weight: 700; vertical-align: middle; }
body.app .rec-grid { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
body.app .rec-fields h2, body.app .rec-preview h2 { font-size: 1.05rem; margin-bottom: 4px; }
body.app .rec-preview { position: sticky; top: 20px; }
body.app .rec-preview .ph { color: var(--muted); font-size: 0.82rem; margin-bottom: 12px; }
body.app .field { margin-bottom: 12px; }
body.app .field label { display: block; margin-bottom: 6px; font-size: 0.9rem; } /* global `label` sets only font-weight:700 */
body.app .field input, body.app .field select { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #f7faf9; font: inherit; }
body.app .field input:focus, body.app .field select:focus { outline: 2px solid var(--nile); border-color: var(--nile); background: #fff; }

/* Appointments: one row per day, and the Google action pair stacked at one size (D9) */
body.app .hours-day { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
body.app .hours-day-name { min-width: 5.5em; color: var(--ink); }
body.app .hours-day .hours-closed { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; font-weight: 400; cursor: pointer; }
body.app .hours-closed input[type=checkbox] { width: 24px; height: 24px; margin: 0; padding: 0; flex: none; accent-color: var(--nile); } /* [type] out-ranks .field input */
body.app .hours-times { display: inline-flex; flex: 1 1 auto; align-items: center; gap: 4px; min-width: 0; }
body.app .hours-day input[type=time] { width: auto; flex: 1 1 0; min-width: 0; max-width: 10em; min-height: 44px; margin: 0; padding: 0 4px; } /* the pair must fit a phone-width row; slim padding keeps AM/PM visible */
body.app .appt-acts { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 16px; max-width: 360px; }
body.app .appt-acts form { margin: 0; }
body.app .appt-acts .btn-gold, body.app .appt-acts button { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin: 0; padding-top: 0; padding-bottom: 0; }
body.app .custom { border: 1px dashed #bfe0d3; border-radius: 12px; padding: 14px; margin-top: 6px; background: #f7fbf9; }
body.app .preview pre { background: #0f2b26; color: #dcefe7; border-radius: 11px; padding: 15px 16px; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 0.86rem; line-height: 1.7; white-space: pre-wrap; overflow-x: auto; }
body.app .rec-save { display: flex; align-items: center; gap: 14px; margin-top: 16px; }

@media (max-width: 820px) { body.app .rec-grid { grid-template-columns: 1fr; } body.app .rec-preview { position: static; } }

/* M6: inline error under a form whose Ajax submit failed (public/js/console-ajax.js). */
body.app .ajax-error { color: #b3261e; font-size: 0.82rem; margin: 4px 0 0; }

/* ===== Epic 9 phase 6: channels (approved mockup) ===== */
.avatar-wrap { position: relative; flex: 0 0 auto; display: inline-flex; }
.ch-badge { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ch-badge svg { width: 11px; height: 11px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ch-badge.wa { background: #128c7e; }
.ch-badge.tg { background: #1d8fcc; }
.avatar-wrap .ch-badge { position: absolute; bottom: -3px; left: -3px; border: 2px solid #fff; }
.ch-filter { display: flex; gap: 6px; padding: 0 14px 12px; flex-wrap: wrap; }
.ch-chip { width: auto; font: inherit; font-size: 0.82rem; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px; border-radius: 999px; cursor: pointer; border: 1px solid rgba(12, 92, 79, 0.22); background: #fff; color: var(--ink); }
.ch-chip:hover { background: #f7faf9; transform: none; }
.ch-chip.on { background: var(--nile); border-color: var(--nile); color: #fff; }
.ch-chip .ch-badge { width: 18px; height: 18px; }
.ch-count { font-weight: 500; opacity: 0.85; }
.thread-who .s-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.channel-tag { font-size: 0.78rem; font-weight: 700; border-radius: 999px; padding: 0 8px; }
.channel-tag.tg { color: #135f8a; background: #e6f3fb; }
.channel-tag.wa { color: #0b5f56; background: #e3f3ef; }
.msg-note { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.dash-channels { margin-bottom: 18px; }
.dash-channels-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-channels-head h2 { font-size: 1.1rem; }
.dash-channels-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.ch-card { box-shadow: none; display: flex; flex-direction: column; }
.ch-card-head { display: flex; align-items: center; gap: 10px; }
.ch-card-head .ch-badge { width: 34px; height: 34px; }
.ch-card-head .ch-badge svg { width: 18px; height: 18px; stroke-width: 2.2; }
.ch-card-head .dash-card-label { font-size: 0.95rem; color: var(--ink); font-weight: 700; }
.ch-card-off { border-style: dashed; border-color: rgba(29, 143, 204, 0.55); background: #f5fafd; }
.ch-card-action { margin-top: 12px; align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; box-sizing: border-box; }
.tg-connect { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.tg-back { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.tg-connect-head { display: flex; align-items: center; gap: 12px; }
.tg-connect-head .ch-badge { width: 48px; height: 48px; }
.tg-connect-head .ch-badge svg { width: 26px; height: 26px; stroke-width: 2.1; }
.tg-connect-head h1 { font-size: 1.5rem; }
.tg-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.tg-steps li { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.tg-steps p { margin-top: 2px; color: #3f504b; font-size: 0.92rem; }
.tg-step-n { width: 30px; height: 30px; border-radius: 50%; background: var(--nile); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.tg-step-body { flex: 1; min-width: 0; }
.tg-copy { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; background: #f5fafd; border: 1px solid rgba(29, 143, 204, 0.35); border-radius: 10px; padding: 6px 8px 6px 12px; margin-top: 8px; }
.tg-copy-value { font-weight: 700; color: #135f8a; overflow-wrap: anywhere; }
.tg-code { background: #fbf6ea; border-color: rgba(217, 154, 43, 0.5); }
.tg-code .tg-copy-value { color: var(--ink); font-size: 1.25rem; letter-spacing: 0.12em; }
.tg-copy .btn-sm { width: auto; min-height: 36px; flex: 0 0 auto; }
.ch-card-action .btn-danger { width: auto; min-height: 44px; }
.tg-open { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; box-sizing: border-box; }
.tg-wait { display: flex; flex-direction: column; background: #fff7e8; border: 1px solid rgba(217, 154, 43, 0.45); border-radius: 12px; padding: 14px 16px; color: #6b4004; font-size: 0.9rem; }
.tg-how h2 { font-size: 1.02rem; margin-bottom: 6px; }
.tg-how ul { margin: 0; padding-inline-start: 20px; color: #3f504b; font-size: 0.9rem; display: flex; flex-direction: column; gap: 4px; }
@media (pointer: coarse) {
  .ch-chip { min-height: 44px; }
  .tg-copy .btn-sm { min-height: 44px; }
}
