:root {
    --ink: #1b2433;
    --muted: #6b7385;
    --line: #e4e8f0;
    --line-strong: #cfd6e4;
    --paper: #eef1f6;
    --card: #ffffff;
    --brand: #1e4db7;
    --brand-deep: #163a9a;
    --brand-soft: #e8eefc;
    --nav: #163a9a;
    --sales: #3b8cff;
    --purchase: #1b2a6b;
    --warn: #b45309;
    --warn-soft: #fff7ed;
    --danger: #e11d48;
    --danger-soft: #ffe4e6;
    --ok: #0f9d58;
    --shadow: 0 1px 4px rgba(22, 40, 90, .06);
    --radius: 12px;
    --font: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
    --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--paper);
    line-height: 1.4;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.35rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 0.95rem; font-weight: 650; letter-spacing: -0.01em; }
h3 { font-size: 0.85rem; font-weight: 650; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background: var(--paper);
}
.login-card {
    width: min(400px, 100%);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px 24px 24px;
    box-shadow: var(--shadow);
}
.brand-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--brand-deep);
    color: white;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .04em;
}
.eyebrow {
    margin: 0;
    color: var(--brand);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.lede, .muted { color: var(--muted); font-size: 0.86rem; }
.login-card h1 { margin: 4px 0 6px; }
.login-card .lede { margin-bottom: 4px; }
label { display: block; margin: 12px 0 4px; font-size: 12px; font-weight: 650; color: #3d4a46; }
input[type="email"], input[type="password"], input[type="text"], input[type="number"], input[type="search"], input[type="date"], input[type="file"], select, textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    padding: 7px 10px;
    background: white;
    min-height: 34px;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(30, 77, 183, .25);
    border-color: var(--brand);
}
.remember { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-weight: 500; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--brand);
    border-radius: 6px;
    background: var(--brand);
    color: white;
    padding: 7px 12px;
    min-height: 34px;
    font-weight: 650;
    font-size: 0.86rem;
    cursor: pointer;
    white-space: nowrap;
}
.button:hover { background: #163a9a; }
.button.secondary { background: white; color: var(--brand-deep); border-color: var(--line-strong); }
.button.secondary:hover { background: var(--brand-soft); border-color: #b7c8f0; }
.button.danger { background: white; color: var(--danger); border-color: #e3b4b4; }
.button.danger:hover { background: var(--danger-soft); }
.button.cta { width: 100%; min-height: 44px; font-size: 1rem; }
.login-card .button { width: 100%; margin-top: 16px; }
.error { color: var(--danger); font-size: 13px; margin: 4px 0 0; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 56px;
    padding: 0 16px;
    background: var(--nav);
    color: white;
    overflow: visible;
}
.app-logo { display: flex; align-items: center; margin-right: 8px; }
.app-bar .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: white;
    color: var(--nav);
}
.app-nav { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1 1 auto; overflow: visible; }
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 8px;
    color: #e8eeff;
    font-size: 14px;
    font-weight: 650;
    background: transparent;
    border: 0;
    cursor: pointer;
    list-style: none;
}
.nav-link::-webkit-details-marker { display: none; }
.nav-link.active, .nav-link:hover, .nav-drop:hover > .nav-link { background: rgba(255,255,255,.14); color: white; }
.nav-cluster { display: inline-flex; align-items: center; gap: 2px; }
.nav-plus {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #3b8cff;
    color: white;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
}
.sales-flyout {
    display: none;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: center;
    gap: 0;
    min-width: 280px;
    padding: 10px 6px 6px;
}
.nav-drop:hover > .sales-flyout, .nav-drop:focus-within > .sales-flyout { display: grid; }
.sales-flyout a { border-radius: 8px; }
.sales-flyout .menu-plus {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--brand);
    font-size: 18px;
    font-weight: 700;
}
.sales-flyout .menu-plus:hover { background: #eef3ff; }
.sales-flyout .returns-link { color: #e11d48; font-weight: 700; }
.sales-flyout .menu-plus-return { color: #e11d48; }
.nav-drop { position: relative; z-index: 21; }
.nav-drop:hover, .nav-drop:focus-within { z-index: 50; }
.nav-menu {
    display: none;
    position: absolute;
    top: calc(100% - 2px);
    left: 0;
    min-width: 196px;
    padding: 10px 8px 8px;
    background: white;
    color: var(--ink);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(16, 30, 70, .18);
    z-index: 30;
    pointer-events: auto;
}
.nav-menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -14px;
    height: 16px;
}
.nav-menu-right { right: 0; left: auto; }
.nav-menu a, .nav-menu button.link {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--ink);
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
}
.nav-menu a:hover, .nav-menu button.link:hover { background: #f3f6ff; color: var(--brand-deep); }
.nav-menu p { margin: 8px 10px 4px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav-menu-wide { min-width: 228px; }
.nav-drop:hover > .nav-menu, .nav-drop:focus-within > .nav-menu, .nav-drop[open] > .nav-menu { display: block; }
.nav-drop:hover > .sales-flyout, .nav-drop:focus-within > .sales-flyout { display: grid; }
.app-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.app-search input {
    width: 160px;
    min-height: 32px;
    border-radius: 999px;
    border: 0;
    background: rgba(255,255,255,.16);
    color: white;
}
.app-search input::placeholder { color: #c9d4f5; }
.app-tools select {
    width: auto;
    min-width: 0;
    max-width: 10rem;
    margin: 0;
    min-height: 32px;
    background: rgba(255,255,255,.16);
    color: white;
    border: 0;
}
.user-chip {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f8c45c;
    color: #1b2433;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}
.user-chip::-webkit-details-marker { display: none; }
.nav-user .nav-menu p { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); margin: 4px 10px; }
.nav-user .muted { color: var(--muted); font-size: 12px; }

.workspace { min-width: 0; padding: 0 0 28px; flex: 1 1 auto; }
.workspace:has(.bill-shell), .workspace:has(.ledger), .workspace:has(.bill-view) { padding-bottom: 0; }
.who { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; color: var(--ink); }
.who-mark {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: var(--brand-soft);
    color: var(--brand-deep);
    font-size: 11px;
    font-weight: 700;
}
.who-name { flex: 0 0 auto; font-size: 13px; font-weight: 650; line-height: 1.2; white-space: nowrap; }
.workspace > .banner, .workspace > .command, .workspace > .page-head, .workspace > .filters,
.workspace > .cards, .workspace > .kpi, .workspace > .table-wrap, .workspace > h2,
.workspace > .pos-desk, .workspace > .pos-shell, .workspace > .section-nav,
.workspace > .form-grid, .workspace > .invoice-sheet, .workspace > .pager,
.workspace > form, .workspace > section, .workspace > .split {
    margin-left: 16px;
    margin-right: 16px;
}
.workspace > .banner { margin-top: 12px; }
.banner {
    background: var(--brand-soft);
    border: 1px solid #c9e3da;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.command {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-end;
    margin-top: 14px;
    margin-bottom: 12px;
}
.command .lede { margin-top: 2px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.actions a:not(.button), .actions button:not(.button) {
    background: none;
    border: 0;
    color: var(--brand);
    cursor: pointer;
    padding: 0;
    font-weight: 650;
    font-size: 13px;
}

.kpi, .cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.metric, .card {
    display: block;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    box-shadow: var(--shadow);
}
.metric:hover { border-color: #9db4f0; }
.metric span, .card .muted, .card p.muted { display: block; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.metric strong { display: block; margin-top: 2px; font-size: 1.15rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.metric em { display: block; margin-top: 2px; font-style: normal; font-size: 12px; color: var(--brand); font-weight: 650; }
.metric.alert { border-color: #ead7b0; background: #fffdf8; }
.metric.alert strong { color: var(--warn); }
.cards { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.card h2 { margin-top: 4px; font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.page-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 14px; margin-bottom: 10px; }
.page-head .muted { margin-top: 2px; }
.page-head .button { flex: 0 0 auto; white-space: nowrap; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.filters input, .filters select { width: auto; min-width: 140px; }
.section-nav { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.section-nav a {
    border: 1px solid var(--line);
    background: white;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 650;
    color: #3d4a46;
}
.section-nav a.active { background: var(--brand-deep); color: white; border-color: var(--brand-deep); }

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: white;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; background: white; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
    position: sticky;
    top: 0;
    background: #f5f7fb;
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #4d5b56;
    font-weight: 700;
    z-index: 1;
}
tbody tr:hover { background: #f5f8ff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty, td.empty { padding: 22px 12px; text-align: center; color: var(--muted); }
.pager { margin: 8px 16px 0; font-size: 13px; }
.tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 1px 7px;
    background: #eef1ef;
    color: #3d4a46;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
}
.tag.ok { background: #e5f4ec; color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.b2b { background: #e8eefc; color: #1e3a8a; }
.b2b-shell .bill-crumb span { color: #1e3a8a; }
.rx {
    display: inline-flex;
    margin-left: 6px;
    border-radius: 4px;
    background: var(--warn-soft);
    color: var(--warn);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .04em;
    padding: 1px 5px;
    vertical-align: 1px;
}

.form-grid { display: grid; gap: 8px; max-width: 640px; margin-top: 14px; }
.form-grid.wide { max-width: none; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.purchase-line { margin-bottom: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: white; }

.pos-desk, .pos-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: 12px;
    align-items: start;
    margin-top: 12px;
}
.pos-main, .pos-search, .pos-results, .cart-lines { display: grid; gap: 8px; min-width: 0; }
.pos-search { gap: 4px; }
.pos-results { overflow-x: auto; }
.pos-search input { font-size: 16px; min-height: 40px; padding: 8px 12px; }
.pos-desk { min-width: 0; }
.pos-hit, .cart-line {
    background: white;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
}
.pos-hit button, .batch-chip { margin: 6px 6px 0 0; }
.batch-chip { font-size: 12px; }
.hit-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.hit-meta b { color: var(--ink); font-weight: 650; }
.checkout, .pos-rail {
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 8px;
    align-content: start;
    min-width: 0;
}
.pos-rail > *, .pos-rail .form-row, .pos-rail .form-row > * { min-width: 0; }
.pos-rail select, .pos-rail input, .pos-rail textarea { min-width: 0; max-width: 100%; }
.pos-rail .form-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pos-rail h2, .checkout h2 { margin: 4px 0 0; }
.bill-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.bill-total span { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.bill-total strong { font-size: 1.15rem; letter-spacing: -0.03em; }
.invoice-sheet { max-width: 800px; background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-top: 14px; }
.split { display: grid; grid-template-columns: 1.2fr .8fr; gap: 12px; margin-top: 12px; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle-label { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sidebar button.link.signout { width: 100%; margin-top: 8px; }
.nav-menu button.link.signout { color: var(--danger); width: 100%; margin-top: 8px; }

@media print {
    .app-bar, .no-print { display: none !important; }
    .shell { display: block; }
    .workspace { padding: 0; }
    .invoice-sheet { border: 0; }
    .workspace > * { margin-left: 0 !important; margin-right: 0 !important; }
}
.ops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 16px 12px; }
.op { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 0 8px; background: white; border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: 6px; padding: 8px 10px; }
.op.hot { border-left-color: var(--warn); background: #fffdf8; }
.op span { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.op strong { font-size: 1.25rem; letter-spacing: -0.02em; }
.op small { color: var(--muted); font-size: 12px; }
.op em { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-style: normal; font-size: 12px; font-weight: 700; color: var(--brand); }
.pos-find { font-size: 18px; min-height: 44px; }
.pos-results { position: relative; }
.lookup-table { font-size: 13px; }
.lookup-row { cursor: pointer; }
.pos-cart { overflow-x: auto; }
.pos-cart th, .pos-cart td { padding: 6px 8px; }
.pos-cart td:nth-child(2), .pos-cart td:nth-child(3),
.lookup-table th, .lookup-table td { white-space: nowrap; }
.pos-cart input, .pos-cart select { min-height: 28px; padding: 4px 6px; width: 4.6rem; min-width: 0; }
.qty-cell { display: flex; align-items: flex-end; gap: 6px; }
.free-field { display: grid; gap: 1px; font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.pos-cart .free-qty { width: 3.6rem; margin: 0; }
.bill-sum { display: grid; gap: 4px; margin: 4px 0; }
.bill-sum div { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; }
.bill-sum dt { color: var(--muted); font-weight: 600; }
.bill-sum dd { margin: 0; font-variant-numeric: tabular-nums; }
.bill-discount input { width: 7rem; text-align: right; min-height: 30px; }
.bill-grand { margin-top: 4px; padding-top: 8px; border-top: 2px solid var(--ink); }
.bill-grand dt, .bill-grand dd { color: var(--ink); font-size: 1.45rem; font-weight: 750; letter-spacing: -0.03em; }
.customer-chip { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; min-width: 0; }
.customer-chip > div { min-width: 0; }
.customer-chip strong { font-size: 1rem; }
.customer-chip p { overflow-wrap: anywhere; }
#rx-box { padding: 0; min-width: 0; }
#rx-box:not(.rx-needed) #rx-note { display: none; }
#rx-box.rx-needed { padding: 8px 10px; border: 1px solid #ead7b0; background: #fffdf8; border-radius: 6px; }
#rx-box.rx-needed #rx-note { margin: 6px 0 0; font-size: 12px; line-height: 1.35; color: #6d5424; }
.pos-actions { display: grid; gap: 6px; }
.pay-stack { display: grid; gap: 8px; margin: 8px 0 12px; }
.pay-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; align-items: end; }
.pay-row span { font-size: 0.75rem; color: var(--muted, #5c6b66); }
.pay-meta { display: grid; gap: 4px; }
.pay-meta > div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.shortage { background: #f4efe4; }
.recent-bills { margin: 0 16px 12px; }
.recent-bills summary { cursor: pointer; font-weight: 650; font-size: 0.95rem; }
.purchase-line:not(tr) { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(4, minmax(0, 1fr)); gap: 6px 8px; align-items: end; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: white; margin-bottom: 6px; }
.purchase-line:not(tr) .form-row { display: contents; }
.purchase-line label { margin: 0 0 2px; font-size: 11px; }
.purchase-line input, .purchase-line select { min-height: 30px; min-width: 0; padding: 4px 6px; }
.purchase-line:not(tr) .muted { grid-column: 1 / -1; margin: 0; font-size: 11px; line-height: 1.3; }
@media (max-width: 1360px) {
    .pos-desk, .pos-shell { grid-template-columns: minmax(0, 1fr) minmax(260px, 300px); }
}
@media (max-width: 1100px) {
    .pos-desk, .pos-shell, .split, .ops { grid-template-columns: 1fr; }
    .kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .purchase-line:not(tr) { grid-template-columns: 1fr 1fr; }
    .dash, .dash-lower { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
    .app-nav, .app-search { display: none; }
    .nav-toggle:checked ~ .shell .app-nav {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--nav);
        padding: 8px 12px 16px;
        z-index: 25;
        max-height: calc(100vh - 56px);
        overflow: auto;
    }
    .nav-toggle:checked ~ .shell .app-nav .nav-menu { display: block; position: static; min-width: 0; box-shadow: none; }
    .nav-toggle-label {
        display: inline-flex;
        align-items: center;
        border: 1px solid rgba(255,255,255,.3);
        background: transparent;
        color: white;
        border-radius: 6px;
        padding: 6px 10px;
        cursor: pointer;
        font-size: 13px;
        font-weight: 650;
    }
    .form-row { grid-template-columns: 1fr; }
    .command { flex-direction: column; align-items: stretch; }
    .kpi { grid-template-columns: 1fr 1fr; }
    .dash, .dash-lower { grid-template-columns: 1fr; }
}

.dash {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.15fr);
    gap: 10px;
    padding: 12px 16px 16px;
    align-items: start;
}
.dash-left, .dash-right, .dash-dues { display: grid; gap: 10px; }
.dash-lower {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(280px, 1.1fr) minmax(280px, 1fr);
    gap: 10px;
    align-items: start;
}
.panel {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 12px 14px;
    min-width: 0;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.panel-head h2 { font-size: 16px; }
.panel-head a { color: var(--brand); font-size: 13px; font-weight: 650; }
.period-tabs {
    display: inline-flex;
    background: #eef2f8;
    border-radius: 999px;
    padding: 3px;
    margin-bottom: 12px;
}
.period-tab {
    border: 0;
    background: transparent;
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 650;
    color: #5b6577;
    cursor: pointer;
}
.period-tab.is-on { background: white; color: var(--ink); box-shadow: var(--shadow); }
.chart-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chart-kpi {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
}
.chart-kpi span { display: block; font-size: 12px; color: var(--muted); font-weight: 650; }
.chart-kpi strong { display: block; font-size: 1.45rem; letter-spacing: -0.03em; }
.chart-kpi.sales strong { color: var(--sales); }
.chart-kpi.purchase strong { color: var(--purchase); }
.chart-kpi small { color: var(--muted); }
.chart-legend { display: flex; gap: 14px; align-items: center; margin: 10px 0 6px; font-size: 12px; color: var(--muted); }
.chart-legend .dot, .stock-keys .dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.chart-legend .dot.sales, .stock-keys .dot.current { background: var(--sales); }
.chart-legend .dot.purchase { background: var(--purchase); }
.stock-keys .dot.expired { background: var(--danger); }
.chart-plot { display: flex; align-items: end; gap: 8px; min-height: 72px; padding: 8px 0 0; border-top: 1px solid var(--line); }
.bar-col { flex: 1; display: grid; justify-items: center; gap: 6px; min-width: 0; }
.bar-col .bars { display: flex; align-items: end; gap: 3px; height: 72px; width: 100%; justify-content: center; }
.bar { width: 14px; border-radius: 4px 4px 0 0; display: block; min-height: 2px; }
.bar.sales { background: var(--sales); }
.bar.purchase { background: var(--purchase); }
.bar-col small { font-size: 10px; color: var(--muted); }
.stock-keys { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }
.stock-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 16px;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid var(--line);
    font-weight: 650;
}
.stock-row .current { color: var(--sales); }
.stock-row .expired { color: var(--danger); }
.expiry-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.expiry-tabs label { font-weight: 700; color: var(--muted); padding-bottom: 8px; cursor: pointer; }
.expiry-tabs label:has(input:checked) { color: var(--ink); border-bottom: 2px solid var(--brand); }
.expiry-tabs input { position: absolute; opacity: 0; }
.expiry-pane { display: none; }
.expiry-pane.on { display: block; }
.dash-table { width: 100%; }
.dash-table th { background: transparent; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 12px; }
.dash-table td strong { display: block; }
.dash-table td small { display: block; color: var(--muted); font-size: 11px; }
.dash-table td.empty { text-align: left; }
.staff-tabs { display: flex; gap: 16px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.staff-tabs .is-on { color: var(--ink); border-bottom: 2px solid #f43f7c; padding-bottom: 4px; }
.donut-wrap { position: relative; width: min(150px, 100%); margin: 0 auto; }
.donut { width: 100%; }
.donut-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 40px; }
.staff-legend { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.staff-legend li { display: flex; gap: 8px; align-items: center; }
.staff-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.staff-panel select { width: auto; min-height: 32px; }
.party-list { list-style: none; padding: 0; margin: 0; }
.party-list li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.party-list li.empty { color: var(--muted); border: 0; }
.party-list .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #dbeafe;
    color: var(--brand-deep);
    font-weight: 800;
    font-size: 12px;
}
.party-list strong { display: block; }
.party-list small { color: var(--muted); font-size: 12px; }
.party-list .due { margin-left: auto; color: var(--danger); font-variant-numeric: tabular-nums; }
.dues-panel .panel-head strong { color: var(--danger); }
.dues-panel .panel-head strong.down::before { content: "↓ "; }
.dues-panel.pay .panel-head strong.up::before { content: "↑ "; }
.view-all { display: inline-block; margin-top: 8px; color: var(--brand); font-size: 13px; font-weight: 650; }
.margin-pct { color: var(--ok); font-weight: 700; }
.shell { position: relative; }

.bill-view { display: flex; flex-direction: column; min-height: calc(100vh - 56px); background: white; }
.bill-view-top, .bill-view-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    align-items: center;
    flex-wrap: wrap;
}
.bill-view-meta > div { min-width: 140px; }
.bill-view-meta span { display: block; font-size: 11px; color: var(--muted); }
.bill-view-meta strong { display: block; }
.bill-view-meta small { color: var(--muted); }
.bill-view .bill-sheet { flex: 1; }
.bill-view-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: var(--nav);
    color: white;
}
.bill-view-foot a, .bill-view-foot .net-open { color: white; background: transparent; border: 0; font: inherit; font-weight: 650; cursor: pointer; }
.bill-view-foot .net-open { margin-left: auto; font-size: 1.05rem; }
.breakdown { border: 0; border-radius: 12px; padding: 0; width: min(640px, 92vw); box-shadow: 0 20px 50px rgba(16, 30, 70, .28); }
.breakdown::backdrop { background: rgba(15, 23, 42, .45); }
.breakdown-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--nav); color: white; }
.breakdown-head h2 { font-size: 1.1rem; }
.breakdown-head .link { color: white; font-size: 1.4rem; }
.breakdown-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; }
.breakdown-notes { background: #fff7e8; border-radius: 8px; padding: 10px 12px; }
.breakdown-notes p { color: var(--brand); font-weight: 700; margin-bottom: 6px; }
.breakdown-body dl { display: grid; gap: 8px; margin: 0; }
.breakdown-body dl div { display: flex; justify-content: space-between; gap: 12px; }
.breakdown-body .net { border-top: 2px solid var(--nav); padding-top: 8px; font-size: 1.15rem; font-weight: 750; }
.breakdown-gst { display: flex; gap: 24px; padding: 10px 16px 16px; background: #eef4ff; }

.ledger { background: #f4f7fb; min-height: calc(100vh - 56px); display: flex; flex-direction: column; }
.ledger-head, .bill-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #f4f7fb;
    border-bottom: 1px solid var(--line);
}
.ledger-title { display: flex; align-items: center; gap: 10px; }
.ledger-title h1 { font-size: 1.15rem; }
.ledger-return, .bill-crumb a { color: var(--brand); font-weight: 700; white-space: nowrap; flex: 0 0 auto; }
.ledger-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: end;
    padding: 10px 16px;
    background: white;
    border-bottom: 1px solid var(--line);
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}
.ledger-filters label { margin: 0; }
.ledger-filters label span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.ledger-filters input, .ledger-filters select { width: auto; min-width: 140px; min-height: 34px; }
.purchase-toolbar {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    overflow-x: auto;
}
.purchase-toolbar .sr-chip { flex: 0 0 auto; min-width: 96px; width: 96px; }
.purchase-toolbar .grow { flex: 1 1 0; min-width: 0; display: flex; }
.purchase-toolbar .grow input, .purchase-toolbar .toolbar-search input { width: 100%; min-width: 0; }
.purchase-toolbar .date-range { flex: 0 0 auto; }
.purchase-toolbar select[name="pay"] { flex: 0 0 auto; min-width: 108px; }
.purchase-toolbar .more-open {
    flex: 0 0 auto;
    background: none;
    border: 0;
    color: var(--brand);
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    padding: 8px 4px;
}
.filter-drawer {
    border: 0;
    padding: 0;
    width: min(380px, 100vw);
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0 0 0 auto;
    box-shadow: -8px 0 28px rgba(16, 30, 70, .18);
}
.filter-drawer::backdrop { background: rgba(15, 23, 42, .28); }
.filter-drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--nav);
    color: white;
}
.filter-drawer-head h2 { font-size: 1.15rem; }
.filter-drawer-head .link { color: white; font-size: 1.4rem; }
.filter-drawer-body { display: grid; gap: 14px; padding: 18px 16px; }
.filter-drawer-body label { margin: 0; }
.filter-drawer-body span { display: block; margin-bottom: 6px; font-size: 14px; color: var(--ink); }
.filter-drawer-body select { width: 100%; min-height: 40px; }
.filter-drawer-foot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 18px;
    padding: 12px 16px 20px;
}
.filter-drawer-foot .reset { color: var(--brand); font-weight: 700; }
.date-range { display: flex; gap: 6px; }
.date-range input { min-width: 0; }
.more-filters { position: relative; }
.more-filters summary { cursor: pointer; font-size: 13px; font-weight: 650; color: var(--brand); list-style: none; padding: 8px 0; }
.more-filters summary::-webkit-details-marker { display: none; }
.more-filters[open] > :not(summary) {
    position: absolute;
    z-index: 8;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    box-shadow: var(--shadow);
}
.ledger-table { background: white; overflow: auto; flex: 1; }
.ledger-table table { margin: 0; }
.ledger-table th { background: #f8fafc; text-transform: none; letter-spacing: 0; }
.ledger-row { cursor: pointer; }
.ledger-row:hover { background: #2b7cff; color: white; }
.ledger-row:hover a, .ledger-row:hover .pay-pill, .ledger-row:hover .due-amt { color: white; }
.draft-tag { color: #d97706; font-weight: 800; }
.ledger-row:hover .draft-tag { color: #ffe7b3; }
.lock-mark { font-weight: 700; }
.icon-print {
    display: inline-block;
    width: 22px;
    height: 22px;
    overflow: hidden;
    text-indent: -99px;
    background: center / 16px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%231e4db7' stroke-width='1.8' viewBox='0 0 24 24'%3E%3Cpath d='M6 9V3h12v6'/%3E%3Cpath d='M6 17H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2'/%3E%3Cpath d='M6 13h12v8H6z'/%3E%3C/svg%3E");
}
.ledger-row:hover .icon-print { filter: brightness(10); }
.bill-no { color: var(--brand); font-weight: 700; }
.due-amt { color: var(--danger); }
.due-pill {
    display: inline-flex;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 4px;
    background: #ffe4e6;
    color: var(--danger);
    font-size: 11px;
    font-weight: 800;
}
.pay-pill { margin-left: 6px; color: var(--brand); font-size: 11px; font-weight: 700; }
.ledger-actions { white-space: nowrap; }
.ledger-actions a { color: var(--brand); margin-left: 8px; font-weight: 650; }
.ledger-foot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: var(--nav);
    color: white;
    font-weight: 650;
}
.ledger .pager { margin: 8px 16px; }

.bill-shell { display: flex; flex-direction: column; min-height: calc(100vh - 56px); background: white; }
.bill-shell .bill-top { background: white; padding: 8px 16px; }
.bill-crumb { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.bill-crumb span { color: var(--muted); }
.bill-tools { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.tool-drop { position: relative; }
.tool-drop > summary {
    list-style: none;
    cursor: pointer;
    border: 1px solid var(--line);
    background: white;
    border-radius: 8px;
    padding: 7px 12px;
    font-weight: 650;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
}
.tool-drop > summary::-webkit-details-marker { display: none; }
.tool-drop .save-summary { background: #00bcd4; color: white; border-color: #00bcd4; padding: 7px 18px; }
.save-menu button {
    display: block;
    width: 100%;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--line);
    text-align: left;
    padding: 10px 8px;
    cursor: pointer;
    font-weight: 650;
}
.save-menu button:hover { background: #f3f7ff; }
.save-menu .book-delivery { color: #e11d48; }
.pick-title { font-size: 11px; color: var(--muted); font-weight: 700; margin: 0 0 6px; }
.pick-list .pick {
    display: block;
    width: 100%;
    background: none;
    border: 0;
    text-align: left;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
}
.pick-list .pick:hover, .pick-list .pick.on { background: #2b7cff; color: white; }
.customer-modal { width: min(720px, 94vw); border: 0; border-radius: 12px; padding: 0; }
.customer-modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    padding: 16px;
}
.customer-modal-body .wide { grid-column: 1 / -1; }
.customer-modal-body .button { grid-column: 2; justify-self: end; }
.doctor-card { flex: 0.9; }
.party-hit.add-hit strong { color: var(--sales); }
.lookup-table { min-width: 420px; }
.tool-drop .gear-summary { min-width: 34px; justify-content: center; }
.tool-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 40;
    background: white;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    min-width: 280px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 8px;
    color: var(--ink);
}
.customer-chip[hidden], #customer-history[hidden], #walkin-label[hidden] { display: none !important; }
.bill-rx:not(.rx-needed) { display: none; }
.who-pill {
    border: 1px solid var(--line);
    background: white;
    border-radius: 8px;
    padding: 7px 12px;
    font-weight: 650;
}
.bill-form { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.bill-meta {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    border-bottom: 1px solid var(--line);
    background: white;
}
.bill-meta > label, .bill-meta > .customer-card { margin: 0; padding: 8px 16px; }
.date-card {
    background: #2563eb;
    color: white;
    min-width: 168px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 11px;
    font-weight: 650;
}
.date-card input {
    background: transparent;
    border: 0;
    color: white;
    font-size: 1.25rem;
    font-weight: 800;
    min-height: 32px;
    padding: 0;
    color-scheme: dark;
}
.customer-card { flex: 1.4; border-right: 1px solid var(--line); position: relative; }
.field-caption { display: block; font-size: 11px; font-weight: 650; color: #3d4a46; margin-bottom: 2px; }
.party-results {
    position: absolute;
    left: 16px;
    right: 16px;
    top: calc(100% - 28px);
    z-index: 25;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    max-height: 240px;
    overflow: auto;
    box-shadow: var(--shadow);
}
.party-hit {
    display: flex;
    gap: 10px;
    align-items: baseline;
    width: 100%;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    text-align: left;
    cursor: pointer;
}
.party-hit:hover { background: #f3f7ff; }
.party-hit span { color: var(--muted); font-size: 12px; }
.party-hit em { margin-left: auto; color: var(--danger); font-style: normal; font-size: 12px; font-weight: 700; }
.party-new { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; margin-top: 6px; align-items: center; }
.party-new[hidden] { display: none !important; }
#customer-history:not([hidden]) {
    display: block;
    margin: 0 16px 8px;
    padding: 10px 12px;
    background: #f8fbff;
    border: 1px solid var(--line);
    border-radius: 8px;
    max-height: 220px;
    overflow: auto;
}
.billing-card { flex: 0.8; }
.bill-meta input, .bill-meta select { min-width: 0; max-width: 100%; }
.counter-bill {
    display: inline-block;
    margin-top: 4px;
    margin-right: 10px;
    background: none;
    border: 0;
    padding: 0;
    color: var(--sales);
    font-weight: 650;
    font-size: 13px;
    cursor: pointer;
}
.bill-rx { padding: 8px 16px; }
.bill-sheet { overflow: auto; flex: 1; min-height: 280px; position: relative; }
.bill-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.bill-grid th {
    background: #e7f0ff;
    color: var(--brand-deep);
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
    position: sticky;
    top: 0;
    font-weight: 650;
}
.bill-grid th:nth-child(1) { width: 16%; }
.bill-grid th:nth-child(2) { width: 10%; }
.bill-grid th:nth-child(3), .bill-grid th:nth-child(13) { width: 4%; }
.bill-grid th:nth-child(7), .bill-grid th:nth-child(8), .bill-grid th:nth-child(9) { width: 7%; }
.bill-search-row td { background: #e8f4ff; padding: 4px 10px; position: relative; }
.bill-search-row .pos-find {
    border: 0;
    background: transparent;
    min-height: 34px;
    font-size: 13px;
    padding: 4px 0;
    color: #7a8494;
}
.bill-grid td { padding: 6px 8px; vertical-align: middle; }
.bill-grid input, .bill-grid select { min-height: 30px; width: 100%; min-width: 0; }
.bill-sheet .pos-results {
    position: absolute;
    left: 10px;
    right: 10px;
    top: 100%;
    z-index: 16;
    background: white;
    box-shadow: var(--shadow);
    max-height: 280px;
    overflow: auto;
}
.bill-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    min-height: 42px;
    padding: 0 16px;
    background: var(--nav);
    color: white;
    font-weight: 650;
    margin-top: auto;
    position: sticky;
    bottom: 0;
    z-index: 12;
}
.bill-foot .foot-link, .bill-foot .net-open {
    background: transparent;
    border: 0;
    color: white;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}
.bill-foot .net-open { margin-left: auto; }
.bill-foot strong { font-size: 1.2rem; }
.recent-bills { display: none; }
.bill-payable {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    background: var(--nav);
    color: white;
    border-radius: 10px;
    padding: 10px 12px;
}
.bill-payable strong { font-size: 1.25rem; }
.bill-payable .button.secondary { background: white; }
.purchase-meta {
    display: grid;
    grid-template-columns: minmax(240px, 1.4fr) minmax(200px, 1fr) minmax(150px, 180px) minmax(150px, 180px);
    align-items: stretch;
}
.purchase-meta > label { min-width: 0; }
.purchase-grid table { min-width: 1100px; }
.purchase-line td { white-space: nowrap; }
.purchase-grid table { margin: 0; }
.purchase-grid th { background: #eef4ff; text-transform: none; letter-spacing: 0; font-size: 12px; }
.purchase-line td { position: relative; vertical-align: top; }
.purchase-line input { min-height: 32px; }
.purchase-line .lookup-hits {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 54px;
    z-index: 20;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    max-height: 220px;
    overflow: auto;
}
.purchase-line .line-meta { display: block; color: var(--muted); font-size: 11px; }
.purchase-foot, .purchase-view-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    padding: 10px 18px;
    background: #c4455a;
    color: white;
    font-weight: 650;
}
.purchase-foot a, .purchase-view-foot a { color: white; }
.purchase-view-foot { margin-top: auto; }
.remove-line { font-size: 1.1rem; margin-right: 4px; }
.line-amount { text-align: right; font-weight: 700; white-space: nowrap; }

.ledger-tabs { display: flex; gap: 18px; padding: 8px 16px 0; background: white; border-bottom: 1px solid var(--line); }
.ledger-tabs a { padding: 8px 4px 10px; color: var(--muted); font-weight: 650; }
.ledger-tabs a.on { color: var(--brand); border-bottom: 2px solid var(--brand); }
.gate-modal { border: 0; border-radius: 12px; padding: 0; width: min(720px, 94vw); }
.gate-modal::backdrop { background: rgba(15, 23, 42, .4); }
.gate-modal-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 16px; }
.gate-modal-body .wide { grid-column: 1 / -1; }
.gate-modal-body span { display: block; font-size: 12px; margin-bottom: 4px; }
.tot-steps { display: flex; gap: 24px; list-style: none; padding: 16px 24px; margin: 0; background: white; border-bottom: 1px solid var(--line); }
.tot-steps li { color: var(--muted); font-weight: 700; }
.tot-steps li.on { color: var(--brand); }
.tot-pane { padding: 20px 24px; }
.tot-list { display: grid; gap: 10px; max-width: 720px; }
.tot-card { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f4f9ff; }
.tot-card strong { display: block; }
.tot-card span { color: var(--muted); font-size: 12px; }
.inline-price { display: flex; gap: 6px; align-items: center; }
.inline-price input { width: 7rem; }
.pick-list a.pick { display: block; }

.bill-pay input, .bill-pay select { background: white; }
@media (max-width: 900px) {
    .bill-meta { flex-wrap: wrap; }
    .date-card { min-width: 100%; }
}

.settings-shell {
    display: grid;
    grid-template-columns: 196px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    margin-top: 4px;
}
.settings-rail {
    position: sticky;
    top: 72px;
    display: grid;
    gap: 2px;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 8px 12px;
    box-shadow: var(--shadow);
}
.settings-rail p {
    margin: 10px 8px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.settings-rail p:first-child { margin-top: 2px; }
.settings-rail a {
    display: block;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 650;
    color: var(--ink);
}
.settings-rail a:hover { background: #f3f6ff; color: var(--brand-deep); }
.settings-main { display: grid; gap: 12px; min-width: 0; }
.settings-card {
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px 18px;
    box-shadow: var(--shadow);
}
.settings-card-head { margin-bottom: 12px; max-width: 52rem; }
.settings-card-head h2 { font-size: 1.05rem; }
.settings-card-head p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}
.settings-grid > .wide { grid-column: 1 / -1; }
.settings-grid label { margin: 0; }
.settings-grid input, .settings-grid textarea, .settings-grid select {
    width: 100%;
    margin-top: 4px;
}
.settings-grid small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 500; }
.field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 650;
    color: #3d4a46;
}
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f7f9fd;
    cursor: pointer;
}
.choice:has(input:checked) {
    border-color: var(--brand);
    background: var(--brand-soft);
}
.choice input { margin: 0 0 4px; width: auto; }
.choice strong { font-size: 13px; }
.choice span { color: var(--muted); font-size: 12px; font-weight: 500; }
.settings-save {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
@media (max-width: 900px) {
    .settings-shell, .choice-row, .settings-grid { grid-template-columns: 1fr; }
    .settings-rail { position: static; }
}

.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}
.role-card {
    display: grid;
    gap: 10px;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.role-card.is-owner { border-color: #c5d4f8; background: #f7f9ff; }
.role-card-head { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: start; }
.role-card-head h2 { font-size: 1.1rem; }
.role-card-head strong { font-size: 1.35rem; letter-spacing: -0.03em; }
.role-card-head span { grid-column: 2; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.role-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.role-chips li {
    border: 1px solid var(--line);
    background: #f4f6fb;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 650;
}
.role-people { color: var(--muted); font-size: 13px; }
.role-card-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.role-card-actions a { color: var(--brand); font-weight: 650; }
.role-card-actions .link { color: var(--danger); background: none; border: 0; padding: 0; cursor: pointer; font-weight: 650; }
.role-create { max-width: 720px; }
.perm-group-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.perm-group-head .remember { margin: 0; }
.perm-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 6px;
}
.perm-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 8px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7f9fd;
    font-weight: 650;
}
.perm-item input { grid-row: 1 / span 2; margin: 4px 0 0; }
.perm-item small { grid-column: 2; color: var(--muted); font-size: 11px; font-weight: 500; font-family: var(--mono); }
.perm-item:has(input:checked) { border-color: #c5d4f8; background: var(--brand-soft); }
