/* Sale Console Control Center — one stylesheet, no build step.
   Card language: warm cream page, deep green hero cards with faint line art,
   white rounded cards, small icon tiles, thin bars, green = good, coral = bad. */

@font-face { font-family: 'MD Nichrome'; src: url('../fonts/MDNichrome-Bold.otf') format('opentype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/inter-regular.woff2') format('woff2'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/inter-bold.woff2') format('woff2'); font-weight: 600 800; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #F3F1EA;
  --bg-2: #ECE9DF;
  --card: #FFFFFF;
  --ink: #16221D;
  --ink-2: #3A4640;
  --muted: #727B76;
  --faint: #A3AAA5;
  --line: #E9E5DA;
  --line-2: #F1EEE6;

  --g-950: #0B1612;
  --g-900: #1F3D33;
  --g-800: #24493C;
  --g-700: #2B5446;
  --g-600: #33664F;
  --g-500: #3E7A5F;
  --g-400: #5E9A7D;
  --g-300: #8DB9A3;
  --g-200: #C4DDCF;
  --g-100: #E3EFE8;
  --g-50:  #F0F6F2;

  --coral: #E0604F;
  --coral-ink: #B8412F;
  --coral-50: #FBECE8;
  --amber: #E3A03A;
  --amber-50: #FBF2E2;
  --sky: #5B9BD0;
  --sky-50: #E7F0F8;
  --plum: #8A5CC2;
  --plum-50: #F1EAF8;
  --purple: #7E05E8;

  --pos: #2F8A5B;
  --neg: var(--coral);

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --shadow: 0 1px 2px rgba(22, 34, 29, .04), 0 8px 24px -12px rgba(22, 34, 29, .12);
  --shadow-lg: 0 2px 6px rgba(22, 34, 29, .05), 0 24px 48px -20px rgba(22, 34, 29, .25);

  --display: 'MD Nichrome', 'Inter', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --sidebar: 248px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
b, strong { font-weight: 700; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.eyebrow.light { color: var(--g-300); }

/* ── icons ── */
i[data-icon] { display: inline-flex; width: 18px; height: 18px; flex: none; }
i[data-icon] svg { width: 100%; height: 100%; }
svg.ic { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── dots ── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok, .dot.live { background: #3FBF7F; }
.dot.live { box-shadow: 0 0 0 0 rgba(63, 191, 127, .5); animation: pulse 2s infinite; }
.dot.bad { background: var(--coral); box-shadow: 0 0 0 0 rgba(224, 96, 79, .5); animation: pulse-bad 1.6s infinite; }
.dot.warn { background: var(--amber); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(63,191,127,.55); } 70% { box-shadow: 0 0 0 7px rgba(63,191,127,0); } 100% { box-shadow: 0 0 0 0 rgba(63,191,127,0); } }
@keyframes pulse-bad { 0% { box-shadow: 0 0 0 0 rgba(224,96,79,.55); } 70% { box-shadow: 0 0 0 7px rgba(224,96,79,0); } 100% { box-shadow: 0 0 0 0 rgba(224,96,79,0); } }

/* ── boot ── */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 50; transition: opacity .35s; }
.boot.out { opacity: 0; pointer-events: none; }
.boot-mark { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, var(--g-900), var(--g-600)); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.86); opacity: .7; } }

/* ── buttons & fields ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-weight: 600; font-size: 13.5px; cursor: pointer;
  transition: transform .15s var(--ease), background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #D8D3C5; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--g-900); border-color: var(--g-900); color: #fff; }
.btn.primary:hover { background: var(--g-800); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--bg-2); }
.btn.danger { color: var(--coral-ink); }
.btn.danger:hover { background: var(--coral-50); border-color: #F2C9C1; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.busy { opacity: .6; pointer-events: none; }
.btn.primary[disabled] { opacity: 1; background: var(--bg-2); border-color: var(--line); color: var(--faint); }
.btn.busy::after { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2); cursor: pointer;
  transition: background .15s, transform .15s;
}
.icon-btn:hover { background: var(--bg-2); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 9px; }
.icon-btn.sm i[data-icon] { width: 15px; height: 15px; }
.icon-btn.spin i { animation: spin .8s linear infinite; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=email], input[type=search], input[type=number], select, textarea {
  height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: #FCFBF8;
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s; min-width: 0; width: 100%;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--g-400); box-shadow: 0 0 0 3px rgba(62, 122, 95, .15); background: #fff; }
.form-error { min-height: 18px; font-size: 12.5px; color: var(--coral-ink); }

/* switch */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #D9D5CA; transition: background .2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--g-500); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(62,122,95,.25); }

/* segmented control */
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); position: relative; }
.seg:empty { display: none; }
.seg button { position: relative; z-index: 1; height: 32px; padding: 0 12px; border: 0; background: transparent; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; transition: color .2s; white-space: nowrap; }
.seg button[aria-selected=true] { color: var(--ink); }
.seg .seg-thumb { position: absolute; top: 3px; bottom: 3px; border-radius: 9px; background: #fff; box-shadow: 0 1px 3px rgba(22,34,29,.12); transition: left .3s var(--ease), width .3s var(--ease); }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.chip.ok { background: var(--g-100); color: #1E6B45; }
.chip.bad { background: var(--coral-50); color: var(--coral-ink); }
.chip.warn { background: var(--amber-50); color: #92600F; }
.chip.info { background: var(--sky-50); color: #2F6597; }
.chip.dark { background: rgba(255,255,255,.08); color: #CFE3D8; }
.chip button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; display: inline-grid; }

/* ── sign in ── */
.signin { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(380px, 1.05fr) 1fr; }
.signin-hero {
  position: relative; overflow: hidden; margin: 16px; border-radius: 28px; padding: 40px; color: #fff;
  background: radial-gradient(120% 90% at 100% 0%, #3A6D58 0%, transparent 55%), linear-gradient(150deg, var(--g-900), var(--g-700));
  display: flex; flex-direction: column; justify-content: space-between; min-height: 560px;
}
.signin-hero h1 { font: 700 64px/1 var(--display); margin: 10px 0 14px; letter-spacing: .01em; }
.signin-hero p { max-width: 420px; color: #CFE1D7; font-size: 15px; }
.signin-hero-foot { display: flex; align-items: center; gap: 10px; color: #B9D3C5; font-size: 13px; }
.lineart { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lineart path { fill: none; stroke: rgba(255,255,255,.09); stroke-width: 1.4; }
.signin-panel { display: grid; place-items: center; padding: 32px 20px; }
.signin-card { width: min(400px, 100%); display: grid; gap: 14px; animation: rise .5s var(--ease) both; }
.signin-card h2 { font: 700 34px/1.05 var(--display); margin: 6px 0 0; letter-spacing: .01em; }
.signin-card p { margin: 0; }
.signin-logo-sm { display: none; }
.link-back { justify-self: start; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; font-weight: 600; font-size: 13px; }
.code-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.code-boxes input { height: 56px; text-align: center; font: 700 24px var(--body); padding: 0; border-radius: 14px; caret-color: var(--g-500); }
.code-boxes.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── shell ── */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 20px;
  padding: 22px 16px 16px; border-right: 1px solid var(--line); background: #F7F5EF;
}
.brand { padding: 4px 8px 6px; }
.brand img { display: block; height: 26px; width: auto; }
.brand-sub { margin-top: 8px; font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.nav { display: grid; gap: 4px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 12px;
  text-decoration: none; color: var(--ink-2); font-weight: 600; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--bg-2); }
.nav a.active { background: var(--g-900); color: #fff; box-shadow: 0 8px 18px -10px rgba(31,61,51,.7); }
.nav a i { opacity: .85; }
.side-foot { margin-top: auto; display: grid; gap: 12px; }
.side-card { position: relative; overflow: hidden; border-radius: 18px; padding: 14px 14px 12px; color: #fff; background: linear-gradient(150deg, var(--g-900), var(--g-700)); }
.side-card-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #CFE1D7; }
.side-card-big { margin-top: 8px; font: 700 28px/1 var(--display); }
.side-card-big small { font: 500 12px var(--body); color: #B9D3C5; }
.side-card-link { display: inline-block; margin-top: 10px; font-size: 12px; color: #B9D3C5; text-decoration: none; }
.side-card-link:hover { color: #fff; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px; }
.me-text { min-width: 0; flex: 1; display: grid; }
.me-text b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .icon-btn { width: 34px; height: 34px; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: 12.5px; color: #fff; background: var(--g-600); letter-spacing: .02em;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

.main { min-width: 0; padding: 0 28px 40px; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 0 -28px 6px; padding: 18px 28px 14px; background: rgba(243, 241, 234, .9);
  backdrop-filter: saturate(1.2) blur(12px); -webkit-backdrop-filter: saturate(1.2) blur(12px);
}
.crumbs { font-size: 12px; color: var(--muted); }
.crumbs span { margin: 0 4px; color: var(--faint); }
.crumbs b { color: var(--ink-2); font-weight: 600; }
.tb-title h1 { margin: 2px 0 0; font: 700 30px/1.05 var(--display); letter-spacing: .01em; }
.tb-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); width: 230px; color: var(--muted); }
.search input { border: 0; background: transparent; height: 38px; padding: 0; box-shadow: none !important; }
.search i { width: 16px; height: 16px; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.live-pill.stale .dot { background: var(--amber); animation: none; }
.live-pill.tick .dot { animation: none; box-shadow: 0 0 0 4px rgba(63,191,127,.25); }
.mobile-only { display: none; }
.mock-banner { margin: 0 0 14px; padding: 8px 14px; border-radius: 12px; background: var(--amber-50); color: #8A5A0F; font-size: 12.5px; font-weight: 600; }

/* tabs */
.tab { display: none; }
.tab.active { display: block; animation: tabIn .45s var(--ease) both; }
@keyframes tabIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── grid & cards ── */
.grid { display: grid; gap: 16px; }
.row { display: grid; gap: 16px; margin-bottom: 16px; }
.row.kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.row.hero { grid-template-columns: minmax(0, 1fr) 340px; }
.row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row.top { align-items: start; }
.row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row.two-one { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row.one-two { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.stack { display: grid; gap: 16px; align-content: start; }
.row > *, .stack > * { min-width: 0; }

.card {
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px 18px 16px; min-width: 0;
  border: 1px solid rgba(233, 229, 218, .7);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; min-height: 28px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.005em; }
.card-head .sub { font-size: 12px; color: var(--muted); font-weight: 500; }
.card-head-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card.pad-0 { padding: 0; }

.tile-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--g-50); color: var(--g-700); flex: none; border: 1px solid var(--g-100); }
.tile-ic i { width: 17px; height: 17px; }
.tile-ic.coral { background: var(--coral-50); color: var(--coral-ink); border-color: #F6D9D3; }
.tile-ic.amber { background: var(--amber-50); color: #9A6614; border-color: #F3E2C2; }
.tile-ic.sky { background: var(--sky-50); color: #2F6597; border-color: #D4E4F2; }
.tile-ic.plum { background: var(--plum-50); color: #6A3EA3; border-color: #E4D8F3; }
.tile-ic.dark { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.08); }

/* KPI tile */
.kpi { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px; overflow: hidden; }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; line-height: 1.2; }
.kpi-value { font: 700 32px/1 var(--display); letter-spacing: .01em; margin-top: 4px; white-space: nowrap; }
.kpi-value small { font: 600 13px var(--body); color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); min-height: 18px; }
.kpi-foot b { color: var(--ink-2); }
.kpi .spark { height: 36px; margin: 2px -2px -4px; }
.kpi.green { color: #fff; background: radial-gradient(130% 120% at 100% 0%, #3C705A 0%, transparent 55%), linear-gradient(150deg, var(--g-900), var(--g-700)); border: 0; }
.kpi.green .kpi-label, .kpi.green .kpi-foot, .kpi.green .kpi-value small { color: #BFD8CA; }
.kpi.green .kpi-foot b { color: #fff; }
.pos { color: var(--pos); font-weight: 700; }
.neg { color: var(--coral-ink); font-weight: 700; }
.kpi.green .pos { color: #8FE0B4; }

.spark { display: block; width: 100%; overflow: visible; }
.spark path.line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark path.area { opacity: .16; }
.spark.draw path.line { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.2s var(--ease) forwards; }
.spark.draw path.area { opacity: 0; animation: fadeArea .8s .5s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadeArea { to { opacity: .16; } }

.bar { height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--g-600); width: 0; transition: width 1s var(--ease); }
.bar.dark { background: rgba(255,255,255,.12); }
.bar.dark > span { background: #8FE0B4; }
.stackbar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--line-2); }
.stackbar > span { display: block; height: 100%; width: 0; transition: width 1s var(--ease); }

/* list rows */
.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--line-2); min-width: 0; }
.li:first-child { border-top: 0; }
.li-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.li-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-end { text-align: right; flex: none; display: grid; gap: 2px; }
.li-end b { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.li-end small { font-size: 11.5px; color: var(--muted); }
.li .bar { margin-top: 6px; }
.rank { width: 22px; font-size: 12px; font-weight: 700; color: var(--faint); text-align: center; flex: none; }
.empty { padding: 26px 8px; text-align: center; color: var(--muted); font-size: 13px; }
.empty i { display: block; margin: 0 auto 8px; width: 26px; height: 26px; color: var(--faint); }

/* donut */
.donut-wrap { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 18px; align-items: center; }
.donut { position: relative; width: 150px; height: 150px; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 18; }
.donut .seg-arc { transition: stroke-dasharray 1.1s var(--ease), stroke-dashoffset 1.1s var(--ease); stroke-linecap: butt; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center b { font: 700 28px/1 var(--display); }
.donut-center small { font-size: 11.5px; color: var(--muted); }
.legend { display: grid; gap: 10px; }
.legend-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; font-size: 13px; }
.legend-row .sw { width: 10px; height: 10px; border-radius: 50%; }
.legend-row .pct { color: var(--muted); font-size: 12px; width: 38px; text-align: right; }
.legend-row b { font-variant-numeric: tabular-nums; text-align: right; }

.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.mini-stats > div { display: grid; gap: 2px; min-width: 0; }
.mini-stats small { font-size: 11.5px; color: var(--muted); }
.mini-stats b { font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-stats.dividers > div + div { border-left: 1px solid var(--line-2); padding-left: 12px; }

/* events trio */
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.trio > div { border-radius: 14px; padding: 12px; background: var(--g-50); border: 1px solid var(--g-100); min-width: 0; }
.trio b { display: block; font: 700 26px/1 var(--display); margin-top: 6px; }
.trio small { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* ── flow panel ── */
.flow-card {
  position: relative; overflow: hidden; border-radius: var(--r-lg); color: #E7F2EC; min-height: 440px;
  background: radial-gradient(80% 70% at 50% 45%, #163329 0%, #0E1F19 55%, #08120E 100%);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
}
.flow-card.compact { min-height: 340px; }
.flow-head { position: relative; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 0; flex-wrap: wrap; }
.flow-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.flow-head .sub { font-size: 12px; color: #9DBDAD; margin-top: 3px; }
.flow-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.flow-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); color: #CFE3D8; cursor: pointer; transition: background .15s, opacity .15s; }
.flow-chip:hover { background: rgba(255,255,255,.1); }
.flow-chip.off { opacity: .4; }
.flow-chip .sw { width: 8px; height: 8px; border-radius: 50%; }
.flow-canvas { position: relative; flex: 1; min-height: 300px; }
.flow-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.flow-foot { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 0 14px 14px; border-radius: 14px; overflow: hidden; background: rgba(255,255,255,.06); }
.flow-foot > div { padding: 10px 12px; background: rgba(10, 22, 18, .72); backdrop-filter: blur(6px); min-width: 0; }
.flow-foot small { display: block; font-size: 11px; color: #8FB0A0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-foot b { font: 700 20px/1.1 var(--display); color: #fff; font-variant-numeric: tabular-nums; }
.flow-foot b.bad { color: #FF9A8A; }
.flow-tip {
  position: fixed; z-index: 60; pointer-events: none; min-width: 180px; max-width: 260px; padding: 10px 12px; border-radius: 12px;
  background: rgba(12, 26, 21, .96); color: #E7F2EC; border: 1px solid rgba(143, 224, 180, .25); font-size: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
.flow-tip b { display: block; font-size: 13px; color: #fff; margin-bottom: 4px; }
.flow-tip div { display: flex; justify-content: space-between; gap: 12px; color: #A9C7B8; }
.flow-tip div span:last-child { color: #E7F2EC; text-align: right; }

/* ── charts ── */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis-label { font-size: 10.5px; fill: var(--faint); }
.chart .hover-line { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.chart-tip { position: absolute; top: 0; pointer-events: none; padding: 8px 10px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 12px; white-space: nowrap; opacity: 0; transition: opacity .12s; transform: translateX(-50%); z-index: 3; }
.chart-tip div { display: flex; align-items: center; gap: 6px; }
.chart-tip .sw { width: 8px; height: 8px; border-radius: 50%; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ── tables ── */
.table-wrap { overflow-x: auto; margin: 0 -18px -16px; padding: 0 18px 8px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
table.t th.sortable { cursor: pointer; }
table.t th.sortable:hover { color: var(--ink); }
table.t th .arr { display: inline-block; width: 10px; color: var(--g-500); }
table.t td { padding: 10px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background .12s; }
table.t tbody tr:hover { background: #FBFAF6; }
table.t .r { text-align: right; font-variant-numeric: tabular-nums; }
table.t .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
table.t .who b { font-weight: 600; }
table.t input[type=text], table.t select { height: 34px; border-radius: 9px; font-size: 13px; }
table.t select { min-width: 110px; }
table.t td.r { white-space: nowrap; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.kind { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.kind.pl { background: var(--plum-50); color: #6A3EA3; }
.kind.app { background: var(--g-100); color: #1E6B45; }
.err-cell.has { color: var(--coral-ink); font-weight: 700; }

/* ── traffic ── */
.ip-card { position: relative; overflow: hidden; color: #fff; border: 0; background: radial-gradient(130% 120% at 100% 0%, #3C705A 0%, transparent 55%), linear-gradient(150deg, var(--g-900), var(--g-700)); }
.ip-card .eyebrow { color: #A9CBB9; }
.ip-big { display: flex; align-items: center; gap: 10px; margin: 8px 0 14px; flex-wrap: wrap; }
.ip-big b { font: 700 34px/1 var(--display); letter-spacing: .02em; word-break: break-all; }
.ip-list { display: flex; gap: 6px; flex-wrap: wrap; }
.copy-btn { border: 0; cursor: pointer; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: rgba(255,255,255,.12); color: #fff; transition: background .15s; }
.copy-btn:hover { background: rgba(255,255,255,.2); }
.copy-btn.light { background: var(--bg-2); color: var(--ink-2); }
.copy-btn i { width: 14px; height: 14px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; font-weight: 700; font-size: 12.5px; }
.status-pill.up { background: var(--g-100); color: #1E6B45; }
.status-pill.down { background: var(--coral-50); color: var(--coral-ink); }
.status-pill.unknown { background: var(--bg-2); color: var(--muted); }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 14px 0; }
.kv small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.kv b { font-size: 15px; font-variant-numeric: tabular-nums; }
.last-error { font-size: 12px; color: var(--coral-ink); background: var(--coral-50); padding: 8px 10px; border-radius: 10px; margin-bottom: 12px; word-break: break-word; }
.ping-result { font-size: 12.5px; margin-left: 4px; }
.agent-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 4px; border-radius: 999px; background: var(--g-50); border: 1px solid var(--g-100); font-weight: 600; font-size: 12.5px; animation: rise .4s var(--ease) both; }
.agent-chip .avatar { width: 26px; height: 26px; font-size: 10.5px; }

/* ── settings ── */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.setting { border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 10px; background: #FDFCF9; transition: border-color .2s, box-shadow .2s; min-width: 0; }
.setting.dirty { border-color: var(--g-300); box-shadow: 0 0 0 3px rgba(62,122,95,.08); }
.setting-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.setting-key { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--ink); }
.setting-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.setting-row { display: flex; gap: 8px; }
.setting-row input { flex: 1; }
.setting-eff { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setting-eff code { font-family: var(--mono); color: var(--ink-2); }
.add-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.add-row input { flex: 1 1 160px; }

/* toasts */
.toasts { position: fixed; z-index: 80; right: 20px; bottom: 20px; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toastIn .35s var(--ease) both; max-width: min(380px, calc(100vw - 32px)); }
.toast.ok i { color: #8FE0B4; }
.toast.err { background: #5A1F17; }
.toast.err i { color: #FFB3A6; }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* placeholder for the ticket designer */
.placeholder { display: grid; place-items: center; min-height: 420px; text-align: center; color: var(--muted); }
.placeholder .boot-mark { margin: 0 auto 14px; width: 38px; height: 38px; }
.skeleton { background: linear-gradient(90deg, var(--line-2), #F8F6F1, var(--line-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.err-box { padding: 18px; border-radius: 16px; background: var(--coral-50); color: var(--coral-ink); font-weight: 600; }

/* entrance stagger */
.enter > * { animation: rise .55s var(--ease) both; }
.enter > *:nth-child(2) { animation-delay: .05s; }
.enter > *:nth-child(3) { animation-delay: .1s; }
.enter > *:nth-child(4) { animation-delay: .15s; }
.enter > *:nth-child(5) { animation-delay: .2s; }
.enter > *:nth-child(6) { animation-delay: .25s; }

/* ── system status ── */
.status-top { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px; font-size: 12.5px; font-weight: 700; text-decoration: none; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); transition: background .2s, color .2s, border-color .2s; white-space: nowrap; }
.status-top.green { background: var(--g-100); border-color: var(--g-200); color: #1E6B45; }
.status-top.green .dot { background: #3FBF7F; animation: pulse 2s infinite; }
.status-top.amber { background: var(--amber-50); border-color: #F1D9AE; color: #8A5A0F; }
.status-top.amber .dot { background: var(--amber); animation: pulse-amber 1.8s infinite; }
.status-top.red { background: var(--coral-50); border-color: #F2C9C1; color: var(--coral-ink); }
.status-top.red .dot { background: var(--coral); animation: pulse-bad 1.2s infinite; }
@keyframes pulse-amber { 0% { box-shadow: 0 0 0 0 rgba(227,160,58,.55); } 70% { box-shadow: 0 0 0 7px rgba(227,160,58,0); } 100% { box-shadow: 0 0 0 0 rgba(227,160,58,0); } }
.nav-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.nav-dot.green { background: #3FBF7F; }
.nav-dot.amber { background: var(--amber); }
.nav-dot.red { background: var(--coral); animation: pulse-bad 1.2s infinite; }

.sys-card { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 20px 22px; color: #fff; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: center; box-shadow: var(--shadow-lg); margin-bottom: 16px;
  background: radial-gradient(120% 140% at 100% 0%, #3C705A 0%, transparent 55%), linear-gradient(150deg, var(--g-900), var(--g-700)); }
.sys-card.amber { background: radial-gradient(120% 140% at 100% 0%, #C98A2B 0%, transparent 60%), linear-gradient(150deg, #5A3D12, #8A5E1C); }
.sys-card.red { background: radial-gradient(120% 140% at 100% 0%, #D4604E 0%, transparent 60%), linear-gradient(150deg, #5A1F17, #8E3426); }
.sys-card.unknown { background: linear-gradient(150deg, #3A4640, #59645E); }
.sys-orb { position: relative; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.12); }
.sys-orb::before, .sys-orb::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); animation: ripple 2.4s infinite; }
.sys-orb::after { animation-delay: 1.2s; }
.sys-orb i { width: 26px; height: 26px; }
@keyframes ripple { from { transform: scale(1); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
.sys-main { min-width: 0; }
.sys-main .eyebrow { color: rgba(255,255,255,.7); }
.sys-main h2 { margin: 4px 0 4px; font: 700 28px/1.1 var(--display); letter-spacing: .01em; }
.sys-main p { margin: 0; color: rgba(255,255,255,.78); font-size: 13px; }
.sys-checks { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sys-check { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); font-size: 12px; font-weight: 600; color: #fff; text-decoration: none; }
.sys-check .dot { width: 7px; height: 7px; }
.sys-check .dot.ok { background: #8FE0B4; }
.sys-check .dot.bad { background: #FF9A8A; animation: none; }
.sys-check .dot.warn { background: #FFD08A; }

.check-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; }
.check-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #3FBF7F; }
.check-card.amber::before { background: var(--amber); }
.check-card.red::before { background: var(--coral); }
.check-card.unknown::before { background: var(--faint); }
.check-big { font: 700 30px/1 var(--display); }
.check-big small { font: 600 13px var(--body); color: var(--muted); margin-left: 3px; }
.check-lines { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.check-lines div { display: flex; justify-content: space-between; gap: 10px; }
.check-lines b { color: var(--ink-2); font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-detail { font-size: 12px; color: var(--coral-ink); background: var(--coral-50); padding: 7px 9px; border-radius: 9px; word-break: break-word; }
.check-card.amber .check-detail { color: #8A5A0F; background: var(--amber-50); }
.row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; height: 56px; align-items: end; }
.strip > span { display: flex; flex-direction: column-reverse; height: 100%; border-radius: 4px; overflow: hidden; background: var(--line-2); cursor: default; transition: transform .15s; transform-origin: bottom; animation: stripIn .5s var(--ease) both; }
.strip > span:hover { transform: scaleY(1.08); }
.strip > span i { display: block; width: 100%; }
@keyframes stripIn { from { transform: scaleY(0); } }
.strip-axis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--faint); }
.strip-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); font-weight: 600; flex-wrap: wrap; }
.strip-legend span { display: inline-flex; align-items: center; gap: 6px; }
.strip-legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.uptime { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.uptime > div { padding: 10px 12px; border-radius: 12px; background: var(--bg); }
.uptime small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.uptime b { font-size: 18px; font-variant-numeric: tabular-nums; }
.kind.health { background: var(--amber-50); color: #8A5A0F; }
table.t td.msg { max-width: 420px; min-width: 220px; white-space: normal; word-break: break-word; font-size: 12.5px; }
table.t tr.new td { animation: rowFlash 1.6s var(--ease); }
@keyframes rowFlash { from { background: #FFF4E0; } }

/* tabbar (mobile) */
.tabbar { display: none; }

/* ── responsive ── */
@media (max-width: 1360px) {
  .row.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search { width: 180px; }
}
@media (max-width: 1180px) {
  .row.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row.hero { grid-template-columns: minmax(0, 1fr); }
  .row.hero > .stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row.two-one, .row.one-two { grid-template-columns: minmax(0, 1fr); }
  .search { display: none; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .main { padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
  .topbar { position: static; flex-wrap: wrap; margin: 0 -16px 6px; padding: 14px 16px 6px; gap: 10px; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .tb-title h1 { font-size: 26px; }
  .tb-actions { width: 100%; justify-content: flex-start; gap: 8px; }
  .tb-actions .seg { order: 9; }
  .status-top { margin-right: auto; }
  .live-pill { height: 36px; }
  .icon-btn { width: 36px; height: 36px; }
  .mobile-only { display: inline-grid; }
  .tabbar {
    position: fixed; z-index: 30; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px; border-radius: 20px;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(14px); box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  }
  .tabbar a { display: grid; justify-items: center; gap: 3px; padding: 7px 0 6px; border-radius: 14px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; transition: background .15s, color .15s; }
  .tabbar a.active { color: var(--g-900); background: var(--g-50); }
  .tabbar a i { width: 20px; height: 20px; }
  .toasts { bottom: calc(92px + env(safe-area-inset-bottom)); right: 16px; left: 16px; justify-items: center; }
  .signin { grid-template-columns: minmax(0, 1fr); }
  .signin-hero { display: none; }
  .signin-logo-sm { display: block; margin-bottom: 18px; }
  .row.three, .row.two { grid-template-columns: minmax(0, 1fr); }
  .row.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sys-card { grid-template-columns: auto minmax(0, 1fr); }
  .sys-checks { grid-column: 1 / -1; justify-content: flex-start; }
  .row.hero > .stack { grid-template-columns: minmax(0, 1fr); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .row.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .row { gap: 12px; margin-bottom: 12px; }
  .kpi { padding: 13px; }
  .kpi-value { font-size: 26px; }
  .kpi .tile-ic { width: 30px; height: 30px; }
  .card { padding: 15px 14px 14px; border-radius: 18px; }
  .table-wrap { margin: 0 -14px -14px; padding: 0 14px 8px; }
  .donut-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .donut-wrap .legend { width: 100%; }
  .flow-card, .flow-card.compact { min-height: 0; }
  .flow-canvas { min-height: 380px; }
  .flow-chip { height: 24px; padding: 0 8px; font-size: 11px; }
  .flow-foot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ip-big b { font-size: 28px; }
  .seg button { padding: 0 10px; }
  #live-text { display: none; }
  .status-top { height: 36px; padding: 0 11px; }
  .row.four { grid-template-columns: minmax(0, 1fr); }
  .sys-main h2 { font-size: 22px; }
  .uptime b { font-size: 15px; }
  .live-pill { padding: 0 13px; }
  .mini-stats b { font-size: 14px; }
  .trio b { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .spark.draw path.line { stroke-dashoffset: 0; }
  .spark.draw path.area { opacity: .16; }
}
