/*
 * Kebrio UI — shared look for KebStud, KebFin, KebVest and KebWork (KR-PRD-001).
 * Plain CSS on purpose: KebFin is a static site with no build step, so it can
 * link this file directly. The Vite apps import it from their entry file.
 *
 * v2 (2026-11-07, Iris after KB's reference dashboards): soft white cards on a
 * tinted canvas, big thin titles and numbers, light sidebar with a dark pill,
 * pill buttons, soft-tint status tags, one data accent per app.
 *
 * Rules this file encodes (G1–G9, as amended by v2):
 *   G1 at most 6 cards per screen: white, borderless, 20px radius, soft shadow,
 *      on the app's tinted canvas; hairlines group content inside a card; never nested
 *   G2 one number strip per page (.k-strip), 36px light numbers, small grey units
 *   G3 status = dot + text (.k-status) or one soft-tint tag per row (.k-tag), text >= 4.5:1
 *   G4 at most one notice bar at the top (.k-notice)
 *   G5 one dark pill primary button per page (.k-btn.is-primary), round icon buttons
 *   G6 no greeting: date + 40px light title + one useful summary line (.k-head)
 *   G7 Geist + Geist Mono, 1.5px line icons
 *   G8 buttons 40px (44px on phones), shadows only on cards and overlays
 *   G9 apps keep their brand: set --k-canvas, --k-accent (data only), --k-brand
 *
 * Every app-specific value is a variable; apps set them on :root after
 * importing this file. Fonts are served from this package (no font CDN).
 */

/* ---------- fonts (self-hosted, OFL — see fonts/OFL.txt) ---------- */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('./fonts/geist-latin-wght-normal.woff2') format('woff2-variations'), url('./fonts/geist-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('./fonts/geist-latin-ext-wght-normal.woff2') format('woff2-variations'), url('./fonts/geist-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('./fonts/geist-mono-latin-wght-normal.woff2') format('woff2-variations'), url('./fonts/geist-mono-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('./fonts/geist-mono-latin-ext-wght-normal.woff2') format('woff2-variations'), url('./fonts/geist-mono-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- tokens (light) ---------- */
:root {
  --k-font: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --k-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --k-canvas: #EEF0F1;      /* page background — each app tints it */
  --k-bg: var(--k-canvas);
  --k-card: #FFFFFF;        /* cards */
  --k-surface: #FFFFFF;     /* overlays, inputs */
  --k-hover: #F3F4F5;       /* row hover inside a card */
  --k-ink: #16191D;         /* text, primary button, active nav pill */
  --k-ink-2: #4E5560;       /* secondary text */
  --k-ink-3: #636A75;       /* labels, units: >= 4.5:1 on white, canvas and hover */
  --k-line: #E4E6E8;        /* hairlines inside cards */
  --k-line-2: #EEEFF1;      /* row rules */
  --k-line-strong: #D3D6DA; /* inputs */
  --k-track: #E6E9EB;       /* empty part of gauges and meters */

  --k-good: #17784A;  --k-good-tint: #E3F2EA;
  --k-warn: #94580A;  --k-warn-tint: #FBEEDC;
  --k-bad: #B42318;   --k-bad-tint: #FBE7E4;
  --k-info: #1F5FB4;  --k-info-tint: #E6EEF9;
  --k-neutral: #7D838D; --k-neutral-tint: #EEF0F2;

  --k-accent: #0B7573;      /* data only: progress, charts, gauges — app overrides */
  --k-brand: #0F766E;       /* links and focus ring — app overrides */

  --k-radius-card: 20px;
  --k-radius: 10px;         /* inputs, small surfaces */
  --k-radius-sm: 6px;
  --k-shadow-card: 0 1px 2px rgba(20, 24, 22, .04), 0 10px 30px rgba(20, 24, 22, .04);
  --k-shadow-overlay: 0 2px 6px rgba(15, 18, 24, .06), 0 24px 60px rgba(15, 18, 24, .18);
  --k-btn-h: 40px;
  --k-btn-sm-h: 32px;
  --k-input-h: 40px;
  --k-tap: 44px;
  --k-ease: cubic-bezier(.2, .7, .3, 1);
}

/* ---------- tokens (dark) — KebVest default, others opt in ---------- */
:root[data-theme='dark'], .k-dark {
  --k-canvas: #071527;
  --k-card: #0D1D33;
  --k-surface: #10223B;
  --k-hover: #13283F;
  --k-ink: #E7ECF2;
  --k-ink-2: #A6B1C0;
  --k-ink-3: #8C99AC;
  --k-line: #1D2F47;
  --k-line-2: #172840;
  --k-line-strong: #2A3D58;
  --k-track: #1B2D45;
  --k-good: #45C486;  --k-good-tint: rgba(69, 196, 134, .14);
  --k-warn: #E3A541;  --k-warn-tint: rgba(227, 165, 65, .14);
  --k-bad: #F2796B;   --k-bad-tint: rgba(242, 121, 107, .14);
  --k-info: #6FA8FF;  --k-info-tint: rgba(111, 168, 255, .14);
  --k-neutral: #8592A6; --k-neutral-tint: rgba(133, 146, 166, .14);
  --k-shadow-card: 0 1px 2px rgba(0, 0, 0, .25), 0 10px 30px rgba(0, 0, 0, .2);
  --k-shadow-overlay: 0 2px 6px rgba(0, 0, 0, .3), 0 24px 60px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- base ---------- */
.k-num, .k-mono { font-variant-numeric: tabular-nums; }
.k-mono { font-family: var(--k-mono); font-size: .92em; }

/* page head: date, big light title, one summary line (G6) */
.k-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 20px; flex-wrap: wrap; }
.k-eyebrow { font-size: 14px; color: var(--k-ink-2); }
.k-title { font-size: 40px; line-height: 1.1; font-weight: 300; letter-spacing: -.035em; margin: 4px 0 0; color: var(--k-ink); }
.k-sum { color: var(--k-ink-2); margin-top: 8px; font-size: 14px; }
.k-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* cards (G1) */
.k-card { background: var(--k-card); border-radius: var(--k-radius-card); box-shadow: var(--k-shadow-card); padding: 20px 24px; min-width: 0; }
.k-card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; font-size: 16px; font-weight: 500; letter-spacing: -.01em; color: var(--k-ink); }
.k-card-h a, .k-card-h button { font-size: 13px; font-weight: 400; color: var(--k-ink-2); text-decoration: none; background: none; border: 0; cursor: pointer; }
.k-card-h a:hover, .k-card-h button:hover { color: var(--k-ink); text-decoration: underline; }

/* one notice bar (G4) */
.k-notice { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 16px; background: var(--k-card); border-radius: 14px; box-shadow: var(--k-shadow-card); color: var(--k-ink-2); font-size: 14px; }
.k-notice b, .k-notice strong { color: var(--k-ink); font-weight: 600; }
.k-notice .k-go { margin-left: auto; color: var(--k-ink); font-weight: 500; white-space: nowrap; }

/* status (G3): dot + text, or one soft-tint tag per row */
.k-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; background: var(--k-neutral); }
.k-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--k-ink-2); white-space: nowrap; line-height: 20px; }
.k-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--k-neutral); flex: none; }
.k-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--k-neutral-tint); color: var(--k-ink-2); }
.is-good { --k-tone: var(--k-good); --k-tint: var(--k-good-tint); }
.is-warn { --k-tone: var(--k-warn); --k-tint: var(--k-warn-tint); }
.is-bad { --k-tone: var(--k-bad); --k-tint: var(--k-bad-tint); }
.is-info { --k-tone: var(--k-info); --k-tint: var(--k-info-tint); }
.is-neutral { --k-tone: var(--k-neutral); --k-tint: var(--k-neutral-tint); }
.k-status[class*='is-']::before, .k-dot[class*='is-'] { background: var(--k-tone); }
.k-tag[class*='is-'] { background: var(--k-tint); color: var(--k-tone); }

/* number strip (G2) — lives inside one card */
.k-strip { display: grid; grid-template-columns: repeat(var(--k-cols, 4), minmax(0, 1fr)); }
.k-strip > * { padding: 4px 20px; min-width: 0; color: inherit; text-decoration: none; }
.k-strip > :first-child { padding-left: 0; }
.k-strip > * + * { border-left: 1px solid var(--k-line); }
.k-strip a:hover { text-decoration: none; }
.k-strip a:hover .k-l { color: var(--k-ink); }
.k-l { font-size: 13px; color: var(--k-ink-2); }
.k-v { font-size: 36px; line-height: 1.15; font-weight: 300; letter-spacing: -.03em; margin-top: 6px; font-variant-numeric: tabular-nums; color: var(--k-ink); white-space: nowrap; }
.k-v small { font-size: 14px; font-weight: 400; color: var(--k-ink-3); letter-spacing: 0; margin-left: 4px; }
.k-v small.k-pre { margin: 0 4px 0 0; }
.k-s { font-size: 13px; color: var(--k-ink-2); margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.k-meter { height: 6px; background: var(--k-track); border-radius: 3px; overflow: hidden; }
.k-meter > i { display: block; height: 100%; background: var(--k-accent); border-radius: 3px; }

/* semicircle gauge (one per page, where a single ratio is the point) */
.k-gauge { display: block; margin: 0 auto; }
.k-gauge .tick { stroke: var(--k-track); stroke-width: 7; stroke-linecap: round; }
.k-gauge .tick.on { stroke: var(--k-accent); }
.k-gauge-v { font-size: 34px; font-weight: 300; letter-spacing: -.03em; fill: var(--k-ink); font-family: var(--k-font); }
.k-gauge-s { font-size: 13px; fill: var(--k-ink-2); font-family: var(--k-font); }

/* rows inside a card */
.k-sec-h { margin: 0 0 6px; font-size: 13px; font-weight: 500; color: var(--k-ink-2); display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.k-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--k-line-2); min-width: 0; }
.k-row:last-child { border-bottom: 0; }
.k-row-main { flex: 1; min-width: 0; }
.k-row-t { font-weight: 500; overflow-wrap: anywhere; }
.k-row-d { font-size: 13px; color: var(--k-ink-3); overflow-wrap: anywhere; }
.k-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--k-neutral-tint); color: var(--k-ink-2); }
.k-row .k-reveal { opacity: 0; transition: opacity .12s var(--k-ease); }
.k-row:hover .k-reveal, .k-row:focus-within .k-reveal { opacity: 1; }
@media (hover: none) { .k-row .k-reveal { opacity: 1; } }

/* buttons (G5, G8) */
.k-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--k-btn-h); padding: 0 18px; border-radius: 999px; border: 0; background: var(--k-card); box-shadow: var(--k-shadow-card); color: var(--k-ink); font: 500 14px/1 var(--k-font); cursor: pointer; white-space: nowrap; text-decoration: none; }
.k-btn:hover { background: var(--k-hover); text-decoration: none; }
.k-btn.is-primary { background: var(--k-ink); color: var(--k-card); box-shadow: none; }
.k-btn.is-primary:hover { opacity: .88; background: var(--k-ink); }
.k-btn.is-text { background: none; box-shadow: none; color: var(--k-ink-2); padding: 0 10px; }
.k-btn.is-icon { width: var(--k-btn-h); padding: 0; }
.k-btn:disabled { opacity: .45; cursor: not-allowed; }

.k-link { color: var(--k-ink); font-weight: 500; text-decoration: none; }
.k-link:hover { text-decoration: underline; }

/* light sidebar on the canvas, dark pill for the active item */
.k-side { background: transparent; color: var(--k-ink-2); }
.k-nav-item { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 14px; border-radius: 999px; color: var(--k-ink-2); font-size: 14px; font-weight: 450; text-decoration: none; }
.k-nav-item:hover { background: rgba(0, 0, 0, .04); color: var(--k-ink); text-decoration: none; }
.k-nav-item.is-active { background: var(--k-ink); color: var(--k-card); }

/* ---------- accessibility ---------- */
.k-scope :focus-visible, .k-focus:focus-visible { outline: 2px solid var(--k-brand); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- phone ---------- */
@media (max-width: 820px) {
  .k-title { font-size: 32px; }
  .k-btn { height: var(--k-tap); }
  .k-btn.is-icon { width: var(--k-tap); }
  .k-card { padding: 16px; border-radius: 18px; }
  .k-strip { --k-cols: 2; row-gap: 14px; }
  .k-strip > * { padding: 2px 12px; }
  .k-strip > :nth-child(2n + 1) { padding-left: 0; border-left: 0; }
  .k-v { font-size: 30px; }
  .k-row { min-height: var(--k-tap); }
  .k-nav-item { height: var(--k-tap); }
}
