/* ============================================================
   KCC Voucher Manager — shared design system
   Extracted from the UI/UX prototypes (admin, organiser, manager).
   Scanner has its own stylesheet (scanner.css).
   ============================================================ */

:root {
    --navy: #14306e;
    --navy-tint: #e8edf7;
    --navy-tint-2: #f3f6fc;
    --navy-soft: #9fb1da;
    --navy-hover: #eef1f8;

    --ink: #1c1c1e;
    --ink-2: #3a3a3c;
    --ink-3: #48484a;
    --muted: #6e6e73;
    --faint: #8e8e93;
    --faint-2: #aeaeb2;

    --bg: #f2f2f7;
    --bg-sidebar: #f7f7f9;
    --surface: #ffffff;
    --row-hover: #f5f5f7;
    --fill: rgba(118, 118, 128, .12);
    --fill-solid: #e9e9ee;
    --line: #e5e5ea;
    --line-2: #ececf0;
    --line-3: #d1d1d6;

    --green: #0b5e2e;
    --green-tint: #e3f3e9;
    --amber: #f2b300;
    --amber-tint: #fff6db;
    --amber-ink: #5c4300;
    --amber-dark: #3d2c00;
    --amber-bar: #b37f00;
    --amber-bar-2: #f2c94c;
    --red: #9e1218;
    --red-tint: #fde8e9;
    --grey-tint: #efeff4;
    --blue: #2650c8;
    --blue-tint: #e6edff;

    --radius-card: 18px;
    --radius-ctl: 10px;
    --radius-modal: 22px;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .04), 0 0 0 .5px rgba(0, 0, 0, .05);
    --shadow-pop: 0 12px 30px -10px rgba(14, 27, 61, .25);
    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --mono: ui-monospace, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); }
a:hover { color: var(--ink); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed !important; pointer-events: none; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; }
[hidden] { display: none !important; }

.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; }
.bold { font-weight: 700; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.stack-2 { display: flex; flex-direction: column; gap: 2px; }
.row { display: flex; align-items: center; gap: 12px; }
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.ml-auto { margin-left: auto; }
.mt-auto { margin-top: auto; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }

/* ── Admin shell ─────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 236px; flex-shrink: 0; background: var(--bg-sidebar);
    border-right: 1px solid rgba(0, 0, 0, .08);
    display: flex; flex-direction: column; gap: 26px;
    padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar__brand { display: flex; flex-direction: column; gap: 8px; padding: 0 8px; text-decoration: none; }
.sidebar__brand img { height: 46px; width: auto; align-self: flex-start; }
.sidebar__brand span, .eyebrow {
    font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar__nav a {
    height: 40px; border-radius: 10px; color: var(--ink-2); font-size: 14px; font-weight: 600;
    display: flex; align-items: center; gap: 12px; padding: 0 12px; text-decoration: none;
}
.sidebar__nav a:hover { background: var(--navy-hover); color: var(--ink-2); }
.sidebar__nav a.is-active { background: var(--navy-tint); color: var(--navy); }
.sidebar__nav svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar__foot { margin-top: auto; padding: 12px; border-radius: 10px; background: var(--bg); display: flex; flex-direction: column; gap: 2px; }
.sidebar__foot b { font-size: 13px; }
.sidebar__foot span { font-size: 13px; color: var(--muted); }

.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 60px; background: rgba(255, 255, 255, .78);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    display: flex; align-items: center; gap: 20px; padding: 0 28px; position: sticky; top: 0; z-index: 20;
}
.topbar .topbar__menu { display: none; }
.topbar__clock { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.who { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; position: relative; }
.who__text { display: flex; flex-direction: column; line-height: 1.2; }
.who__text b { font-weight: 600; }
.who__text span { font-size: 12px; color: var(--muted); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.avatar--soft { background: var(--navy-tint); color: var(--navy); width: 38px; height: 38px; font-weight: 700; }
.menu-pop {
    position: absolute; right: 0; top: 46px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow-pop); min-width: 200px; overflow: hidden; z-index: 30;
}
.menu-pop a, .menu-pop button {
    display: block; width: 100%; text-align: left; padding: 11px 14px; border: none; background: #fff;
    color: var(--ink); text-decoration: none; font-size: 14px; cursor: pointer; border-top: 1px solid var(--line-2);
}
.menu-pop a:first-child { border-top: none; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--row-hover); }

.main { padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 22px; max-width: 1440px; width: 100%; }

/* Global search */
.search { position: relative; flex: 1; max-width: 440px; }
.search svg { position: absolute; left: 12px; top: 12px; }
.search input {
    width: 100%; height: 40px; border-radius: 10px; border: 1px solid transparent; background: var(--fill);
    padding: 0 12px 0 36px; font-size: 14px; outline: none;
}
.search input:focus { border-color: var(--navy); background: #fff; }
.search__results {
    position: absolute; top: 46px; left: 0; right: 0; background: #fff; border: 1px solid var(--line);
    border-radius: 10px; box-shadow: var(--shadow-pop); overflow: hidden; z-index: 30;
}
.search__results a {
    display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; text-decoration: none;
    color: var(--ink); border-bottom: 1px solid var(--line-2);
}
.search__results a:hover, .search__results a.is-focus { background: #f4f6fb; }
.search__results .empty-line { padding: 14px; color: var(--muted); }

/* ── Top-nav shell (organiser portal, restaurant manager) ── */
.tophead {
    background: rgba(255, 255, 255, .78);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, .08); position: sticky; top: 0; z-index: 20;
}
.tophead__inner { max-width: 1160px; margin: 0 auto; padding: 16px 24px 14px; display: flex; flex-direction: column; gap: 14px; }
.tophead--wide .tophead__inner, .page--wide { max-width: 1280px; }
.tophead__bar { display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.tophead__logo { height: 40px; width: auto; }
.tophead__title { font-size: 34px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.page { max-width: 1160px; margin: 0 auto; padding: 24px 24px 56px; display: flex; flex-direction: column; gap: 20px; width: 100%; }

/* ── Page header ─────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head__title { display: flex; flex-direction: column; gap: 4px; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.h1 { margin: 0; font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.h2 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.subtitle { color: var(--muted); font-size: 15px; }
.crumbs { display: flex; gap: 8px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--navy); font-weight: 600; text-decoration: none; }

/* ── Cards ───────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.card--pad { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.card--pad-lg { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.card--clip { overflow: hidden; }
.card--outline { border: 1px solid var(--line); box-shadow: none; border-radius: 12px; }
.card--warn { border: 1px solid var(--amber); box-shadow: none; border-radius: 12px; }
.card__title { font-size: 16px; font-weight: 700; }
.card__title--lg { font-size: 17px; font-weight: 700; }
.card__head { padding: 18px 22px 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card__foot { border-top: 1px solid var(--line-2); padding-top: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.grid { display: grid; gap: 18px; }
.grid-auto-160 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; }
.grid-auto-220 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.grid-auto-300 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.grid-auto-320 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.grid-auto-360 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; }
.grid-auto-380 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.grid-1-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    height: 40px; padding: 0 16px; border-radius: 999px; border: none; background: var(--navy); color: #fff;
    font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; text-decoration: none; white-space: nowrap; transition: transform .15s, background-color .2s, opacity .2s;
}
.btn:hover { color: #fff; filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn--secondary { background: var(--fill); color: var(--ink); border-radius: var(--radius-ctl); padding: 0 14px; }
.btn--secondary:hover { color: var(--ink); background: rgba(118, 118, 128, .18); filter: none; }
.btn--ghost { background: transparent; color: var(--navy); border-radius: var(--radius-ctl); }
.btn--ghost:hover { color: var(--navy); background: var(--navy-hover); filter: none; }
.btn--outline-warn { background: #fff; color: var(--amber-dark); border: 1px solid #8a6500; border-radius: var(--radius-ctl); height: 36px; font-size: 13px; }
.btn--outline-warn:hover { color: var(--amber-dark); }
.btn--dashed { background: #fff; color: var(--navy); border: 1px dashed var(--faint-2); border-radius: var(--radius-ctl); align-self: flex-start; }
.btn--dashed:hover { color: var(--navy); background: var(--navy-tint-2); filter: none; }
.btn--danger { background: var(--red); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--md { height: 36px; padding: 0 14px; font-size: 13px; }
.btn--lg { height: 44px; padding: 0 18px; font-size: 15px; }
.btn--xl { height: 52px; font-size: 16px; }
.btn--block { width: 100%; }
.btn--icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; background: var(--fill); color: var(--ink); font-size: 18px; }
.btn--icon:hover { color: var(--ink); filter: none; background: rgba(118, 118, 128, .2); }

/* ── Badges & chips ──────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px;
    border-radius: 20px; white-space: nowrap; background: var(--grey-tint); color: var(--ink-3); line-height: 1.4;
}
.badge--lg { padding: 4px 10px; }
.badge--navy { background: var(--navy-tint); color: var(--navy); }
.badge--grey { background: var(--grey-tint); color: var(--ink-3); }
.badge--outline { background: #fff; color: var(--muted); border: 1px solid var(--line-3); }
.badge--warn, .badge--amber { background: var(--amber-tint); color: var(--amber-ink); }
.badge--red { background: var(--red-tint); color: var(--red); }
.badge--green { background: var(--green-tint); color: var(--green); }
.badge--blue { background: var(--blue-tint); color: var(--blue); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--amber .dot { background: var(--amber); }
.tag { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line-3); color: var(--ink-2); white-space: nowrap; }
.swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.swatch--empty { background: var(--fill-solid); border: 1px solid var(--line-3); }
.dot-10 { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 10px; flex-wrap: wrap; line-height: 1.45; }
.alert svg { flex-shrink: 0; }
.alert__text { flex: 1; min-width: 220px; }
.alert--warn { background: var(--amber-tint); border: 1px solid var(--amber); color: var(--amber-dark); }
.alert--closed { background: var(--grey-tint); border: 1px solid var(--line-3); color: var(--ink-3); }
.alert--info { background: var(--navy-tint); color: var(--navy); align-items: flex-start; }
.alert--error { background: var(--red-tint); border: 1px solid #f3b8bb; color: var(--red); }
.alert--success { background: var(--green-tint); border: 1px solid #b6dcc4; color: var(--green); }
.alert--secret { background: var(--amber-tint); border: 1px solid var(--amber); color: var(--amber-dark); font-size: 13px; font-weight: 600; }
.field-error { display: flex; gap: 8px; align-items: flex-start; color: var(--red); font-size: 13px; font-weight: 600; line-height: 1.4; }

/* ── Segmented control (tabs) ────────────────────────────── */
.seg {
    display: inline-flex; background: var(--fill); border-radius: 9px; padding: 2px; gap: 2px;
    align-self: flex-start; overflow-x: auto; max-width: 100%;
}
.seg__item {
    height: 32px; padding: 0 16px; border: none; border-radius: 7px; background: transparent; color: var(--ink-2);
    font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center;
    gap: 6px; text-decoration: none;
}
.seg__item:hover { color: var(--ink); }
.seg__item.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
.seg__item .count { color: var(--muted); }
.seg--lg .seg__item { font-size: 14px; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    font-size: 13px; font-weight: 600; color: var(--muted); text-align: left; padding: 12px 16px;
    border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table .right, .table th.right { text-align: right; }
.table tr.is-link { cursor: pointer; }
.table tr.is-link:hover td { background: var(--row-hover); }
.table tfoot td, .table tr.total td { background: var(--row-hover); font-weight: 700; border-bottom: none; padding-top: 13px; padding-bottom: 13px; }
.table--compact td { padding-top: 10px; padding-bottom: 10px; }
.table--min-720 { min-width: 720px; }
.table--min-820 { min-width: 820px; }
.table--min-900 { min-width: 900px; }
.table--min-960 { min-width: 960px; }
.table th a { color: inherit; text-decoration: none; }
.table th a .arrow { color: var(--navy); }
.cell-title { display: flex; flex-direction: column; gap: 2px; }
.cell-title b, .cell-title .title { font-weight: 600; font-size: 14px; }
.cell-title span { font-size: 12px; color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; color: var(--muted); font-size: 13px; }

/* ── Quota bar & stats ───────────────────────────────────── */
.qbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--fill-solid); }
.qbar--sm { height: 8px; border-radius: 4px; }
.qbar--lg { height: 16px; border-radius: 10px; }
.qbar > span { display: block; height: 100%; }
.qbar .q-red { background: var(--navy); }
.qbar .q-alloc { background: var(--navy-soft); }
.qbar--warn .q-red { background: var(--amber-bar); }
.qbar--warn .q-alloc { background: var(--amber-bar-2); }
.qbar--closed .q-red { background: var(--faint); }
.qbar--closed .q-alloc { background: #c5cad5; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend .q-red { background: var(--navy); }
.legend .q-alloc { background: var(--navy-soft); }
.qbar--warn + .legend .q-red, .legend--warn .q-red { background: var(--amber-bar); }
.legend--warn .q-alloc { background: var(--amber-bar-2); }
.legend--closed .q-red { background: var(--faint); }
.legend--closed .q-alloc { background: #c5cad5; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat__label { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat__value { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat__value--xl { font-size: 34px; }
.stat__value--xxl { font-size: 40px; line-height: 1; }
.stat__value small { font-size: 15px; font-weight: 600; color: var(--muted); }
.stat__note { font-size: 13px; color: var(--muted); }

.minibar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.minibar--6 { height: 6px; border-radius: 3px; }
.minibar > span { display: block; height: 100%; background: var(--navy); }
.minibar--grey > span { background: var(--faint); }

/* Simple vertical bar chart */
.vchart { display: grid; gap: 6px; align-items: end; border-bottom: 1px solid var(--line-3); }
.vchart__col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; }
.vchart__bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--navy); }
.vchart__labels { display: grid; gap: 6px; }
.vchart__labels span { font-size: 11px; color: var(--muted); text-align: center; }

/* ── Line lists (label / value rows) ─────────────────────── */
.lines { display: flex; flex-direction: column; }
.line {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0;
    border-top: 1px solid var(--line-2);
}
.line:first-child { border-top: none; }
.lines--topped .line:first-child { border-top: 1px solid var(--line-2); }
.line__value { color: var(--ink-2); text-align: right; }
.line--total { border-top: 2px solid var(--ink); padding-top: 14px; }
.keyrow { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.keyrow:last-child { border-bottom: none; }
.keyrow__body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 200px; }
.keyrow__label { font-size: 13px; font-weight: 600; color: var(--muted); }
.keyrow__value { font-family: var(--mono); font-size: 14px; word-break: break-all; }
.keyrow__note { font-size: 12px; color: var(--muted); }
.box-grey { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: var(--bg); border-radius: 10px; }
.box-grey--row { flex-direction: row; justify-content: space-between; }
.secret-box { display: flex; gap: 8px; align-items: center; padding: 12px 14px; border-radius: 10px; background: var(--ink); color: #fff; }
.secret-box code { font-family: var(--mono); font-size: 13px; flex: 1; word-break: break-all; }
.secret-box .btn { background: #fff; color: var(--ink); border-radius: 6px; height: 32px; font-size: 13px; }

/* ── Forms ───────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.field--cap { font-size: 12px; color: var(--muted); }
.field__hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.input, .select, .textarea {
    height: 42px; border-radius: var(--radius-ctl); border: 1px solid transparent; background: var(--fill);
    padding: 0 12px; font-size: 14px; font-weight: 400; color: var(--ink); outline: none; width: 100%;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--navy); background: #fff; }
.input--boxed { background: #fff; border-color: var(--line-3); }
.input.is-error { border-color: var(--red); }
.input--mono { font-family: var(--mono); text-transform: uppercase; }
.input--lg { height: 48px; font-size: 16px; padding: 0 14px; }
.input--num { text-align: center; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.select { background-color: #fff; border-color: var(--line-3); appearance: auto; }
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 64px; line-height: 1.4; }
.w-90 { width: 90px; } .w-120 { width: 120px; } .w-160 { width: 160px; } .w-320 { max-width: 320px; } .w-420 { max-width: 420px; } .w-520 { max-width: 520px; }
.check-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px;
    font-weight: 400; cursor: pointer; flex-wrap: wrap;
}
.check-row input[type=checkbox], .check-row input[type=radio], .check { width: 18px; height: 18px; accent-color: var(--navy); flex-shrink: 0; }
.check-row.is-on { border-color: var(--navy); background: var(--navy-tint-2); }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button {
    width: 44px; height: 44px; border-radius: 10px; border: none; background: var(--fill); font-size: 20px; cursor: pointer;
}
.stepper .input { width: 120px; height: 44px; background: #fff; border: 1px solid var(--line-3); }
.stepper--lg button { width: 48px; height: 48px; font-size: 22px; }
.stepper--lg .input { width: 110px; height: 48px; font-size: 20px; }
.radio-card {
    border-radius: 12px; border: 2px solid var(--line); background: #fff; padding: 14px 16px; display: flex; align-items: center;
    gap: 14px; text-align: left; cursor: pointer; color: var(--ink); font-weight: 400;
}
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card__dot {
    width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: flex; align-items: center;
    justify-content: center; flex-shrink: 0;
}
.radio-card__dot::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: transparent; }
.radio-card.is-on, .radio-card:has(input:checked) { border-color: var(--navy); background: var(--navy-tint-2); }
.radio-card.is-on .radio-card__dot, .radio-card:has(input:checked) .radio-card__dot { border-color: var(--navy); }
.radio-card.is-on .radio-card__dot::after, .radio-card:has(input:checked) .radio-card__dot::after { background: var(--navy); }

/* iOS-style switch */
.switch { display: inline-flex; align-items: center; gap: 8px; border: none; background: transparent; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink); padding: 0; }
.switch__track { width: 51px; height: 31px; border-radius: 16px; background: #e9e9eb; position: relative; display: block; transition: background .2s; flex-shrink: 0; }
.switch__track::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .2); transition: left .2s;
}
.switch.is-on .switch__track { background: var(--navy); }
.switch.is-on .switch__track::after { left: 22px; }

/* ── Wizard ──────────────────────────────────────────────── */
.steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.step { border: none; background: transparent; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; cursor: pointer; }
.step__bar { height: 4px; border-radius: 2px; background: var(--line); }
.step__label { font-size: 12px; font-weight: 600; color: var(--faint); }
.step.is-done .step__bar, .step.is-current .step__bar { background: var(--navy); }
.step.is-done .step__label { color: var(--navy); }
.step.is-current .step__label { color: var(--ink); }
.wizard-pane { display: flex; flex-direction: column; gap: 18px; }
.wizard-pane__title { font-size: 18px; font-weight: 700; }

/* ── Overlays: drawer + modal ────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(8, 12, 24, .45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; animation: kccFade .2s ease; }
.overlay--drawer { background: rgba(8, 12, 24, .4); z-index: 40; justify-content: flex-end; align-items: stretch; padding: 0; }
.drawer { width: 460px; max-width: 100%; height: 100%; background: #fff; overflow: auto; display: flex; flex-direction: column; animation: kccSlide .28s cubic-bezier(.32, .72, 0, 1); }
.drawer__head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer__body { padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }
.drawer__section-title { font-size: 15px; font-weight: 700; }
.drawer__loading { padding: 40px 24px; color: var(--muted); }
.modal { width: 480px; max-width: 100%; background: #fff; border-radius: var(--radius-modal); overflow: hidden; max-height: calc(100vh - 48px); display: flex; flex-direction: column; animation: kccPop .22s cubic-bezier(.2, .8, .2, 1); }
.modal--sm { width: 440px; }
.modal--md { width: 520px; }
.modal--lg { width: 720px; }
.modal__head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.modal__head--plain { border-bottom: none; padding-bottom: 0; }
.modal__title { font-size: 18px; font-weight: 700; }
.modal__body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; line-height: 1.5; }
.modal__foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.sheet-mobile { }

.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv span:first-child { font-size: 12px; color: var(--muted); }
.ent { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.ent__head { display: flex; justify-content: space-between; }
.hist { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.signature { height: 110px; border-radius: 10px; border: 1px dashed #c7c7cc; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; overflow: hidden; }
.signature img { max-height: 100%; }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
    padding: 12px 18px; border-radius: 10px; font-weight: 600; z-index: 60; box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .4);
    max-width: 90vw; text-align: center; animation: kccToast .25s cubic-bezier(.2, .8, .2, 1);
}
.toast--error { background: var(--red); }

/* ── Empty state ─────────────────────────────────────────── */
.empty { padding: 64px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.empty__title { font-size: 17px; font-weight: 700; }
.empty__text { color: var(--muted); max-width: 380px; line-height: 1.5; }

/* ── Auth pages ──────────────────────────────────────────── */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth__card { width: 420px; max-width: 100%; background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 36px 32px; display: flex; flex-direction: column; gap: 22px; }
.auth__logo { height: 58px; width: auto; align-self: center; }
.auth__title { display: flex; flex-direction: column; gap: 6px; text-align: center; }
.auth__title b { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.auth__title span { color: var(--muted); line-height: 1.45; }
.auth__foot { font-size: 13px; color: var(--muted); text-align: center; }

/* ── Docs page ───────────────────────────────────────────── */
.docs pre, .code {
    background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 16px 18px; overflow-x: auto;
    font-family: var(--mono); font-size: 13px; line-height: 1.55; margin: 0;
}
.docs h2 { font-size: 22px; margin-top: 12px; }
.docs h3 { font-size: 17px; margin-top: 6px; }
.docs p, .docs li { line-height: 1.6; color: var(--ink-2); }
.docs code:not(pre code) { font-family: var(--mono); font-size: 12.5px; background: var(--fill); padding: 1px 6px; border-radius: 5px; }
.method { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--navy-tint); color: var(--navy); }
.method--post { background: var(--green-tint); color: var(--green); }
.method--patch { background: var(--amber-tint); color: var(--amber-ink); }
.method--delete { background: var(--red-tint); color: var(--red); }

/* ── Error page ──────────────────────────────────────────── */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.error-page__code { font-size: 64px; font-weight: 700; color: var(--navy); letter-spacing: -.03em; }

/* ── Animations ──────────────────────────────────────────── */
@keyframes kccFade { from { opacity: 0 } to { opacity: 1 } }
@keyframes kccPop { from { opacity: 0; transform: scale(.96) } to { opacity: 1; transform: none } }
@keyframes kccSlide { from { transform: translateX(40px); opacity: .4 } to { transform: none; opacity: 1 } }
@keyframes kccToast { from { opacity: 0; transform: translate(-50%, 10px) } to { opacity: 1; transform: translate(-50%, 0) } }
@keyframes kccIn { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }

/* ── Print ───────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .tophead, .page-head__actions, .no-print { display: none !important; }
    .main, .page { padding: 0; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid var(--line); }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
    .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 45; transform: translateX(-100%); transition: transform .25s; box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
    .sidebar.is-open { transform: none; }
    .topbar { padding: 0 16px; gap: 12px; }
    .topbar .topbar__menu { display: inline-flex; }
    .topbar__clock, .who__text { display: none; }
    .main { padding: 20px 16px 40px; }
    .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .tophead__inner, .page { padding-left: 16px; padding-right: 16px; }
    .tophead__title { font-size: 28px; }
    .h1 { font-size: 28px; }
    .grid-auto-380, .grid-auto-360, .grid-auto-320 { grid-template-columns: 1fr; }
    .kv-grid, .grid-2 { grid-template-columns: 1fr 1fr; }
    .overlay--sheet { align-items: flex-end; padding: 0; }
    .overlay--sheet .modal { border-radius: 20px 20px 0 0; width: 100%; max-height: 90vh; }
    .hide-sm { display: none !important; }
}
@media (min-width: 721px) {
    .show-sm { display: none !important; }
}

/* PIN entry (admin + manager staff forms) */
.input--pin { font-family: var(--mono); font-size: 18px; letter-spacing: .25em; max-width: 200px; }
