/* Kutsik demo kit — общая основа наших демо. Правится здесь, а не копиями в демо.
   Акцент переопределяется в самом демо: :root { --acc: …; --acc-ink: …; --acc-soft: … } */
:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #0f172a;
  --mute: #64748b;
  --line: #e2e8f0;
  --acc: #0f766e;
  --acc-ink: #ffffff;
  --acc-soft: #ecfdf5;
  --dark: #0f172a;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #dc2626;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --panel: #121a2b; --ink: #e8edf6; --mute: #94a3b8; --line: #243049;
    --dark: #070c17; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --panel: #121a2b; --ink: #e8edf6; --mute: #94a3b8; --line: #243049;
  --dark: #070c17; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--acc); }
h1, h2, h3 { line-height: 1.18; margin: 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.num { font-variant-numeric: tabular-nums; }
.mute { color: var(--mute); }
.hint { color: var(--mute); font-size: 13.5px; }

/* плашка «это демо» */
.k-note { background: var(--acc-soft); border-bottom: 1px solid var(--line); font-size: 13.5px; padding: 7px 0; }

/* шапка с переключателем ролей/режимов */
.k-top { position: sticky; top: 0; z-index: 30; background: var(--panel); border-bottom: 1px solid var(--line); }
.k-top .in { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.k-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .2px; }
.k-seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.k-seg button { border: 0; background: none; padding: 8px 14px; border-radius: 8px; color: var(--mute); font-weight: 650; min-height: 40px; }
.k-seg button[aria-pressed="true"] { background: var(--acc); color: var(--acc-ink); }

/* кнопки */
.btn { border: 1px solid var(--acc); background: var(--acc); color: var(--acc-ink); font-weight: 650; border-radius: 10px;
  padding: 10px 16px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.ghost { background: none; color: var(--acc); }
.btn.quiet { background: var(--bg); border-color: var(--line); color: var(--ink); font-weight: 600; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* карточки, таблицы, формы */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.k-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 14px; }
.k-tabs button { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 9px 14px; font-weight: 650; min-height: 42px; }
.k-tabs button[aria-pressed="true"] { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.tbl-wrap { overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--mute); font-weight: 700; white-space: nowrap; }
td.r, th.r { text-align: right; }
tbody tr:hover { background: var(--bg); }
td input, td select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); min-height: 38px; }
label.f { display: block; margin-bottom: 12px; }
label.f span { display: block; font-size: 13.5px; color: var(--mute); margin-bottom: 4px; }
label.f input, label.f select, label.f textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); min-height: 44px; }
label.f textarea { resize: vertical; line-height: 1.45; }
label.f.bad input, label.f.bad select, label.f.bad textarea { border-color: var(--bad); }
label.f em { display: block; color: var(--bad); font-size: 13.5px; font-style: normal; margin-top: 4px; font-weight: 650; }
.k-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.k-counts > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 14px; }
.k-counts b { display: block; font-size: 23px; font-weight: 800; }
.k-counts span { color: var(--mute); font-size: 13px; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.tag.ok { color: var(--ok); border-color: color-mix(in oklab, var(--ok) 40%, var(--line)); }
.tag.bad { color: var(--bad); border-color: color-mix(in oklab, var(--bad) 40%, var(--line)); }
.tag.warn { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 40%, var(--line)); }

/* модалка и шторка */
.scrim { position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 40; }
.modal { position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(820px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); overflow: auto;
  background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); }
.drawer { position: fixed; z-index: 41; right: 0; top: 0; height: 100dvh; width: min(430px, 100vw);
  background: var(--panel); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.dhead { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.dhead h2 { margin: 0; font-size: 17px; }
.dhead .x { margin-left: auto; border: 0; background: none; font-size: 24px; line-height: 1; color: var(--mute); width: 44px; height: 44px; }
.dbody { padding: 14px 16px; overflow: auto; flex: 1; }
.dfoot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); }

/* тост, автопоказ, «що тут важливо» */
.toast { position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%); z-index: 70;
  background: var(--ink); color: var(--bg); padding: 11px 15px; border-radius: 11px; font-weight: 650;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.tour { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 60;
  width: min(660px, calc(100vw - 24px)); background: var(--ink); color: var(--bg); border-radius: 12px;
  padding: 12px 14px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow); }
.tour p { margin: 0; flex: 1; font-size: 14.5px; }
.tour button { border: 1px solid currentColor; background: none; color: inherit; border-radius: 9px; padding: 7px 11px; font-weight: 600; }
.k-tour-btn { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 50; box-shadow: var(--shadow); }
.why { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin-top: 16px; }
.why > div { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.why b { display: block; margin-bottom: 4px; }
.why span { color: var(--mute); font-size: 14px; }
.k-foot { padding: 24px 0 calc(90px + env(safe-area-inset-bottom)); color: var(--mute); font-size: 13.5px; }

@media (max-width: 900px) {
  .k-top .in { flex-wrap: wrap; }
  .btn.sm { min-height: 44px; }
  .modal { width: 100vw; height: 100dvh; max-height: none; top: 0; left: 0; transform: none; border-radius: 0; }
  .k-tabs button { flex: 1; }
}
