/* ==========================================================================
   Kanye Studio — "Midnight" design system  ·  ks.css  ·  v2
   Navy-black ground, one navy accent, mono tabular numerals.
   Token NAMES match the live site (shell + 11 pages); only values changed.
   Dark is the default; light = [data-theme="light"] on any ancestor.
   Cheap by design: transform/opacity motion only, no filters, no canvas.
   ========================================================================== */

/* ---------- 1. Tokens: dark (default) ---------- */
.ks, .ks[data-theme="dark"] {
  color-scheme: dark;
  /* surfaces */
  --field:    #0B0E14;   /* app ground, navy-black */
  --field-2:  #0F131B;   /* rail, top bar, secondary ground */
  --panel:    #141924;   /* cards, sheets */
  --panel-2:  #19202D;   /* hover on panel, raised rows */
  --sunken:   #080A0F;   /* inputs, wells, code */
  --border:   #222A38;
  --border-2: #2F3949;   /* hover / stronger divider */
  /* text */
  --text:   #E8ECF3;     /* 14.8:1 on panel */
  --text-2: #C5CCD8;     /* 11:1 on panel */
  --muted:  #9CA6B8;     /* 7:1 */
  /* accent — "navy". Names kept as --blue* for drop-in compatibility */
  --blue:        #2A4AAE;  /* fills: primary button, checked controls, mark tile (white text 7.8:1) */
  --blue-ink:    #A9BDFF;  /* accent as text and icons on dark, 9.5:1 */
  --blue-tint:   #141E38;  /* selected row / current nav background */
  --blue-tint-2: #1B284A;  /* hover on tinted, text selection */
  --on-blue:     #FFFFFF;  /* text on a navy fill */
  --blue-hover:  #3354BF;
  --accent-line: #6F8DF0;  /* rules, underlines, focus, selection rings: 5.6:1 so lines stay visible on dark */
  --seg-on: #2F3949; --knob: #E8ECF3; --knob-on: #FFFFFF;
  --accent: var(--blue); --accent-ink: var(--blue-ink);
  --focus: 0 0 0 2px var(--field), 0 0 0 4px var(--accent-line);
  /* status — bg = badge fill, fg = badge text, soft = quiet surface, dot = solid mark */
  --queued-bg:#26282D; --queued-fg:#C1C4CA; --queued-soft:#1B1C20; --queued-dot:#8A8E96;
  --run-bg:#0E3340;    --run-fg:#7FDBEA;    --run-soft:#0B222B;    --run-dot:#2CC4DC;   /* cyan, kept apart from the navy accent */
  --warn-bg:#3A2A0E;   --warn-fg:#FFC56B;   --warn-soft:#241B0C;   --warn-dot:#F0A93A;
  --done-bg:#133A28;   --done-fg:#79E3AE;   --done-soft:#0E2219;   --done-dot:#3DD68C;
  --fail-bg:#45201E;   --fail-fg:#FF9C94;   --fail-soft:#2A1514;   --fail-dot:#F2665E;
  --used-bg:#2A2545;   --used-fg:#C9BCFF;   --used-soft:#1B1830;   --used-dot:#9C88F5;
  /* categorical channel palette (oklch L.74 C.15 / bg L.30 / ink L.87) */
  --c1:#82A8FE;--c1-bg:#1C2C51;--c1-ink:#C0D4FE;
  --c2:#F28E42;--c2-bg:#482304;--c2-ink:#FEC7A2;
  --c3:#5AC576;--c3-bg:#0D371A;--c3-ink:#A4E7B2;
  --c4:#B794FC;--c4-bg:#32254C;--c4-ink:#D9CBFE;
  --c5:#F180B5;--c5-bg:#471D31;--c5-ink:#FFBFDA;
  --c6:#10C4BC;--c6-bg:#003634;--c6-ink:#7FEAE3;
  --c7:#FB817F;--c7-bg:#4B1D1D;--c7-ink:#FEC3C0;
  --c8:#9BB940;--c8-bg:#283302;--c8-ink:#C9DF95;
  --c9:#08BAF8;--c9-bg:#023347;--c9-ink:#A1DEFE;
  --c10:#DD86DA;--c10-bg:#40203F;--c10-ink:#F9BDF6;
  --c11:#D2A408;--c11-bg:#3A2C01;--c11-ink:#F0D186;
  --c12:#A9ABAD;--c12-bg:#282F35;--c12-ink:#CBD6E1;
  /* elevation: 2 levels */
  --sh-1: 0 1px 0 rgba(255,255,255,.035) inset, 0 1px 2px rgba(0,0,0,.45);
  --sh-2: 0 0 0 1px rgba(255,255,255,.04), 0 12px 32px -8px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.35);
  --sh-3: var(--sh-2);
  --scrim: rgba(4,6,12,.68);
  --grid-line: rgba(255,255,255,.035);
  --skel: #1B2230; --skel-hi: rgba(255,255,255,.05);
}

/* ---------- 1b. Tokens: light (re-tuned, not inverted) ---------- */
.ks[data-theme="light"] {
  color-scheme: light;
  --field:#F3F5F9; --field-2:#EAEEF4; --panel:#FFFFFF; --panel-2:#F7F9FC; --sunken:#EEF1F6;
  --border:#DFE4EC; --border-2:#CBD3DF;
  --text:#121826; --text-2:#313948; --muted:#4D5667;
  --blue:#1E3A8A; --blue-ink:#1E3A8A; --blue-tint:#E7ECF8; --blue-tint-2:#D5DEF3; --on-blue:#FFFFFF; --blue-hover:#24449E;
  --accent-line:#1E3A8A;
  --seg-on:#FFFFFF; --knob:#FFFFFF; --knob-on:#FFFFFF;
  --focus: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent-line);
  --queued-bg:#E9EAEC; --queued-fg:#4A4D54; --queued-soft:#F3F4F5; --queued-dot:#8C9098;
  --run-bg:#D5F2F7;    --run-fg:#0B5E6E;    --run-soft:#EAF8FB;    --run-dot:#0E9BB3;
  --warn-bg:#FCEBCB;   --warn-fg:#7A4A00;   --warn-soft:#FEF5E4;   --warn-dot:#D98A0B;
  --done-bg:#D6F1E2;   --done-fg:#0B6638;   --done-soft:#ECF8F1;   --done-dot:#1E9E62;
  --fail-bg:#FADDDA;   --fail-fg:#A3241C;   --fail-soft:#FDF0EE;   --fail-dot:#D9433B;
  --used-bg:#ECE7FD;   --used-fg:#5B3FC4;   --used-soft:#F5F2FE;   --used-dot:#7B61E0;
  --c1:#4E75D2;--c1-bg:#E4EDFF;--c1-ink:#2C488E;
  --c2:#B85F05;--c2-bg:#FFE8D9;--c2-ink:#773A00;
  --c3:#1B9247;--c3-bg:#DBF5DF;--c3-ink:#035D28;
  --c4:#8663C6;--c4-bg:#EFE9FF;--c4-ink:#563B85;
  --c5:#BA4E84;--c5-bg:#FEE5EF;--c5-ink:#7B2B54;
  --c6:#018D87;--c6-bg:#CFF6F3;--c6-ink:#025956;
  --c7:#C34F51;--c7-bg:#FEE6E5;--c7-ink:#822B2E;
  --c8:#6D8602;--c8-bg:#E8F2D4;--c8-ink:#445500;
  --c9:#0285B4;--c9-bg:#D9F1FF;--c9-ink:#045473;
  --c10:#A855A7;--c10-bg:#FCE4FB;--c10-ink:#6E316E;
  --c11:#977502;--c11-bg:#F8ECCF;--c11-ink:#614900;
  --c12:#6F7C89;--c12-bg:#E9EDF2;--c12-ink:#434E5B;
  --sh-1: 0 1px 2px rgba(18,24,38,.06), 0 0 0 1px rgba(18,24,38,.02);
  --sh-2: 0 0 0 1px rgba(18,24,38,.06), 0 12px 32px -10px rgba(18,24,38,.22), 0 2px 6px rgba(18,24,38,.06);
  --scrim: rgba(18,24,38,.38);
  --grid-line: rgba(18,24,38,.05);
  --skel:#E6EAF0; --skel-hi: rgba(255,255,255,.7);
}

/* ---------- 1c. Theme-independent scales ---------- */
.ks {
  --font-display: 'Schibsted Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font: 'Instrument Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  /* type: size / line */
  --t-display: 28px; --t-h1: 22px; --t-h2: 18px; --t-h3: 16px;
  --t-body: 15px; --t-sm: 14px; --t-label: 13px; --t-micro: 12px;
  /* spacing */
  --s-1:4px; --s-2:8px; --s-3:12px; --s-4:16px; --s-5:20px; --s-6:24px; --s-8:32px; --s-10:40px; --s-12:48px; --s-16:64px;
  /* radius: controls 8 · cards 12 · sheets 16 · badges/chips 6 · round only for avatars, dots, switches */
  --r-xs:4px; --r-sm:6px; --r-md:8px; --r-lg:12px; --r-xl:16px; --r-full:999px;
  /* control heights */
  --h-sm:28px; --h-ctl:36px; --h-lg:44px;
  /* motion */
  --dur-1:120ms; --dur-2:160ms; --dur-3:220ms;
  --ease: cubic-bezier(.4,.6,.2,1);      /* = live --ks-ease */
  --ease-out: cubic-bezier(.2,.8,.2,1);
  --ks-ease: var(--ease);
  /* shell */
  --rail: 232px; --rail-collapsed: 64px; --top: 56px;

  background: var(--field);
  color: var(--text);
  font: 400 var(--t-body)/22px var(--font);
  font-feature-settings: "ss01" 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  container-type: inline-size;
  container-name: ks;
}
.ks *, .ks *::before, .ks *::after { box-sizing: border-box; }
.ks :where(h1,h2,h3,h4,p,ul,ol,figure,dl,dd) { margin: 0; }
.ks :where(ul,ol) { padding: 0; list-style: none; }
.ks :where(button,input,select,textarea) { font: inherit; color: inherit; }
.ks :where(a) { color: var(--blue-ink); text-decoration: none; }
.ks :where(a:hover) { text-decoration: underline; text-underline-offset: 3px; }
.ks svg { flex: none; }
.ks ::selection { background: var(--blue-tint-2); color: var(--text); }
.ks :focus-visible, .ks .is-focus { outline: none; box-shadow: var(--focus); }

/* numerals: every number, everywhere */
.ks .num, .ks td.n, .ks .badge .n, .ks .count, .ks time {
  font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1, "lnum" 1;
}
.ks .mono, .ks .stat-v, .ks .kbd, .ks code {
  font-family: var(--mono); font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "tnum" 1, "lnum" 1, "zero" 0;
  letter-spacing: -0.01em;
}
.ks .tnum { font-variant-numeric: tabular-nums lining-nums; }

/* ---------- 2. Type ---------- */
.ks .t-display { font: 600 var(--t-display)/34px var(--font-display); letter-spacing: -0.025em; }
.ks .t-h1 { font: 600 var(--t-h1)/28px var(--font-display); letter-spacing: -0.02em; }
.ks .t-h2 { font: 600 var(--t-h2)/24px var(--font-display); letter-spacing: -0.015em; }
.ks .t-h3 { font: 600 var(--t-h3)/22px var(--font); letter-spacing: -0.01em; }
.ks .t-body { font: 400 var(--t-body)/22px var(--font); }
.ks .t-sm { font: 400 var(--t-sm)/20px var(--font); }
.ks .t-label { font: 500 var(--t-label)/18px var(--font); }
.ks .t-micro { font: 500 var(--t-micro)/16px var(--font); }
.ks .t-over { font: 600 var(--t-micro)/16px var(--font); text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); }
.ks .t-2 { color: var(--text-2); } .ks .t-mut { color: var(--muted); } .ks .t-acc { color: var(--blue-ink); }
.ks .t-ok { color: var(--done-fg); } .ks .t-bad { color: var(--fail-fg); }
.ks .trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ks .pretty { text-wrap: pretty; }
.ks .sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- 3. Layout helpers ---------- */
.ks .hstack { display: flex; align-items: center; gap: var(--s-2); }
.ks .vstack { display: flex; flex-direction: column; gap: var(--s-2); }
.ks .wrap { flex-wrap: wrap; }
.ks .grow { flex: 1 1 auto; min-width: 0; }
.ks .sp { margin-left: auto; }
.ks .grid-auto { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(min(var(--min, 240px), 100%), 1fr)); }
.ks .divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.ks .vr { width: 1px; align-self: stretch; background: var(--border); }

/* ---------- 4. Shell: app, rail, top bar ---------- */
.ks .app { display: flex; flex-wrap: wrap; min-height: 100vh; align-items: stretch; }
.ks .main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.ks .page { padding: var(--s-6) var(--s-8) var(--s-12); display: flex; flex-direction: column; gap: var(--s-6); width: 100%; }
.ks .page.narrow { max-width: 1120px; margin-inline: auto; }

.ks .rail {
  flex: 0 0 var(--rail); width: var(--rail);
  background: var(--field-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-3) var(--s-3) var(--s-3);
}
.ks .rail-brand { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 6px; margin-bottom: var(--s-2); border-radius: var(--r-md); color: var(--text); }
.ks .rail-brand:hover { background: var(--panel); text-decoration: none; }
.ks .rail-brand .wm { font: 600 15px/1 var(--font-display); letter-spacing: -0.02em; white-space: nowrap; }
.ks .rail-brand .wm span { color: var(--muted); font-weight: 500; }
.ks .rail-collapse { margin-left: auto; }
.ks .rail-search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--border); background: var(--sunken); border-radius: var(--r-md); color: var(--muted); font-size: var(--t-sm); margin-bottom: var(--s-3); cursor: pointer; width: 100%; text-align: left; }
.ks .rail-search:hover { border-color: var(--border-2); color: var(--text-2); }
.ks .rail-search .kbd { margin-left: auto; }
.ks .rail-group { display: flex; flex-direction: column; gap: 1px; padding: var(--s-2) 0; }
.ks .rail-group + .rail-group { border-top: 1px solid var(--border); }
.ks .rail-h { font: 600 var(--t-micro)/16px var(--font); color: var(--muted); padding: 4px 10px 6px; letter-spacing: .05em; text-transform: uppercase; }
.ks a.rtool {
  position: relative; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px;
  border-radius: var(--r-md); color: var(--text-2); font: 500 var(--t-sm)/1 var(--font); text-decoration: none;
}
.ks a.rtool svg { width: 18px; height: 18px; color: var(--muted); transition: color var(--dur-1) var(--ease); }
.ks a.rtool:hover, .ks a.rtool.is-hover { background: var(--panel); color: var(--text); }
.ks a.rtool:hover svg { color: var(--text-2); }
.ks a.rtool[aria-current="page"] { background: var(--blue-tint); color: var(--text); font-weight: 600; }
.ks a.rtool[aria-current="page"] svg { color: var(--blue-ink); }
.ks a.rtool[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-line); }
.ks a.rtool .lock { margin-left: auto; width: 14px; height: 14px; color: var(--muted); }
.ks a.rtool .count { margin-left: auto; font-size: 11px; color: var(--muted); }
.ks .rail-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: var(--s-3); display: flex; align-items: center; gap: 10px; }
.ks .rail-foot .who { min-width: 0; flex: 1; line-height: 16px; }
.ks .rail-foot .who b { display: block; font: 500 var(--t-sm)/18px var(--font); color: var(--text); }
.ks .rail-foot .who small { font-size: var(--t-micro); color: var(--muted); }
.ks .rail .rail-mtoggle { display: none; }
/* collapsed rail: icons only */
.ks .rail.collapsed { flex-basis: var(--rail-collapsed); width: var(--rail-collapsed); padding-inline: 10px; }
.ks .rail.collapsed .wm, .ks .rail.collapsed .rail-h, .ks .rail.collapsed .rtool .lbl, .ks .rail.collapsed .rtool .lock,
.ks .rail.collapsed .rtool .count, .ks .rail.collapsed .who, .ks .rail.collapsed .rail-search span, .ks .rail.collapsed .rail-search .kbd { display: none; }
.ks .rail.collapsed a.rtool, .ks .rail.collapsed .rail-search, .ks .rail.collapsed .rail-brand { justify-content: center; padding: 0; }
.ks .rail.collapsed .rail-collapse { margin: 0 auto; }
.ks .rail.collapsed .rail-top { flex-direction: column; }
.ks .rail.collapsed a.rtool[aria-current="page"]::before { left: -10px; }
.ks .rail.collapsed .rail-foot { flex-direction: column; }

.ks .topbar {
  min-height: var(--top); display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-3) var(--s-4);
  padding: 10px var(--s-8); border-bottom: 1px solid var(--border); background: var(--field);
}
.ks .topbar .crumb { display: flex; flex-direction: column; min-width: 0; flex: 1 1 260px; }
.ks .topbar h1 { font: 600 19px/24px var(--font-display); letter-spacing: -0.015em; }
.ks .topbar p { font-size: var(--t-sm); line-height: 20px; color: var(--text-2); }
.ks .topbar .actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }

/* mobile shell (container ≤ 760px): rail turns into a top bar + drawer */
@container ks (max-width: 760px) {
  .ks .rail { flex: 1 1 100%; width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border); gap: 0; }
  .ks .rail-top { flex: 1; }
  .ks .rail-brand { margin: 0; }
  .ks .rail-collapse { display: none; }
  .ks .rail .rail-mtoggle { display: inline-flex; }
  .ks .rail-search, .ks .rail-group, .ks .rail-foot { display: none; }
  .ks .rail.open .rail-search, .ks .rail.open .rail-group, .ks .rail.open .rail-foot { display: flex; flex-basis: 100%; }
  .ks .rail.open .rail-search { margin: 10px 0 4px; height: 40px; }
  .ks .rail.open a.rtool { height: 44px; font-size: 15px; }
  .ks .rail.open .rail-foot { padding-bottom: 4px; }
  .ks a.rtool[aria-current="page"]::before { display: none; }
  .ks .topbar { padding: 12px 16px; }
  .ks .page { padding: 16px 16px 40px; gap: 20px; }
  .ks .btn, .ks .input, .ks .seg button, .ks .tab, .ks .fpill { min-height: 40px; }
  .ks .btn.icon { width: 40px; }
  .ks .hide-m { display: none !important; }
}
@container ks (min-width: 761px) { .ks .show-m { display: none !important; } }

/* ---------- 5. Buttons ---------- */
.ks .btn {
  --b-bg: var(--panel); --b-fg: var(--text); --b-bd: var(--border-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h-ctl); padding: 0 14px;
  border-radius: var(--r-md); border: 1px solid var(--b-bd); background: var(--b-bg); color: var(--b-fg);
  font: 500 var(--t-sm)/1 var(--font); white-space: nowrap; cursor: pointer; text-decoration: none; user-select: none;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.ks .btn svg { width: 16px; height: 16px; }
.ks .btn:hover, .ks .btn.is-hover { --b-bg: var(--panel-2); --b-bd: var(--muted); text-decoration: none; }
.ks .btn:active, .ks .btn.is-active { transform: translateY(1px); }
.ks .btn.primary { --b-bg: var(--blue); --b-fg: var(--on-blue); --b-bd: transparent; font-weight: 600; }
.ks .btn.primary:hover, .ks .btn.primary.is-hover { --b-bg: var(--blue-hover); }
.ks .btn.quiet { --b-bg: transparent; --b-bd: transparent; --b-fg: var(--text-2); }
.ks .btn.quiet:hover, .ks .btn.quiet.is-hover { --b-bg: var(--panel-2); --b-fg: var(--text); --b-bd: transparent; }
.ks .btn.danger { --b-bg: transparent; --b-fg: var(--fail-fg); --b-bd: color-mix(in oklab, var(--fail-dot) 45%, transparent); }
.ks .btn.danger:hover, .ks .btn.danger.is-hover { --b-bg: var(--fail-soft); --b-bd: var(--fail-dot); }
.ks .btn.danger.solid { --b-bg: var(--fail-dot); --b-fg: #fff; --b-bd: transparent; }
.ks .btn.sm { height: var(--h-sm); padding: 0 10px; font-size: var(--t-label); border-radius: var(--r-sm); gap: 6px; }
.ks .btn.sm svg { width: 14px; height: 14px; }
.ks .btn.lg { height: var(--h-lg); padding: 0 20px; font-size: var(--t-body); border-radius: 10px; }
.ks .btn.icon { width: var(--h-ctl); padding: 0; }
.ks .btn.icon.sm { width: var(--h-sm); }
.ks .btn:disabled, .ks .btn.is-disabled { opacity: .45; cursor: not-allowed; transform: none; }
.ks .btn.is-loading { color: transparent !important; position: relative; pointer-events: none; }
.ks .btn.is-loading::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--b-fg); border-right-color: transparent; animation: ks-spin .7s linear infinite; }
.ks .btn .kbd { margin-left: 2px; }
.ks .btn-group { display: inline-flex; }
.ks .btn-group .btn { border-radius: 0; } .ks .btn-group .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); } .ks .btn-group .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; } .ks .btn-group .btn + .btn { margin-left: -1px; }
.ks .kbd { display: inline-flex; align-items: center; height: 20px; min-width: 20px; padding: 0 5px; border-radius: var(--r-xs); border: 1px solid var(--border-2); background: var(--panel); color: var(--muted); font-size: 11px; line-height: 1; }
.ks .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-2); border-top-color: var(--accent-line); animation: ks-spin .7s linear infinite; display: inline-block; }

/* ---------- 6. Inputs ---------- */
.ks .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ks .field > label, .ks .lbl-t { font: 600 var(--t-label)/18px var(--font); color: var(--text); }
.ks .hint { font-size: var(--t-label); line-height: 18px; color: var(--muted); }
.ks .err { font-size: var(--t-label); line-height: 16px; color: var(--fail-fg); display: flex; gap: 6px; align-items: center; }
.ks .input {
  height: var(--h-ctl); width: 100%; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--border-2);
  background: var(--sunken); color: var(--text); font-size: var(--t-body); outline: none;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease), background-color var(--dur-1) var(--ease);
}
.ks .input::placeholder { color: var(--muted); }
.ks .input:hover, .ks .input.is-hover { border-color: var(--muted); }
.ks .input:focus, .ks .input.is-focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent-line) 22%, transparent); }
.ks .input.is-error { border-color: var(--fail-dot); box-shadow: 0 0 0 3px color-mix(in oklab, var(--fail-dot) 16%, transparent); }
.ks .input:disabled, .ks .input.is-disabled { opacity: .5; cursor: not-allowed; }
.ks .input.sm { height: var(--h-sm); font-size: var(--t-sm); padding: 0 10px; border-radius: var(--r-sm); }
.ks .input.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.ks textarea.input { height: auto; min-height: 96px; padding: 10px 12px; line-height: 20px; resize: vertical; }
.ks .input-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.ks .input-wrap > svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.ks .input-wrap > .input { padding-left: 34px; }
.ks .input-wrap > .suffix { position: absolute; right: 6px; display: flex; gap: 4px; align-items: center; }
.ks .input-wrap > .input.has-suffix { padding-right: 44px; }
.ks .select { position: relative; display: inline-flex; min-width: 0; }
.ks .select select { appearance: none; -webkit-appearance: none; height: var(--h-ctl); width: 100%; padding: 0 34px 0 12px; border-radius: var(--r-md); border: 1px solid var(--border-2); background: var(--sunken); color: var(--text); font-size: var(--t-body); cursor: pointer; outline: none; }
.ks .select select:hover { border-color: var(--muted); }
.ks .select select:focus-visible { border-color: var(--accent-line); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent-line) 22%, transparent); }
.ks .select > svg { position: absolute; right: 10px; top: 50%; margin-top: -8px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.ks .select.sm select { height: var(--h-sm); font-size: var(--t-sm); border-radius: var(--r-sm); }
.ks .select.sm > svg { margin-top: -7px; width: 14px; height: 14px; }
/* menu (dropdown open state) */
.ks .menu { background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--r-lg); box-shadow: var(--sh-2); padding: 4px; min-width: 200px; display: flex; flex-direction: column; gap: 1px; }
.ks .menu button { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2); font-size: var(--t-sm); cursor: pointer; text-align: left; }
.ks .menu button:hover, .ks .menu button.is-hover { background: var(--panel-2); color: var(--text); }
.ks .menu button[aria-selected="true"] { color: var(--text); }
.ks .menu button[aria-selected="true"] .ck { color: var(--blue-ink); }
.ks .menu .ck { margin-left: auto; width: 16px; height: 16px; }
.ks .menu .sep { height: 1px; background: var(--border); margin: 4px -4px; }
.ks .menu .mh { font-size: var(--t-micro); color: var(--muted); padding: 6px 10px 2px; }

/* switch + checkbox */
.ks .switch { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: var(--r-full); background: var(--border-2); position: relative; cursor: pointer; flex: none; margin: 0; transition: background-color var(--dur-2) var(--ease); }
.ks .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--knob); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform var(--dur-2) var(--ease-out); }
.ks .switch:checked { background: var(--blue); }
.ks .switch:checked::after { transform: translateX(14px); background: var(--knob-on); }
.ks .switch:disabled { opacity: .45; cursor: not-allowed; }
.ks .check { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--muted); background: var(--sunken); position: relative; cursor: pointer; margin: 0; flex: none; transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); }
.ks .check:hover { border-color: var(--text-2); }
.ks .check:checked, .ks .check.is-mixed { background: var(--blue); border-color: var(--blue); }
.ks .check:checked::after { content: ""; position: absolute; left: 5px; top: 1.5px; width: 5px; height: 9px; border: solid var(--on-blue); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ks .check.is-mixed::after { content: ""; position: absolute; left: 3px; right: 3px; top: 6.5px; height: 2px; background: var(--on-blue); border-radius: 1px; }
.ks .check:disabled { opacity: .45; cursor: not-allowed; }
.ks .opt { display: inline-flex; align-items: center; gap: 10px; font-size: var(--t-sm); color: var(--text-2); cursor: pointer; min-height: 28px; }

/* ---------- 7. Tabs, segmented, filter pills ---------- */
.ks .tabs { display: flex; gap: var(--s-6); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.ks .tab { position: relative; height: 46px; padding: 0 2px; border: 0; background: none; color: var(--text-2); font: 600 16px/1 var(--font-display); letter-spacing: -0.01em; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.ks .tab:hover, .ks .tab.is-hover { color: var(--text); }
.ks .tab[aria-selected="true"] { color: var(--text); }
.ks .tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--accent-line); border-radius: 2px 2px 0 0; }
.ks .tab .count { font: 500 12px/1 var(--mono); color: var(--text-2); padding: 3px 6px; border-radius: var(--r-xs); background: var(--panel-2); }
.ks .tab[aria-selected="true"] .count { color: var(--text); background: var(--blue-tint-2); }
.ks .tab svg { width: 18px; height: 18px; }
.ks .tab:disabled { opacity: .45; cursor: not-allowed; }
.ks .seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunken); border: 1px solid var(--border); border-radius: var(--r-md); }
.ks .seg button { height: 30px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2); font: 500 var(--t-sm)/1 var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ks .seg button svg { width: 15px; height: 15px; }
.ks .seg button:hover { color: var(--text); }
.ks .seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--text); box-shadow: var(--sh-1); }
.ks .fpills { display: flex; gap: 6px; flex-wrap: wrap; }
.ks .fpill { height: 32px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--border); background: transparent; color: var(--text-2); font: 500 var(--t-sm)/1 var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.ks .fpill:hover, .ks .fpill.is-hover { border-color: var(--border-2); color: var(--text); background: var(--panel); }
.ks .fpill .count { font-size: 12px; color: var(--text-2); }
.ks .fpill[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--field); }
.ks .fpill[aria-pressed="true"] .count { color: color-mix(in oklab, var(--field) 65%, var(--text)); }
.ks .fpill .dot { width: 7px; height: 7px; }

/* ---------- 8. Badges, dots, chips, tags ---------- */
.ks .badge { --bg: var(--queued-bg); --fg: var(--queued-fg); --dt: var(--queued-dot); display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px 0 7px; border-radius: var(--r-sm); background: var(--bg); color: var(--fg); font: 500 var(--t-label)/1 var(--font); white-space: nowrap; }
.ks .badge svg { width: 12px; height: 12px; }
.ks .badge .dot { background: var(--dt); }
.ks .b-todo, .ks .b-queued { --bg: var(--queued-bg); --fg: var(--queued-fg); --dt: var(--queued-dot); }
.ks .b-tested, .ks .b-run { --bg: var(--run-bg); --fg: var(--run-fg); --dt: var(--run-dot); }
.ks .b-impr, .ks .b-done { --bg: var(--done-bg); --fg: var(--done-fg); --dt: var(--done-dot); }
.ks .b-used { --bg: var(--used-bg); --fg: var(--used-fg); --dt: var(--used-dot); }
.ks .b-dead, .ks .b-fail { --bg: var(--fail-bg); --fg: var(--fail-fg); --dt: var(--fail-dot); }
.ks .b-acc { --bg: var(--blue-tint); --fg: var(--blue-ink); --dt: var(--accent-line); }
.ks .b-warn { --bg: var(--warn-bg); --fg: var(--warn-fg); --dt: var(--warn-dot); }
.ks .b-line { --bg: transparent; border: 1px solid var(--border-2); --fg: var(--text-2); }
.ks .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; display: inline-block; }
.ks .dot.live { position: relative; }
.ks .dot.live::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; background: inherit; opacity: .35; animation: ks-pulse 1.6s var(--ease) infinite; }
.ks .role { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--r-xs); font: 500 11px/1 var(--font); border: 1px solid var(--border-2); color: var(--text-2); }
.ks .role.owner { border-color: color-mix(in oklab, var(--accent-line) 55%, transparent); color: var(--blue-ink); }
/* channel color plumbing: .c1 … .c12 */
.ks .c1{--c:var(--c1);--cb:var(--c1-bg);--ci:var(--c1-ink)} .ks .c2{--c:var(--c2);--cb:var(--c2-bg);--ci:var(--c2-ink)} .ks .c3{--c:var(--c3);--cb:var(--c3-bg);--ci:var(--c3-ink)}
.ks .c4{--c:var(--c4);--cb:var(--c4-bg);--ci:var(--c4-ink)} .ks .c5{--c:var(--c5);--cb:var(--c5-bg);--ci:var(--c5-ink)} .ks .c6{--c:var(--c6);--cb:var(--c6-bg);--ci:var(--c6-ink)}
.ks .c7{--c:var(--c7);--cb:var(--c7-bg);--ci:var(--c7-ink)} .ks .c8{--c:var(--c8);--cb:var(--c8-bg);--ci:var(--c8-ink)} .ks .c9{--c:var(--c9);--cb:var(--c9-bg);--ci:var(--c9-ink)}
.ks .c10{--c:var(--c10);--cb:var(--c10-bg);--ci:var(--c10-ink)} .ks .c11{--c:var(--c11);--cb:var(--c11-bg);--ci:var(--c11-ink)} .ks .c12{--c:var(--c12);--cb:var(--c12-bg);--ci:var(--c12-ink)}
.ks .cdot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; display: inline-block; }
.ks .ctag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px 0 7px; border-radius: var(--r-sm); background: var(--cb); color: var(--ci); font: 500 var(--t-label)/1 var(--font); white-space: nowrap; max-width: 100%; }
.ks .ctag .cdot { width: 6px; height: 6px; }
.ks .ctag.line { background: transparent; border: 1px solid var(--border); color: var(--text-2); }
.ks .chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--panel); color: var(--text-2); font: 500 var(--t-label)/1 var(--font); white-space: nowrap; }
.ks .chip svg { width: 13px; height: 13px; }

/* ---------- 9. Cards, stat tiles ---------- */
.ks .card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); min-width: 0; }
.ks .card.raised { box-shadow: var(--sh-1); }
.ks .card.flat { background: transparent; }
.ks .card.sunk { background: var(--sunken); }
.ks .card.pad { padding: var(--s-5); }
.ks .card.hoverable { transition: border-color var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease); cursor: pointer; }
.ks .card.hoverable:hover, .ks .card.is-hover { border-color: var(--border-2); background: var(--panel-2); }
.ks .card.is-sel { border-color: color-mix(in oklab, var(--accent-line) 70%, transparent); box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent-line) 70%, transparent); }
.ks .card-h { display: flex; align-items: center; gap: var(--s-3); padding: 14px var(--s-5); border-bottom: 1px solid var(--border); min-height: 52px; flex-wrap: wrap; }
.ks .card-h h2, .ks .card-h h3 { font: 600 16px/22px var(--font-display); letter-spacing: -0.01em; }
.ks .card-h .sub { font-size: var(--t-label); color: var(--text-2); }
.ks .card-b { padding: var(--s-5); }
.ks .card-f { padding: 12px var(--s-5); border-top: 1px solid var(--border); display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.ks .sec-h { display: flex; align-items: baseline; gap: var(--s-3); flex-wrap: wrap; }
.ks .sec-h h2 { font: 600 var(--t-h2)/24px var(--font-display); letter-spacing: -0.015em; }
.ks .sec-h p { font-size: var(--t-sm); color: var(--text-2); }
.ks .sec-h .sp { align-self: center; }

.ks .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(172px, 100%), 1fr)); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.ks .stats .stat { border: 0; border-radius: 0; background: transparent; box-shadow: -1px 0 0 var(--border); }
.ks .stat { position: relative; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); animation: ks-rise var(--dur-3) var(--ease-out) both; }
.ks .stat:nth-child(2){animation-delay:30ms}.ks .stat:nth-child(3){animation-delay:60ms}.ks .stat:nth-child(4){animation-delay:90ms}.ks .stat:nth-child(5){animation-delay:120ms}.ks .stat:nth-child(6){animation-delay:150ms}.ks .stat:nth-child(n+7){animation-delay:180ms}
.ks .stat-l { font: 600 var(--t-micro)/16px var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.ks .stat-v { font-size: 26px; line-height: 32px; font-weight: 500; letter-spacing: -0.03em; color: var(--text); white-space: nowrap; }
.ks .stat-v small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 2px; letter-spacing: 0; }
.ks .stat-d { font: 500 var(--t-label)/16px var(--font); font-variant-numeric: tabular-nums lining-nums; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.ks .stat-d.up { color: var(--done-fg); } .ks .stat-d.down { color: var(--fail-fg); }
.ks .stat-d svg { width: 12px; height: 12px; }
.ks .stat.accent .stat-v { color: var(--blue-ink); }
.ks .stat.good .stat-v { color: var(--done-fg); }
.ks .stat.bad .stat-v { color: var(--fail-fg); }
.ks .stat.hero { background: var(--blue-tint); border-color: color-mix(in oklab, var(--accent-line) 30%, transparent); }
.ks .stat.hero .stat-l { color: var(--blue-ink); }
.ks .stat.lg .stat-v { font-size: 30px; line-height: 36px; }
.ks a.stat { color: inherit; text-decoration: none; transition: background-color var(--dur-1) var(--ease); }
.ks a.stat:hover { background: var(--panel-2); text-decoration: none; }
.ks a.chip { text-decoration: none; }
.ks a.chip:hover { border-color: var(--border-2); background: var(--panel-2); }

/* ---------- 10. Table ---------- */
.ks .tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--panel); max-width: 100%; }
.ks .tbl-wrap.tall { max-height: 520px; }
.ks table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-sm); }
.ks .tbl th { position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; font: 600 var(--t-label)/16px var(--font); color: var(--text-2); padding: 0 12px; height: 36px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.ks .tbl th.n, .ks .tbl td.n { text-align: right; }
.ks .tbl th .sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: 4px 0; border-radius: var(--r-xs); }
.ks .tbl th .sort:hover { color: var(--text); }
.ks .tbl th .sort svg { width: 12px; height: 12px; opacity: .55; }
.ks .tbl th[aria-sort] { color: var(--text); }
.ks .tbl th[aria-sort] .sort svg { opacity: 1; color: var(--blue-ink); }
.ks .tbl td { padding: 0 12px; height: 44px; border-bottom: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.ks .tbl td.n { color: var(--text); }
.ks .tbl tr:last-child td { border-bottom: 0; }
.ks .tbl tbody tr { transition: background-color var(--dur-1) var(--ease); }
.ks .tbl tbody tr:hover td, .ks .tbl tbody tr.is-hover td { background: var(--panel-2); }
.ks .tbl tbody tr.is-sel td { background: var(--blue-tint); }
.ks .tbl tbody tr.is-sel td:first-child { box-shadow: inset 2px 0 0 var(--accent-line); }
.ks .tbl .ch { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; }
.ks .tbl.dense td { height: 36px; }
.ks .tbl .group td { height: 32px; background: var(--sunken); font: 500 var(--t-micro)/14px var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- 11. Bar list, meter, progress ---------- */
.ks .bars { display: flex; flex-direction: column; gap: 2px; }
.ks .bar-row { display: grid; grid-template-columns: minmax(90px, 160px) minmax(60px, 1fr) 64px 48px; gap: 12px; align-items: center; height: 32px; padding: 0 8px; margin: 0 -8px; border-radius: var(--r-sm); font-size: var(--t-sm); }
.ks .bar-row:hover { background: var(--panel-2); }
.ks .bar-row .bl { color: var(--text-2); display: flex; align-items: center; gap: 8px; min-width: 0; }
.ks .bar-row .bv, .ks .bar-row .bp { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ks .bar-row .bv { color: var(--text); } .ks .bar-row .bp { color: var(--text-2); font-size: var(--t-label); }
.ks .track { height: 8px; border-radius: 2px; background: var(--sunken); overflow: hidden; position: relative; }
.ks .track > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--bar, var(--text-2)); border-radius: 2px; transition: width var(--dur-3) var(--ease-out); }
.ks .bar-row .track > i { background: var(--bar, var(--accent-line)); }
.ks .meter { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ks .meter-h { display: flex; justify-content: space-between; gap: 8px; font-size: var(--t-label); color: var(--text-2); }
.ks .meter-h b { font-weight: 500; color: var(--text); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ks .meter .track { height: 6px; }
.ks .track.bad > i { background: var(--fail-dot); } .ks .track.ok > i { background: var(--done-dot); } .ks .track.run > i { background: var(--run-dot); } .ks .track.neu > i { background: var(--text-2); } .ks .track.cc > i { background: var(--c); }
.ks .meter.seg-meter .track { background: repeating-linear-gradient(90deg, var(--sunken) 0 calc(10% - 2px), transparent calc(10% - 2px) 10%); }
.ks .meter .track > i { background: var(--bar, var(--text-2)); }
.ks .meter.hit .track > i { --bar: var(--done-dot); }
.ks .meter.near .track > i { --bar: var(--accent-line); }
.ks .meter .tick { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); border-radius: 1px; opacity: .55; }
.ks .progress { height: 4px; border-radius: 2px; background: var(--sunken); overflow: hidden; position: relative; }
.ks .progress > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--run-dot); border-radius: 2px; }
.ks .progress.done > i { background: var(--done-dot); } .ks .progress.fail > i { background: var(--fail-dot); }
.ks .progress.indet > i { width: 30% !important; animation: ks-indet 1.2s var(--ease) infinite; }

/* ---------- 12. List rows ---------- */
.ks .list { display: flex; flex-direction: column; }
.ks .list.boxed { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.ks .lrow { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; border-bottom: 1px solid var(--border); position: relative; color: var(--text-2); text-decoration: none; background: transparent; transition: background-color var(--dur-1) var(--ease); min-width: 0; width: 100%; text-align: left; border-left: 0; border-right: 0; border-top: 0; font: inherit; }
.ks .lrow:last-child { border-bottom: 0; }
.ks button.lrow, .ks a.lrow { cursor: pointer; }
.ks .lrow:hover, .ks .lrow.is-hover { background: var(--panel-2); text-decoration: none; }
.ks .lrow.is-sel, .ks .lrow[aria-current="true"] { background: var(--blue-tint); }
.ks .lrow.is-sel::before, .ks .lrow[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--accent-line); }
.ks .lrow .lt { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.ks .lrow .lt b { font: 500 var(--t-sm)/20px var(--font); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ks .lrow .lt small { font-size: var(--t-label); line-height: 16px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ks .lrow .meta { font-size: var(--t-label); color: var(--muted); white-space: nowrap; }
.ks .lrow.compact { min-height: 40px; padding: 6px 12px; }
.ks .ico-tile { width: 32px; height: 32px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--sunken); border: 1px solid var(--border); color: var(--text-2); flex: none; }
.ks .ico-tile svg { width: 16px; height: 16px; }

/* ---------- 13. Overlays: modal, sheet, toast, alert, tooltip, command ---------- */
.ks .scrim { background: var(--scrim); display: grid; place-items: center; padding: 24px; border-radius: inherit; }
.ks .modal { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--r-xl); box-shadow: var(--sh-2); animation: ks-pop var(--dur-3) var(--ease-out) both; }
.ks .modal-h { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 6px; }
.ks .modal-h h2 { font: 600 var(--t-h3)/22px var(--font-display); }
.ks .modal-h p { font-size: var(--t-sm); color: var(--muted); margin-top: 2px; }
.ks .modal-b { padding: 14px 20px; display: flex; flex-direction: column; gap: 14px; }
.ks .modal-f { padding: 14px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.ks .sheet { width: min(400px, 100%); background: var(--panel); border-left: 1px solid var(--border-2); box-shadow: var(--sh-2); display: flex; flex-direction: column; margin-left: auto; align-self: stretch; }
.ks .toast { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 8px 8px 14px; background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--r-lg); box-shadow: var(--sh-2); font-size: var(--t-sm); color: var(--text); width: min(380px, 100%); animation: ks-rise var(--dur-3) var(--ease-out) both; }
.ks .toast > svg { width: 16px; height: 16px; }
.ks .toast.ok > svg { color: var(--done-dot); } .ks .toast.bad > svg { color: var(--fail-dot); }
.ks .toast .grow small { display: block; color: var(--muted); font-size: var(--t-label); }
.ks .alert { --a: var(--run-dot); --af: var(--text); display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid color-mix(in oklab, var(--a) 35%, var(--border)); background: color-mix(in oklab, var(--a) 7%, var(--panel)); font-size: var(--t-sm); line-height: 20px; color: var(--text-2); }
.ks .alert > svg { width: 16px; height: 16px; color: var(--a); margin-top: 2px; }
.ks .alert b { color: var(--text); font-weight: 600; }
.ks .alert.ok { --a: var(--done-dot); } .ks .alert.bad { --a: var(--fail-dot); } .ks .alert.warn { --a: var(--warn-dot); } .ks .alert.acc { --a: var(--accent-line); }
.ks .tip { position: relative; display: inline-flex; align-items: center; padding: 6px 8px; border-radius: var(--r-sm); background: var(--text); color: var(--field); font-size: var(--t-label); line-height: 16px; box-shadow: var(--sh-2); white-space: nowrap; }
.ks .tip::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 1px; }
.ks .tip .kbd { background: transparent; border-color: color-mix(in oklab, var(--field) 40%, transparent); color: inherit; margin-left: 6px; height: 18px; }
.ks .cmdk { width: min(560px, 100%); background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--r-xl); box-shadow: var(--sh-2); overflow: hidden; }
.ks .cmdk-in { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.ks .cmdk-in svg { width: 18px; height: 18px; color: var(--muted); }
.ks .cmdk-in input { flex: 1; border: 0; background: transparent; outline: none; font-size: 15px; color: var(--text); min-width: 0; }
.ks .cmdk-in input::placeholder { color: var(--muted); }
.ks .cmdk-list { padding: 6px; display: flex; flex-direction: column; gap: 1px; max-height: 340px; overflow: auto; }
.ks .cmdk-h { font-size: var(--t-micro); color: var(--muted); padding: 8px 10px 4px; }
.ks .cmdk-item { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 10px; border-radius: var(--r-md); color: var(--text-2); font-size: var(--t-sm); border: 0; background: transparent; width: 100%; text-align: left; cursor: pointer; }
.ks .cmdk-item svg { width: 16px; height: 16px; color: var(--muted); }
.ks .cmdk-item small { margin-left: auto; color: var(--muted); font-size: var(--t-label); }
.ks .cmdk-item:hover, .ks .cmdk-item[aria-selected="true"] { background: var(--panel-2); color: var(--text); }
.ks .cmdk-item[aria-selected="true"] svg { color: var(--blue-ink); }
.ks .cmdk-f { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: var(--t-micro); color: var(--muted); flex-wrap: wrap; }

/* ---------- 14. Skeleton, empty, error ---------- */
.ks .sk { display: block; background: var(--skel); border-radius: var(--r-xs); position: relative; overflow: hidden; height: 12px; }
.ks .sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--skel-hi), transparent); animation: ks-shimmer 1.4s var(--ease) infinite; }
.ks .sk.t { height: 10px; } .ks .sk.h { height: 22px; } .ks .sk.av { width: 28px; height: 28px; border-radius: 50%; } .ks .sk.blk { height: 120px; border-radius: var(--r-md); }
.ks .empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 40px 24px; border: 1px dashed var(--border-2); border-radius: var(--r-lg); color: var(--muted); }
.ks .empty .ico-tile { width: 40px; height: 40px; margin-bottom: 4px; }
.ks .empty .ico-tile svg { width: 20px; height: 20px; }
.ks .empty b { font: 600 var(--t-body)/20px var(--font); color: var(--text); }
.ks .empty p { font-size: var(--t-sm); max-width: 340px; }
.ks .empty .hstack { margin-top: 6px; justify-content: center; flex-wrap: wrap; }
.ks .errbox { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: var(--r-lg); border: 1px solid color-mix(in oklab, var(--fail-dot) 40%, var(--border)); background: var(--fail-soft); }
.ks .errbox > svg { width: 18px; height: 18px; color: var(--fail-dot); margin-top: 1px; }
.ks .errbox b { display: block; color: var(--text); font-weight: 600; font-size: var(--t-body); }
.ks .errbox p { color: var(--text-2); font-size: var(--t-sm); margin: 2px 0 10px; }
.ks .errbox code { font-family: var(--mono); font-size: 12px; color: var(--fail-fg); }

/* ---------- 15. Avatar ---------- */
.ks .av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--cb, var(--panel-2)); color: var(--ci, var(--text-2)); font: 600 11px/1 var(--font); letter-spacing: .02em; flex: none; border: 1px solid color-mix(in oklab, var(--c, var(--border-2)) 35%, transparent); }
.ks .av.sm { width: 22px; height: 22px; font-size: 10px; }
.ks .av.lg { width: 40px; height: 40px; font-size: 14px; }
.ks .av-stack { display: flex; } .ks .av-stack .av { margin-left: -6px; box-shadow: 0 0 0 2px var(--panel); } .ks .av-stack .av:first-child { margin-left: 0; }

/* ---------- 16. Domain micro-components ---------- */
/* 2FA code chip */
.ks .totp { display: inline-flex; align-items: center; gap: 10px; height: 34px; padding: 0 6px 0 10px; border-radius: var(--r-md); background: var(--sunken); border: 1px solid var(--border-2); cursor: pointer; color: var(--text); }
.ks .totp:hover { border-color: var(--muted); }
.ks .totp .code { font: 500 15px/1 var(--mono); letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.ks .totp .code i { font-style: normal; display: inline-block; width: 6px; }
.ks .totp .ring { width: 20px; height: 20px; transform: rotate(-90deg); }
.ks .totp .ring circle { fill: none; stroke-width: 2.5; }
.ks .totp .ring .bgc { stroke: var(--border-2); }
.ks .totp .ring .fgc { stroke: var(--accent-line); stroke-linecap: round; stroke-dasharray: 50.27; animation: ks-ring 30s linear infinite; }
.ks .totp.low .ring .fgc { stroke: var(--fail-dot); }
.ks .totp .copy { width: 24px; height: 24px; display: grid; place-items: center; color: var(--muted); border-radius: var(--r-sm); }
.ks .totp .copy svg { width: 14px; height: 14px; }
.ks .totp.copied { border-color: color-mix(in oklab, var(--done-dot) 60%, transparent); }
.ks .totp.copied .copy { color: var(--done-dot); }
/* inline audio player */
.ks .player { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; border-radius: var(--r-md); background: var(--sunken); border: 1px solid var(--border); min-width: 0; }
.ks .player .pbtn { width: 32px; height: 32px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--text); color: var(--field); cursor: pointer; flex: none; }
.ks .player .pbtn svg { width: 14px; height: 14px; }
.ks .player .pbtn:hover { background: var(--blue); color: var(--on-blue); }
.ks .wave { flex: 1; height: 28px; display: flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; }
.ks .wave i { flex: 1 0 2px; max-width: 3px; border-radius: 1px; background: var(--border-2); height: 40%; }
.ks .wave i.on { background: var(--accent-line); }
.ks .player time { font-size: var(--t-label); color: var(--muted); white-space: nowrap; }
/* QR card */
.ks .qr { width: 96px; height: 96px; padding: 8px; background: #fff; border-radius: var(--r-md); flex: none; display: block; }
.ks .qr svg { width: 100%; height: 100%; display: block; }
.ks .qr.sm { width: 64px; height: 64px; padding: 5px; }
/* calendar */
.ks .cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--border); border-top: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--panel); }
.ks .cal-dow { font: 500 var(--t-micro)/14px var(--font); color: var(--muted); padding: 8px 10px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--field-2); }
.ks .day { min-height: 116px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; transition: background-color var(--dur-1) var(--ease); }
.ks .day:hover, .ks .day.is-hover { background: var(--panel-2); }
.ks .day .dn { font: 500 12px/20px var(--mono); color: var(--text-2); padding: 0 4px; display: flex; align-items: center; justify-content: space-between; }
.ks .day.out { background: var(--field-2); } .ks .day.out .dn { color: var(--muted); opacity: .6; }
.ks .day.today .dn > span:first-child { background: var(--blue); color: var(--on-blue); border-radius: var(--r-xs); padding: 0 5px; }
.ks .day.is-sel { box-shadow: inset 0 0 0 2px var(--accent-line); }
.ks .day .more { font-size: 11px; color: var(--muted); padding: 1px 6px; }
.ks .tchip { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: var(--r-xs); background: var(--cb); color: var(--ci); font: 500 11.5px/15px var(--font); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; border: 0; text-align: left; cursor: pointer; }
.ks .tchip::before { content: ""; width: 3px; align-self: stretch; border-radius: 2px; background: var(--c); flex: none; }
.ks .tchip span { overflow: hidden; text-overflow: ellipsis; }
.ks .tchip.done { opacity: .55; text-decoration: line-through; text-decoration-color: color-mix(in oklab, var(--ci) 50%, transparent); }

/* ---------- 17. Brand mark ---------- */
.ks .mark { width: 28px; height: 28px; border-radius: 7px; background: var(--blue); color: var(--on-blue); display: grid; place-items: center; flex: none; }
.ks .mark svg { width: 100%; height: 100%; }
.ks .mark.mono { background: var(--text); color: var(--field); }
.ks .mark.line { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--border-2); }

/* ---------- 18. Page atmosphere (static, zero-cost) ---------- */
.ks .gridbg { background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 32px 32px; background-position: -1px -1px; -webkit-mask-image: radial-gradient(ellipse 70% 90% at 30% 0%, #000 30%, transparent 75%); mask-image: radial-gradient(ellipse 70% 90% at 30% 0%, #000 30%, transparent 75%); }

/* tool tile (hub launcher): hairline amber edge draws in on hover */
.ks a.tool { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 18px; min-height: 148px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--border); color: var(--text); text-decoration: none; overflow: hidden; transition: border-color var(--dur-2) var(--ease), background-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-out); }
.ks a.tool::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, var(--accent-line), transparent 80%); transform: scaleX(0); transform-origin: left; transition: transform var(--dur-3) var(--ease-out); }
.ks a.tool:hover, .ks a.tool.is-hover { border-color: var(--border-2); background: var(--panel-2); text-decoration: none; transform: translateY(-2px); }
.ks a.tool:hover::before, .ks a.tool.is-hover::before { transform: scaleX(1); }
.ks a.tool .ti { width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--sunken); border: 1px solid var(--border); color: var(--text-2); transition: color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease); }
.ks a.tool .ti svg { width: 18px; height: 18px; }
.ks a.tool:hover .ti, .ks a.tool.is-hover .ti { color: var(--blue-ink); border-color: color-mix(in oklab, var(--accent-line) 40%, var(--border)); }
.ks a.tool b { font: 600 15px/20px var(--font-display); letter-spacing: -0.01em; display: block; }
.ks a.tool p { font-size: var(--t-sm); line-height: 18px; color: var(--muted); margin-top: 2px; }
.ks a.tool .go { position: absolute; right: 16px; top: 20px; width: 16px; height: 16px; color: var(--muted); opacity: 0; transform: translateX(-4px); transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-out); }
.ks a.tool:hover .go, .ks a.tool.is-hover .go { opacity: 1; transform: none; }
.ks a.tool .tfoot { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: var(--t-label); color: var(--muted); }
.ks a.tool.locked { opacity: .55; }
.ks .kbdhint { font-size: var(--t-label); color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }

/* ---------- 19. Motion ---------- */
@keyframes ks-spin { to { transform: rotate(360deg); } }
@keyframes ks-pulse { 0% { transform: scale(.6); opacity: .5; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes ks-shimmer { to { transform: translateX(100%); } }
@keyframes ks-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes ks-pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes ks-indet { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
@keyframes ks-ring { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 50.27; } }
@media (prefers-reduced-motion: reduce) {
  .ks *, .ks *::before, .ks *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .ks .totp .ring .fgc { animation: none; }
  .ks a.tool:hover { transform: none; }
}

/* ---------- 20. Hub launcher (profile-picker style) ---------- */
.ks .launch { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 44px; padding: 48px 32px 72px; }
.ks .launch-groups { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 36px 56px; }
.ks .launch-head { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.ks .launch-head h2 { font: 600 34px/40px var(--font-display); letter-spacing: -0.03em; }
.ks .launch-head p { font-size: 17px; line-height: 24px; color: var(--text-2); }
.ks .launch-group { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ks .launch-label { font: 600 12px/16px var(--font); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.ks .launch-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; }
.ks a.ptile { width: 152px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-decoration: none; color: var(--text-2); }
.ks a.ptile .pt-box { position: relative; width: 152px; height: 152px; border-radius: 18px; display: grid; place-items: center; background: var(--cb); color: var(--c); border: 2px solid transparent; transition: transform var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
.ks a.ptile .pt-box svg { width: 64px; height: 64px; }
.ks a.ptile b { font: 600 17px/22px var(--font-display); letter-spacing: -0.01em; color: var(--text-2); transition: color var(--dur-1) var(--ease); text-align: center; }
.ks a.ptile small { font: 500 13px/16px var(--font); color: var(--muted); font-variant-numeric: tabular-nums; }
.ks a.ptile:hover, .ks a.ptile:focus-visible { text-decoration: none; box-shadow: none; }
.ks a.ptile:hover .pt-box, .ks a.ptile:focus-visible .pt-box { transform: translateY(-4px) scale(1.03); border-color: var(--text); box-shadow: var(--sh-2); }
.ks a.ptile:hover b, .ks a.ptile:focus-visible b { color: var(--text); }
.ks .pt-key { position: absolute; top: 10px; right: 12px; font-size: 12px; color: var(--ci); opacity: .75; }
.ks .pt-live { position: absolute; top: 12px; left: 12px; color: var(--run-dot); display: inline-flex; }
.ks .pt-live .dot { width: 8px; height: 8px; }
@container ks (max-width: 760px) {
  .ks .launch { padding: 32px 16px 48px; gap: 28px; justify-content: flex-start; }
  .ks .launch-groups { gap: 28px; }
  .ks .launch-head h2 { font-size: 26px; line-height: 32px; }
  .ks .launch-row { gap: 16px; }
  .ks a.ptile, .ks a.ptile .pt-box { width: 100px; }
  .ks a.ptile .pt-box { height: 100px; border-radius: 14px; }
  .ks a.ptile .pt-box svg { width: 44px; height: 44px; }
  .ks a.ptile b { font-size: 14px; line-height: 18px; }
}
@media (prefers-reduced-motion: reduce) { .ks a.ptile:hover .pt-box { transform: none; } }
.ks .day .dn .btn { opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.ks .day:hover .dn .btn, .ks .day .dn .btn:focus-visible { opacity: 1; }
