/* Litmux Admin - neutral and plain: white, greys and black; colour only where it means something
   (paid, trial, flagged). Light by default, dark on request. */
:root {
  --page: #f7f7f8; --surface: #ffffff; --raised: #ffffff; --border: #e4e4e7; --border-soft: #f0f0f2;
  --text: #09090b; --text-2: #52525b; --text-3: #a1a1aa;
  --hover: #f4f4f5; --selected: #ececee; --focus: rgba(9, 9, 11, .12);
  --primary: #18181b; --primary-hover: #27272a; --primary-text: #ffffff;
  --green: #15803d; --green-bg: #f0fdf4; --amber: #a16207; --amber-bg: #fefce8;
  --red: #b91c1c; --red-bg: #fef2f2; --blue: #1d4ed8; --blue-bg: #eff6ff; --violet: #6d28d9; --violet-bg: #f5f3ff;
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100;          /* charts: validated, colour-blind safe */
  --shadow-sm: 0 1px 2px rgba(9, 9, 11, .05);
  --shadow: 0 1px 3px rgba(9, 9, 11, .06), 0 1px 2px rgba(9, 9, 11, .04);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --page: #09090b; --surface: #0f0f11; --raised: #18181b; --border: #27272a; --border-soft: #1c1c1f;
  --text: #fafafa; --text-2: #a1a1aa; --text-3: #71717a;
  --hover: #18181b; --selected: #222226; --focus: rgba(250, 250, 250, .14);
  --primary: #fafafa; --primary-hover: #e4e4e7; --primary-text: #09090b;
  --green: #4ade80; --green-bg: rgba(74, 222, 128, .1); --amber: #facc15; --amber-bg: rgba(250, 204, 21, .1);
  --red: #f87171; --red-bg: rgba(248, 113, 113, .1); --blue: #60a5fa; --blue-bg: rgba(96, 165, 250, .1);
  --violet: #a78bfa; --violet-bg: rgba(167, 139, 250, .1);
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
  --shadow-sm: none; --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--page); color: var(--text); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }
.cell-main a:hover b, .feed a:hover, a.lnk:hover { text-decoration: underline; text-underline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
::selection { background: var(--selected); }

/* ---- sign in */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--page); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 32px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.login-brand { display: flex; gap: 10px; align-items: center; }
.login-brand img { width: 28px; height: 28px; border-radius: 7px; }
.login-brand b { font-size: 15px; font-weight: 600; }
.login-brand span { color: var(--text-3); font-size: 14px; }
.login-card h1 { font-size: 20px; font-weight: 600; margin: 8px 0 0; letter-spacing: -.01em; }
.login-card .lead { color: var(--text-2); font-size: 13.5px; margin: -8px 0 4px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.login-card input { height: 38px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; background: var(--surface); }
.login-card input:focus, .input:focus { outline: none; border-color: var(--text-3); box-shadow: 0 0 0 3px var(--focus); }
.err { color: var(--red); min-height: 18px; margin: 0; font-size: 13px; }
.login-foot { color: var(--text-3); font-size: 12px; text-align: center; margin: 0; }

/* ---- shell */
.shell { display: flex; min-height: 100%; }
.side { width: 240px; flex: none; background: var(--surface); border-right: 1px solid var(--border); display: flex;
  flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.brand img { width: 24px; height: 24px; border-radius: 6px; }
.brand b { font-size: 14px; font-weight: 600; }
.brand span { color: var(--text-3); font-size: 14px; }
.side-search { margin: 2px 12px 8px; position: relative; }
.side-search input { width: 100%; height: 32px; border: 1px solid var(--border); border-radius: 7px; background: var(--page);
  padding: 0 40px 0 30px; font-size: 13px; }
.side-search input:focus { outline: none; border-color: var(--text-3); box-shadow: 0 0 0 3px var(--focus); background: var(--surface); }
.side-search svg { position: absolute; left: 10px; top: 9px; width: 14px; height: 14px; stroke: var(--text-3); fill: none;
  stroke-width: 1.8; stroke-linecap: round; }
.side-search kbd { position: absolute; right: 7px; top: 6px; font: 11px/18px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-3); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; background: var(--surface); }
nav { display: flex; flex-direction: column; padding: 0 8px; flex: 1; overflow-y: auto; }
.nav-group { color: var(--text-3); font-size: 11.5px; font-weight: 500; padding: 16px 10px 4px; }
nav a { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 6px; color: var(--text-2);
  font-weight: 500; font-size: 13.5px; }
nav a svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round;
  stroke-linejoin: round; flex: none; }
nav a:hover { background: var(--hover); color: var(--text); }
nav a.on { background: var(--selected); color: var(--text); }
nav a .count { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
nav a .count.alert { color: var(--red); }
.side-foot { padding: 12px; border-top: 1px solid var(--border); }
.who { display: flex; gap: 10px; align-items: center; padding: 2px 4px; }
.who b { display: block; font-size: 13px; font-weight: 600; line-height: 1.3; }
.who span { color: var(--text-3); font-size: 12px; word-break: break-all; line-height: 1.3; }
.badge-round { width: 30px; height: 30px; border-radius: 50%; background: var(--hover); color: var(--text); display: inline-flex;
  align-items: center; justify-content: center; font-weight: 600; font-size: 12px; flex: none; border: 1px solid var(--border); }
.side-actions { display: flex; gap: 6px; margin-top: 10px; }
.side-actions button { flex: 1; height: 28px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
  color: var(--text-2); font-size: 12.5px; cursor: pointer; }
.side-actions button:hover { background: var(--hover); color: var(--text); }
main { flex: 1; min-width: 0; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 28px 36px 8px; flex-wrap: wrap; }
.top h1 { font-size: 22px; margin: 0; font-weight: 600; letter-spacing: -.02em; }
.top .sub { color: var(--text-3); font-size: 13.5px; margin-top: 2px; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page { padding: 16px 36px 48px; max-width: 1480px; }

/* ---- pieces */
.btn { height: 32px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  box-shadow: var(--shadow-sm); color: var(--text); }
.btn:hover { background: var(--hover); }
.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--red); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.wide { width: 100%; height: 38px; justify-content: center; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: none; padding: 0; cursor: pointer; color: var(--text-2); font-weight: 500; }
.link:hover { color: var(--text); }
.input, select.input { height: 32px; border: 1px solid var(--border); border-radius: 7px; padding: 0 10px; background: var(--surface);
  min-width: 0; font-size: 13px; box-shadow: var(--shadow-sm); }
.search { width: 260px; max-width: 100%; }
.seg { display: inline-flex; background: var(--hover); border-radius: 8px; padding: 2px; gap: 2px; border: 1px solid var(--border); }
.seg button { border: none; background: none; height: 26px; padding: 0 10px; cursor: pointer; color: var(--text-2);
  font-weight: 500; font-size: 12.5px; border-radius: 6px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
:root[data-theme="dark"] .seg button.on { background: var(--raised); }

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, 1fr); }
.two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.halves { grid-template-columns: 1fr 1fr; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.w160 { width: 160px; } .w80 { width: 80px; } .w110 { width: 110px; }
table.edit td { padding: 8px 10px; } table.edit .input { width: 100%; }
table.edit td:nth-child(3), table.edit td:nth-child(4) { width: 1%; }
.plan-row { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.plan-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.plan-head .p-name { width: 240px; }
.plan-head .p-del { margin-left: auto; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 12px; margin-top: 12px; }
.apps .field { color: var(--text); font-weight: 400; font-size: 13px; }
textarea.input.area { height: auto; padding: 8px 10px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.field .muted { font-weight: 400; font-size: 12px; }
.ok-text { color: var(--green); }
input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-sm); min-width: 0; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 20px 0; min-height: 36px; }
.card-h h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-h .sub { color: var(--text-3); font-size: 12.5px; }
.card-b { padding: 12px 20px 18px; }
.kpi { padding: 18px 20px; }
.kpi .k { color: var(--text-2); font-size: 13px; font-weight: 500; }
.kpi .v { font-size: 27px; font-weight: 600; letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .d { color: var(--text-3); font-size: 12.5px; margin-top: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.delta { font-weight: 600; font-size: 12px; padding: 0 6px; border-radius: 5px; font-variant-numeric: tabular-nums; line-height: 20px; }
.delta.up { color: var(--green); background: var(--green-bg); }
.delta.down { color: var(--red); background: var(--red-bg); }
.delta.flat { color: var(--text-2); background: var(--hover); }
.warn-text { color: var(--amber); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3); padding: 10px 16px; border-bottom: 1px solid var(--border);
  white-space: nowrap; background: var(--surface); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--hover); }
.table-wrap { overflow-x: auto; border-radius: 10px; }
.cell-main b { display: block; font-weight: 500; }
.cell-main span { color: var(--text-3); font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.empty { color: var(--text-3); padding: 32px; text-align: center; font-size: 13px; }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px; color: var(--text-3); font-size: 13px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500;
  white-space: nowrap; border: 1px solid var(--border); color: var(--text-2); background: var(--surface); line-height: 20px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.pill.plain::before { display: none; }
.pill.green { color: var(--green); background: var(--green-bg); border-color: transparent; }
.pill.green::before { background: var(--green); }
.pill.blue { color: var(--blue); background: var(--blue-bg); border-color: transparent; }
.pill.blue::before { background: var(--blue); }
.pill.amber { color: var(--amber); background: var(--amber-bg); border-color: transparent; }
.pill.amber::before { background: var(--amber); }
.pill.red { color: var(--red); background: var(--red-bg); border-color: transparent; }
.pill.red::before { background: var(--red); }
.pill.violet { color: var(--violet); background: var(--violet-bg); border-color: transparent; }
.pill.violet::before { background: var(--violet); }

.demo-tag { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--hover);
  border: 1px solid var(--border); border-radius: 5px; padding: 0 6px; line-height: 18px; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12.5px; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.switch { display: flex; gap: 12px; align-items: flex-start; }
.switch input { margin-top: 3px; }
.switch b { font-weight: 500; display: block; }
.switch span { color: var(--text-3); font-size: 12.5px; }

/* charts */
.chart { width: 100%; height: 240px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .ax { stroke: var(--border-soft); stroke-width: 1; }
.chart .guide { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart text { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .tip { position: absolute; pointer-events: none; background: var(--raised); color: var(--text); border: 1px solid var(--border);
  font-size: 12px; padding: 8px 10px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -110%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .1); line-height: 1.6; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-2); font-size: 12.5px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: 0; }
.legend i.dash { width: 12px; height: 2px; border-radius: 0; vertical-align: 3px; }
.legend b { color: var(--text); font-weight: 600; margin-left: 4px; font-variant-numeric: tabular-nums; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1.1fr) 2fr 48px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar-track { height: 6px; background: var(--hover); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--c1); border-radius: 99px; width: 0; }

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.feed-item:last-child { border-bottom: none; }
.feed-item .ic { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 7px; background: var(--c3); }
.feed-item .ic.green { background: var(--green); } .feed-item .ic.blue { background: var(--blue); }
.feed-item .ic.amber { background: var(--amber); } .feed-item .ic.red { background: var(--red); }
.feed-item .t { flex: 1; min-width: 0; }
.feed-item .t b { font-weight: 500; }
.feed-item .t span { color: var(--text-3); font-size: 12.5px; }
.feed-item time { color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* drawer */
.drawer { position: fixed; inset: 0; z-index: 20; }
.drawer-back { position: absolute; inset: 0; background: rgba(9, 9, 11, .3); }
.drawer-body { position: absolute; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: var(--page);
  border-left: 1px solid var(--border); overflow-y: auto; padding: 24px 24px 40px; box-shadow: -12px 0 40px rgba(0, 0, 0, .12); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.drawer-head h2 { margin: 0 0 4px; font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.section { margin-top: 16px; }
.form-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.form-row label, .field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 12px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.check:last-child { border-bottom: none; }
.check .dot { margin-top: 7px; flex: none; }
.check b { font-weight: 500; }
.check span { color: var(--text-3); font-size: 12.5px; display: block; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--primary); color: var(--primary-text);
  padding: 9px 14px; border-radius: 8px; font-weight: 500; font-size: 13px; z-index: 30; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.keybox { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--hover); border: 1px solid var(--border);
  padding: 10px 12px; border-radius: 8px; word-break: break-all; -webkit-user-select: all; user-select: all; font-size: 13px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--text-2); }

@media (max-width: 1180px) { .two, .halves { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--border); }
  nav { flex-direction: row; overflow-x: auto; padding: 0 8px 8px; }
  nav a { flex: none; }
  .nav-group, .side-foot, .side-search { display: none; }
  .brand { padding: 12px 16px 8px; }
  .top { padding: 18px 16px 4px; }
  .page { padding: 12px 16px 32px; }
  .form-row { grid-template-columns: 1fr; }
  .search { width: 100%; }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 21px; }
}
