/* ===== Tokens ===== */
:root {
  --bg: #EEF0F4;
  --panel: #FFFFFF;
  --panel-2: #F7F8FA;
  --ink: #1B1E29;
  --muted: #6B7183;
  --line: #DCE0E8;
  --accent: #0E7C86;
  --accent-hover: #0B6870;
  --accent-soft: #DDF1F2;
  --amber: #D98E1F;
  --amber-soft: #FBEFD9;
  --danger: #C2413A;
  --danger-soft: #F8E1DF;
  --ok: #2E8B57;
  --chat-bg: #E6E9EF;
  --bubble-me: #D3EEEF;
  --bubble-them: #FFFFFF;
  --tick-read: #1B8FE0;
  --side-bg: #1B1E29;
  --side-ink: #C9CDD8;
  --side-active: #2A2E3D;
  --shadow: 0 1px 2px rgba(20, 24, 40, .06), 0 8px 24px rgba(20, 24, 40, .06);
  --r-lg: 12px;
  --r-md: 8px;
  --r-sm: 6px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161D; --panel: #1C1F29; --panel-2: #222633; --ink: #E6E8EE; --muted: #9097A8; --line: #2C3040;
    --accent: #2BB3BE; --accent-hover: #4CC4CE; --accent-soft: #173E43; --amber: #E8A33D; --amber-soft: #3A2E18;
    --danger: #E46A62; --danger-soft: #3E2222; --chat-bg: #171A22; --bubble-me: #16484D; --bubble-them: #252937;
    --tick-read: #53B6FF; --side-bg: #0F1117; --side-active: #1F2330; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161D; --panel: #1C1F29; --panel-2: #222633; --ink: #E6E8EE; --muted: #9097A8; --line: #2C3040;
  --accent: #2BB3BE; --accent-hover: #4CC4CE; --accent-soft: #173E43; --amber: #E8A33D; --amber-soft: #3A2E18;
  --danger: #E46A62; --danger-soft: #3E2222; --chat-bg: #171A22; --bubble-me: #16484D; --bubble-them: #252937;
  --tick-read: #53B6FF; --side-bg: #0F1117; --side-active: #1F2330; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 24px; letter-spacing: -.01em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ===== Buttons & inputs ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap; }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; color: inherit; }
.icon-btn:hover { background: var(--panel-2); }

label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 6px; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 14px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 80px; }
input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); cursor: pointer; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid { display: grid; gap: 14px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); font-weight: 400; cursor: pointer; padding: 6px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.check-list { border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px 12px; max-height: 190px; overflow: auto; margin-top: 6px; }

/* Switch */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 22px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.alert { padding: 10px 12px; border-radius: var(--r-md); background: var(--danger-soft); color: var(--danger); font-size: 14px; }

/* ===== Login ===== */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); padding: 32px; border-radius: 16px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.login-card h1 { margin-top: 8px; }
.login-card p { margin: -8px 0 4px; }
.login-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); font-size: 16px; }

/* ===== Layout ===== */
.app { display: flex; height: 100vh; height: 100dvh; }
.sidebar { width: 228px; flex: none; background: var(--side-bg); color: var(--side-ink); display: flex; flex-direction: column; padding: 16px 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; color: #fff; font-weight: 600; font-size: 16px; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r-md); color: var(--side-ink); font-size: 14px; font-weight: 500; }
.nav a:hover { background: var(--side-active); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-badge { margin-left: auto; background: var(--amber); color: #1B1E29; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 6px; padding-top: 12px; border-top: 1px solid var(--side-active); }
.sidebar-foot .icon-btn { color: var(--side-ink); }
.sidebar-foot .icon-btn:hover { background: var(--side-active); }
.me-link { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-md); color: var(--side-ink); min-width: 0; flex: 1; }
.me-link:hover, .me-link.active { background: var(--side-active); color: #fff; }
.me-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { flex: 1; min-width: 0; overflow: auto; }

.page { padding: 28px 32px 48px; max-width: 1180px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 12px; }
.panel-body { padding: 18px; }

/* Avatars */
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; font-weight: 600; font-size: 15px; flex: none; position: relative; text-transform: uppercase; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--panel); }
.avatar.sm .dot { width: 9px; height: 9px; }

/* Chips & status */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.chip .sw { width: 8px; height: 8px; border-radius: 50%; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.status.open { background: var(--amber-soft); color: var(--amber); }
.status.assigned { background: var(--accent-soft); color: var(--accent); }
.status.closed { background: var(--panel-2); color: var(--muted); }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.online-dot.on { background: var(--ok); }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 10px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--panel-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user b { font-weight: 600; display: block; }

/* ===== Dashboard ===== */
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 20px; }
.stat { padding: 18px 20px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat .v { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat.attention .v { color: var(--amber); }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.dash-grid .wide { grid-column: 1 / -1; }
.chart { width: 100%; height: 200px; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--accent); }
.chart .bar.today { fill: var(--amber); }
.chart .val { fill: var(--ink); font-weight: 600; }
.mini-stats { display: grid; gap: 12px; }
.mini-stats div { display: flex; justify-content: space-between; font-size: 14px; }
.mini-stats b { font-variant-numeric: tabular-nums; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 40px; align-items: center; gap: 10px; font-size: 13px; padding: 6px 0; }
.bar-row .track { height: 8px; background: var(--panel-2); border-radius: 8px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 8px; }
.bar-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Domains ===== */
.domain-list { display: grid; gap: 12px; }
.domain-row { display: grid; grid-template-columns: 6px 1fr auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; cursor: pointer; }
.domain-row:hover { border-color: var(--muted); }
.domain-row .stripe { background: var(--c, var(--accent)); }
.domain-row .body { padding: 16px 18px; min-width: 0; }
.domain-row .side { padding: 16px 18px; display: flex; align-items: center; gap: 22px; }
.domain-row h3 { display: flex; align-items: center; gap: 8px; }
.domain-row .domains { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.domain-row.off { opacity: .6; }
.metric { text-align: right; }
.metric b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.metric span { font-size: 12px; color: var(--muted); }
.key-box { display: flex; align-items: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; }
.key-box code { flex: 1; overflow-x: auto; white-space: nowrap; }
.snippet { position: relative; background: var(--side-bg); color: #D7DBE6; border-radius: var(--r-md); padding: 14px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; white-space: pre; }
.snippet .btn { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.snippet .btn:hover { background: rgba(255,255,255,.16); }
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* ===== Empty ===== */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

/* ===== Modal ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 17, 23, .5); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .12s ease-out; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .15s ease-out; }
.modal.wide { max-width: 640px; }
.modal-head { padding: 18px 20px 0; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ===== Toast ===== */
#toast-root { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: var(--r-md); font-size: 14px; box-shadow: var(--shadow); animation: pop .15s ease-out; }
.toast.err { background: var(--danger); color: #fff; }

/* ===== Chats (3 pane) ===== */
.chats { display: grid; grid-template-columns: 340px 1fr 300px; height: 100%; min-height: 0; }
.chats.no-info { grid-template-columns: 340px 1fr; }
.c-list { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.c-list-head { padding: 14px 14px 10px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.c-list-head .row { display: flex; gap: 8px; }
.c-list-head select { flex: 1; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; padding: 5px 10px; border-radius: 20px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button:hover { background: var(--panel-2); }
.tabs button.on { background: var(--accent-soft); color: var(--accent); }
.tabs button .n { margin-left: 4px; font-size: 11px; background: var(--amber); color: #1B1E29; border-radius: 10px; padding: 0 6px; }
.c-items { overflow-y: auto; flex: 1; }
.c-item { display: grid; grid-template-columns: 4px 40px 1fr; gap: 0 12px; padding: 12px 14px 12px 0; cursor: pointer; border-bottom: 1px solid var(--line); align-items: center; }
.c-item:hover { background: var(--panel-2); }
.c-item.on { background: var(--accent-soft); }
.c-item .stripe { align-self: stretch; background: var(--c); border-radius: 0 3px 3px 0; margin: -12px 0; }
.c-item .mid { min-width: 0; }
.c-item .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.c-item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-item .time { font-size: 12px; color: var(--muted); flex: none; }
.c-item .time.unread { color: var(--accent); font-weight: 600; }
.c-item .bot { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 2px; }
.c-item .prev { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-item .prev.typing { color: var(--accent); font-style: italic; }
.c-item .meta { display: flex; gap: 6px; align-items: center; margin-top: 5px; font-size: 12px; color: var(--muted); }
.c-item .meta .kname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.unread-n { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; flex: none; }
.c-more { padding: 12px; text-align: center; }

.c-conv { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--chat-bg); }
.c-conv-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; }
.c-conv-empty .big { font-size: 44px; margin-bottom: 8px; }
.c-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 62px; }
.c-head .who { min-width: 0; flex: 1; cursor: pointer; }
.c-head .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-head .who .sub { font-size: 12.5px; color: var(--muted); }
.c-head .who .sub.typing { color: var(--accent); }
.c-head .actions { display: flex; gap: 6px; align-items: center; }
.back-btn { display: none; }
.c-msgs { flex: 1; overflow-y: auto; padding: 16px 6% 8px; display: flex; flex-direction: column; gap: 3px; }
.day-sep { align-self: center; background: var(--panel); color: var(--muted); font-size: 12px; padding: 3px 10px; border-radius: 8px; margin: 12px 0 8px; box-shadow: 0 1px 1px rgba(0,0,0,.05); }
.sys { align-self: center; font-size: 12px; color: var(--muted); background: var(--panel-2); padding: 4px 12px; border-radius: 8px; margin: 6px 0; text-align: center; max-width: 80%; }
.msg { max-width: min(72%, 560px); padding: 7px 10px 6px; border-radius: 12px; position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.06); word-wrap: break-word; white-space: pre-wrap; font-size: 14.5px; line-height: 1.45; }
.msg.them { align-self: flex-start; background: var(--bubble-them); border-top-left-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--bubble-me); border-top-right-radius: 4px; }
.msg.cont.them { border-top-left-radius: 12px; }
.msg.cont.me { border-top-right-radius: 12px; }
.msg.first { margin-top: 8px; }
.msg .by { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.msg .foot { float: right; margin: 6px 0 -3px 12px; font-size: 11px; color: var(--muted); display: inline-flex; gap: 3px; align-items: center; white-space: nowrap; }
.msg .tick { width: 16px; height: 11px; fill: var(--muted); }
.msg .tick.read { fill: var(--tick-read); }
.msg.pending { opacity: .6; }
.msg .att-img { display: block; max-width: 260px; max-height: 300px; border-radius: 8px; margin: -2px -4px 4px; cursor: zoom-in; }
.msg .att-file { display: flex; align-items: center; gap: 10px; padding: 8px; background: rgba(0,0,0,.05); border-radius: 8px; margin-bottom: 4px; color: inherit; }
.msg .att-file svg { width: 26px; height: 26px; color: var(--accent); }
.msg .att-file small { display: block; color: var(--muted); }
.typing-bubble { align-self: flex-start; background: var(--bubble-them); padding: 10px 14px; border-radius: 12px; border-top-left-radius: 4px; display: inline-flex; gap: 4px; margin-top: 4px; }
.typing-bubble i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing-bubble i:nth-child(2) { animation-delay: .2s; }
.typing-bubble i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

.composer { padding: 10px 14px; background: var(--panel); border-top: 1px solid var(--line); position: relative; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { min-height: 42px; max-height: 160px; resize: none; border-radius: 21px; padding: 10px 16px; line-height: 1.4; }
.send-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.send-btn:hover { background: var(--accent-hover); }
.send-btn:disabled { opacity: .5; }
.composer .closed-note { text-align: center; font-size: 13px; color: var(--muted); padding: 6px; }
.canned-pop { position: absolute; bottom: calc(100% + 4px); left: 14px; right: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); max-height: 240px; overflow: auto; z-index: 5; }
.canned-pop button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--line); }
.canned-pop button:last-child { border-bottom: 0; }
.canned-pop button.on, .canned-pop button:hover { background: var(--accent-soft); }
.canned-pop b { color: var(--accent); margin-right: 8px; }
.canned-pop span { color: var(--muted); }
.file-preview { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 0 4px 8px; }

.c-info { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; min-height: 0; }
.c-info-top { text-align: center; padding: 24px 18px 18px; border-bottom: 1px solid var(--line); }
.c-info-top h2 { margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.c-info-sec { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.info-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.c-info-sec h3 { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
.c-info .kv { grid-template-columns: 82px 1fr; font-size: 13px; }
.verified { color: var(--accent); }
.verified svg { width: 16px; height: 16px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 70; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .chats { grid-template-columns: 320px 1fr; }
  .chats .c-info { position: fixed; right: 0; top: 0; bottom: 0; width: 320px; z-index: 30; box-shadow: var(--shadow); padding-top: env(safe-area-inset-top, 0px); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { flex-direction: column-reverse; }
  .sidebar { width: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); align-items: center; }
  :root { padding-bottom: 0; }
  .brand, .sidebar-foot .me-name { display: none; }
  .nav { display: flex; flex: 1; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 6px 8px; position: relative; }
  .nav a.active { box-shadow: none; }
  .nav-badge { position: absolute; top: 0; right: 2px; margin: 0; }
  .sidebar-foot { margin: 0; border: 0; padding: 0; }
  .me-link { padding: 4px; flex: none; }
  .page { padding: 20px 16px 32px; }
  .field-row { grid-template-columns: 1fr; }
  .chats, .chats.no-info { grid-template-columns: 1fr; }
  .chats.has-active .c-list { display: none; }
  .chats:not(.has-active) .c-conv { display: none; }
  .back-btn { display: inline-grid; }
  .c-msgs { padding: 12px 10px 8px; }
  .msg { max-width: 85%; }
  .c-info { width: 100% !important; }
  .domain-row { grid-template-columns: 6px 1fr; }
  .domain-row .side { grid-column: 2; padding-top: 0; justify-content: flex-start; }
  .c-head [data-act=transfer], .c-head [data-act=close], .c-head [data-act=reopen], .c-head .actions .chip { display: none; }
  .nav a span { white-space: nowrap; }
}
