:root {
    --ink: #10241f;
    --muted: #5d6f6a;
    --line: #d7e3df;
    --paper: #f4f7f6;
    --card: #ffffff;
    --brand: #146c5b;
    --brand-deep: #0d3d34;
    --danger: #9b2c2c;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
    background:
        radial-gradient(circle at top left, #d7efe8, transparent 40%),
        var(--paper);
}
.login-card {
    width: min(420px, 100%);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 32px;
    box-shadow: 0 18px 50px rgba(16, 36, 31, .08);
}
.brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--brand-deep);
    color: white;
    font-weight: 700;
}
.eyebrow { margin: 16px 0 0; color: var(--brand); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 6px 0 8px; font-size: 28px; }
.lede, .muted { color: var(--muted); }
label { display: block; margin: 16px 0 6px; font-size: 14px; }
input[type="email"], input[type="password"], input[type="text"], input[type="number"], input[type="search"], input[type="date"], select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    background: white;
}
.remember { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    color: white;
    padding: 12px 16px;
    cursor: pointer;
}
.button.secondary { background: #e7f3ef; color: var(--brand-deep); }
.login-card .button { width: 100%; margin-top: 18px; }
.error { color: var(--danger); font-size: 14px; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar {
    background: var(--brand-deep);
    color: white;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-height: 100vh;
    overflow: auto;
    position: sticky;
    top: 0;
}
.sidebar nav { display: grid; gap: 4px; }
.sidebar a, .sidebar button.link {
    padding: 7px 12px;
    font-size: 14px;
    border-radius: 10px;
    color: white;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}
.sidebar a.active, .sidebar a:hover { background: rgba(255,255,255,.12); }
.nav-label, .nav-group summary { margin: 10px 12px 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #9fb8b1; cursor: pointer; }
.nav-group { margin: 0; }
.nav-group summary { list-style: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.sidebar .grow { margin-top: auto; }
.workspace { padding: 28px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
table { width: 100%; border-collapse: collapse; background: white; border-radius: 16px; overflow: hidden; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.banner { background: #e7f3ef; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.form-grid { display: grid; gap: 12px; max-width: 520px; }
.form-grid.wide { max-width: 820px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.page-head, .filters, .actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.page-head { justify-content: space-between; }
.filters { margin-bottom: 16px; }
.filters input, .filters select { width: auto; min-width: 180px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: white; }
.actions form { margin: 0; }
.actions a:not(.button), .actions button:not(.button) { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; }
.pager { margin-top: 16px; }
.tag { display: inline-block; border-radius: 999px; padding: 2px 8px; background: #e7f3ef; font-size: 12px; }
.tag.warn { background: #f8e8c8; }
.tag.danger { background: #f8d4d4; color: #9b2c2c; }
.purchase-line { margin-bottom: 12px; }
.pos { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.1fr); gap: 16px; align-items: start; }
.pos-results, .cart-lines { display: grid; gap: 8px; }
.pos-hit, .cart-line { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.pos-hit button, .batch-chip { margin: 6px 6px 0 0; }
.invoice-sheet { max-width: 800px; background: white; border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .shell { display: block; }
    .workspace { padding: 0; }
    .invoice-sheet { border: 0; }
}
@media (max-width: 800px) {
    .form-row { grid-template-columns: 1fr; }
}
.footer-note { color: #b7c9c4; font-size: 12px; line-height: 1.5; }
.brand-row { display: flex; gap: 12px; align-items: center; }
.brand-row .eyebrow { margin: 0; }
.brand-row strong { display: block; font-size: 14px; }
.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); }
.topbar-title, .topbar-tools { display: flex; gap: 12px; align-items: center; min-width: 0; }
.topbar-title { flex: 1 1 auto; }
.topbar-title strong { display: block; overflow-wrap: anywhere; }
.topbar-tools { flex: 1 1 auto; justify-content: flex-end; flex-wrap: wrap; }
.topbar-tools select { width: auto; min-width: 0; max-width: 11rem; margin: 0; }
.who { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; max-width: none; color: var(--ink); }
.who-mark { flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 999px; background: #e7f3ef; color: var(--brand-deep); font-size: 12px; font-weight: 700; }
.who-name { flex: 0 0 auto; font-size: 14px; line-height: 1.25; white-space: nowrap; overflow: visible; }
.tag.ok { background: #e7f3ef; color: var(--brand-deep); }
.command { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.metric { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.metric:hover { border-color: #9fc9bd; }
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 6px; font-size: 28px; letter-spacing: -0.03em; }
.metric.alert strong { color: var(--danger); }
.section-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.section-nav a { border: 1px solid var(--line); background: white; border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.section-nav a.active { background: var(--brand-deep); color: white; border-color: var(--brand-deep); }
.pos-shell { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(360px, 1.2fr) minmax(240px, .7fr); gap: 16px; align-items: start; }
.pos-panel, .pos-side { display: grid; gap: 12px; }
.pos-search input { font-size: 18px; padding: 14px 16px; }
.checkout { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.checkout h2 { margin-top: 0; }
.rx { display: inline-block; margin-left: 6px; border-radius: 999px; background: #f8e8c8; color: #7a4b00; font-size: 12px; padding: 1px 7px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
@media (max-width: 1100px) {
    .pos-shell { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { display: none; position: sticky; top: 0; max-height: none; }
    .nav-toggle:checked ~ .shell { grid-template-columns: 1fr; }
    .nav-toggle:checked ~ .shell .sidebar { display: flex; }
    .nav-toggle-label { display: inline-flex; align-items: center; border: 1px solid var(--line); background: white; border-radius: 10px; padding: 8px 12px; cursor: pointer; }
    .topbar { align-items: flex-start; }
    .topbar-tools { flex-wrap: wrap; }
    .command { flex-direction: column; align-items: stretch; }
}
