/* ============================================================
   TrafficCore — Cabinet (Network Admin) styles
   Builds on tokens.css. Dense SaaS dashboard vocabulary.
   ============================================================ */

/* ---- semantic status hues (theme-aware) ---- */
:root {
  --ok:    oklch(58% 0.13 152);
  --warn:  oklch(70% 0.14 75);
  --bad:   oklch(58% 0.18 27);
  --info:  oklch(60% 0.13 250);
  --vio:   oklch(58% 0.16 292);
  --ok-soft:   color-mix(in oklch, var(--ok) 14%, transparent);
  --warn-soft: color-mix(in oklch, var(--warn) 16%, transparent);
  --bad-soft:  color-mix(in oklch, var(--bad) 14%, transparent);
  --info-soft: color-mix(in oklch, var(--info) 14%, transparent);
  --vio-soft:  color-mix(in oklch, var(--vio) 14%, transparent);
  --sidebar-w: 264px;
  --rail-w: 72px;
  --topbar-h: 64px;
  --pad: calc(14px + 8px * var(--density, 1));
  --row-h: calc(40px + 8px * var(--density, 1));
}
[data-theme="dark"] {
  --ok:   oklch(72% 0.15 152);
  --warn: oklch(80% 0.14 80);
  --bad:  oklch(70% 0.17 27);
  --info: oklch(72% 0.12 250);
  --vio:  oklch(72% 0.15 292);
}

body { overflow: hidden; font-size: 15px; }
svg.ic { width: 18px; height: 18px; flex: none; }

/* ============ APP SHELL ============ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============ SIDEBAR ============ */
.sb {
  width: var(--sidebar-w); flex: none;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width .28s var(--ease);
}
.app.rail .sb { width: var(--rail-w); }
.sb-head {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}
.sb-brand { display: flex; align-items: center; gap: 11px; font-weight: 680;
  font-size: 17px; letter-spacing: -0.03em; white-space: nowrap; min-width: 0; }
.sb-brand .glyph { width: 26px; height: 26px; flex: none; }
.sb-brand .wl { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); display: block; margin-top: 1px; }
.app.rail .sb-brand .txt { display: none; }

.sb-scroll { flex: 1; overflow-y: auto; padding: 12px 12px 20px; }
.sb-scroll::-webkit-scrollbar { width: 7px; }
.sb-scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 9px; }

.sb-group { margin-top: 16px; }
.sb-group:first-child { margin-top: 4px; }
.sb-glabel { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); padding: 0 12px 7px; }
.app.rail .sb-glabel { opacity: 0; height: 8px; padding: 0; }

.sb-item {
  display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 12px; border-radius: var(--r-md);
  color: var(--ink-2); font-weight: 480; font-size: 14.5px;
  cursor: pointer; white-space: nowrap; position: relative;
  transition: background .14s, color .14s;
}
.sb-item:hover { background: var(--surface-2); color: var(--ink); }
.sb-item .ic { width: 19px; height: 19px; flex: none; }
.sb-item .lbl { min-width: 0; overflow: hidden; }
.app.rail .sb-item .lbl, .app.rail .sb-item .cnt { display: none; }
.app.rail .sb-item { justify-content: center; padding: 0; }
.sb-item .cnt { margin-left: auto; font-size: 12px; font-weight: 600;
  color: var(--ink-3); font-family: var(--font-mono); }
.sb-item.active {
  background: var(--accent-soft); color: var(--accent); font-weight: 560;
}
.sb-item.active .cnt { color: var(--accent); }
.sb-item.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.app.rail .sb-item.active::before { left: -12px; }

.sb-foot { flex: none; border-top: 1px solid var(--line); padding: 12px; }
.sb-user { display: flex; align-items: center; gap: 11px; padding: 7px 8px;
  border-radius: var(--r-md); cursor: pointer; }
.sb-user:hover { background: var(--surface-2); }
.sb-ava { width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--accent), color-mix(in oklch, var(--accent) 50%, var(--vio)));
  color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 13px; }
.sb-uinfo { min-width: 0; }
.app.rail .sb-uinfo, .app.rail .sb-user .chev { display: none; }
.sb-uinfo .nm { font-weight: 560; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-uinfo .rl { font-size: 12px; color: var(--ink-3); }
.sb-user .chev { margin-left: auto; color: var(--ink-3); }

/* ============ MAIN / TOPBAR ============ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 clamp(16px, 2.4vw, 30px);
  border-bottom: 1px solid var(--line);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  z-index: 20;
}
.tb-burger { width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink-2); cursor: pointer; }
.tb-burger:hover { color: var(--ink); border-color: var(--ink-3); }
.tb-title { min-width: 0; }
.tb-title h1 { font-size: 19px; font-weight: 620; letter-spacing: -0.02em; line-height: 1.1; }
.tb-title .crumb { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 9px; flex: none; }

.tb-search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 13px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink-3); width: 230px; cursor: text; }
.tb-search input { border: 0; background: transparent; outline: 0; color: var(--ink);
  font: inherit; font-size: 14px; width: 100%; }
.tb-search .ic { width: 16px; height: 16px; flex: none; }
.tb-search kbd { margin-left: auto; font-family: var(--font-mono); font-size: 11px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--ink-3); }
@media (max-width: 1080px) { .tb-search { width: 44px; padding: 0; justify-content: center; }
  .tb-search input, .tb-search kbd { display: none; } }

.icon-btn { width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink-2); cursor: pointer; position: relative; transition: .14s; }
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn .ic { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--bad); border: 2px solid var(--surface); }

/* ============ CONTENT ============ */
.content { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.content::-webkit-scrollbar { width: 11px; }
.content::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 9px; border: 3px solid var(--bg); }
.view { padding: clamp(18px, 2.4vw, 30px); max-width: 1360px; margin: 0 auto;
  animation: viewIn .34s var(--ease-out) both; }
@keyframes viewIn { from { transform: translateY(7px); } to { transform: none; } }

/* page header inside views */
.ph { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.ph-l { min-width: 0; }
.ph h2 { font-size: 24px; font-weight: 640; letter-spacing: -0.025em; }
.ph .sub { color: var(--ink-2); font-size: 14px; margin-top: 5px; }
.ph-r { margin-left: auto; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ============ BUTTONS (extend landing) ============ */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: var(--r-md); border: 1px solid transparent; font: inherit; font-size: 14px;
  font-weight: 540; cursor: pointer; white-space: nowrap; transition: .15s var(--ease);
  letter-spacing: -0.01em; }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 6px 16px -8px var(--accent-glow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,.14), 0 12px 26px -8px var(--accent-glow); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-sm .ic { width: 15px; height: 15px; }
.btn-icon { width: 34px; padding: 0; justify-content: center; }
.btn-danger { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in oklch, var(--bad) 35%, transparent); }
.btn-danger:hover { background: color-mix(in oklch, var(--bad) 22%, transparent); }

/* small row action icons */
.act { display: inline-flex; gap: 2px; }
.act button { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px;
  border: 0; background: transparent; color: var(--ink-3); cursor: pointer; transition: .13s; }
.act button:hover { background: var(--surface-2); color: var(--ink); }
.act button.dng:hover { background: var(--bad-soft); color: var(--bad); }
.act .ic { width: 16px; height: 16px; }

/* ============ CARDS ============ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); }
.card-h { display: flex; align-items: center; gap: 12px; padding: 15px var(--pad);
  border-bottom: 1px solid var(--line); }
.card-h h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.card-h .sub { font-size: 12.5px; color: var(--ink-3); }
.card-h .r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-b { padding: var(--pad); }
.card-b.flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .g-4 { grid-template-columns: repeat(2, 1fr); } .g-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .g-2, .g-3, .g-4 { grid-template-columns: 1fr; } }
.span-2 { grid-column: span 2; }
@media (max-width: 760px) { .span-2 { grid-column: span 1; } }

/* ============ KPI / STAT CARDS ============ */
.kpi { padding: var(--pad); display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.kpi .top { display: flex; align-items: center; gap: 9px; }
.kpi .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); flex: none; }
.kpi .ico .ic { width: 18px; height: 18px; }
.kpi .lab { font-size: 13px; color: var(--ink-2); font-weight: 480; }
.kpi .num { font-size: 25px; font-weight: 660; letter-spacing: -0.03em; word-spacing: -0.18em;
  font-family: var(--font-mono); font-feature-settings: "tnum" 1; line-height: 1; }
.kpi .delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 560;
  font-family: var(--font-mono); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.kpi .spark { position: absolute; right: 0; bottom: 0; width: 50%; height: 38px; opacity: .5; }

/* ============ BADGES ============ */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: 7px; font-size: 12px; font-weight: 560; letter-spacing: .01em; white-space: nowrap;
  font-family: var(--font-mono); }
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok   { background: var(--ok-soft);   color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad  { background: var(--bad-soft);  color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.vio  { background: var(--vio-soft);  color: var(--vio); }
.badge.mute { background: var(--surface-2); color: var(--ink-3); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 12.5px;
  color: var(--ink-2); font-weight: 480; }
.chip .ic { width: 13px; height: 13px; }
.tag { font-family: var(--font-mono); font-size: 12px; padding: 2px 7px; border-radius: 6px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

/* ============ TABLES ============ */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; font-weight: 560; font-size: 11.5px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-3); padding: 11px var(--pad); white-space: nowrap;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
table.tbl td { padding: 0 var(--pad); height: var(--row-h); border-bottom: 1px solid var(--line);
  color: var(--ink); vertical-align: middle; white-space: nowrap; }
table.tbl tbody tr { transition: background .12s; cursor: default; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl .num { font-family: var(--font-mono); font-feature-settings: "tnum" 1; text-align: right; }
table.tbl th.num { text-align: right; }
.t-strong { font-weight: 560; }
.t-mut { color: var(--ink-3); }
.t-name { display: flex; align-items: center; gap: 10px; }
.t-name .av { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center;
  font-size: 11px; font-weight: 650; color: #fff; font-family: var(--font-mono); }
.t-name .sub { font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.cbx { width: 16px; height: 16px; border-radius: 5px; border: 1.6px solid var(--line-2); background: var(--surface);
  cursor: pointer; appearance: none; flex: none; position: relative; }
.cbx:checked { background: var(--accent); border-color: var(--accent); }
.cbx:checked::after { content: ""; position: absolute; inset: 0; background: no-repeat center/11px
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); }

/* mini bar inside cells (CR / progress) */
.mbar { display: inline-flex; align-items: center; gap: 8px; }
.mbar .track { width: 54px; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.mbar .fill { height: 100%; border-radius: 3px; background: var(--accent); }

/* ============ TOOLBAR / FILTERS ============ */
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 120px; }
.field { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink-2); font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: .14s; }
.field:hover { border-color: var(--ink-3); }
.field .ic { width: 15px; height: 15px; flex: none; color: var(--ink-3); }
.field select, .field input { border: 0; background: transparent; outline: 0; color: var(--ink);
  font: inherit; font-size: 13.5px; cursor: pointer; }
.field.search { flex: 1; min-width: 180px; cursor: text; }
.field.search input { width: 100%; cursor: text; }
.segmented { display: inline-flex; padding: 3px; border-radius: var(--r-md); background: var(--surface-2);
  border: 1px solid var(--line); gap: 2px; }
.segmented button { height: 30px; padding: 0 13px; border: 0; background: transparent; border-radius: 8px;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: .13s; }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button { height: 40px; padding: 0 14px; border: 0; background: transparent; font: inherit; font-size: 14px;
  font-weight: 500; color: var(--ink-2); cursor: pointer; position: relative; border-radius: 8px 8px 0 0; }
.tabs button:hover { color: var(--ink); background: var(--surface); }
.tabs button.on { color: var(--accent); }
.tabs button.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px; }
.tabs button .cnt { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); margin-left: 6px; }

/* pagination */
.pager { display: flex; align-items: center; gap: 12px; padding: 13px var(--pad); border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-3); }
.pager .pages { margin-left: auto; display: flex; gap: 4px; }
.pager .pages button { min-width: 30px; height: 30px; padding: 0 7px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer; }
.pager .pages button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pager .pages button:disabled { opacity: .4; cursor: default; }

/* ============ FORMS ============ */
.frm { display: flex; flex-direction: column; gap: 18px; }
.frm-row { display: grid; gap: 16px; }
.frm-row.c2 { grid-template-columns: 1fr 1fr; }
.frm-row.c3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 680px) { .frm-row.c2, .frm-row.c3 { grid-template-columns: 1fr; } }
.lbl { display: block; font-size: 13px; font-weight: 540; color: var(--ink-2); margin-bottom: 7px; }
.lbl .req { color: var(--bad); }
.lbl .hint { font-weight: 400; color: var(--ink-3); margin-left: 6px; font-size: 12px; }
.inp, .sel, .txa { width: 100%; height: 42px; padding: 0 13px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px;
  outline: 0; transition: border-color .14s, box-shadow .14s; }
.txa { height: auto; padding: 11px 13px; resize: vertical; min-height: 76px; line-height: 1.5; }
.inp:focus, .sel:focus, .txa:focus { border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
.inp.mono { font-family: var(--font-mono); font-size: 13px; letter-spacing: -0.02em; }
.inp::placeholder, .txa::placeholder { color: var(--ink-3); }
.inp-group { display: flex; align-items: center; gap: 8px; }
.inp-pre { padding: 0 12px; height: 42px; display: grid; place-items: center; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-3); font-family: var(--font-mono);
  font-size: 13px; white-space: nowrap; flex: none; }

/* radio cards */
.radio-cards { display: grid; gap: 10px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 680px) { .radio-cards { grid-template-columns: 1fr 1fr; } }
.rc { border: 1.5px solid var(--line-2); border-radius: var(--r-md); padding: 13px; cursor: pointer;
  transition: .14s; background: var(--surface); }
.rc:hover { border-color: var(--ink-3); }
.rc.on { border-color: var(--accent); background: var(--accent-soft); }
.rc .t { font-weight: 580; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.rc .t .dot { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-2); flex: none; }
.rc.on .t .dot { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.rc .d { font-size: 12px; color: var(--ink-3); margin-top: 5px; }

/* toggle switch */
.sw { width: 40px; height: 23px; border-radius: 999px; background: var(--line-2); border: 0; cursor: pointer;
  position: relative; flex: none; transition: background .18s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-1); transition: transform .18s var(--ease); }
.sw.on { background: var(--accent); }
.sw.on::after { transform: translateX(17px); }
.sw-row { display: flex; align-items: center; gap: 11px; }
.sw-row .txt { font-size: 13.5px; }
.sw-row .txt .d { font-size: 12px; color: var(--ink-3); }

/* ============ MODAL / DRAWER ============ */
.scrim { position: fixed; inset: 0; background: rgba(8,12,22,.5); -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px); z-index: 100; opacity: 0; transition: opacity .25s; }
.scrim.show { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 96vw); background: var(--bg);
  border-left: 1px solid var(--line); z-index: 101; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .32s var(--ease-out); box-shadow: var(--shadow-3); }
.drawer.show { transform: translateX(0); }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(.97); opacity: 0;
  width: min(560px, 94vw); max-height: 88vh; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-xl); z-index: 101; display: flex; flex-direction: column; box-shadow: var(--shadow-3);
  transition: transform .26s var(--ease-out), opacity .26s; }
.modal.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.d-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); flex: none; }
.d-head h3 { font-size: 17px; font-weight: 620; }
.d-head .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.d-head .x { margin-left: auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px;
  border: 0; background: transparent; color: var(--ink-3); cursor: pointer; }
.d-head .x:hover { background: var(--surface-2); color: var(--ink); }
.d-body { flex: 1; overflow-y: auto; padding: 22px; }
.d-foot { flex: none; display: flex; align-items: center; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }
.d-foot .sp { flex: 1; }

/* wizard stepper */
.stepper { display: flex; align-items: center; gap: 0; padding: 16px 22px; border-bottom: 1px solid var(--line);
  flex: none; overflow-x: auto; }
.step { display: flex; align-items: center; gap: 9px; color: var(--ink-3); white-space: nowrap; }
.step .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px;
  font-weight: 650; border: 1.5px solid var(--line-2); flex: none; font-family: var(--font-mono); }
.step .nm { font-size: 13px; font-weight: 520; }
.step.on { color: var(--accent); }
.step.on .n { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.step.done { color: var(--ink-2); }
.step.done .n { border-color: var(--ok); background: var(--ok); color: #fff; }
.step-sep { width: 28px; height: 1.5px; background: var(--line-2); margin: 0 10px; flex: none; }
@media (max-width: 680px) { .step .nm { display: none; } .step-sep { width: 14px; margin: 0 6px; } }

/* ============ MACRO / CODE ============ */
.codebox { font-family: var(--font-mono); font-size: 12.5px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 13px 14px; color: var(--ink); line-height: 1.7; word-break: break-all;
  position: relative; }
.codebox .mac { color: var(--accent); }
.codebox .copy { position: absolute; top: 9px; right: 9px; }
.macro-chip { font-family: var(--font-mono); font-size: 12px; padding: 3px 8px; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); cursor: pointer;
  transition: .12s; }
.macro-chip:hover { background: var(--accent); color: var(--accent-ink); }

/* status dot for postback log rows */
.method { font-family: var(--font-mono); font-size: 11px; font-weight: 650; padding: 2px 6px; border-radius: 5px; }
.method.GET { background: var(--info-soft); color: var(--info); }
.method.POST { background: var(--ok-soft); color: var(--ok); }

/* empty / hints */
.hint-box { display: flex; gap: 11px; padding: 13px 15px; border-radius: var(--r-md); background: var(--info-soft);
  border: 1px solid color-mix(in oklch, var(--info) 25%, transparent); color: var(--ink); font-size: 13px; line-height: 1.55; }
.hint-box .ic { width: 18px; height: 18px; color: var(--info); flex: none; margin-top: 1px; }

/* divider */
.hr { height: 1px; background: var(--line); border: 0; margin: 4px 0; }

/* toast */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 9px; align-items: center; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: var(--r-md);
  background: var(--ink); color: var(--bg); font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-2);
  animation: toastIn .3s var(--ease-out) both; }
.toast .ic { width: 17px; height: 17px; color: var(--ok); }
@keyframes toastIn { from { transform: translateY(12px); } to { transform: none; } }

/* offers as cards (variation) */
.offer-cards { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .offer-cards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .offer-cards { grid-template-columns: 1fr; } }
.ocard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px;
  display: flex; flex-direction: column; gap: 13px; transition: .16s; box-shadow: var(--shadow-1); cursor: pointer; }
.ocard:hover { border-color: var(--ink-3); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.ocard .oc-top { display: flex; align-items: flex-start; gap: 11px; }
.ocard .logo { width: 42px; height: 42px; border-radius: 11px; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 16px; font-family: var(--font-mono); }
.ocard .oc-nm { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.ocard .oc-adv { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.ocard .oc-pay { font-family: var(--font-mono); font-weight: 650; font-size: 17px; letter-spacing: -0.02em; white-space: nowrap; }
.ocard .oc-stats { display: flex; gap: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.ocard .oc-stats .s .v { font-family: var(--font-mono); font-weight: 600; font-size: 14px; }
.ocard .oc-stats .s .k { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* compact density toggles handled via --density var */

/* responsive: collapse sidebar to overlay on small screens */
@media (max-width: 860px) {
  .sb { position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w); z-index: 90;
    transform: translateX(-100%); transition: transform .28s var(--ease); }
  .app.rail .sb { width: var(--sidebar-w); }
  .app.mobopen .sb { transform: translateX(0); box-shadow: var(--shadow-3); }
}

/* tweaks mount: bottom-left, doesn't clash with toasts */
#tweaks-root { position: fixed; z-index: 210; }

/* ============ POPOVERS (notifications / user menu) ============ */
.pop { position: fixed; width: 320px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3); z-index: 150; overflow: hidden;
  transform: translateY(-5px); transition: transform .16s var(--ease-out); }
.pop.show { transform: translateY(0); }
.pop-h { display: flex; align-items: center; gap: 9px; padding: 13px 15px; font-weight: 600; font-size: 14px;
  border-bottom: 1px solid var(--line); }
.pop-item { display: flex; align-items: center; gap: 11px; padding: 11px 15px; border-bottom: 1px solid var(--line);
  transition: background .12s; }
.pop-item:hover { background: var(--surface-2); }
.pop-item .ic { width: 17px; height: 17px; color: var(--ink-3); flex: none; }
.pop-item.unread { background: var(--accent-soft); }
.pop-item.unread:hover { background: color-mix(in oklch, var(--accent) 18%, transparent); }
.pi-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: var(--surface-2); color: var(--ink-2); }
.pi-ic .ic { width: 16px; height: 16px; color: inherit; }
.pop-item.unread .pi-ic { background: var(--accent); color: #fff; }
.dot-u { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.pop-f { padding: 10px 12px; }
.pop-f .pop-item { border: 0; padding: 9px 8px; border-radius: 9px; }

/* ============ COLOR PALETTE SWATCHES ============ */
.pal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; }
.pal-sw { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; transition: .14s; }
.pal-sw:hover { border-color: var(--ink-3); background: var(--surface-2); }
.pal-sw.on { border-color: var(--ink-2); background: var(--surface-2); }
.pal-sw .sw-dot { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center;
  box-shadow: 0 2px 6px -1px rgba(0,0,0,.3), inset 0 0 0 1px rgba(255,255,255,.18); }
.pal-sw .sw-dot .ic { width: 15px; height: 15px; color: #fff; stroke-width: 3; }
.pal-sw .sw-nm { font-size: 13px; font-weight: 520; color: var(--ink); }

/* ============ FUNNEL ============ */
.funnel { display: flex; flex-direction: column; gap: 15px; }
.fn-row .fn-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px;
  color: var(--ink-2); margin-bottom: 6px; gap: 10px; }
.fn-row .fn-top span { white-space: nowrap; }
.fn-row .fn-top span:first-child { overflow: hidden; text-overflow: ellipsis; }
.fn-track { height: 9px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.fn-fill { height: 100%; border-radius: 5px; transition: width .8s var(--ease-out); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
