/* =====================================================================
   TechPad WhatsApp — panel styles
   Palette: slate paper, ink, workshop teal (connected), amber (needs a
   human), indigo (AI-written), brick (errors). One family: Onest, with
   Noto Sans Telugu for customer messages in Telugu script.
   ===================================================================== */
:root {
  --paper: #EEF1F4;
  --panel: #FFFFFF;
  --panel-2: #F6F8FA;
  --ink: #18212B;
  --ink-2: #4A5866;
  --ink-3: #7A8794;
  --line: #DCE2E8;
  --line-2: #C9D1D9;
  --teal: #0E6E6E;
  --teal-2: #0B5858;
  --teal-soft: #DDF0EE;
  --amber: #C98A0B;
  --amber-soft: #FBF0D6;
  --indigo: #5B4BC4;
  --indigo-soft: #ECE9FB;
  --brick: #B83A26;
  --brick-soft: #F9E3DE;
  --sky: #2F6FB3;
  --sky-soft: #E1ECF8;
  --side: #18212B;
  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 16px;
  --shadow: 0 1px 2px rgba(24, 33, 43, .06), 0 8px 24px -12px rgba(24, 33, 43, .18);
  --font: "Onest", "Noto Sans Telugu", system-ui, -apple-system, "Segoe UI", sans-serif;
  --step--1: .8125rem;
  --step-0: .9375rem;
  --step-1: 1.125rem;
  --step-2: 1.375rem;
  --step-3: 1.875rem;
  --step-4: 2.5rem;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--step-0); line-height: 1.5; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--teal); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--panel); padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--ink-3); }
.small { font-size: var(--step--1); }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------------- shell ---------------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #C7D0D9; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--teal); display: grid; place-items: center; font-weight: 700; }
.brand-name { font-weight: 600; font-size: var(--step-0); }
.brand-name span { color: #8FA0B0; font-weight: 500; }
.nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 1px; overflow-y: auto; flex: 1; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: #C7D0D9; text-decoration: none; font-size: var(--step--1); font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: rgba(14,110,110,.35); color: #fff; box-shadow: inset 3px 0 0 #3DB3A8; }
.nav-count { margin-left: auto; background: var(--amber); color: #1d1500; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.side-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.08); }
.me { display: flex; flex-direction: column; font-size: var(--step--1); }
.me strong { color: #fff; font-weight: 600; }
.me span { color: #8FA0B0; }
.icon-btn { background: none; border: 0; color: inherit; padding: 8px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { background: rgba(127,127,127,.15); }
.main-col { display: flex; flex-direction: column; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-title { font-size: var(--step-1); }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.menu-toggle { display: none; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 99px; font-size: var(--step--1); font-weight: 600; text-decoration: none; border: 1px solid var(--line); color: var(--ink-2); background: var(--panel); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.conn-connected, .conn-sync_complete { color: var(--teal); border-color: #B5DCD8; background: var(--teal-soft); }
.conn-connected .dot, .conn-sync_complete .dot { background: var(--teal); box-shadow: 0 0 0 3px rgba(14,110,110,.18); }
.conn-syncing, .conn-connecting { color: var(--sky); background: var(--sky-soft); border-color: #BCD3EC; }
.conn-syncing .dot, .conn-connecting .dot { background: var(--sky); animation: pulse 1.4s infinite; }
.conn-error, .conn-disconnected { color: var(--brick); background: var(--brick-soft); border-color: #EFC2B9; }
.conn-error .dot, .conn-disconnected .dot { background: var(--brick); }
.ai-pill[data-on="1"] { color: var(--indigo); background: var(--indigo-soft); border-color: #D3CDF6; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.content { padding: 24px; max-width: 1280px; width: 100%; }
.content-inbox { padding: 0; max-width: none; flex: 1; min-height: 0; }

/* ---------------- building blocks ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); max-width: 70ch; }
.block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.block > h2 { font-size: var(--step-1); margin-bottom: 4px; }
.block > p.lead { margin: 0 0 14px; color: var(--ink-2); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); font-weight: 600; font-size: var(--step--1); cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--panel-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-2); }
.btn.danger { color: var(--brick); border-color: #E9B8AE; }
.btn.danger.solid { background: var(--brick); color: #fff; border-color: var(--brick); }
.btn.ai { color: var(--indigo); border-color: #CFC8F4; }
.btn.amber { color: #7A5300; border-color: #E8CD8A; background: var(--amber-soft); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: none; }
label { display: block; font-size: var(--step--1); font-weight: 600; margin-bottom: 5px; color: var(--ink-2); }
.field { margin-bottom: 14px; }
.field small, .hint { display: block; color: var(--ink-3); font-size: 12.5px; margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=time], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); font-size: var(--step-0);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: 2px solid rgba(14,110,110,.2); outline-offset: 0; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--teal); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; color: var(--ink); margin: 0; }
.switch input { position: absolute; opacity: 0; }
.switch i { width: 40px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--teal); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--sky); outline-offset: 2px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.tag.teal { background: var(--teal-soft); color: var(--teal); border-color: #B5DCD8; }
.tag.amber { background: var(--amber-soft); color: #7A5300; border-color: #EBD49A; }
.tag.indigo { background: var(--indigo-soft); color: var(--indigo); border-color: #D3CDF6; }
.tag.brick { background: var(--brick-soft); color: var(--brick); border-color: #EFC2B9; }
.tag.sky { background: var(--sky-soft); color: var(--sky); border-color: #BCD3EC; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
table.data th { text-align: left; font-weight: 600; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--panel-2); }
.table-wrap { overflow-x: auto; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty h2 { font-size: var(--step-1); margin-bottom: 6px; color: var(--ink); }
.notice { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; border: 1px solid; font-size: var(--step--1); }
.notice strong { display: block; margin-bottom: 2px; font-size: var(--step-0); }
.notice.warn { background: var(--amber-soft); border-color: #EBD49A; color: #5C3F00; }
.notice.bad { background: var(--brick-soft); border-color: #EFC2B9; color: #6E2215; }
.notice.good { background: var(--teal-soft); border-color: #B5DCD8; color: #0A4545; }
.notice.info { background: var(--sky-soft); border-color: #BCD3EC; color: #1C4570; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 9px 12px; font-weight: 600; font-size: var(--step--1); color: var(--ink-3); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--teal); }
pre.code { background: var(--side); color: #D6DEE6; padding: 14px; border-radius: 8px; overflow: auto; font-size: 12.5px; max-height: 420px; white-space: pre-wrap; word-break: break-word; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: var(--step--1); margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }

/* ---------------- dashboard ---------------- */
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.stat { background: var(--panel); padding: 16px 18px; }
.stat b { display: block; font-size: var(--step-3); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-2); font-size: var(--step--1); }
.stat.hot b { color: var(--amber); }
.stat.ai b { color: var(--indigo); }
.conn-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.conn-hero .big-num { font-size: var(--step-2); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------- inbox ---------------- */
.inbox { display: grid; grid-template-columns: 340px 1fr 300px; height: calc(100vh - 57px); background: var(--panel); }
.inbox.no-detail { grid-template-columns: 340px 1fr; }
.ib-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.ib-search { padding: 12px; border-bottom: 1px solid var(--line); }
.ib-filters { display: flex; gap: 6px; padding: 10px 12px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.ib-filters button { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.ib-filters button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.ib-filters button i { font-style: normal; opacity: .65; margin-left: 4px; }
.ib-items { overflow-y: auto; flex: 1; }
.ci { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; padding: 12px; border-bottom: 1px solid #EEF1F4; cursor: pointer; align-items: start; text-align: left; width: 100%; background: none; border-left: 3px solid transparent; }
.ci:hover { background: var(--panel-2); }
.ci.on { background: #E9F3F2; border-left-color: var(--teal); }
.ci.attn { border-left-color: var(--amber); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px; background: #5D6B79; }
.ci-main { min-width: 0; display: block; }
.ci-main > span { display: block; }
.ci-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-prev { color: var(--ink-2); font-size: var(--step--1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-main > .ci-meta { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.ci-side { text-align: right; font-size: 12px; color: var(--ink-3); display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.unread { background: var(--teal); color: #fff; font-weight: 700; font-size: 11px; min-width: 20px; height: 20px; border-radius: 99px; display: grid; place-items: center; padding: 0 6px; }
.ib-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #E9EDF1; }
.chat-head { background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.chat-who { min-width: 0; flex: 1 1 140px; }
.chat-who h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#toggle-detail { display: none; }
.chat-head h2 { font-size: var(--step-0); }
.chat-head .sub { color: var(--ink-3); font-size: 12.5px; }
.back-btn { display: none; }

/* bot state switch — the one loud element */
.botstate { display: inline-flex; flex: none; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.botstate button { border: 0; background: none; padding: 7px 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; border-right: 1px solid var(--line); }
.botstate button:last-child { border-right: 0; }
.botstate button[aria-pressed="true"].s-ai { background: var(--indigo); color: #fff; }
.botstate button[aria-pressed="true"].s-paused { background: #5D6B79; color: #fff; }
.botstate button[aria-pressed="true"].s-human { background: var(--amber); color: #1d1500; }
.botstate .sw { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .7; }
.state-line { padding: 7px 16px; font-size: 12.5px; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--ink-2); }
.state-line .tag { margin-left: 6px; }
.state-line.ai { background: var(--indigo-soft); color: #3B2F94; }
.state-line.human { background: var(--amber-soft); color: #5C3F00; }
.state-line.paused { background: #EEF0F3; }
.state-line.off { background: #EEF0F3; }

.msgs { flex: 1; overflow-y: auto; padding: 18px 6%; display: flex; flex-direction: column; gap: 4px; }
.day-sep { align-self: center; font-size: 12px; color: var(--ink-2); background: rgba(255,255,255,.75); padding: 3px 10px; border-radius: 99px; margin: 10px 0; }
.bubble { max-width: min(74%, 560px); padding: 7px 10px 5px; border-radius: 10px; position: relative; box-shadow: 0 1px 1px rgba(24,33,43,.07); word-wrap: break-word; }
.bubble .txt { white-space: pre-wrap; }
.bubble.in { align-self: flex-start; background: #fff; border-top-left-radius: 3px; }
.bubble.out { align-self: flex-end; background: #DCEFEA; border-top-right-radius: 3px; }
.bubble.out.src-ai { background: var(--indigo-soft); }
.bubble.out.src-menu, .bubble.out.src-system { background: #E6EAEF; }
.bubble.out.src-mobile_app { background: #FFF6DD; }
.bubble.out.src-history, .bubble.in.src-history { opacity: .88; }
.bubble.failed { box-shadow: inset 0 0 0 1.5px var(--brick); }
.bubble.revoked { font-style: italic; color: var(--ink-3); }
.src { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; margin-bottom: 2px; white-space: normal; }
.src::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.src-ai .src { color: var(--indigo); }
.src-dashboard .src, .src-template .src { color: var(--teal); }
.src-mobile_app .src { color: #8A6100; }
.src-menu .src, .src-system .src { color: #4E5C6A; }
.src-history .src { color: var(--ink-3); }
.b-meta { display: flex; gap: 6px; justify-content: flex-end; align-items: center; font-size: 11px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; }
.tick { font-weight: 700; letter-spacing: -2px; }
.tick.read { color: #2F86D6; }
.tick.failed { color: var(--brick); letter-spacing: 0; }
.b-err { font-size: 12px; color: var(--brick); margin-top: 4px; white-space: normal; }
.b-media img, .b-media video { max-width: 260px; max-height: 260px; border-radius: 6px; display: block; margin-bottom: 4px; }
.b-media audio { max-width: 260px; }
.b-file { display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; background: rgba(0,0,0,.05); border-radius: 6px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 13px; }
.load-older { align-self: center; }
.composer { background: var(--panel); border-top: 1px solid var(--line); padding: 10px 12px; }
.composer form { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 42px; max-height: 160px; resize: none; flex: 1; }
.composer .ghost span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.composer .ghost { padding: 9px; }
.composer .note { font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.ib-detail { border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.ib-detail h3 { font-size: var(--step--1); color: var(--ink-3); font-weight: 600; margin-bottom: 6px; }
.ib-empty { display: grid; place-items: center; height: 100%; color: var(--ink-2); text-align: center; padding: 24px; }

/* ---------------- KB / menus / misc ---------------- */
.kb-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--panel); display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 8px; }
.kb-item.off { background: var(--panel-2); }
.kb-item.off .kb-title { color: var(--ink-3); }
.kb-title { font-weight: 600; }
.kb-body { color: var(--ink-2); font-size: var(--step--1); white-space: pre-wrap; margin-top: 4px; }
.menu-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 14px; overflow: hidden; }
.menu-card header { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.menu-card header h3 { font-size: var(--step-0); }
.menu-preview { display: grid; grid-template-columns: 1fr 280px; }
.menu-items { padding: 6px 0; }
.menu-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; padding: 9px 16px; align-items: start; border-bottom: 1px solid #EEF1F4; }
.menu-item:last-child { border-bottom: 0; }
.opt-num { width: 28px; height: 28px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.phone-prev { background: #E9EDF1; padding: 14px; border-left: 1px solid var(--line); }
.phone-prev .bubble { max-width: 100%; font-size: 13.5px; }
.gate-list { list-style: none; padding: 0; margin: 0; }
.gate-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.gate-list li:last-child { border-bottom: 0; }
.steps-list { margin: 0; padding-left: 20px; }
.steps-list li { margin-bottom: 6px; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 1px; min-width: 0; position: relative; height: 100%; }
.bar-col span { display: block; border-radius: 2px; }
.bar-x { display: flex; gap: 6px; font-size: 11px; color: var(--ink-3); margin-top: 6px; }
.bar-x span { flex: 1; text-align: center; min-width: 0; overflow: hidden; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------------- modal + toasts ---------------- */
.modal { border: 0; border-radius: var(--radius-l); padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow); color: var(--ink); }
.modal.wide { width: min(820px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(24,33,43,.45); }
.modal-box { padding: 22px; margin: 0; }
.modal-box h2 { font-size: var(--step-1); margin-bottom: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: var(--step--1); box-shadow: var(--shadow); max-width: 380px; }
.toast.bad { background: var(--brick); }
.toast.good { background: var(--teal); }

/* ---------------- login ---------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--side); color: #C7D0D9; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h1 { color: #fff; font-size: var(--step-4); max-width: 14ch; font-weight: 600; letter-spacing: -.03em; }
.auth-art p { max-width: 42ch; }
.auth-chat { display: flex; flex-direction: column; gap: 6px; max-width: 380px; }
.auth-chat .bubble { font-size: 14px; color: var(--ink); }
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-form form { width: min(380px, 100%); }
.auth-form h2 { font-size: var(--step-2); margin-bottom: 6px; }

/* ---------------- responsive ---------------- */
@media (max-width: 1180px) {
  .inbox { grid-template-columns: 300px 1fr; }
  .ib-detail { display: none; }
  #toggle-detail { display: inline-grid; }
  .inbox.show-detail .ib-detail { display: flex; position: fixed; right: 0; top: 57px; bottom: 0; width: 320px; background: var(--panel); z-index: 6; box-shadow: var(--shadow); }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .menu-preview { grid-template-columns: 1fr; }
  .phone-prev { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 248px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .menu-toggle { display: inline-grid; }
  .top { padding: 10px 14px; }
  .content { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; height: calc(100vh - 53px); }
  .inbox .ib-chat { display: none; }
  .inbox.chat-open .ib-list { display: none; }
  .inbox.chat-open .ib-chat { display: flex; }
  .back-btn { display: inline-grid; }
  .botstate { margin-left: 0; width: 100%; }
  .botstate button { flex: 1; justify-content: center; padding: 8px 6px; font-size: 12px; }
  .msgs { padding: 14px 10px; }
  .bubble { max-width: 88%; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .top-title { font-size: var(--step-0); }
  .ai-pill { display: none; }
}
