/* SMSDesk on the «Комутатор» design system (https://claude.ai/artifact/YVk28VLW9p65LBzoJjCCNt).
   Local names map 1:1 to the system tokens; never add literal colours below. */
:root {
  --bg: #f4f6fa;            /* bg */
  --surface: #ffffff;       /* surface */
  --surface-2: #f8fafd;     /* input / quiet panel fill */
  --surface-3: #f0f4fa;     /* surface-muted */
  --border: #e0e6ee;        /* line */
  --border-strong: #d3ddea; /* line-strong */
  --text: #17243a;          /* ink */
  --text-2: #617087;        /* ink-muted */
  --text-3: #617087;        /* ink-muted (captions) */
  --label: #43546c;         /* label */
  --accent: #285fe5;        /* accent */
  --accent-hover: #224fc3;  /* accent-hover */
  --accent-soft: #edf2ff;   /* accent-soft */
  --on-accent: #ffffff;     /* on-accent */
  --nav: #101e34; --nav-ink: #aebbd0; --nav-active: #23344c; --nav-indicator: #73a5ff; --nav-strong: #ffffff;
  --ok: #14784b;   --ok-soft: #edf8f1;
  --warn: #8c6724; --warn-soft: #fffaf0;
  --bad: #b4423c;  --bad-soft: #fff3f2;
  --muted-soft: #f0f4fa;
  --focus: #4b85ff;
  --disabled: #eef1f5;
  --shadow: 0 2px 5px rgba(22,40,65,.012);
  --shadow-pop: 0 12px 35px rgba(36,50,80,.08);
  --radius: 12px;           /* radius-lg */
  --radius-sm: 7px;         /* radius-md */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1626; --surface: #142035; --surface-2: #172438; --surface-3: #1a2840;
    --border: #26354d; --border-strong: #3a4d69;
    --text: #e6ecf5; --text-2: #9aa8bd; --text-3: #9aa8bd; --label: #b8c4d6;
    --accent: #6b97ff; --accent-hover: #8fb0ff; --accent-soft: #1d2c4d; --on-accent: #0b1220;
    --nav: #0a1220; --nav-ink: #9fb0c8; --nav-active: #1c2a42;
    --ok: #4cc38a; --ok-soft: #12301f; --warn: #e0b25a; --warn-soft: #33280f; --bad: #ff8a7a; --bad-soft: #3a1a17;
    --muted-soft: #1a2840; --focus: #8fb0ff; --disabled: #1a2638;
    --shadow: none; --shadow-pop: 0 12px 35px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1626; --surface: #142035; --surface-2: #172438; --surface-3: #1a2840;
  --border: #26354d; --border-strong: #3a4d69;
  --text: #e6ecf5; --text-2: #9aa8bd; --text-3: #9aa8bd; --label: #b8c4d6;
  --accent: #6b97ff; --accent-hover: #8fb0ff; --accent-soft: #1d2c4d; --on-accent: #0b1220;
  --nav: #0a1220; --nav-ink: #9fb0c8; --nav-active: #1c2a42;
  --ok: #4cc38a; --ok-soft: #12301f; --warn: #e0b25a; --warn-soft: #33280f; --bad: #ff8a7a; --bad-soft: #3a1a17;
  --muted-soft: #1a2840; --focus: #8fb0ff; --disabled: #1a2638;
  --shadow: none; --shadow-pop: 0 12px 35px rgba(0,0,0,.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
:where(button, a, input, select, textarea, [role="button"]):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
a { color: inherit; }
.muted { color: var(--text-2); margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
svg { width: 18px; height: 18px; fill: currentColor; flex: none; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 20px; letter-spacing: -.3px; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid currentColor; border-radius: 10px; font-size: 13px; font-weight: 800; letter-spacing: -.5px; opacity: .9; }
.brand-mark::after { content: "SD"; }
.brand-lg { font-size: 24px; }
.brand-lg .brand-mark { width: 40px; height: 40px; border-radius: 11px; font-size: 14px; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--bg); }
.login-brand { display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 40px 48px; background: var(--nav); color: var(--nav-ink); }
.login-brand .brand { color: var(--nav-strong); }
.login-overline { margin: 0 0 14px; font-size: 11px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: var(--nav-indicator); }
.login-headline { margin: 0; font-size: 40px; line-height: 1.12; letter-spacing: -1.2px; font-weight: 750; color: var(--nav-strong); text-wrap: balance; }
.login-lead { margin: 16px 0 0; max-width: 380px; font-size: 14px; line-height: 1.6; }
.login-foot { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.login-main { display: grid; place-items: center; padding: 32px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 18px; }
.login-card h1 { font-size: 27px; font-weight: 650; letter-spacing: -.7px; }
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-brand { padding: 24px 20px; gap: 18px; }
  .login-headline { font-size: 26px; }
  .login-lead, .login-foot { display: none; }
  .login-main { place-items: start center; }
}

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100%; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 28px 16px 20px; background: var(--nav); color: var(--nav-ink); }
.sidebar > .brand { padding: 0 10px; color: var(--nav-strong); }
.nav { display: grid; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--nav-ink); font-weight: 500; font-size: 13px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--nav-active); color: var(--nav-strong); }
.nav a.active { background: var(--nav-active); color: var(--nav-strong); box-shadow: inset 3px 0 var(--nav-indicator); }
.nav a.active svg { color: var(--nav-indicator); }
.sidebar-foot { margin-top: auto; display: grid; gap: 12px; padding: 0 4px; }
.foot-actions { display: flex; justify-content: space-between; align-items: center; }
.sidebar .icon-btn { background: var(--nav-active); border-color: transparent; color: var(--nav-ink); }
.sidebar .icon-btn:hover { color: var(--nav-strong); }
.sidebar .btn-ghost { color: var(--nav-ink); }
.sidebar .btn-ghost:hover { background: var(--nav-active); color: var(--nav-strong); }
.sync { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--nav-ink); padding: 8px 10px; border-radius: var(--radius-sm); background: var(--nav-active); }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--nav-ink); flex: none; }
.sync.ok .dot { background: #4cc38a; }
.sync.bad .dot { background: #ff8a7a; }

.main { min-width: 0; padding: 28px 32px 48px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.topbar h1 { font-size: 27px; font-weight: 650; letter-spacing: -.7px; line-height: 1.25; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.view { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.view > * { min-width: 0; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px; display: grid; gap: 10px; position: relative; overflow: hidden; }
.kpi-label { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kpi-value { font-size: 27px; font-weight: 650; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 15px; color: var(--text-3); font-weight: 500; }
.kpi-foot { font-size: 12px; color: var(--text-3); display: flex; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.ring { width: 56px; height: 56px; position: absolute; right: 18px; top: 18px; }
.ring circle { fill: none; stroke-width: 6; }
.ring .track { stroke: var(--surface-3); }
.ring .bar { stroke: var(--ok); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray .6s; }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 8px 20px 0; }
.bars .b { flex: 1; background: var(--accent); border-radius: 3px 3px 1px 1px; min-height: 2px; opacity: .85; position: relative; }
.bars .b:hover { opacity: 1; }
.bars .b[data-zero] { background: var(--surface-3); }
.bars-axis { display: flex; justify-content: space-between; padding: 6px 20px 16px; font-size: 11px; color: var(--text-3); }

/* ---------- badges, dots ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--muted-soft); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.online { background: var(--ok-soft); color: var(--ok); }
.badge.no_network { background: var(--warn-soft); color: var(--warn); }
.badge.offline { background: var(--bad-soft); color: var(--bad); }
.badge.disabled { background: var(--muted-soft); color: var(--text-3); }
.badge.src { background: var(--accent-soft); color: var(--accent); }
.signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; vertical-align: middle; }
.signal i { width: 4px; border-radius: 1px; background: var(--surface-3); }
.signal i:nth-child(1) { height: 25%; } .signal i:nth-child(2) { height: 50%; }
.signal i:nth-child(3) { height: 75%; } .signal i:nth-child(4) { height: 100%; }
.signal.s1 i:nth-child(-n+1), .signal.s2 i:nth-child(-n+2), .signal.s3 i:nth-child(-n+3), .signal.s4 i { background: var(--ok); }
.signal.s1 i:nth-child(-n+1) { background: var(--warn); }
.code-chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-weight: 700; font-size: 14px; letter-spacing: .08em; padding: 4px 10px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); border: 1px dashed var(--accent); cursor: pointer; }
.code-chip:hover { border-style: solid; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--text-2); background: var(--surface-3); padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--accent-soft); }
tbody tr.clickable { cursor: pointer; }
.cell-main { font-weight: 600; white-space: nowrap; }
.cell-line { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
a.btn { text-decoration: none; }
.cell-sub { font-size: 12px; color: var(--text-3); }
.empty { padding: 48px 20px; text-align: center; color: var(--text-3); display: grid; gap: 8px; justify-items: center; }
.empty svg { width: 36px; height: 36px; opacity: .5; }

/* ---------- toolbar / inputs ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); padding: 7px 12px; border-radius: 999px; font: inherit; font-size: 13px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.chip b { font-variant-numeric: tabular-nums; color: var(--text-3); font-weight: 600; }
.chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.input, select.input, textarea.input { font: inherit; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 11px; min-height: 39px; outline: none; transition: border-color .15s; min-width: 0; }
.input:focus { border-color: var(--accent); }
.search { position: relative; flex: 1 1 240px; max-width: 360px; }
.search .input { width: 100%; padding-left: 36px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; color: var(--label); font-weight: 600; }
.field .input { width: 100%; }
.field small { color: var(--text-3); font-size: 12px; }
.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-error { color: var(--bad); margin: 0; min-height: 1em; font-size: 13px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform .15s; }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }

/* ---------- buttons ---------- */
.btn { font: inherit; font-size: 13px; font-weight: 600; border-radius: var(--radius-sm); padding: 9px 15px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .05s, background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:disabled { background: var(--disabled); border-color: var(--border); color: var(--text-2); opacity: 1; cursor: not-allowed; }
.btn-danger { color: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; padding: 11px 16px; }
.icon-btn { width: 34px; height: 34px; border-radius: var(--radius-sm); display: inline-grid; place-items: center; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; }
.icon-btn:hover { color: var(--text); background: var(--surface-3); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- SMS feed ---------- */
.feed { display: grid; }
.msg { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); align-items: start; }
.msg:last-child { border-bottom: 0; }
.avatar { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface-3); color: var(--text-2); }
.msg-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.msg-from { font-weight: 600; }
.msg-meta { font-size: 12px; color: var(--text-3); }
.msg-text { margin-top: 4px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.msg-side { display: grid; justify-items: end; gap: 8px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 13px; }

/* ---------- modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,18,32,.55); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s; }
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-pop); animation: pop .18s ease-out; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 20px; display: grid; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; }
.secret { font-family: var(--mono); font-size: 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-3); border: 1px dashed var(--border-strong); display: flex; justify-content: space-between; align-items: center; gap: 10px; word-break: break-all; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--text); font-size: 13px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 60; }
.toast { background: var(--surface); border: 1px solid var(--border-strong); border-left: 3px solid var(--ok); border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow-pop); max-width: 340px; animation: pop .18s ease-out; color: var(--text); }
.toast.err { border-left-color: var(--bad); }
.ledger { display: grid; gap: 2px; max-height: 320px; overflow: auto; }
.ledger-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ledger-row:last-child { border-bottom: 0; }
.plus { color: var(--ok); font-weight: 700; } .minus { color: var(--bad); font-weight: 700; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ---------- client cabinet ---------- */
.cabinet { min-height: 100%; }
.flag { font-size: 16px; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.chip-lg { padding: 8px 14px; font-weight: 600; }
.demo-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .04em; background: var(--warn-soft); color: var(--warn); }
.cab-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 24px; padding: 12px 32px; border-bottom: 1px solid var(--border); background: var(--surface); }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a { text-decoration: none; color: var(--text-2); font-weight: 600; padding: 8px 14px; border-radius: 10px; }
.tabs a:hover { background: var(--surface-3); color: var(--text); }
.tabs a.active { background: var(--accent-soft); color: var(--text); }
.cab-user { display: flex; align-items: center; gap: 8px; }
.balance { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 700; }
.balance-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--warn); box-shadow: inset 0 0 0 3px var(--warn-soft); }
.cab-main { max-width: 1120px; margin: 0 auto; padding: 28px 32px 64px; display: grid; gap: 20px; }
.cab-hello h1 { font-size: 26px; }
.take { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; overflow: hidden; }
.take-info { padding: 24px; display: grid; gap: 16px; align-content: start; background: var(--surface-3); border-right: 1px solid var(--border); }
.take-info h2 { font-size: 20px; }
.take-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat span { font-size: 12px; color: var(--text-3); }
.take-form { padding: 24px; display: grid; gap: 14px; align-content: start; }
.qty { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qty .input { width: 110px; font-size: 18px; font-weight: 700; text-align: center; }
.cost { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.cost b { font-size: 18px; font-variant-numeric: tabular-nums; }
.banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--warn-soft); background: var(--warn-soft); }
.banner svg { color: var(--warn); }
.banner-text { flex: 1; }
.banner .btn svg { color: inherit; }
.banner-ok { border-color: var(--ok-soft); background: var(--ok-soft); }
.banner-ok > svg { color: var(--ok); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--text-2); }
@media (max-width: 520px) { .banner { flex-wrap: wrap; } }
.sel-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.countdown { font-variant-numeric: tabular-nums; }
.countdown.soon { color: var(--warn); font-weight: 600; }
.code-big { font-family: var(--mono); font-size: 22px; font-weight: 800; letter-spacing: .12em; }
.code-card { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.code-card:last-child { border-bottom: 0; }
.code-card .msg-text { font-size: 13px; }
.tg { font-size: 12px; }
.fresh { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } }
@media (max-width: 820px) {
  .cab-top { padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
  .cab-top .brand span:last-child { display: none; }
  .tabs { order: 3; flex-basis: 100%; }
  .tabs a { flex: 1; text-align: center; }
  .cab-main { padding: 20px 16px 48px; }
  .take { grid-template-columns: 1fr; }
  .take-info { border-right: 0; border-bottom: 1px solid var(--border); }
  .code-card { grid-template-columns: 1fr auto; }
  .code-card .code-meta { grid-column: 1 / -1; order: 3; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .hide-md { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; flex-direction: row; padding: 8px 10px; z-index: 40; border-right: 0; border-top: 0; background: var(--nav); }
  .sidebar > .brand, .sidebar-foot .sync { display: none; }
  .nav { grid-auto-flow: column; grid-auto-columns: 1fr; flex: 1; }
  .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; }
  .sidebar-foot { margin: 0; display: none; }
  .main { padding: 20px 16px 96px; }
  .topbar h1 { font-size: 22px; }
  .mobile-only { display: inline-flex !important; }
  .hide-sm { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .msg { grid-template-columns: 1fr; }
  .msg .avatar { display: none; }
  .msg-side { justify-items: start; grid-auto-flow: column; justify-content: start; }
  .toolbar > * { min-width: 0; max-width: 100%; }
  .search { flex-basis: 100%; max-width: none; }
  .toolbar select.input { flex: 1 1 100%; }
  .chips { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; } .kpi-value { font-size: 24px; } .ring { width: 40px; height: 40px; right: 12px; top: 12px; }
}
.mobile-only { display: none; }
