/* Admin portal styles (portal.css) on top of /shared/design.css. Page specific components only. */

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand-primary); animation: spin .8s linear infinite; }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-side {
  background: var(--brand-primary); color: var(--brand-ink); padding: var(--s7); display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-side::after {
  content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%;
  border: 56px solid color-mix(in srgb, var(--brand-ink) 8%, transparent);
}
.login-side .ls-brand { display: flex; align-items: center; gap: var(--s3); font-weight: 650; font-size: var(--fs-md); }
.login-side .ls-brand img { max-height: 40px; max-width: 160px; object-fit: contain; }
.login-side .ls-mark { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand-ink) 16%, transparent); font-weight: 700; }
.login-side h1 { font-size: 34px; line-height: 1.15; max-width: 14ch; font-weight: 650; letter-spacing: -0.02em; }
.login-side p { opacity: .82; max-width: 40ch; margin-top: var(--s3); }
.login-lamps { display: flex; gap: 10px; margin-top: var(--s5); }
.login-lamps span { width: 10px; height: 10px; border-radius: 50%; background: color-mix(in srgb, var(--brand-ink) 30%, transparent); }
.login-lamps span:nth-child(2) { background: var(--brand-accent); }
.login-main { display: grid; place-items: center; padding: var(--s6) var(--s4); position: relative; }
.login-tools { position: fixed; top: var(--s4); right: var(--s4); z-index: 5; }
.login-card { width: min(380px, 100%); }
.login-card h2 { font-size: var(--fs-xl); margin-bottom: var(--s1); }
.login-card .sub { color: var(--ink-2); margin-bottom: var(--s5); }
.login-card .form-error { margin-bottom: var(--s4); }
.login-foot { margin-top: var(--s6); color: var(--ink-3); font-size: var(--fs-xs); }
@media (max-width: 860px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-side { padding: var(--s5) var(--s4); min-height: 0; }
  .login-side h1, .login-side p, .login-lamps { display: none; }
  .login-side::after { display: none; }
}

/* Apply bar */
.apply-bar {
  position: sticky; top: 52px; z-index: 25; display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s6);
  background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--warn-line); font-size: var(--fs-sm);
}
.apply-bar .ab-text { flex: 1; min-width: 0; }
.apply-bar .ab-text b { color: var(--ink); font-weight: 600; margin-right: 6px; }
.apply-bar .ab-text span { color: var(--ink-2); }
.apply-bar.ok { background: var(--ok-soft); color: var(--ok); border-bottom-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.apply-bar .btn-apply { background: #f2b51b; border-color: #e3a40e; color: #2a1d00; font-weight: 600; }
.apply-bar .btn-apply:hover { background: #e9aa0f; }
.apply-bar.licence-bar.danger { background: var(--danger-soft); color: var(--danger); border-bottom-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.apply-bar.licence-bar .ab-text span { display: inline; }
/* Licence page key-value rows (3.9) */
.kv-grid { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; align-items: baseline; }
.kv-grid .kv-row { display: contents; }
.danger-text { color: var(--danger); }
@media (max-width: 860px) {
  .kv-grid { grid-template-columns: 1fr; }
  .apply-bar { top: 57px; padding: 10px var(--s4); }
  .apply-bar .ab-text span { display: none; }
}

/* Mobile head and more sheet */
.mobile-head .brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-primary); color: var(--brand-ink); font-weight: 700; }
.mobile-head img { max-height: 28px; max-width: 110px; object-fit: contain; }
.mobile-head .mh-title { font-weight: 650; flex: 1; min-width: 0; }
.mobile-head .mh-tenant { color: var(--ink-3); font-size: var(--fs-xs); font-weight: 500; display: block; }
.sheet-list { display: grid; gap: 2px; margin: 0 calc(-1 * var(--s2)); }
.sheet-list a, .sheet-list button {
  display: flex; align-items: center; gap: var(--s3); padding: 12px var(--s2); border-radius: 8px; color: var(--ink); text-decoration: none;
  font: 500 var(--fs-md)/1.2 var(--font); background: none; border: 0; text-align: left; cursor: pointer; width: 100%;
}
.sheet-list a:hover, .sheet-list button:hover { background: var(--surface-3); }

/* Admin pages use the whole browser width (v3.8). design.css keeps its 1320 px cap for the web client, which shares it. */
.content { max-width: none; }
@media (min-width: 1600px) { .content { padding-left: var(--s7); padding-right: var(--s7); } }
/* With a drawer docked beside the page the page is narrower, so use less side padding. */
@media (min-width: 1100px) { :root.drawer-docked .content { padding-left: var(--s5); padding-right: var(--s5); } }
/* Top bar: keep the company name readable, and drop the copy button's words when the bar gets narrow. */
.topbar { container-type: inline-size; container-name: topbar; }
.topbar .tb-context { flex: 0 1 auto; }
.topbar .tb-context b { min-width: 48px; }
@container topbar (max-width: 760px) { .topbar .tb-label { display: none; } }

/* Dashboard (pages/dashboard.js): full-width rows stacked in one column. Inside a row, .dash-cols lays the content out in
   columns of at least 280 px that wrap to fewer columns as the window narrows, down to one on a phone. */
.dash-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
.dash-row { min-width: 0; }
.dash-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--s5) var(--s6); align-items: start; }
.dash-cols-sm { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: var(--s4) var(--s6); }
.dash-col { min-width: 0; }
.dash-col[hidden] { display: none; }
.dash-col-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 30px; margin-bottom: var(--s2);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
/* The four headline numbers at the top of the Status row */
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: var(--s3); }
.dash-kpi { padding: var(--s3) var(--s4); display: grid; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.kpi-label { color: var(--ink-2); font-size: var(--fs-sm); display: flex; align-items: center; gap: 8px; }
.kpi-label .icon { color: var(--ink-3); }
.kpi-value { font-size: 34px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 4px; }
.kpi-value small { font-size: var(--fs-md); color: var(--ink-3); font-weight: 500; margin-left: 4px; }
.kpi-note { color: var(--ink-3); font-size: var(--fs-xs); }
.kpi-note.warn { color: var(--warn); }
@media (max-width: 640px) { .kpi-value { font-size: 28px; } .dash-cols { gap: var(--s5); } }
/* Lists that run in several columns on a wide row (firewall checks, applies, events) */
.log-list.log-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); column-gap: var(--s6); }
.log-list.log-cols-wide { grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); }
.log-list.log-cols li { border-top: 0; border-bottom: 1px solid var(--line); align-content: start; }

/* The list row whose drawer is open (lib/crud.js) */
.table tbody tr.row-open td { background: var(--brand-soft); }
.table tbody tr.row-open td:first-child { box-shadow: inset 3px 0 0 var(--brand-primary); }

/* BLF presence panel: the expansion module look */
.blf-panel { background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); padding: var(--s4); border-top: 1px solid var(--line); }
.blf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; }
.blf-key {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  box-shadow: 0 1px 0 var(--line), inset 0 -2px 0 color-mix(in srgb, var(--ink) 4%, transparent);
  color: var(--ink); text-align: left; font: inherit; cursor: pointer; min-width: 0;
}
.blf-key:hover { border-color: var(--line-strong); }
.blf-lamp {
  grid-row: 1 / span 2; width: 12px; height: 12px; border-radius: 50%; background: var(--st-idle);
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, .25);
}
.blf-key[data-state="inuse"] .blf-lamp { background: var(--st-inuse); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-inuse) 22%, transparent), 0 0 10px color-mix(in srgb, var(--st-inuse) 60%, transparent); }
.blf-key[data-state="ringing"] .blf-lamp { background: var(--st-ringing); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-ringing) 25%, transparent), 0 0 10px var(--st-ringing); animation: blink .9s steps(2, start) infinite; }
.blf-key[data-state="unavailable"] .blf-lamp { background: var(--st-unavailable); opacity: .85; }
.blf-key[data-state="dnd"] .blf-lamp { background: var(--st-dnd); }
.blf-key[data-state="unavailable"] { background: color-mix(in srgb, var(--surface) 70%, var(--surface-2)); }
.blf-key[data-state="unavailable"] .blf-name { color: var(--ink-3); }
.blf-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.blf-num { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; }
.blf-state { color: var(--ink-3); font-size: 11px; margin-left: auto; white-space: nowrap; }
.blf-key[data-state="inuse"] .blf-state { color: var(--st-inuse); }
.blf-key[data-state="ringing"] .blf-state { color: var(--warn); }
.blf-key[data-state="dnd"] .blf-state { color: var(--st-dnd); }
.blf-name { font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.legend { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* Health card */
.health-head { display: flex; align-items: center; gap: var(--s3); }
.health-head .h-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); }
.health-head.down .h-icon { background: var(--danger-soft); color: var(--danger); }
.meter-row { display: grid; gap: 6px; }
.meter-row .mr-top { display: flex; justify-content: space-between; font-size: var(--fs-sm); }
.meter-row .mr-top span:last-child { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s3); padding: 10px 0; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.log-list li:first-child { border-top: 0; }
.log-list .ll-icon { grid-row: 1 / span 2; margin-top: 1px; }
.log-list .ll-icon.ok { color: var(--ok); }
.log-list .ll-icon.bad { color: var(--danger); }
.log-list .ll-detail { color: var(--ink-2); word-break: break-word; }
.log-list .ll-meta { color: var(--ink-3); font-size: var(--fs-xs); }

/* Destination picker */
.dest-picker { display: grid; grid-template-columns: minmax(150px, 200px) minmax(0, 1fr); gap: var(--s2); }
.dest-picker .dest-none { display: flex; align-items: center; height: 38px; }
@media (max-width: 520px) { .dest-picker { grid-template-columns: minmax(0, 1fr); } }
.dest-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); max-width: 100%; min-width: 0; }
.dest-badge .icon { color: var(--ink-3); }

/* Sub navigation inside a section */
.subnav { margin-bottom: var(--s4); }

/* Lists with ordering (members, trunks, BLF keys, patterns) */
.order-list { display: grid; gap: 6px; }
.order-row {
  display: flex; align-items: center; gap: var(--s2); padding: 6px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-width: 0;
}
.order-row .or-idx { width: 22px; text-align: center; color: var(--ink-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; flex: none; }
.order-row .or-main { flex: 1; min-width: 0; display: flex; gap: var(--s2); align-items: center; }
.order-row .or-main .input, .order-row .or-main .select { height: 34px; }
.order-row .or-actions { display: flex; gap: 2px; flex: none; }
.order-add { display: flex; gap: var(--s2); margin-top: var(--s2); flex-wrap: wrap; }
.order-add .select { flex: 1; min-width: 160px; }
@media (max-width: 520px) {
  .order-row { flex-wrap: wrap; row-gap: 6px; }
  .order-row .or-actions { margin-left: auto; }
  .order-row .or-main { order: 10; flex-basis: 100%; flex-wrap: wrap; }
}

/* Member picker (checkbox grid) */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 260px; overflow: auto; padding: 2px; }
.member-grid label {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: var(--fs-sm); min-width: 0;
}
.member-grid label:has(input:checked) { border-color: var(--brand-line); background: var(--brand-soft); }
.member-grid input { accent-color: var(--brand-primary); width: 16px; height: 16px; flex: none; }
.member-grid .mg-num { font-weight: 650; font-variant-numeric: tabular-nums; }
.member-grid .mg-name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* IVR keypad */
.ivr-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--s5); align-items: start; }
@media (max-width: 760px) { .ivr-layout { grid-template-columns: minmax(0, 1fr); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key {
  aspect-ratio: 1 / .86; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface);
  display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 8px 6px 9px; cursor: pointer; color: var(--ink);
  font: inherit; position: relative; box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--ink) 5%, transparent); min-width: 0;
}
.key:hover { border-color: var(--ink-3); }
.key .k-digit { font-size: 28px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; align-self: end; }
.key .k-dest { font-size: 11px; line-height: 1.25; color: var(--ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.key.used { background: var(--brand-soft); border-color: var(--brand-line); }
.key.used .k-dest { color: var(--brand-text); font-weight: 550; }
.key[aria-pressed="true"] { border-color: var(--brand-primary); box-shadow: 0 0 0 2px var(--brand-primary); }
.key-editor { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); background: var(--surface-2); display: grid; gap: var(--s3); }
.key-editor h3 { display: flex; align-items: center; gap: var(--s2); }
.key-editor .ke-digit { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--brand-primary); color: var(--brand-ink); font-weight: 700; font-size: 18px; }
.key-summary { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: var(--fs-sm); }
.key-summary li { display: flex; gap: var(--s2); align-items: center; }
.key-summary .kd { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-3); font-weight: 650; font-size: 12px; flex: none; }

/* Time conditions */
.tc-status { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; padding: var(--s4); border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.big-pill { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 20px; border-radius: 999px; font-size: 18px; font-weight: 650; }
.big-pill .dot { width: 12px; height: 12px; }
.big-pill.open { background: var(--ok-soft); color: var(--ok); }
.big-pill.open .dot { background: var(--ok); }
.big-pill.closed { background: var(--danger-soft); color: var(--danger); }
.big-pill.closed .dot { background: var(--danger); }
.big-pill.holiday { background: color-mix(in srgb, var(--st-dnd) 14%, var(--surface)); color: var(--st-dnd); }
.big-pill.holiday .dot { background: var(--st-dnd); }
.tc-status .tc-note { color: var(--ink-3); font-size: var(--fs-xs); flex-basis: 100%; }
.week { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 6px 10px; align-items: center; }
.week .wd { font-size: var(--fs-sm); color: var(--ink-2); font-weight: 550; }
.week .track { position: relative; height: 22px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.week .track .seg-open { position: absolute; top: 0; bottom: 0; background: var(--brand-primary); opacity: .85; border-radius: 4px; }
.week .track .seg-open span { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); color: var(--brand-ink); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.week .track::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(to right, color-mix(in srgb, var(--ink) 12%, transparent) 1px, transparent 1px); background-size: calc(100% / 4) 100%; }
.week .ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rule-card { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3); display: grid; gap: var(--s3); background: var(--surface); }
.rule-card .rc-top { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rule-card .rc-time { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.rule-card .rc-time .input { width: 130px; }
.day-chip { min-width: 46px; justify-content: center; }
.holiday-row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.holiday-row .input[type="date"] { width: 170px; }
.holiday-row .input.h-name { flex: 1; min-width: 160px; }
.holiday-row.past { opacity: .55; }

/* Extensions */
.ext-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.secret { display: flex; gap: var(--s2); align-items: center; }
.secret .input { font-family: var(--font-mono); font-size: 13px; }
.device-list { display: grid; gap: var(--s2); }
.device-card { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s3); align-items: center; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r); }
.device-card .dc-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.device-card .dc-meta { color: var(--ink-3); font-size: var(--fs-xs); }
.qr-box { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: var(--s4); align-items: start; padding: var(--s4); border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.qr-box img { width: 160px; height: 160px; border-radius: 8px; background: #fff; padding: 6px; image-rendering: pixelated; }
@media (max-width: 520px) { .qr-box { grid-template-columns: minmax(0, 1fr); } }
.vendor-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s2); }
.vendor-pick button {
  display: grid; gap: 2px; text-align: left; padding: var(--s3); border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface);
  cursor: pointer; font: inherit; color: var(--ink);
}
.vendor-pick button[aria-pressed="true"] { border-color: var(--brand-primary); box-shadow: 0 0 0 1px var(--brand-primary); background: var(--brand-soft); }
.vendor-pick button b { font-weight: 600; }
.vendor-pick button span { font-size: var(--fs-xs); color: var(--ink-3); }

/* Phone keys */
.keys-list .order-row .key-type { width: 130px; flex: none; }
.keys-list .order-row .key-label { flex: 1; min-width: 90px; }
.keys-list .order-row .key-value { width: 150px; }
@media (max-width: 520px) {
  .keys-list .order-row .key-type { width: 100%; flex: 1 1 100%; }
  .keys-list .order-row .key-value, .keys-list .order-row .key-label { width: auto; flex: 1 1 40%; min-width: 0; }
}

/* Outbound pattern helper */
.pattern-help { font-size: var(--fs-sm); }
.pattern-help table { width: 100%; border-collapse: collapse; margin-top: var(--s2); }
.pattern-help td { padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.pattern-help td:first-child { white-space: nowrap; width: 1%; }

/* Sounds, audio */
.play-btn { width: 32px; height: 32px; border-radius: 50%; padding: 0; }
.play-btn.playing { background: var(--brand-primary); color: var(--brand-ink); border-color: var(--brand-primary); }
.dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--r); padding: var(--s5); text-align: center; color: var(--ink-2); cursor: pointer; display: grid; gap: var(--s2); justify-items: center;
}
.dropzone.over { border-color: var(--brand-primary); background: var(--brand-soft); }

/* Filters bar */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s3); align-items: end; margin-bottom: var(--s4); }
.filters .field > label { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 500; }

/* Tenant switcher */
.tenant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s4); }
.tenant-card { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s3); align-items: center; padding: var(--s4); cursor: pointer; text-align: left; font: inherit; color: var(--ink); }
.tenant-card:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); }
.tenant-card .tc-mark { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 17px; }
.tenant-card .tc-mark img { width: 44px; height: 44px; object-fit: contain; border-radius: 11px; background: #fff; }
.tenant-card .tc-meta { color: var(--ink-3); font-size: var(--fs-sm); }
.tenant-card.current { border-color: var(--brand-primary); }

/* Brand preview */
.brand-preview { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.brand-preview .bp-bar { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); color: #fff; font-weight: 650; }
.brand-preview .bp-bar img { max-height: 28px; max-width: 120px; object-fit: contain; }
.brand-preview .bp-body { padding: var(--s4); display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; background: var(--surface); }
.color-row { display: flex; gap: var(--s2); align-items: center; }
.color-row .input[type="text"] { width: 120px; font-family: var(--font-mono); font-size: 13px; }

/* Settings layout */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s5); align-items: start; }
.settings-nav { display: grid; gap: 2px; position: sticky; top: 72px; }
.settings-nav a { padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; display: flex; gap: 10px; align-items: center; }
.settings-nav a:hover { background: var(--surface-3); color: var(--ink); }
.settings-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-text); }
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .settings-nav a { white-space: nowrap; }
}
.form-card { max-width: 820px; }
.form-card .card-foot { justify-content: flex-end; }

/* Dial codes */
.dc-table td:first-child { width: 1%; white-space: nowrap; }
.dc-code { white-space: nowrap; font: 650 15px/1 var(--font-mono); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); padding: 4px 8px; border-radius: 6px; display: inline-block; }

/* SMS group card */
.group-card .gc-stats { display: flex; gap: var(--s5); font-size: var(--fs-sm); color: var(--ink-2); }
.group-card .gc-stats b { display: block; font-size: var(--fs-lg); color: var(--ink); font-variant-numeric: tabular-nums; }

/* Settings fields that can fall back to the platform value */
.set-label { display: flex; align-items: center; gap: var(--s2); min-height: 28px; }
.set-label label { font-weight: 550; font-size: var(--fs-sm); color: var(--ink); }
.set-tag { font-size: var(--fs-xs); font-weight: 500; }
.set-tag.inherit { color: var(--ink-3); }
.set-tag.own { color: var(--brand-text); }
.set-label .btn-sm { height: 26px; padding: 0 8px; }

/* Editable dial codes */
.dc-input { width: 112px; font: 600 15px/1 var(--font-mono); letter-spacing: .04em; }
.dc-edit .error { display: none; margin-top: 4px; }
.dc-edit.invalid .error { display: block; }
.dc-edit.invalid .input { border-color: var(--danger); }
.dc-edit.changed .input { border-color: var(--brand-primary); background: var(--brand-soft); }
.dc-fail td { vertical-align: top; }
@media (max-width: 860px) { .dc-input { width: 92px; } }
@media print { .dc-input { border: 0; background: none; } .table-tools { display: none; } }

/* Trunk registration */
.reg-cell { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; max-width: 260px; }
.reg-err { color: var(--danger); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 860px) { .reg-cell { align-items: flex-end; text-align: right; max-width: 150px; } }
.trunk-live { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); margin-bottom: var(--s4); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.trunk-live .tl-text { flex: 1; display: grid; gap: 4px; min-width: 0; }
.qr-col { display: grid; gap: var(--s2); justify-items: center; align-content: start; }

/* Reports, Storage card */
.storage-body { padding: 0 var(--s4) var(--s4); display: grid; gap: var(--s4); }
.storage-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.st-stat { display: grid; gap: 2px; min-width: 0; }
.st-stat .st-label { font-size: var(--fs-sm); color: var(--ink-2); }
.st-stat b { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.01em; }
.st-bar { display: flex; height: 10px; border-radius: var(--r-pill); overflow: hidden; background: var(--surface-3); }
.st-bar span { display: block; height: 100%; min-width: 0; }
.seg-rec { background: var(--brand-primary); }
.seg-vm { background: var(--brand-accent); }
.seg-snd { background: var(--info); }
.seg-other { background: var(--line-strong); }
.seg-free { background: var(--surface-3); border: 1px solid var(--line-strong); }
.st-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.st-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.storage-keep { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3); border-top: 1px solid var(--line); padding-top: var(--s4); }
.storage-keep .help { max-width: 52ch; }
@media (max-width: 600px) { .storage-stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .st-stat b { font-size: var(--fs-md); } }

/* Reports pack (pages/reports.js): phone summary line, bars by hour and weekday, heat map */
.table td.only-sm, .table th.only-sm { display: none; }
@media (max-width: 640px) { .table.responsive td.only-sm { display: block; } }
.rp-legend { display: flex; gap: 14px; }
.rp-legend i, .rp-in, .rp-out { display: inline-block; }
.rp-legend i { width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.rp-in { background: var(--brand-primary); }
.rp-out { background: var(--brand-accent); }
.rp-hours { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; height: 220px; align-items: end; }
.rp-col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 0; }
.rp-stack { display: flex; flex-direction: column; flex: none; border-radius: 3px 3px 0 0; overflow: hidden; min-height: 0; }
.rp-stack > i { display: block; flex-basis: 0; min-height: 0; }
.rp-val, .rp-lab { height: 14px; line-height: 14px; font-size: 10px; color: var(--ink-3); text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; flex: none; }
.rp-days { display: grid; gap: 8px; }
.rp-day { display: grid; grid-template-columns: 96px minmax(0, 1fr) 44px; gap: var(--s3); align-items: center; }
.rp-day-l { font-size: var(--fs-sm); color: var(--ink-2); }
.rp-track { display: flex; height: 18px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.rp-track > i { display: block; height: 100%; }
.rp-heat-wrap { overflow-x: auto; }
.rp-heat { display: grid; grid-template-columns: 34px repeat(24, minmax(14px, 1fr)); gap: 2px; min-width: 520px; align-items: center; }
.rp-cell { display: block; aspect-ratio: 1 / 1; border-radius: 3px; min-height: 14px; }
.rp-hl, .rp-dl { font-size: 10px; color: var(--ink-3); text-align: center; white-space: nowrap; }
.rp-dl { text-align: left; font-size: var(--fs-xs); }
@media (max-width: 600px) { .rp-val { display: none; } .rp-day { grid-template-columns: 72px minmax(0, 1fr) 36px; } .rp-hours { height: 180px; } }
/* Step by step help on the Backups page (v3.7.1) */
.howto { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); padding: 10px var(--s4); }
.howto summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: "Show steps"; margin-left: auto; font-weight: 500; font-size: var(--fs-sm); color: var(--brand-primary); }
.howto[open] summary::after { content: "Hide steps"; }
.howto ol { margin: 10px 0 8px; padding-left: 22px; display: grid; gap: 6px; font-size: var(--fs-sm); }
.howto li { overflow-wrap: anywhere; }

