/* ==========================================================================
   ERPDunia Design System — core
   Tokens, base, and components shared by the website, client portal and console.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Brand — Dunia violet with a marigold counterpoint */
  --brand-25: #f8f7ff;
  --brand-50: #f1efff;
  --brand-100: #e5e1ff;
  --brand-200: #cec7ff;
  --brand-300: #ada2ff;
  --brand-400: #8b7bff;
  --brand-500: #6a55fa;
  --brand-600: #5a43ec;
  --brand-700: #4b34cc;
  --brand-800: #3c2ba3;
  --brand-900: #2b2178;
  --marigold-50: #fff6ea;
  --marigold-100: #ffe7c7;
  --marigold-300: #ffbe6b;
  --marigold-400: #ffa53d;
  --marigold-500: #f98b1a;
  --marigold-600: #dd6e06;
  --grad-brand: linear-gradient(115deg, #6a55fa 0%, #9b4df0 50%, #f7823a 100%);
  --grad-brand-soft: linear-gradient(115deg, rgba(106, 85, 250, .10), rgba(247, 130, 58, .10));

  /* Ink scale */
  --ink-950: #080a14;
  --ink-900: #0f1222;
  --ink-800: #1b1f33;
  --ink-700: #2d3248;
  --ink-600: #4b5165;
  --ink-500: #6b7186;
  --ink-400: #9197aa;
  --ink-300: #c4c8d4;
  --ink-200: #dfe2ea;
  --ink-100: #eef0f5;
  --ink-50: #f6f7fa;

  /* Theme roles (light) */
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f3f4f8;
  --hover: #f4f5f9;
  --active: #eceef4;
  --border: #e6e8ef;
  --border-2: #d8dbe5;
  --text: #0f1222;
  --text-2: #4b5165;
  --text-3: #7d8397;
  --accent: #5a43ec;
  --accent-hover: #4b34cc;
  --accent-soft: #f1efff;
  --accent-text: #4b34cc;
  --ring-color: rgba(106, 85, 250, .24);

  --success: #0e9f6e;
  --success-soft: #e7f7ef;
  --success-text: #067a52;
  --warning: #e08a00;
  --warning-soft: #fff4dc;
  --warning-text: #9a5b00;
  --danger: #e5484d;
  --danger-soft: #fdeced;
  --danger-text: #bf2c33;
  --info: #2f7de1;
  --info-soft: #e9f2fd;
  --info-text: #1c5db5;
  --purple: #8b5cf6;
  --purple-soft: #f1ecff;
  --purple-text: #6b3fd6;
  --orange: #f2711c;
  --orange-soft: #ffefe4;
  --orange-text: #bb500a;

  /* Charts (validated palette: CVD-separated, light surface) */
  --series-1: #6a55fa;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --ord-1: #a79eff;
  --ord-2: #8574ff;
  --ord-3: #6a55fa;
  --ord-4: #4b31d1;
  --chart-grid: #eef0f5;
  --chart-base: #d8dbe5;
  --spark: #c9cedb;

  --shadow-xs: 0 1px 2px rgba(15, 18, 34, .05);
  --shadow-sm: 0 1px 2px rgba(15, 18, 34, .05), 0 1px 3px rgba(15, 18, 34, .05);
  --shadow-md: 0 1px 2px rgba(15, 18, 34, .04), 0 6px 16px -4px rgba(15, 18, 34, .10);
  --shadow-lg: 0 4px 10px -4px rgba(15, 18, 34, .06), 0 16px 36px -10px rgba(15, 18, 34, .18);
  --shadow-xl: 0 32px 72px -18px rgba(15, 18, 34, .30);

  --r-xs: 6px;
  --r-sm: 8px;
  --r: 10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-2xl: 28px;

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090b14;
  --surface: #10131e;
  --surface-2: #131725;
  --surface-3: #181d2d;
  --hover: #171b2a;
  --active: #1f2435;
  --border: #212638;
  --border-2: #2d3348;
  --text: #eceef6;
  --text-2: #a8aec1;
  --text-3: #6f758b;
  --accent: #8b7bff;
  --accent-hover: #a194ff;
  --accent-soft: rgba(139, 123, 255, .14);
  --accent-text: #b4a9ff;
  --ring-color: rgba(139, 123, 255, .30);

  --success-soft: rgba(14, 159, 110, .15);
  --success-text: #4cd89b;
  --warning-soft: rgba(224, 138, 0, .15);
  --warning-text: #fbbd52;
  --danger-soft: rgba(229, 72, 77, .15);
  --danger-text: #ff7d82;
  --info-soft: rgba(47, 125, 225, .17);
  --info-text: #7fb4ff;
  --purple-soft: rgba(139, 92, 246, .17);
  --purple-text: #c3a8ff;
  --orange-soft: rgba(242, 113, 28, .15);
  --orange-text: #ff9e5e;

  --series-1: #8b7bff;
  --series-2: #d95926;
  --series-3: #199e70;
  --ord-1: #5a45e6;
  --ord-2: #7a68ff;
  --ord-3: #9d91ff;
  --ord-4: #c2baff;
  --chart-grid: #1c2131;
  --chart-base: #2d3348;
  --spark: #3a4158;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .55);
  --shadow-lg: 0 18px 40px -12px rgba(0, 0, 0, .65);
  --shadow-xl: 0 32px 72px -18px rgba(0, 0, 0, .75);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11';
}
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
h1, h2, h3, h4 { font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
table { border-collapse: collapse; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
::selection { background: rgba(106, 85, 250, .20); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

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

.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; display: inline-block; vertical-align: -.2em; }

/* --------------------------------------------------------------------------
   Typography helpers
   -------------------------------------------------------------------------- */
.t-display { font-family: var(--font-display); font-weight: 800; letter-spacing: -.035em; line-height: 1.04; }
.h1 { font-size: 24px; font-weight: 700; letter-spacing: -.022em; line-height: 1.2; }
.h2 { font-size: 18px; font-weight: 650; letter-spacing: -.015em; }
.h3 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-accent { color: var(--accent-text); }
.text-success { color: var(--success-text); }
.text-danger { color: var(--danger-text); }
.text-warning { color: var(--warning-text); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.upper { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 650; }
.link { color: var(--accent-text); font-weight: 550; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.kbd, kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
  font: 500 11px/1 var(--font); color: var(--text-3); background: var(--surface); border: 1px solid var(--border-2);
  border-bottom-width: 2px; border-radius: 5px;
}

/* --------------------------------------------------------------------------
   Layout utilities
   -------------------------------------------------------------------------- */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.col { flex-direction: column; }
.wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } .hide-sm { display: none !important; } }
@media (min-width: 721px) { .show-sm { display: none !important; } }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  --btn-h: 36px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--btn-h); padding: 0 14px; border-radius: var(--r); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; line-height: 1; white-space: nowrap; user-select: none;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease), transform .12s var(--ease);
}
.btn .icon { width: 16px; height: 16px; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring-color); }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(15, 18, 34, .14), inset 0 1px 0 rgba(255, 255, 255, .16); }
.btn-primary:hover { background: var(--accent-hover); }
[data-theme="dark"] .btn-primary { color: #0b0d17; }
.btn-gradient {
  color: #fff; background: var(--grad-brand); background-size: 140% 100%; background-position: 0 0;
  box-shadow: 0 10px 24px -10px rgba(106, 85, 250, .75), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: background-position .5s var(--ease), box-shadow .2s var(--ease), transform .12s var(--ease);
}
.btn-gradient:hover { background-position: 100% 0; box-shadow: 0 14px 30px -10px rgba(106, 85, 250, .9), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-dark { background: var(--ink-900); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); }
.btn-dark:hover { background: var(--ink-700); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-2); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--hover); border-color: var(--border-2); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-soft { background: var(--accent-soft); color: var(--accent-text); }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d23a40; }
.btn-danger-ghost { color: var(--danger-text); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.95); }
.btn-white { background: #fff; color: var(--ink-900); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.btn-white:hover { background: #f3f3f7; }
.btn-outline-light { color: #fff; border-color: rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .04); }
.btn-outline-light:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .34); }
.btn-xs { --btn-h: 26px; padding: 0 9px; font-size: 12px; border-radius: var(--r-sm); gap: 5px; }
.btn-xs .icon { width: 14px; height: 14px; }
.btn-sm { --btn-h: 32px; padding: 0 11px; font-size: 13px; border-radius: var(--r-sm); }
.btn-lg { --btn-h: 44px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-xl { --btn-h: 52px; padding: 0 26px; font-size: 16px; border-radius: 14px; }
.btn-icon { width: var(--btn-h); padding: 0; }
.btn-block { width: 100%; }
.btn .spinner { display: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading .spinner { display: block; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-secondary.is-loading .spinner, .btn-ghost.is-loading .spinner { border-color: var(--border-2); border-top-color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-group { display: inline-flex; }
.btn-group > .btn:not(:first-child), .btn-group > .dd:not(:first-child) > .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.btn-group > .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-group > .btn-primary + .dd > .btn-primary { border-left: 1px solid rgba(255, 255, 255, .22); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.label .opt { font-weight: 450; color: var(--text-3); }
.help { font-size: 12px; color: var(--text-3); }
.field-error { font-size: 12px; color: var(--danger-text); font-weight: 500; margin: 0; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text); font-size: 14px; box-shadow: var(--shadow-xs);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--border-2) 60%, var(--text-3)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring-color); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-3); color: var(--text-3); cursor: not-allowed; }
.is-invalid .input, .is-invalid .select, .is-invalid .textarea, .input.is-invalid { border-color: var(--danger); }
.is-invalid .input:focus { box-shadow: 0 0 0 4px rgba(229, 72, 77, .18); }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d8397' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.input-sm, .select-sm { height: 32px; font-size: 13px; border-radius: var(--r-sm); }
.input-lg { height: 46px; font-size: 15px; border-radius: 12px; padding: 0 14px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .icon { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.input-wrap > .input { padding-left: 34px; }
.input-wrap .input-suffix { position: absolute; right: 8px; }
.input-affix { display: flex; align-items: stretch; }
.input-affix > span { display: flex; align-items: center; padding: 0 12px; background: var(--surface-3); border: 1px solid var(--border-2); border-right: 0; border-radius: var(--r) 0 0 var(--r); color: var(--text-2); font-size: 13px; font-weight: 500; }
.input-affix > .input { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-affix > .input:first-child { border-top-left-radius: var(--r); border-bottom-left-radius: var(--r); }
.input-affix > .input:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-affix > .input + span { border-left: 0; border-right: 1px solid var(--border-2); border-radius: 0 var(--r) var(--r) 0; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 4px; }

.check { display: inline-flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 14px; color: var(--text); line-height: 1.4; }
.check input { appearance: none; -webkit-appearance: none; margin: 1px 0 0; width: 17px; height: 17px; flex-shrink: 0; border: 1.5px solid var(--border-2); border-radius: 5px; background: var(--surface); display: grid; place-items: center; transition: all .15s var(--ease); cursor: pointer; }
.check input[type="radio"] { border-radius: 50%; }
.check input::after { content: ''; width: 9px; height: 9px; transform: scale(0); transition: transform .15s var(--ease-spring); background: #fff; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); }
.check input[type="radio"]::after { clip-path: none; border-radius: 50%; width: 7px; height: 7px; }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { transform: scale(1); }
.check input:focus-visible { box-shadow: 0 0 0 4px var(--ring-color); outline: none; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { appearance: none; -webkit-appearance: none; width: 36px; height: 20px; border-radius: 99px; background: var(--border-2); position: relative; margin: 0; cursor: pointer; transition: background .2s var(--ease); flex-shrink: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease-spring); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { box-shadow: 0 0 0 4px var(--ring-color); outline: none; }

/* Choice cards (radio as cards) */
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body.flex { display: flex; }
.choice-body { display: block; padding: 12px 14px; border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--surface); transition: all .15s var(--ease); }
.choice:hover .choice-body { border-color: color-mix(in srgb, var(--accent) 40%, var(--border-2)); }
.choice input:checked + .choice-body { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring-color); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.choice input:focus-visible + .choice-body { box-shadow: 0 0 0 4px var(--ring-color); }

/* --------------------------------------------------------------------------
   Badges, chips, dots
   -------------------------------------------------------------------------- */
.badge {
  --b-bg: var(--surface-3); --b-fg: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap; background: var(--b-bg); color: var(--b-fg);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge .icon { width: 13px; height: 13px; }
.badge-lg { height: 26px; padding: 0 10px; font-size: 13px; }
.badge-gray { --b-bg: var(--surface-3); --b-fg: var(--text-2); }
.badge-brand { --b-bg: var(--accent-soft); --b-fg: var(--accent-text); }
.badge-info { --b-bg: var(--info-soft); --b-fg: var(--info-text); }
.badge-success { --b-bg: var(--success-soft); --b-fg: var(--success-text); }
.badge-warning { --b-bg: var(--warning-soft); --b-fg: var(--warning-text); }
.badge-danger { --b-bg: var(--danger-soft); --b-fg: var(--danger-text); }
.badge-purple { --b-bg: var(--purple-soft); --b-fg: var(--purple-text); }
.badge-orange { --b-bg: var(--orange-soft); --b-fg: var(--orange-text); }
.badge-outline { background: transparent; border: 1px solid var(--border-2); color: var(--text-2); }
.badge-gold { --b-bg: linear-gradient(120deg, #fff1d6, #ffe0b0); --b-fg: #8a4b00; background: var(--b-bg); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 550; color: var(--text-2); white-space: nowrap; }
.chip .icon { width: 14px; height: 14px; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--text-3); }
.status-dot.online { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }

/* Priority glyph */
.prio { width: 14px; height: 14px; flex-shrink: 0; }
.prio rect.on { fill: currentColor; }
.prio rect.off { fill: currentColor; opacity: .22; }
.prio-urgent { color: var(--danger); }
.prio-high { color: var(--orange); }
.prio-normal { color: var(--text-2); }
.prio-low { color: var(--text-3); }
.prio-label { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); white-space: nowrap; }

/* --------------------------------------------------------------------------
   Avatars & product tiles
   -------------------------------------------------------------------------- */
.avatar {
  --size: 32px;
  width: var(--size); height: var(--size); border-radius: 50%; flex-shrink: 0;
  display: inline-grid; place-items: center; font-size: calc(var(--size) * .38); font-weight: 650; letter-spacing: .01em; color: #fff;
  background: linear-gradient(140deg, hsl(var(--h, 250) 78% 64%), hsl(calc(var(--h, 250) + 38) 70% 48%));
  text-shadow: 0 1px 1px rgba(0, 0, 0, .12); user-select: none;
}
.avatar.xs { --size: 20px; font-size: 9px; }
.avatar.sm { --size: 24px; }
.avatar.md { --size: 36px; }
.avatar.lg { --size: 44px; }
.avatar.xl { --size: 56px; }
.avatar-stack { display: inline-flex; }
.avatar-stack > * + * { margin-left: -8px; }
.avatar-stack > * { box-shadow: 0 0 0 2px var(--surface); }
.avatar-empty { background: var(--surface-3); color: var(--text-3); border: 1px dashed var(--border-2); text-shadow: none; }

.p-icon {
  --accent: #6a55fa; --s: 36px;
  width: var(--s); height: var(--s); border-radius: calc(var(--s) * .3); flex-shrink: 0; display: inline-grid; place-items: center;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.p-icon .icon { width: 52%; height: 52%; }
.p-icon.xs { --s: 22px; border-radius: 6px; }
.p-icon.sm { --s: 28px; }
.p-icon.lg { --s: 48px; }
.p-icon.xl { --s: 64px; }
.p-icon.solid { color: #fff; background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 88%, #fff), color-mix(in srgb, var(--accent) 80%, #000)); box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--accent) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25); }

/* Health ring */
.ring { --size: 40px; position: relative; width: var(--size); height: var(--size); display: inline-grid; place-items: center; flex-shrink: 0; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.2; }
.ring .ring-track { stroke: var(--surface-3); }
.ring .ring-value { stroke-linecap: round; transition: stroke-dasharray .6s var(--ease); }
.ring b { font-size: calc(var(--size) * .32); font-weight: 700; font-variant-numeric: tabular-nums; }
.ring-success .ring-value { stroke: var(--success); }
.ring-warning .ring-value { stroke: var(--warning); }
.ring-danger .ring-value { stroke: var(--danger); }
.ring-gray .ring-value { stroke: var(--text-3); }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); min-height: 54px; }
.card-head.no-border { border-bottom: 0; padding-bottom: 4px; }
.card-title { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.card-title .icon { width: 16px; height: 16px; color: var(--text-3); }
.card-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--accent-text); }
.card-link .icon { width: 14px; height: 14px; transition: transform .15s var(--ease); }
.card-link:hover .icon { transform: translateX(2px); }
.card-interactive { transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease); }
.card-interactive:hover { border-color: var(--border-2); box-shadow: var(--shadow-md); transform: translateY(-1px); }

/* Description list */
.dl { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 10px 14px; font-size: 13.5px; }
.dl dt { color: var(--text-3); }
.dl dd { color: var(--text); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* List rows */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
a.list-row { transition: background .12s var(--ease); }
a.list-row:hover { background: var(--hover); }
.list-row .meta { font-size: 12.5px; color: var(--text-3); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 9px 14px; white-space: nowrap;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table th:first-child, .table td:first-child { padding-left: 18px; }
.table th:last-child, .table td:last-child { padding-right: 18px; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s var(--ease); }
.table tbody tr:hover td { background: var(--hover); }
.table tr[data-href] { cursor: pointer; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .check-cell { width: 36px; padding-right: 0; }
.table tr.is-selected td { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.table-compact td { padding-top: 8px; padding-bottom: 8px; }
.cell-title { font-weight: 600; color: var(--text); display: block; }
.cell-sub { font-size: 12.5px; color: var(--text-3); display: block; margin-top: 1px; }
.cell-flex { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* --------------------------------------------------------------------------
   Tabs & segmented control
   -------------------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; font-size: 13.5px; font-weight: 600;
  color: var(--text-3); white-space: nowrap; transition: color .15s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.tab .count { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.tab.active .count { background: var(--accent-soft); color: var(--accent-text); }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 11px; }
.seg > a, .seg > button, .seg > label { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all .15s var(--ease); white-space: nowrap; }
.seg > a:hover, .seg > button:hover, .seg > label:hover { color: var(--text); }
.seg > .active, .seg > [aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg .icon { width: 15px; height: 15px; }

/* --------------------------------------------------------------------------
   Dropdowns
   -------------------------------------------------------------------------- */
.dd { position: relative; display: inline-flex; }
.dd-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 220px; max-height: min(420px, 70vh); overflow-y: auto;
  padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-4px) scale(.98); transform-origin: top left;
  transition: opacity .14s var(--ease), transform .14s var(--ease), visibility 0s linear .14s;
}
.dd-menu.right { left: auto; right: 0; transform-origin: top right; }
.dd-menu.up { top: auto; bottom: calc(100% + 6px); transform-origin: bottom left; }
.dd.open > .dd-menu { opacity: 1; visibility: visible; transform: none; transition: opacity .14s var(--ease), transform .14s var(--ease); }
.dd-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text); text-align: left; cursor: pointer; white-space: nowrap;
}
.dd-item:hover, .dd-item:focus-visible { background: var(--hover); outline: none; }
.dd-item .icon { width: 16px; height: 16px; color: var(--text-3); }
.dd-item.danger { color: var(--danger-text); }
.dd-item.danger .icon { color: currentColor; }
.dd-item .meta { margin-left: auto; font-size: 12px; color: var(--text-3); }
.dd-item.active { background: var(--accent-soft); color: var(--accent-text); }
.dd-sep { height: 1px; background: var(--border); margin: 6px -6px; }
.dd-label { padding: 8px 10px 4px; font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.dd-search { padding: 4px 4px 6px; }

/* --------------------------------------------------------------------------
   Modal (native <dialog>)
   -------------------------------------------------------------------------- */
dialog.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--border);
  border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-xl); overflow: visible;
}
dialog.modal.wide { width: min(760px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(8, 10, 20, .45); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: modal-in .22s var(--ease); }
dialog.modal[open]::backdrop { animation: fade-in .22s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 6px; }
.modal-title { font-size: 17px; font-weight: 700; letter-spacing: -.015em; }
.modal-sub { font-size: 13.5px; color: var(--text-2); margin-top: 4px; }
.modal-body { padding: 14px 22px 20px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.modal-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 14px; }
.modal-icon .icon { width: 22px; height: 22px; }

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */
.toasts { position: fixed; z-index: 1000; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; pointer-events: none; max-width: calc(100vw - 40px); }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 11px; width: 380px; max-width: 100%; padding: 13px 14px;
  background: var(--ink-900); color: #f2f3f8; border-radius: 14px; box-shadow: 0 20px 44px -12px rgba(8, 10, 20, .5), inset 0 0 0 1px rgba(255, 255, 255, .06);
  font-size: 13.5px; line-height: 1.45; animation: toast-in .35s var(--ease-spring);
}
[data-theme="dark"] .toast { background: #1c2133; }
.toast.leaving { animation: toast-out .25s var(--ease) forwards; }
.toast-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.toast-icon .icon { width: 14px; height: 14px; }
.toast-success .toast-icon { background: rgba(14, 159, 110, .22); color: #4cd89b; }
.toast-error .toast-icon { background: rgba(229, 72, 77, .22); color: #ff8a8e; }
.toast-info .toast-icon { background: rgba(139, 123, 255, .22); color: #b4a9ff; }
.toast-warning .toast-icon { background: rgba(224, 138, 0, .22); color: #fbbd52; }
.toast-text { flex: 1; padding-top: 1px; }
.toast-close { color: rgba(255, 255, 255, .45); padding: 2px; border-radius: 6px; }
.toast-close:hover { color: #fff; background: rgba(255, 255, 255, .08); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* --------------------------------------------------------------------------
   Tooltip (CSS only)
   -------------------------------------------------------------------------- */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translate(-50%, 4px);
  padding: 6px 9px; border-radius: 8px; background: var(--ink-900); color: #fff; font-size: 12px; font-weight: 500; line-height: 1.3;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s var(--ease), transform .12s var(--ease); z-index: 80;
  box-shadow: 0 8px 20px -6px rgba(8, 10, 20, .4);
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: .25s; }
[data-tip-pos="bottom"]::after { bottom: auto; top: calc(100% + 8px); transform: translate(-50%, -4px); }
[data-tip-pos="right"]::after { left: calc(100% + 8px); bottom: 50%; transform: translate(-4px, 50%); }
[data-tip-pos="right"]:hover::after { transform: translate(0, 50%); }

/* --------------------------------------------------------------------------
   Alerts, callouts, progress, empty states, pager
   -------------------------------------------------------------------------- */
.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); font-size: 13.5px; line-height: 1.5; border: 1px solid transparent; }
.alert .icon { width: 18px; height: 18px; margin-top: 1px; }
.alert-title { font-weight: 650; }
.alert-info { background: var(--info-soft); color: var(--info-text); border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success-text); border-color: color-mix(in srgb, var(--success) 22%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning-text); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert-danger { background: var(--danger-soft); color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.alert-brand { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }

.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .6s var(--ease); }
.progress.success > span { background: var(--success); }
.progress.warning > span { background: var(--warning); }
.progress.danger > span { background: var(--danger); }

.empty { text-align: center; padding: 48px 24px; }
.empty-art { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px; display: grid; place-items: center; color: var(--accent-text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent); position: relative; }
.empty-art::before { content: ''; position: absolute; inset: -8px; border-radius: 22px; border: 1px dashed color-mix(in srgb, var(--accent) 25%, transparent); }
.empty-art .icon { width: 24px; height: 24px; }
.empty h3 { font-size: 15.5px; font-weight: 650; }
.empty p { color: var(--text-2); font-size: 13.5px; margin: 6px auto 0; max-width: 380px; }
.empty .btn { margin-top: 16px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); }
.pager-links { display: flex; gap: 4px; }
.pager-btn { min-width: 30px; height: 30px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--text-2); border: 1px solid transparent; }
.pager-btn .icon { width: 15px; height: 15px; }
a.pager-btn:hover { background: var(--hover); color: var(--text); }
.pager-btn.active { border-color: var(--border-2); background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.pager-btn.disabled { opacity: .35; }
.pager-gap { padding: 0 4px; align-self: center; }

.divider-text { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-3); }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Skeleton shimmer */
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--hover) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* --------------------------------------------------------------------------
   KPI tiles
   -------------------------------------------------------------------------- */
.kpi { position: relative; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; overflow: hidden; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 13px; font-weight: 550; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.kpi-label .icon { width: 15px; height: 15px; color: var(--text-3); }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.025em; line-height: 1.1; color: var(--text); }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; }
.kpi-note { font-size: 12.5px; color: var(--text-3); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.delta .icon { width: 13px; height: 13px; }
.delta.good { color: var(--success-text); }
.delta.bad { color: var(--danger-text); }
.delta.flat { color: var(--text-3); }
.kpi-hero .kpi-value { font-size: 34px; }

.spark { position: relative; display: inline-block; width: 88px; height: 26px; flex-shrink: 0; }
.spark svg { width: 100%; height: 100%; overflow: visible; }
.spark polyline { fill: none; stroke: var(--spark); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark i { position: absolute; right: -3px; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--series-1); box-shadow: 0 0 0 2px var(--surface); }

/* --------------------------------------------------------------------------
   Charts
   -------------------------------------------------------------------------- */
.chart { position: relative; margin: 0; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; font-size: 12.5px; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.chart-body { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
.chart-y { position: relative; min-width: 34px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chart-y span { position: absolute; right: 0; transform: translateY(50%); white-space: nowrap; line-height: 1; }
.chart-plot { position: relative; min-width: 0; }
.chart-grid { position: absolute; inset: 0; pointer-events: none; }
.chart-grid i { position: absolute; left: 0; right: 0; height: 1px; background: var(--chart-grid); }
.chart-grid i.base { background: var(--chart-base); }
.chart-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: var(--c); opacity: .10; }
.chart-dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.chart-crosshair { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--chart-base); pointer-events: none; }
.chart-hover-dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.chart-x { position: relative; height: 22px; margin-top: 8px; margin-left: calc(34px + 10px); font-size: 11.5px; color: var(--text-3); display: flex; }
.chart-x span { flex: 1; text-align: center; white-space: nowrap; }
.chart-x.point span { position: absolute; top: 0; flex: none; }
.chart-x:not(.point) span { overflow: visible; text-align: center; }
.chart-cols { position: absolute; inset: 0; display: flex; align-items: stretch; }
.chart-col { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; min-width: 0; padding: 0 2px; }
.chart-bar { width: min(20px, 42%); min-height: 0; background: var(--c); border-radius: 4px 4px 0 0; transition: filter .12s var(--ease), opacity .12s var(--ease); cursor: default; outline-offset: 1px; }
.chart-bar:hover, .chart-bar:focus-visible { filter: brightness(1.12); }
.chart-cols:hover .chart-bar:not(:hover) { opacity: .75; }
.chart-tooltip {
  position: absolute; z-index: 20; min-width: 130px; padding: 9px 11px; border-radius: 10px; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 12.5px; white-space: nowrap;
}
.chart-tooltip .tt-label { color: var(--text-3); font-size: 11.5px; margin-bottom: 5px; font-weight: 550; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 8px; }
.chart-tooltip .tt-row + .tt-row { margin-top: 3px; }
.chart-tooltip .tt-key { width: 12px; height: 2px; border-radius: 2px; background: var(--c); }
.chart-tooltip .tt-value { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tooltip .tt-name { color: var(--text-2); }
.chart-table { display: none; width: 100%; font-size: 13px; border-collapse: collapse; }
.chart-table th, .chart-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.chart-table th { color: var(--text-3); font-weight: 600; font-size: 12px; }
.chart-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.chart-table caption { text-align: left; font-size: 12px; color: var(--text-3); padding-bottom: 6px; }
.chart.show-table > :not(.chart-table) { display: none !important; }
.chart.show-table .chart-table { display: table; }
.chart-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 180px; color: var(--text-3); font-size: 13px; }
.chart-empty .icon { width: 22px; height: 22px; }

.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(96px, 34%) minmax(0, 1fr) auto; align-items: center; gap: 12px; font-size: 13px; }
.hbar-label { min-width: 0; color: var(--text); font-weight: 550; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-label small { color: var(--text-3); font-weight: 450; margin-left: 2px; }
.hbar-track { position: relative; height: 18px; display: flex; align-items: center; }
.hbar { display: block; height: 14px; border-radius: 0 4px 4px 0; background: var(--c); transition: width .7s var(--ease), filter .12s var(--ease); }
.hbar:hover, .hbar:focus-visible { filter: brightness(1.1); }
.hbar-value { font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; text-align: right; min-width: 56px; }

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */
.md { font-size: 15px; line-height: 1.72; color: var(--text-2); }
.md > * + * { margin-top: 14px; }
.md h2 { font-size: 20px; color: var(--text); margin-top: 30px; letter-spacing: -.02em; scroll-margin-top: 90px; }
.md h3 { font-size: 16.5px; color: var(--text); margin-top: 24px; }
.md ul, .md ol { padding-left: 22px; }
.md li + li { margin-top: 6px; }
.md li::marker { color: var(--text-3); }
.md strong { color: var(--text); font-weight: 650; }
.md code { font-family: var(--font-mono); font-size: .88em; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text); border: 1px solid var(--border); }
.md a { color: var(--accent-text); font-weight: 550; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
.md blockquote { padding: 4px 0 4px 18px; border-left: 3px solid var(--brand-300); color: var(--text); font-style: italic; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
.md-table { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--r-md); }
.md-table table { width: 100%; border-collapse: collapse; font-size: .92em; line-height: 1.5; }
.md-table th, .md-table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.md-table th { background: var(--surface-3); color: var(--text); font-weight: 650; white-space: nowrap; }
.md-table tbody tr:last-child td { border-bottom: 0; }
.md-table td:first-child { color: var(--text); font-weight: 550; }
.md-figure { margin: 24px 0; }
.md-figure img { display: block; width: 100%; height: auto; border-radius: var(--r-lg); border: 1px solid var(--border); }
.md-figure figcaption { margin-top: 8px; font-size: 13.5px; color: var(--text-3); text-align: center; }
.md-callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); font-size: 14px; border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent); }
.md-callout::before { content: '💡'; }

.copy-btn.copied .icon { color: var(--success); }
.stars { display: inline-flex; gap: 2px; color: #f5a524; }
.stars .icon { width: 14px; height: 14px; fill: currentColor; }
.stars .off { color: var(--border-2); }

.logo-mark { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: -.035em; line-height: 1; color: var(--text); white-space: nowrap; }
.logo-mark svg { width: 32px; height: 32px; flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(106, 85, 250, .28)); }
.logo-mark b { font-weight: 800; background-image: linear-gradient(100deg, #6b57ff 0%, #9b4df0 50%, #f7743a 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-i { position: relative; display: inline-block; }
.logo-i::after { content: ''; position: absolute; left: 50%; top: .075em; width: .21em; height: .21em; margin-left: -.105em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff7da, #ffd166 45%, #ff9a1f); box-shadow: 0 0 .2em rgba(255, 176, 50, .6); }
.logo-light, [data-theme="dark"] .logo-mark { color: #fff; }
.logo-light b, [data-theme="dark"] .logo-mark b { background-image: linear-gradient(100deg, #b7aaff 0%, #dca8ff 45%, #ffab70 100%); }
.logo-light svg, [data-theme="dark"] .logo-mark svg { filter: drop-shadow(0 6px 16px rgba(123, 97, 255, .45)); }

@media (max-width: 640px) {
  .alert { flex-wrap: wrap; }
  .alert > .grow { flex: 1 1 calc(100% - 30px); }
  .alert > .btn { margin-left: 30px; }
}
