/* Demo kit — shared look for every dummy demo in the portfolio.
   rem only (16px = 1rem). Icons: Material Symbols Rounded. No native select, no browser dialogs. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,300..600,0..1,0&display=swap');

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #e4e6eb;
  --line-strong: #cfd3da;
  --text: #16181d;
  --muted: #6b7280;
  --accent: #2f6bff;
  --accent-soft: #e8efff;
  --accent-text: #ffffff;
  --ok: #16a34a;
  --ok-soft: #e7f6ec;
  --warn: #d97706;
  --warn-soft: #fdf3e2;
  --bad: #dc2626;
  --bad-soft: #fdeaea;
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --shadow: 0 0.0625rem 0.125rem rgb(16 24 40 / 6%), 0 0.25rem 0.75rem rgb(16 24 40 / 6%);
  --shadow-lg: 0 1rem 3rem rgb(16 24 40 / 18%);
  --font: 'Inter', system-ui, sans-serif;
  --gutter: 1.5rem;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a20;
  --surface-2: #1d2128;
  --line: #2a2f38;
  --line-strong: #3a404b;
  --text: #eef0f4;
  --muted: #9aa1ad;
  --accent: #5b8cff;
  --accent-soft: #1d2a4a;
  --ok-soft: #12301f;
  --warn-soft: #3a2a10;
  --bad-soft: #3a1717;
  color-scheme: dark;
}
@media (max-width: 40rem) { :root { --gutter: 5vw; } }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.375rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 0.9375rem; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 0.75rem; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; }

.ms {
  font-family: 'Material Symbols Rounded';
  font-weight: normal; font-style: normal;
  font-size: 1.25rem; line-height: 1;
  letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap;
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
  flex: none;
}
.ms.fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* ---------- App shell ---------- */
.k-app { min-height: 100vh; display: flex; flex-direction: column; }
.k-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  height: 3.5rem; padding: 0 var(--gutter);
  background: var(--surface); border-bottom: 0.0625rem solid var(--line);
}
.k-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.9375rem; white-space: nowrap; }
.k-brand .ms { color: var(--accent); }
.k-nav { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; }
.k-nav button, .k-nav a {
  all: unset; cursor: pointer; padding: 0.4rem 0.75rem; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; white-space: nowrap;
}
.k-nav .active, .k-nav button:hover, .k-nav a:hover { color: var(--text); background: var(--surface-2); }
/* fixed controls always live on the right edge */
.k-toolbar { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.k-main { flex: 1; padding: var(--gutter); display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.k-layout { flex: 1; display: grid; grid-template-columns: 15rem 1fr; min-height: 0; }
.k-sidebar { background: var(--surface); border-right: 0.0625rem solid var(--line); padding: 1rem 0.75rem; display: flex; flex-direction: column; gap: 0.125rem; }
.k-sidebar button { all: unset; cursor: pointer; display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; }
.k-sidebar button:hover { background: var(--surface-2); color: var(--text); }
.k-sidebar button.active { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 48rem) {
  .k-layout { grid-template-columns: 1fr; }
  .k-sidebar { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 0.0625rem solid var(--line); padding: 0.5rem var(--gutter); }
  .k-sidebar button { white-space: nowrap; }
}

.k-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.k-spread { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.k-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); }

/* ---------- Surfaces ---------- */
.k-card { background: var(--surface); border: 0.0625rem solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.125rem; min-width: 0; }
.k-card > header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.75rem; }
.k-kpi .label { color: var(--muted); font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.k-kpi .value { font-size: 1.625rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 0.25rem; }
.k-kpi .delta { font-size: 0.75rem; font-weight: 600; }
.k-kpi .delta.up { color: var(--ok); } .k-kpi .delta.down { color: var(--bad); }

/* ---------- Buttons ---------- */
.k-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  height: 2.25rem; padding: 0 0.875rem; border-radius: var(--radius-sm);
  border: 0.0625rem solid var(--line-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.k-btn:hover { background: var(--surface-2); }
.k-btn:active { transform: translateY(0.0625rem); }
.k-btn .ms { font-size: 1.125rem; }
.k-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.k-btn.primary:hover { filter: brightness(1.08); }
.k-btn.ghost { border-color: transparent; background: transparent; }
.k-btn.ghost:hover { background: var(--surface-2); }
.k-btn.danger { color: var(--bad); }
.k-btn.sm { height: 1.875rem; padding: 0 0.625rem; font-size: 0.8125rem; }
.k-btn[disabled] { opacity: .5; pointer-events: none; }
.k-icon-btn { all: unset; cursor: pointer; display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: var(--radius-sm); color: var(--muted); }
.k-icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Forms ---------- */
.k-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.k-field > label, .k-label { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.k-input, .k-textarea {
  width: 100%; height: 2.25rem; padding: 0 0.75rem; font: inherit; color: var(--text);
  background: var(--surface); border: 0.0625rem solid var(--line-strong); border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.k-textarea { height: auto; min-height: 5rem; padding: 0.5rem 0.75rem; resize: vertical; }
.k-input:focus, .k-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 0.1875rem var(--accent-soft); }
.k-search { position: relative; }
.k-search .ms { position: absolute; left: 0.625rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.125rem; pointer-events: none; }
.k-search .k-input { padding-left: 2.25rem; }
.k-switch { position: relative; display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.k-switch input { appearance: none; width: 2.25rem; height: 1.25rem; border-radius: 1rem; background: var(--line-strong); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.k-switch input::after { content: ''; position: absolute; top: 0.125rem; left: 0.125rem; width: 1rem; height: 1rem; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: var(--shadow); }
.k-switch input:checked { background: var(--accent); }
.k-switch input:checked::after { transform: translateX(1rem); }
input[type="range"].k-range { width: 100%; accent-color: var(--accent); }

/* custom select / combo (see kit.js) */
.k-select { position: relative; min-width: 10rem; }
.k-select-btn {
  width: 100%; height: 2.25rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0 0.5rem 0 0.75rem; font: inherit; color: var(--text); text-align: left; cursor: pointer;
  background: var(--surface); border: 0.0625rem solid var(--line-strong); border-radius: var(--radius-sm);
}
.k-select-btn:focus-visible, .k-select.open .k-select-btn { outline: none; border-color: var(--accent); box-shadow: 0 0 0 0.1875rem var(--accent-soft); }
.k-select-btn span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-select-btn .placeholder { color: var(--muted); }
.k-pop {
  position: absolute; z-index: 50; top: calc(100% + 0.25rem); left: 0; right: 0; min-width: 12rem;
  background: var(--surface); border: 0.0625rem solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 0.25rem; max-height: 18rem; overflow: auto; display: none;
}
.k-select.open .k-pop { display: block; }
.k-pop .k-pop-search { margin: 0.125rem 0.125rem 0.375rem; width: calc(100% - 0.25rem); }
.k-pop .k-pop-head { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 0.5rem 0.625rem 0.25rem; }
.k-opt { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.625rem; border-radius: 0.375rem; cursor: pointer; }
.k-opt:hover, .k-opt.hl { background: var(--surface-2); }
.k-opt.sel { color: var(--accent); font-weight: 600; }
.k-opt.add { color: var(--accent); font-weight: 600; border-top: 0.0625rem solid var(--line); border-radius: 0 0 0.375rem 0.375rem; margin-top: 0.25rem; }
.k-opt-empty { padding: 0.5rem 0.625rem; color: var(--muted); }

/* ---------- Data display ---------- */
.k-table-wrap { overflow-x: auto; border: 0.0625rem solid var(--line); border-radius: var(--radius); background: var(--surface); }
.k-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.k-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.75rem; padding: 0.625rem 0.875rem; background: var(--surface-2); border-bottom: 0.0625rem solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.k-table td { padding: 0.625rem 0.875rem; border-bottom: 0.0625rem solid var(--line); vertical-align: middle; }
.k-table tr:last-child td { border-bottom: 0; }
.k-table tbody tr:hover td { background: var(--surface-2); }
.k-table .r { text-align: right; font-variant-numeric: tabular-nums; }
.k-pill { display: inline-flex; align-items: center; gap: 0.25rem; height: 1.375rem; padding: 0 0.5rem; border-radius: 1rem; font-size: 0.75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.k-pill.ok { background: var(--ok-soft); color: var(--ok); }
.k-pill.warn { background: var(--warn-soft); color: var(--warn); }
.k-pill.bad { background: var(--bad-soft); color: var(--bad); }
.k-pill.accent { background: var(--accent-soft); color: var(--accent); }
.k-avatar { width: 2rem; height: 2rem; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 0.75rem; color: #fff; background: var(--accent); flex: none; }
.k-tabs { display: flex; gap: 0.25rem; border-bottom: 0.0625rem solid var(--line); overflow-x: auto; scrollbar-width: none; }
.k-tabs button { all: unset; cursor: pointer; padding: 0.625rem 0.875rem; color: var(--muted); font-weight: 600; border-bottom: 0.125rem solid transparent; margin-bottom: -0.0625rem; white-space: nowrap; }
.k-tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.k-progress { height: 0.5rem; border-radius: 1rem; background: var(--surface-2); overflow: hidden; }
.k-progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s; }
.k-empty { display: grid; place-items: center; gap: 0.5rem; padding: 3rem 1rem; color: var(--muted); text-align: center; }
.k-empty .ms { font-size: 2.5rem; }

/* ---------- Dialog & toast ---------- */
dialog.k-dialog {
  border: 0; padding: 0; border-radius: var(--radius); background: var(--surface); color: var(--text);
  width: min(28rem, 92vw); box-shadow: var(--shadow-lg);
}
dialog.k-dialog::backdrop { background: rgb(10 12 16 / 45%); backdrop-filter: blur(0.125rem); }
dialog.k-dialog[open] { animation: k-pop .18s ease-out; }
.k-dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem 0.5rem; }
.k-dialog-body { padding: 0.5rem 1.25rem 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.k-dialog-foot { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.875rem 1.25rem; border-top: 0.0625rem solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
@keyframes k-pop { from { opacity: 0; transform: translateY(0.5rem) scale(.98); } }
.k-toasts { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; pointer-events: none; }
.k-toast { display: flex; align-items: center; gap: 0.5rem; background: var(--text); color: var(--bg); padding: 0.625rem 1rem; border-radius: 2rem; font-weight: 500; box-shadow: var(--shadow-lg); animation: k-pop .2s ease-out; }
.k-toast .ms { font-size: 1.125rem; }

/* Little "dummy data" marker every demo shows */
.k-demo-badge { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); padding: 0.2rem 0.5rem; border-radius: 1rem; white-space: nowrap; }
.k-demo-badge .ms { font-size: 0.875rem; }

.k-hide-sm { }
@media (max-width: 40rem) { .k-hide-sm { display: none !important; } }
