/* Kadabox Lab — the owners' console. Dark first, light from the system; the
   brand's indigo → violet, quiet panels, data in one violet. */
:root {
  /* Colours from the kit (/kit/kit.css, written from kit/tokens.json): the ink scale for the panels, the brand for the rest. */
  color-scheme: dark;
  --bg: var(--kb-ink-950); --side: var(--kb-ink-900); --panel: var(--kb-ink-850); --panel2: var(--kb-ink-800); --hover: var(--kb-ink-750);
  --line: rgba(255, 255, 255, .07); --line2: rgba(255, 255, 255, .12);
  --fg: var(--kb-ink-50); --dim: var(--kb-ink-300); --faint: var(--kb-ink-500);
  --acc: var(--kb-iris-400); --acc-soft: color-mix(in srgb, var(--kb-iris-400) 16%, transparent); --acc-ink: #fff;
  --grad: var(--kb-grad);
  --good: #3ccf8e; --good-soft: rgba(60, 207, 142, .14);
  --warn: #ffb74d; --warn-soft: rgba(255, 183, 77, .14);
  --bad: #ff6b7d; --bad-soft: rgba(255, 107, 125, .14);
  /* charts: one series hue, validated for this surface (dataviz: violet, dark step) */
  --s1: #9085e9; --s1-hover: #a99ff0; --grid: rgba(255, 255, 255, .06); --axis: var(--kb-ink-500);
  --r: 14px; --shadow: 0 18px 50px -24px rgba(0, 0, 0, .7);
  --ease: var(--kb-enter);
  font-family: var(--kb-font);
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: var(--kb-ink-50); --side: var(--kb-ink-0); --panel: var(--kb-ink-0); --panel2: var(--kb-ink-50); --hover: var(--kb-ink-100);
    --line: rgba(11, 12, 16, .08); --line2: rgba(11, 12, 16, .14);
    --fg: var(--kb-ink-950); --dim: var(--kb-ink-500); --faint: var(--kb-ink-400);
    --acc: var(--kb-iris-600); --acc-soft: color-mix(in srgb, var(--kb-iris-600) 10%, transparent);
    --good: #12a150; --good-soft: rgba(18, 161, 80, .1); --warn: #b45309; --warn-soft: rgba(180, 83, 9, .1); --bad: #e5384f; --bad-soft: rgba(229, 56, 79, .08);
    --s1: #6250d6; --s1-hover: #7464e0; --grid: rgba(11, 12, 16, .07); --axis: var(--kb-ink-400);
    --shadow: 0 18px 40px -24px rgba(36, 30, 110, .25);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body { font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot i { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--acc); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }

/* ---------- the frame ---------- */
.lab { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; background: var(--side); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand svg { width: 30px; height: 30px; }
.brand small { display: block; font-size: 11px; font-weight: 600; color: var(--acc); letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; color: var(--dim); font-weight: 550; }
.nav:hover { background: var(--hover); color: var(--fg); text-decoration: none; }
.nav.on { background: var(--acc-soft); color: var(--fg); }
.nav.on svg { color: var(--acc); }
.nav svg { width: 18px; height: 18px; flex: none; }
.navsep { height: 1px; background: var(--line); margin: 8px 10px; }
.sidefoot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--dim); }
.sidefoot b { display: block; color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidefoot button { margin-top: 8px; }
.main { min-width: 0; padding: 26px 32px 60px; }
.topbar { display: none; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.head p { margin: 4px 0 0; color: var(--dim); }
.head .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { color: var(--dim); font-size: 13px; margin-bottom: 6px; }
.page { animation: rise .3s var(--ease) both; }

/* ---------- pieces ---------- */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(12, 1fr); }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }
.card h2 { margin: 0 0 4px; font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card h2 .sp { flex: 1; }
.card .sub { margin: 0 0 14px; color: var(--dim); font-size: 12.5px; }
.tile { display: flex; flex-direction: column; gap: 2px; }
.tile .k { color: var(--dim); font-size: 12.5px; font-weight: 550; }
.tile .v { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .n { font-size: 12.5px; color: var(--faint); }
.tile .n b { color: var(--good); font-weight: 600; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); color: var(--fg); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .15s, transform .12s; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 8px 22px -12px rgba(91, 91, 246, .9); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.wide { width: 100%; height: 44px; font-size: 14.5px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 650; background: var(--panel2); color: var(--dim); white-space: nowrap; }
.pill.acc { background: var(--acc-soft); color: var(--acc); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.muted { color: var(--dim); } .faint { color: var(--faint); } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sp { flex: 1; }
.empty { padding: 26px; text-align: center; color: var(--dim); }
.err { padding: 14px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); }
.note { padding: 12px 14px; border-radius: 10px; background: var(--panel2); color: var(--dim); font-size: 13px; }
.skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--panel2), var(--hover), var(--panel2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin: 8px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 650; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; padding: 0 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .mono { word-break: break-all; }
.tbl tr.link { cursor: pointer; }
.tbl tr.link:hover td { background: var(--hover); }
.tbl .who b { display: block; font-weight: 600; }
.tbl .who span { color: var(--dim); font-size: 12.5px; }
.scroll { overflow-x: auto; }
.av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--grad); flex: none; font-size: 13px; }
.av.big { width: 52px; height: 52px; font-size: 20px; }
.who2 { display: flex; align-items: center; gap: 10px; }

/* fields */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--dim); }
.field small { color: var(--faint); font-size: 12px; }
.input { height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); outline: none; width: 100%; }
textarea.input { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.search { max-width: 360px; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--acc); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 14px; }

/* charts */
.chart { position: relative; }
.chart svg text { fill: var(--axis); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .bar { fill: var(--s1); transition: fill .12s; cursor: default; outline: none; }
.chart .bar:hover, .chart .bar:focus { fill: var(--s1-hover); }
.chart .hit { fill: transparent; }
.tip { position: absolute; pointer-events: none; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 7px 10px; box-shadow: var(--shadow); font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 5; }
.tip b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.tip span { color: var(--dim); }
.chartfoot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; color: var(--faint); }
.chartfoot button { background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 12px; padding: 0; }
.chartfoot button:hover { color: var(--fg); }
.hbar { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; align-items: center; gap: 10px; padding: 6px 0; }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .trk { height: 10px; border-radius: 0 4px 4px 0; background: transparent; }
.hbar .fil { height: 100%; border-radius: 0 4px 4px 0; background: var(--s1); min-width: 2px; }
.hbar .val { font-variant-numeric: tabular-nums; color: var(--fg); font-weight: 600; font-size: 13px; }

/* dialogs and toasts */
.scrim { position: fixed; inset: 0; background: rgba(5, 6, 12, .6); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; z-index: 50; animation: rise .2s both; }
.dlg { width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; box-shadow: var(--shadow); animation: pop .22s var(--ease) both; }
.dlg.wide { width: min(820px, 100%); }
.dlg header { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.dlg header h3 { margin: 0; font-size: 17px; flex: 1; }
.dlg .body { padding: 8px 20px 16px; overflow: auto; }
.dlg footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.dlg .x { background: none; border: 0; color: var(--dim); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.dlg .x:hover { background: var(--hover); }
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; }
.toast { padding: 10px 16px; border-radius: 12px; background: var(--fg); color: var(--bg); font-weight: 600; font-size: 13px; box-shadow: var(--shadow); animation: rise .25s var(--ease) both; }
.toast.bad { background: var(--bad); color: #fff; }

/* sign-in */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, rgba(91, 91, 246, .18), transparent 40%), radial-gradient(circle at 85% 90%, rgba(155, 81, 224, .16), transparent 45%); }
.gatecard { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 22px; padding: 30px; box-shadow: var(--shadow); animation: pop .3s var(--ease) both; }
.gatecard .brand { padding: 0 0 18px; }
.gatecard h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
.gatecard p { margin: 0 0 18px; color: var(--dim); }
.code { letter-spacing: .5em; text-align: center; font-size: 22px; font-weight: 700; height: 52px; }

/* art and design */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel2); margin-bottom: 16px; }
.tab { border: 0; background: none; padding: 7px 14px; border-radius: 9px; cursor: pointer; color: var(--dim); font-weight: 600; }
.tab.on { background: var(--panel); color: var(--fg); box-shadow: 0 1px 0 var(--line2); }
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; }
.crumbs a { color: var(--dim); }
.crumbs a:last-child { color: var(--fg); }
.drop { border: 1.5px dashed var(--line2); border-radius: var(--r); padding: 16px; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--acc); background: var(--acc-soft); }
.assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.asset { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.asset .pv { aspect-ratio: 4 / 3; display: grid; place-items: center; cursor: zoom-in; background: repeating-conic-gradient(var(--panel2) 0 25%, var(--panel) 0 50%) 0 0 / 16px 16px; color: var(--faint); }
.asset .pv img, .asset .pv video { max-width: 100%; max-height: 100%; object-fit: contain; }
.asset .pv svg { width: 36px; height: 36px; }
.asset .meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.asset .meta b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset .meta span { font-size: 11.5px; color: var(--faint); }
.asset .tools { display: flex; gap: 2px; padding: 0 6px 6px; }
.asset .tools button { flex: 1; height: 28px; border: 0; background: none; border-radius: 7px; color: var(--dim); cursor: pointer; display: grid; place-items: center; }
.asset .tools button:hover { background: var(--hover); color: var(--fg); }
.asset .tools button.on { color: var(--good); }
.asset .tools svg { width: 16px; height: 16px; }
.folder { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 600; }
.folder:hover { background: var(--hover); }
.folder svg { width: 20px; height: 20px; color: var(--acc); }
.viewer { max-width: 100%; max-height: 70vh; margin: 0 auto; display: block; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.swatch { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; background: var(--panel); }
.swatch i { display: block; height: 64px; }
.swatch div { padding: 8px 10px; font-size: 12.5px; }
.swatch b { display: block; font-weight: 600; }
.swatches.tight { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.swatches.tight .swatch i { height: 40px; }
.tokhead { margin: 22px 0 2px; font-size: 13px; font-weight: 650; letter-spacing: .02em; }
.tokhead:first-child { margin-top: 0; }
.tokSub { margin: 0 0 10px; font-size: 12.5px; }
.scale { display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.scale button { border: 0; height: 72px; padding: 8px 6px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; text-align: left; cursor: pointer; font-size: 11px; }
.scale b { font-size: 12px; } .scale span { font-family: var(--kb-mono); opacity: .8; font-size: 10px; }
.marks { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.markbox { border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.markbox .art { width: 96px; height: 96px; display: grid; place-items: center; }
.markbox .art svg { width: 100%; height: 100%; }
.markbox.darkbg { background: var(--kb-ink-950); } .markbox.lightbg { background: #fff; color: var(--kb-ink-950); }
.type { display: grid; gap: 10px; }
.type div { display: flex; align-items: baseline; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.type small { width: 110px; color: var(--faint); font-size: 12px; flex: none; }

/* phones */
@media (max-width: 900px) {
  .lab { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; width: 260px; left: 0; transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow); }
  .lab.menu .side { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 30; }
  .topbar b { font-size: 15px; }
  .main { padding: 18px 16px 50px; }
  .c3, .c4, .c5, .c6, .c7, .c8 { grid-column: span 12; }
  .c3.half { grid-column: span 6; }
  .tile .v { font-size: 24px; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
