:root {
    --ink: #1d2633;
    --saffron: #e3a12f;
    --saffron-dark: #c48a22;
    --paper: #f6f1e7;
    --card: #fffdf8;
    --line: #e4dccb;
    --text: #1d2633;
    --muted: #5c6675;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-variant-numeric: tabular-nums;
}
a { color: #8a5a10; }
.app-shell { min-height: 100vh; }
.sidebar, .offcanvas, #navOffcanvas {
    background: var(--ink);
    color: #f4efe6;
}
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 232px;
    flex-direction: column;
    z-index: 20;
}
.sidebar nav, .sidebar-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0.25rem 0 1rem;
    overflow: auto;
}
.sidebar a, .sidebar-nav a {
    display: block;
    color: #f4efe6;
    text-decoration: none;
    padding: 0.42rem 1rem;
    border-left: 3px solid transparent;
    line-height: 1.3;
}
.sidebar a.active, .sidebar-nav a.active, .sidebar a:hover, .sidebar-nav a:hover {
    background: rgba(227, 161, 47, 0.16);
    border-left-color: var(--saffron);
    color: #fff;
}
.sidebar a:focus-visible, .sidebar-nav a:focus-visible,
.nav-group:focus-visible {
    outline: 2px solid var(--saffron);
    outline-offset: -2px;
}
.sidebar a.nav-sub, .sidebar-nav a.nav-sub {
    padding: 0.36rem 0.85rem 0.36rem 1.45rem;
    font-size: 0.92rem;
}
.nav-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    margin: 0.35rem 0 0;
    padding: 0.55rem 0.85rem 0.2rem;
    border: 0;
    border-left: 3px solid transparent;
    background: transparent;
    color: #b7c0cc;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
}
.nav-group:hover { color: #fff; }
.nav-chevron {
    width: 0.7rem;
    height: 0.7rem;
    flex: none;
    transition: transform 0.15s ease;
}
.nav-group[aria-expanded="true"] .nav-chevron { transform: rotate(90deg); }
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; padding: 1rem 1rem 0.6rem; }
.brand-mark { width: 0.7rem; height: 0.7rem; border-radius: 2px; background: var(--saffron); display: inline-block; }
.app-main { margin-left: 232px; min-height: 100vh; }
.topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: var(--ink);
    color: #fff;
}
.topbar-title { font-weight: 650; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 0.5rem; }
.role-pill { background: var(--saffron); color: var(--ink); border-radius: 999px; padding: 0.05rem 0.5rem; font-size: 0.75rem; text-transform: uppercase; }
.content { padding: 1rem; }
.card, .panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: none;
}
.btn-primary { background: var(--saffron); border-color: var(--saffron-dark); color: var(--ink); }
.btn-primary:hover, .btn-primary:focus { background: var(--saffron-dark); border-color: var(--saffron-dark); color: var(--ink); }
.btn-ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.table { --bs-table-bg: transparent; }
.table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.table td, .table th { padding: 0.4rem 0.55rem; vertical-align: middle; }
.money, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; }
.stat { padding: 0.8rem 0.9rem; }
.stat .label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; }
.stat .value { font-size: 1.35rem; font-weight: 700; }
.report-filters { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; margin-bottom: 1rem; }
.report-filters label { font-size: 0.8rem; color: var(--muted); display: flex; flex-direction: column; gap: 0.2rem; }
.pos { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.9fr); gap: 0.8rem; align-items: start; }
.pos-menu, .pos-cart { background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.pos-menu { padding: 0.75rem; }
.pos-cart { padding: 0.75rem; display: flex; flex-direction: column; max-height: calc(100vh - 92px); position: sticky; top: 0.5rem; }
.tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.5rem 0; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 0.2rem 0.7rem; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 0.5rem; }
.tile {
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-left: 6px solid var(--accent, var(--saffron));
    border-radius: 6px;
    padding: 0.55rem 0.6rem;
    min-height: 72px;
    cursor: pointer;
}
.tile strong { display: block; }
.tile span { color: var(--muted); }
.cart-lines { overflow: auto; flex: 1; min-height: 80px; }
.cart-line { display: grid; grid-template-columns: 1fr auto auto; gap: 0.35rem; align-items: center; padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
.qty-ctl { display: flex; align-items: center; gap: 0.2rem; }
.qty-ctl button { width: 1.6rem; height: 1.6rem; border: 1px solid var(--line); background: #fff; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 0.6rem; }
.seg label { flex: 1; text-align: center; padding: 0.4rem; margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg input:checked + span { background: var(--ink); color: #fff; display: block; margin: -0.4rem; padding: 0.4rem; }
.lookup-results { border: 1px solid var(--line); border-radius: 6px; max-height: 180px; overflow: auto; background: #fff; }
.lookup-results button { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 0.4rem 0.55rem; border-bottom: 1px solid var(--line); }
.info-card { background: #fff8ea; border: 1px solid var(--line); border-radius: 6px; padding: 0.5rem 0.65rem; margin: 0.5rem 0; font-size: 0.92rem; }
.totals { margin-top: 0.4rem; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-size: 1.25rem; font-weight: 750; }
@media (max-width: 991.98px) {
    .app-main { margin-left: 0; }
    .pos { grid-template-columns: 1fr; }
    .pos-cart { position: static; max-height: none; }
    .pos-savebar { position: sticky; bottom: 0; background: var(--card); padding-top: 0.5rem; border-top: 1px solid var(--line); }
}
@media print {
    .sidebar, .topbar, .no-print, .report-filters, .offcanvas { display: none !important; }
    .app-main { margin: 0; }
    body { background: #fff; }
    .content { padding: 0; }
}
