:root {
    --bg: #f3f7f4;
    --surface: #ffffff;
    --surface-2: #f8fbf9;
    --line: #e0e9e3;
    --line-strong: #cfdbd4;
    --text: #17241d;
    --text-soft: #3a4c43;
    --muted: #6c7d74;
    --accent: #0f7a5a;
    --accent-dark: #0a5b43;
    --accent-soft: #e5f4ed;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --warn: #a15c07;
    --warn-soft: #fff4e0;
    --info: #1d4ed8;
    --info-soft: #e8efff;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(14, 42, 29, .04), 0 10px 30px rgba(14, 42, 29, .05);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-dark);
}

h1, h2, h3, h4 {
    margin: 0;
    line-height: 1.25;
    letter-spacing: -.01em;
}

p {
    margin: 0 0 10px;
}

p:last-child {
    margin-bottom: 0;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 12.5px;
}

.mono {
    font-variant-numeric: tabular-nums;
}

.ico {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

/* ---------- Topbar & navigation ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 60px;
    padding: 0 18px;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 700;
}

.brand:hover {
    color: var(--text);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: linear-gradient(135deg, #108866, #0a5b43);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .04em;
    box-shadow: 0 4px 12px rgba(15, 122, 90, .25);
}

.brand-text {
    display: flex;
    flex-direction: column;
    font-size: 15px;
    line-height: 1.15;
}

.brand-text small {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: .05em;
    text-transform: uppercase;
}

.spacer {
    flex: 1;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 10px 5px 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 12.5px;
    line-height: 1.2;
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
}

.user-meta {
    display: flex;
    flex-direction: column;
    padding-right: 4px;
}

.user-meta strong {
    font-size: 12.5px;
    font-weight: 600;
}

.user-meta span {
    color: var(--muted);
    font-size: 10.5px;
}

.logout-form {
    margin: 0;
}

.shell {
    display: flex;
    align-items: flex-start;
    max-width: 1440px;
    margin: 0 auto;
}

.sidebar {
    position: sticky;
    top: 60px;
    flex: 0 0 228px;
    height: calc(100vh - 60px);
    padding: 18px 14px;
    overflow-y: auto;
    background: var(--surface);
    border-right: 1px solid var(--line);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-label {
    padding: 8px 12px 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #8a9a91;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 11px;
    color: var(--text-soft);
    font-weight: 500;
    font-size: 14px;
    transition: background .15s ease, color .15s ease;
}

.nav a .ico {
    width: 19px;
    height: 19px;
    color: #6f8177;
}

.nav a:hover {
    background: var(--surface-2);
    color: var(--text);
}

.nav a.active {
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 700;
}

.nav a.active .ico {
    color: var(--accent-dark);
}

.sidebar-foot {
    margin-top: 22px;
    padding: 12px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px dashed var(--line-strong);
    font-size: 11.5px;
    color: var(--muted);
}

.content {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    min-width: 0;
    padding: 24px;
    margin: 0 auto;
}

.bottom-nav {
    display: none;
}

/* ---------- Page header ---------- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.page-head h1 {
    font-size: 23px;
    font-weight: 750;
}

.page-head .sub {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---------- Cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}

.card + .card {
    margin-top: 16px;
}

.card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.card-head h2 {
    font-size: 16px;
    font-weight: 700;
}

.card-head .sub {
    color: var(--muted);
    font-size: 12.5px;
}

.card.pad-0 {
    padding: 0;
    overflow: hidden;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: var(--surface-2);
    color: var(--text-soft);
    font: inherit;
    font-weight: 600;
    font-size: 13.5px;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .08s ease, background .15s ease, border-color .15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn .ico {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(180deg, #118566, #0d6f52);
    border-color: #0d6f52;
    color: #fff;
    box-shadow: 0 4px 12px rgba(15, 122, 90, .18);
}

.btn-primary:hover {
    background: var(--accent-dark);
    color: #fff;
}

.btn-outline {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--text-soft);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
}

.btn-ghost {
    background: transparent;
    color: var(--text-soft);
}

.btn-ghost:hover {
    background: var(--surface-2);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #f6cfc9;
}

.btn-danger:hover {
    background: #fbdcd7;
}

.btn-sm {
    min-height: 32px;
    padding: 6px 11px;
    font-size: 12.5px;
    border-radius: 9px;
}

.btn-block {
    width: 100%;
}

.btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

/* ---------- Forms ---------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.field {
    display: block;
    min-width: 0;
}

.field > .label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 650;
    color: var(--text-soft);
}

.field .hint {
    display: block;
    margin-top: 4px;
    font-size: 11.5px;
    color: var(--muted);
}

.req {
    color: var(--danger);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 122, 90, .14);
}

textarea {
    resize: vertical;
    min-height: 76px;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c7d74' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-top: 24px;
    font-size: 13.5px;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    margin-bottom: 16px;
}

.filters .field {
    flex: 1 1 160px;
}

.filters .field.wide {
    flex: 2 1 260px;
}

.filters .btn {
    flex: 0 0 auto;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box > .ico {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--muted);
    pointer-events: none;
}

.search-box input {
    padding-left: 38px;
}

.search-box.has-scan input {
    padding-right: 50px;
}

.input-scan {
    position: relative;
    display: block;
}

.input-scan input {
    width: 100%;
    padding-right: 50px;
}

.scan-trigger {
    position: absolute;
    top: 50%;
    right: 6px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--accent);
    transform: translateY(-50%);
    cursor: pointer;
}

.scan-trigger:hover,
.scan-trigger:focus-visible {
    background: #d5eee2;
    color: var(--accent-dark);
}

.scan-trigger .ico {
    width: 19px;
    height: 19px;
}

body.scan-open {
    overflow: hidden;
}

.scan-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(9, 20, 15, .64);
    backdrop-filter: blur(3px);
}

.scan-dialog {
    width: 100%;
    max-width: 440px;
    padding: 16px;
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.scan-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.scan-head h3 {
    font-size: 17px;
}

.scan-close {
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.scan-view {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 12px;
    background: #0b1410;
}

.scan-view video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-frame {
    position: absolute;
    inset: 16% 9%;
    border: 2px solid rgba(255, 255, 255, .85);
    border-radius: 10px;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, .26);
    pointer-events: none;
}

.scan-line {
    position: absolute;
    top: 20%;
    left: 9%;
    right: 9%;
    height: 2px;
    background: #5ef2b6;
    box-shadow: 0 0 12px #5ef2b6;
    animation: scan-move 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes scan-move {
    0%, 100% { top: 20%; }
    50% { top: 80%; }
}

.scan-status {
    min-height: 20px;
    margin: 10px 0;
    color: var(--text-soft);
    font-size: 13px;
    text-align: center;
}

.scan-manual {
    display: flex;
    gap: 8px;
}

.scan-manual input {
    flex: 1;
    min-width: 0;
}

.scan-added {
    padding: 14px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 13.5px;
    line-height: 1.45;
}

/* ---------- Tables ---------- */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th {
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    background: var(--surface-2);
}

.table td {
    padding: 11px 12px;
    border-bottom: 1px solid #eef3ef;
    vertical-align: top;
}

.table tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: #fbfdfb;
}

.table .num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.table .actions {
    white-space: nowrap;
}

.item-name {
    font-weight: 600;
    color: var(--text);
}

.item-code {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.unit-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-width: 340px;
}

.unit-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    font-size: 11.5px;
    color: var(--text-soft);
    white-space: nowrap;
}

.unit-chip b {
    font-weight: 650;
    color: var(--accent-dark);
    font-variant-numeric: tabular-nums;
}

/* ---------- Quick add & cart bar ---------- */

.cart-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid #cbe7da;
    border-radius: 14px;
    background: var(--accent-soft);
}

.cart-bar-text {
    flex: 1 1 190px;
    min-width: 0;
}

.cart-bar-text strong {
    display: block;
    font-size: 13.5px;
}

.cart-bar-text span {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--text-soft);
}

.cart-bar form {
    margin: 0;
}

.quick-add {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.quick-add select {
    min-width: 128px;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 8px;
    min-height: 32px;
}

.quick-add input[type="number"] {
    width: 64px;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 8px;
    min-height: 32px;
}

.quick-add .btn {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
}

/* ---------- Picking list ---------- */

.pick-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.pick-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.pick-head h2 {
    margin: 0 0 2px;
    font-size: 16px;
}

.pick-head form {
    margin: 0;
}

.pick-orders {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.pick-order {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 2px 7px;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    font-size: 11px;
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pick-order b {
    color: var(--accent-dark);
    font-weight: 650;
}

.pick-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

.pick-form input[type="number"] {
    width: 76px;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 8px;
    min-height: 32px;
}

.pick-form .btn {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
}

/* ---------- Badges & alerts ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 11px;
    font-weight: 650;
    color: var(--text-soft);
    white-space: nowrap;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .75;
}

.badge.success {
    background: var(--accent-soft);
    border-color: #cbe7da;
    color: var(--accent-dark);
}

.badge.warn {
    background: var(--warn-soft);
    border-color: #f5ddb2;
    color: var(--warn);
}

.badge.danger {
    background: var(--danger-soft);
    border-color: #f5cbc5;
    color: var(--danger);
}

.badge.muted {
    color: var(--muted);
}

.badge.plain {
    background: var(--surface);
}

.badge.plain::before {
    display: none;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 14px;
    margin-bottom: 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 13.5px;
}

.alert strong {
    font-weight: 700;
}

.alert-success {
    background: #ecf8f1;
    border-color: #c6e8d6;
    color: #0a5b43;
}

.alert-danger {
    background: var(--danger-soft);
    border-color: #f5cbc5;
    color: #8c1d12;
}

.alert-warn {
    background: var(--warn-soft);
    border-color: #f5ddb2;
    color: #7a4706;
}

.alert-info {
    background: var(--info-soft);
    border-color: #cfdcff;
    color: #1e3a8a;
}

/* ---------- Empty & stats ---------- */

.empty {
    padding: 34px 18px;
    text-align: center;
    color: var(--muted);
    font-size: 13.5px;
}

.empty .ico {
    width: 30px;
    height: 30px;
    margin-bottom: 8px;
    color: #a6b4ac;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.stat .label {
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat .value {
    margin-top: 5px;
    font-size: 23px;
    font-weight: 750;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.stat .foot {
    margin-top: 3px;
    font-size: 11.5px;
    color: var(--muted);
}

/* ---------- Search results & cart ---------- */

.order-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
    gap: 16px;
    align-items: start;
}

.sticky-panel {
    position: sticky;
    top: 78px;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 2px;
}

.search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    transition: border-color .12s ease, background .12s ease;
}

.search-result:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
}

.sr-main {
    flex: 1;
    min-width: 0;
}

.sr-name {
    font-weight: 600;
    font-size: 13.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-meta {
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.sr-side {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.sr-price {
    font-weight: 700;
    font-size: 12.5px;
    color: var(--accent-dark);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.sr-add {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
}

.sr-add:hover {
    background: var(--accent-dark);
}

.cart-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-height: 52vh;
    overflow-y: auto;
}

.cart-row {
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
}

.cart-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cart-title {
    flex: 1;
    min-width: 0;
}

.cart-title strong {
    display: block;
    font-size: 13.5px;
    font-weight: 650;
    line-height: 1.3;
}

.cart-title span {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.cart-remove {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #9aa8a0;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
}

.cart-remove:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.cart-fields {
    display: grid;
    grid-template-columns: 1.2fr .7fr 1fr auto;
    gap: 7px;
    align-items: end;
    margin-top: 9px;
}

.cart-fields .field > .label {
    font-size: 10px;
    margin-bottom: 3px;
    color: var(--muted);
}

.cart-fields input,
.cart-fields select {
    padding: 7px 9px;
    font-size: 12.5px;
    border-radius: 8px;
    min-height: 34px;
}

.cart-subtotal {
    padding-bottom: 8px;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.cart-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--line-strong);
}

.cart-total span {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 600;
}

.cart-total strong {
    font-size: 20px;
    font-weight: 750;
    color: var(--accent-dark);
    font-variant-numeric: tabular-nums;
}

.sale-customer {
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px dashed var(--line-strong);
    background: var(--surface-2);
    margin-bottom: 12px;
}

.selected-customer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 11px;
    background: var(--accent-soft);
    border: 1px solid #cbe7da;
    color: var(--accent-dark);
    font-size: 13px;
}

.selected-customer strong {
    display: block;
}

.selected-customer span {
    font-size: 11.5px;
    opacity: .8;
}

.customer-results {
    margin-top: 8px;
    max-height: 190px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.customer-option {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    font-size: 12.5px;
    text-align: left;
    cursor: pointer;
}

.customer-option:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.customer-option strong {
    display: block;
    font-size: 13px;
}

.customer-option span {
    color: var(--muted);
    font-size: 11px;
}

/* ---------- Units repeater ---------- */

.unit-rows {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.unit-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr 1fr 34px;
    gap: 8px;
    align-items: end;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-2);
}

.unit-row .level {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: -2px;
}

.unit-row input {
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 8px;
}

.unit-del {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
}

.unit-del:hover {
    color: var(--danger);
    border-color: #f5cbc5;
    background: var(--danger-soft);
}

/* ---------- Detail / receipt ---------- */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.detail-item .label {
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
}

.detail-item .value {
    margin-top: 3px;
    font-size: 14.5px;
    font-weight: 600;
}

.receipt-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.receipt-head h2 {
    font-size: 18px;
}

.receipt-head .doc-no {
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.receipt-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    margin-bottom: 16px;
}

.receipt-meta .label {
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
}

.receipt-meta .value {
    margin-top: 2px;
    font-size: 13.5px;
    font-weight: 600;
}

.totals {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.totals-inner {
    width: min(320px, 100%);
}

.totals-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 5px 0;
    font-size: 13.5px;
}

.totals-row.grand {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px dashed var(--line-strong);
    font-size: 17px;
    font-weight: 750;
    color: var(--accent-dark);
}

.totals-row span:last-child {
    font-variant-numeric: tabular-nums;
}

/* ---------- Auth ---------- */

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1100px 520px at 8% -10%, #d8efe3, transparent 60%),
        radial-gradient(900px 480px at 100% 108%, #e4edff, transparent 55%),
        var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 410px;
    padding: 30px;
    border-radius: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 24px 60px rgba(13, 55, 38, .12);
}

.auth-card .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 17px;
    margin-bottom: 14px;
}

.auth-card h1 {
    font-size: 22px;
}

.auth-card .sub {
    margin: 4px 0 20px;
    color: var(--muted);
    font-size: 13px;
}

.auth-card .field {
    margin-bottom: 13px;
}

.auth-foot {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 11.5px;
    color: var(--muted);
    text-align: center;
}

.setup-card {
    max-width: 560px;
}

.setup-list {
    margin: 12px 0 16px;
    padding-left: 20px;
    font-size: 13.5px;
    color: var(--text-soft);
}

.setup-list li {
    margin-bottom: 6px;
}

/* ---------- Misc ---------- */

.hstack {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.divider {
    height: 1px;
    margin: 16px 0;
    background: var(--line);
}

.section-title {
    margin: 22px 0 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
}

.tabs {
    display: inline-flex;
    padding: 3px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    gap: 2px;
    margin-bottom: 14px;
}

.tabs a {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
}

.tabs a.active {
    background: var(--surface);
    color: var(--accent-dark);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
}

.import-help {
    padding: 13px 15px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    font-size: 12.5px;
    color: var(--text-soft);
}

.import-help code {
    padding: 1px 5px;
    border-radius: 5px;
    background: #e9f0eb;
    font-size: 11.5px;
}

.import-help ol {
    margin: 6px 0 0;
    padding-left: 18px;
}

.import-help li {
    margin-bottom: 3px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .order-grid {
        grid-template-columns: 1fr;
    }
    .sticky-panel {
        position: static;
    }
}

@media (max-width: 860px) {
    .sidebar {
        display: none;
    }
    .content {
        padding: 16px 14px calc(86px + env(safe-area-inset-bottom));
    }
    .topbar {
        height: 56px;
        padding: 0 13px;
    }
    .brand-text small {
        display: none;
    }
    .user-chip {
        padding-right: 4px;
    }
    .user-meta {
        display: none;
    }
    .bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        display: flex;
        gap: 2px;
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        overflow-x: auto;
        background: rgba(255, 255, 255, .97);
        backdrop-filter: blur(12px);
        border-top: 1px solid var(--line);
        scrollbar-width: none;
    }
    .bottom-nav::-webkit-scrollbar {
        display: none;
    }
    .bottom-nav a {
        flex: 1 0 62px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: 6px 4px;
        border-radius: 10px;
        color: #64756b;
        font-size: 10px;
        font-weight: 600;
        white-space: nowrap;
    }
    .bottom-nav a .ico {
        width: 21px;
        height: 21px;
    }
    .bottom-nav a.active {
        background: var(--accent-soft);
        color: var(--accent-dark);
    }
    .page-head h1 {
        font-size: 20px;
    }
    .card {
        padding: 14px;
        border-radius: 14px;
    }
    .table thead {
        display: none;
    }
    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
    }
    .table tbody tr {
        margin-bottom: 9px;
        padding: 7px 12px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--surface);
    }
    .table tbody tr:hover {
        background: var(--surface);
    }
    .table td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
        padding: 5px 0;
        border: 0;
        text-align: right;
    }
    .table td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        padding-top: 1px;
        font-size: 11.5px;
        font-weight: 600;
        color: var(--muted);
        text-align: left;
    }
    .table td:empty {
        display: none;
    }
    .table td .unit-chips {
        justify-content: flex-end;
    }
    .quick-add {
        justify-content: flex-end;
    }
    .pick-head {
        flex-direction: column;
    }
    .table td.actions {
        justify-content: flex-end;
        padding-top: 8px;
        margin-top: 4px;
        border-top: 1px dashed var(--line);
    }
    .table td.actions::before {
        align-self: center;
    }
    .filters {
        gap: 8px;
    }
    .filters .field {
        flex: 1 1 100%;
    }
    .filters .btn {
        flex: 1 1 auto;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-grid .full {
        grid-column: auto;
    }
    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
    .cart-fields {
        grid-template-columns: 1fr 1fr;
    }
    .cart-subtotal {
        padding-bottom: 0;
        text-align: right;
    }
    .cart-fields .cart-remove {
        position: absolute;
    }
    .unit-row {
        grid-template-columns: 1fr 1fr;
    }
    .unit-row .unit-del {
        justify-self: end;
    }
    .search-results {
        max-height: none;
    }
    .receipt-meta {
        gap: 14px;
    }
    .totals-inner {
        width: 100%;
    }
}

@media (max-width: 460px) {
    .brand-text {
        font-size: 13.5px;
    }
    .logout-form .btn {
        padding: 6px 9px;
        font-size: 12px;
    }
    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }
    .stat {
        padding: 12px;
    }
    .stat .value {
        font-size: 19px;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .page-actions {
        width: 100%;
    }
    .page-actions .btn {
        flex: 1;
    }
}

/* ---------- Print ---------- */

@media print {
    body {
        background: #fff;
        padding: 0;
        font-size: 12px;
    }
    .topbar,
    .sidebar,
    .bottom-nav,
    .no-print,
    .alert,
    .page-actions {
        display: none !important;
    }
    .shell {
        display: block;
    }
    .content {
        max-width: none;
        padding: 0;
    }
    .card {
        border: 0;
        box-shadow: none;
        padding: 0;
    }
    .table th,
    .table td {
        padding: 6px 8px;
    }
    .table tbody tr {
        border: 0;
        margin: 0;
        padding: 0;
        display: table-row;
    }
    .table td::before {
        display: none;
    }
    .table,
    .table tbody,
    .table tr,
    .table td {
        display: revert;
    }
}
