:root {
    --ink: #262a33;
    --ink-soft: #3e4450;
    --muted: #5d6470;
    --paper: #ffffff;
    --panel: #ffffff;
    --line: #f0e6d8;
    --line-strong: #e6d9c5;
    --accent: #ef6c00;
    --accent-deep: #e65100;
    --accent-tint: #fff3e0;
    --amber: #dfa32e;
    --amber-tint: #faf0d8;
    --green: #ef6c00;
    --green-tint: #fff3e0;
    --red: #c44500;
    --red-tint: #fff3e0;
    --blue: #7d8fd4;
    --blue-tint: #edeffa;
    --purple: #9d89dd;
    --purple-tint: #f1edfb;
    --lavender: #e6e0f9;
    --mint: #e2f0e0;
    --sun: #f8e6ac;
    --peach: #fdeadd;
    --charcoal: #262a33;
    --sidebar-bg: #f6efe6;
    --sidebar-line: #ece1d1;
    --sidebar-text: #3e4450;
    --shadow-sm: 0 2px 6px rgba(150, 110, 70, .07), 0 1px 2px rgba(150, 110, 70, .05);
    --shadow-lg: 0 10px 30px rgba(150, 110, 70, .15), 0 24px 48px rgba(150, 110, 70, .1);
    --shadow-md: 0 8px 22px rgba(150, 110, 70, .13), 0 18px 36px rgba(150, 110, 70, .08);
    --glow-green: 0 0 0 4px rgba(95, 141, 78, .12);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --ease-out: cubic-bezier(.22, .61, .36, 1);
    --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
    --sans: "Segoe UI", -apple-system, Roboto, Arial, sans-serif;
    --display: "Segoe UI Semibold", "Segoe UI", -apple-system, Roboto, Arial, sans-serif;
    --mono: "Consolas", "SFMono-Regular", "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--sans);
    background: var(--paper);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0 0 8px; line-height: 1.2; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.ink-soft { color: var(--ink-soft); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.w-100 { width: 100%; }

/* Layout */
.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 274px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 60;
    transition: transform .22s ease;
}
.sidebar-brand {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--sidebar-line);
    display: flex;
    align-items: center;
    gap: 11px;
}
.brand-mark {
    width: 42px; height: 42px; border-radius: 14px;
    background: linear-gradient(140deg, #ffcc80, #ef6c00);
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 18px;
    font-family: var(--display);
    box-shadow: 0 6px 14px rgba(95, 141, 78, .28);
}
.brand-text strong { display: block; color: var(--ink); font-family: var(--display); font-size: 16px; letter-spacing: .2px; }
.brand-text span { display: block; font-size: 11px; color: #a3978b; margin-top: 2px; }
.sidebar-scroll { overflow-y: auto; flex: 1; padding: 12px 10px 26px; scrollbar-width: thin; }
.sidebar-label { padding: 10px 10px 6px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #b3a796; }
.nav-group { margin: 2px 0; }
.nav-group > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 12px;
    color: #443c35;
    font-weight: 600;
    user-select: none;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { background: rgba(255,255,255,.65); }
.nav-group > summary .chev { margin-left: auto; transition: transform .18s ease; font-size: 10px; color: #b3a796; }
.nav-group[open] > summary .chev { transform: rotate(90deg); }
.nav-group[open] > summary { background: rgba(255,255,255,.8); box-shadow: var(--shadow-sm); }
.nav-children { padding: 4px 0 6px 10px; }
.nav-sub-label {
    padding: 12px 10px 4px 16px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #b3a796;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px 7px 16px;
    border-radius: 10px;
    color: #6b6157;
    font-size: 13px;
    border-left: 2px solid transparent;
    margin: 1px 0;
}
.nav-link:hover { color: var(--ink); background: rgba(255,255,255,.65); text-decoration: none; }
.nav-link.active { color: #fff; background: var(--charcoal); border-left-color: transparent; box-shadow: 0 4px 10px rgba(43, 38, 32, .18); }
.nav-link .link-ico { width: 22px; min-width: 22px; text-align: center; font-size: 13px; line-height: 1; flex: 0 0 auto; transition: transform .18s var(--ease-spring); }
.nav-link.active .dot { background: #f0c987; }
.module-icon {
    width: 28px; height: 28px; min-width: 28px;
    display: grid; place-items: center;
    border-radius: 9px; font-size: 14px;
    background: rgba(255,255,255,.75);
    box-shadow: 0 1px 3px rgba(150, 110, 70, .1);
}
.tone-sales { background: var(--mint); }
.tone-dealers { background: var(--peach); }
.tone-masters { background: var(--lavender); }
.tone-purchase { background: #f9e3cf; }
.tone-inventory { background: var(--accent-tint); }
.tone-production { background: var(--purple-tint); }
.tone-updates { background: #fae4ee; }
.tone-setup { background: #def0ee; }
.tone-accounts { background: var(--blue-tint); }
.tone-hr { background: #fbe9d6; }
.tone-admin { background: #efeae2; }
.tone-reports { background: #e3f0f7; }
.tone-website { background: var(--sun); }

.main { margin-left: 274px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 40;
    height: 64px;
    display: flex; align-items: center; gap: 14px;
    padding: 0 22px;
    background: rgba(250, 244, 236, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
}
.topbar.is-scrolled { background: rgba(253, 250, 245, .98); box-shadow: 0 4px 18px rgba(150, 110, 70, .09); }
.topbar .page-title { font-family: var(--display); font-size: 17px; font-weight: 700; }
.topbar .page-sub { font-size: 11px; color: var(--muted); }
.topbar-search { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-search input {
    width: 250px; border: 1px solid var(--line); background: var(--paper);
    border-radius: 8px; padding: 8px 11px; font-size: 13px;
}
.user-menu { display: flex; align-items: center; gap: 10px; padding-left: 12px; border-left: 1px solid var(--line); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent-tint); color: var(--accent-deep);
    display: grid; place-items: center; font-weight: 700;
}
.user-menu form { margin: 0; }
.content { padding: 22px; flex: 1; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.breadcrumbs { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

/* Components */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.card-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }
.card-head .actions { margin-left: auto; display: flex; gap: 7px; flex-wrap: wrap; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: #faf6ef; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.stat {
    padding: 16px 18px;
    border-radius: var(--radius-md);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    min-width: 0;
    overflow: hidden;
}
.stat .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; overflow-wrap: anywhere; }
.stat .value { font-family: var(--display); font-size: 24px; margin-top: 7px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; word-break: break-word; }
.stat .meta { font-size: 11px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.grid > * { min-width: 0; }
.summary-cards { gap: 8px; }
.summary-cards .stat { padding: 6px 8px; }
.summary-cards .stat .label { font-size: 9px; }
.summary-cards .stat .value { font-size: 16px; margin-top: 2px; }
.summary-cards .stat .meta { font-size: 8px; margin-top: 1px; }
.dealer-ledger-letterhead, .dealer-ledger-title, .dealer-ledger-party, .dealer-ledger-section, .dealer-ledger-signatures { display: none; }
.collection-print-header { display: none; }
.return-letterhead, .return-title, .return-meta, .return-print-table, .return-total-row, .return-note, .return-signatures, .return-declaration { display: none; }
.report-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.return-filter-grid { display: grid; grid-template-columns: 1.1fr 1.4fr 1fr 1.7fr 1fr; gap: 12px; }
@media (max-width: 900px) { .return-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .return-filter-grid { grid-template-columns: 1fr; } }
@media print {
    body.return-invoice-print .print-header, body.return-invoice-print .print-note { display: none !important; }
    body.return-invoice-print .print-sheet { max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; }
    body.return-invoice-print .return-invoice-sheet { display: block; color: #111; }
    body.return-invoice-print .return-letterhead { display: flex; justify-content: center; align-items: center; gap: 10px; border-bottom: 2px solid #315d40; padding-bottom: 8px; text-align: center; }
    body.return-invoice-print .return-letterhead img { width: 54px; height: 45px; object-fit: contain; }
    body.return-invoice-print .return-letterhead strong { display: block; font-size: 22px; }
    body.return-invoice-print .return-letterhead span { display: block; font-size: 9px; line-height: 1.15; }
    body.return-invoice-print .return-title { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 7px; }
    body.return-invoice-print .return-title strong { font-size: 20px; margin: 0 auto; text-decoration: underline; }
    body.return-invoice-print .return-title span { font-size: 11px; font-weight: 700; }
    body.return-invoice-print .return-meta { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #58626b; margin-bottom: 12px; }
    body.return-invoice-print .return-meta > div { padding: 7px 10px; }
    body.return-invoice-print .return-meta > div + div { border-left: 1px solid #58626b; }
    body.return-invoice-print .return-meta div div { display: grid; grid-template-columns: 105px 1fr; font-size: 10px; line-height: 1.55; }
    body.return-invoice-print .return-meta b { font-weight: 700; }
    body.return-invoice-print .return-print-table { display: table; width: 100%; border-collapse: collapse; font-size: 10px; }
    body.return-invoice-print .return-print-table th, body.return-invoice-print .return-print-table td { border: 1px solid #58626b; padding: 6px 7px; }
    body.return-invoice-print .return-print-table th { background: #eef1e9; font-weight: 700; }
    body.return-invoice-print .return-print-table th:nth-child(n+3), body.return-invoice-print .return-print-table td:nth-child(n+3) { text-align: right; }
    body.return-invoice-print .return-totals { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 11px; padding: 9px 7px; border-bottom: 1px solid #829084; }
    body.return-invoice-print .return-totals div { display: flex; justify-content: space-between; width: 260px; }
    body.return-invoice-print .return-totals .grand { background: #f4ead0; font-size: 13px; font-weight: 700; padding: 5px; }
    body.return-invoice-print .return-note { display: block; font-size: 10px; margin-top: 10px; }
    body.return-invoice-print .return-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 90px; margin-top: 105px; text-align: center; font-size: 11px; }
    body.return-invoice-print .return-signatures div { border-top: 1px solid #333; padding-top: 7px; }
    body.return-invoice-print .return-signatures span { font-size: 10px; }
    body.return-invoice-print .return-declaration { display: block; text-align: center; font-size: 9px; color: #4b5560; margin-top: 38px; line-height: 1.5; }
    body.dealer-ledger-print .print-header, body.dealer-ledger-print .print-note { display: none !important; }
    .dealer-ledger-print .print-sheet { max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; }
    .dealer-ledger-print .dealer-ledger-letterhead { display: flex; justify-content: center; align-items: center; gap: 9px; border-bottom: 2px solid #315d40; padding-bottom: 7px; text-align: center; }
    .dealer-ledger-print .dealer-ledger-letterhead img { width: 45px; height: 38px; object-fit: contain; }
    .dealer-ledger-print .dealer-ledger-letterhead strong { display: block; font-size: 18px; }
    .dealer-ledger-print .dealer-ledger-letterhead span { display: block; font-size: 8px; line-height: 1.15; }
    .dealer-ledger-print .dealer-ledger-title { display: block; text-align: center; font-size: 18px; font-weight: 700; margin-top: 8px; }
    .dealer-ledger-print .dealer-ledger-party { display: block; text-align: center; font-size: 10px; margin: 2px 0 14px; }
    .dealer-ledger-print .dealer-ledger-section { display: block; font-size: 11px; margin: 0 0 5px; text-transform: uppercase; }
    .dealer-ledger-print table { width: 100%; border-collapse: collapse; font-size: 9px; }
    .dealer-ledger-print th, .dealer-ledger-print td { border: 1px solid #324a68; padding: 5px 6px; }
    .dealer-ledger-print th { background: #eef2f7; font-weight: 700; }
    .dealer-ledger-print td:nth-child(n+4), .dealer-ledger-print th:nth-child(n+4) { text-align: right; }
    .dealer-ledger-print .dealer-ledger-signatures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 34px; margin-top: 70px; text-align: center; font-size: 10px; }
    .dealer-ledger-print .dealer-ledger-signatures div { border-top: 1px solid #324a68; padding-top: 8px; }
    .collection-receiver-report .report-controls, .collection-receiver-report .page-head { display: none !important; }
    .collection-receiver-report { width: 100%; }
    .collection-receiver-report .collection-print-header { display: block; text-align: center; border-bottom: 2px solid #315d40; padding-bottom: 8px; margin-bottom: 12px; font-size: 10px; }
    .collection-receiver-report .collection-print-brand { display: flex; justify-content: center; align-items: center; gap: 8px; }
    .collection-receiver-report .collection-print-brand img { width: 48px; height: 40px; object-fit: contain; }
    .collection-receiver-report .collection-print-brand strong { display: block; font-size: 19px; }
    .collection-receiver-report .collection-print-brand span { display: block; font-size: 7px; line-height: 1.1; }
    .collection-receiver-report .collection-print-header h2 { margin: 7px 0 2px; color: #315d40; font-size: 17px; }
    .collection-receiver-report .card { border: 0; box-shadow: none; margin: 0 0 10px; padding: 0; }
    .collection-receiver-report .card-head { border: 0; padding: 0 0 4px; }
    .collection-receiver-report .card-head h2 { font-size: 11px; }
    .collection-receiver-report .card-body { padding: 0; }
    .collection-receiver-report .report-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
    .collection-receiver-report .report-summary-grid .stat { padding: 7px; border: 1px solid #aab89f; box-shadow: none; }
    .collection-receiver-report .report-summary-grid .stat .label { font-size: 7px; }
    .collection-receiver-report .report-summary-grid .stat .value { font-size: 13px; margin-top: 3px; }
    .collection-receiver-report table.data { width: 100%; border-collapse: collapse; font-size: 8px; }
    .collection-receiver-report table.data th, .collection-receiver-report table.data td { border: 1px solid #84927d; padding: 3px 4px; }
    .collection-receiver-report table.data th { background: #eef1e9 !important; }
    .collection-receiver-report .table-wrap { overflow: visible; }
}
.stat.accent { background: var(--lavender); border-color: #dcd4f2; color: var(--ink); }
.stat.accent .label, .stat.accent .meta { color: #7a6fa3; }
.stat.accent .value { color: #4b3f80; }
.stat.warn { background: var(--sun); border-color: #f0df9e; color: var(--ink); }
.stat.warn .label, .stat.warn .meta { color: #a08323; }
.stat.warn .value { color: #6e5611; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 15px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--sans);
    cursor: pointer;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .18s ease, transform .18s var(--ease-out);
}
.btn:hover { border-color: var(--line-strong); color: var(--ink); background: var(--paper); text-decoration: none; box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; box-shadow: 0 5px 14px rgba(95, 141, 78, .32); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #cf5a47; border-color: #cf5a47; color: #fff; box-shadow: 0 5px 14px rgba(226, 112, 94, .32); }
.btn-warn { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn-warn:hover { background: #c8922a; border-color: #c8922a; color: #fff; box-shadow: 0 5px 14px rgba(223, 163, 46, .32); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent-deep); }
.btn-ghost:hover { background: var(--accent-tint); box-shadow: none; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: #eef1e9;
    color: var(--ink-soft);
    white-space: nowrap;
}
.badge-green { background: var(--green-tint); color: #256b44; }
.badge-red { background: var(--red-tint); color: #8d2e26; }
.badge-amber { background: var(--amber-tint); color: #80591a; }
.badge-blue { background: var(--blue-tint); color: #294f74; }
.badge-purple { background: var(--purple-tint); color: #563b7c; }
.badge-gray { background: #eef1e9; color: #5d6658; }

.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
    text-align: left; padding: 10px 12px;
    background: #f7f8fa; border-bottom: 1px solid var(--line);
    font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
    white-space: nowrap;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid #f0f2f6; vertical-align: top; }
table.data tbody tr:hover { background: #fafbfd; }
table.data tfoot td { padding: 11px 12px; border-top: 1px solid var(--line-strong); background: #f7f8fa; font-weight: 700; }
table.data.compact th, table.data.compact td { padding: 7px 9px; }
table.data .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .actions-cell { white-space: nowrap; text-align: right; }
table.data tr.is-reversed td { color: #8b92a3; text-decoration: line-through; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink-soft); margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }

form .form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
form .form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
form .form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .label { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.field .hint { font-size: 11px; color: var(--muted); }
.check-line { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-soft); margin: 3px 0; text-transform: none; letter-spacing: 0; font-weight: 500; }
.check-line input[type="checkbox"] { width: auto; margin: 0; }
.readout { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #f7f8fa; font-size: 15px; }
details > summary.link { cursor: pointer; color: var(--green-dark, #2f5f3c); font-size: 12px; font-weight: 600; }
details > summary.link::marker { color: var(--muted); }
input, select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 13px;
    min-height: 36px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(95, 141, 78, .25); border-color: var(--accent); box-shadow: var(--glow-green); }
input[readonly], textarea[readonly], .readonly { background: #f7f8fa; color: var(--ink-soft); }
textarea { resize: vertical; min-height: 72px; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.check input { margin: 0; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
.help-box { padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 12px; background: #f7f8fa; color: var(--ink-soft); font-size: 12px; }
.help-box strong { color: var(--ink); }

.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; font-size: 13px; }
.alert-success { background: var(--green-tint); border-color: #b9dfc8; color: #225d3c; }
.alert-error { background: var(--red-tint); border-color: #eac1bc; color: #7f2b24; }
.alert-info { background: var(--blue-tint); border-color: #c4d8ea; color: #294f74; }
.alert-warn { background: var(--amber-tint); border-color: #e7cfa0; color: #6f4d13; }
.alert ul { margin: 5px 0 0 18px; padding: 0; }

.tabs { display: flex; gap: 5px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 8px 12px; border-radius: 7px 7px 0 0; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--accent-deep); border-bottom-color: var(--accent); background: #fff; font-weight: 700; }
.nav-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.nav-pills a { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); font-size: 12px; background: #fff; }
.nav-pills a.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { min-width: 130px; }
.filters .field.grow { flex: 1; min-width: 180px; }
.filters .btn { min-height: 36px; }
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager .links { display: flex; gap: 4px; flex-wrap: wrap; }
.pager a, .pager span { padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; background: #fff; }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager span.current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.pager span.disabled { color: #b7bdb0; background: #f5f6fa; }
.pager .meta { font-size: 12px; color: var(--muted); }

.quick-actions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.quick-action {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex; flex-direction: column; gap: 7px;
    color: var(--ink);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.quick-action:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); text-decoration: none; }
.quick-action .qi { font-size: 19px; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--mint); box-shadow: 0 2px 6px rgba(150, 110, 70, .09); }
.quick-action strong { font-size: 13px; }
.quick-action span { font-size: 11px; color: var(--muted); }

.list-plain { margin: 0; padding: 0; list-style: none; }
.list-plain li { padding: 10px 0; border-bottom: 1px solid #f0f2f6; display: flex; gap: 10px; align-items: flex-start; }
.list-plain li:last-child { border-bottom: 0; }
.list-plain .grow { flex: 1; min-width: 0; }
.list-plain .strong { font-weight: 600; }
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.totals { display: flex; flex-direction: column; gap: 7px; }
.totals .row { display: flex; justify-content: space-between; gap: 18px; font-size: 13px; }
.totals .row.total { border-top: 1px solid var(--line-strong); padding-top: 8px; margin-top: 3px; font-weight: 700; font-size: 15px; }
.totals .row .num { font-family: var(--mono); }
.summary-strip { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 10px 0; font-size: 12px; color: var(--muted); }
.summary-strip strong { color: var(--ink); }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.section-note { font-size: 12px; color: var(--muted); margin-top: 4px; }

.line-table input, .line-table select { min-height: 31px; padding: 5px 7px; font-size: 12px; }
.line-table th, .line-table td { padding: 6px 7px; }
.line-table .num input { text-align: right; font-family: var(--mono); }
.line-table tfoot td { font-weight: 600; }
.remove-line { color: var(--red); border: 0; background: transparent; cursor: pointer; font-size: 16px; line-height: 1; padding: 4px; }
.add-line { margin-top: 8px; }

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    background: var(--paper);
}
.login-art { display: flex; flex-direction: column; justify-content: space-between; padding: 48px; color: var(--ink-soft); background: radial-gradient(circle at 18% 12%, rgba(255, 214, 170, .55), transparent 40%), radial-gradient(circle at 80% 85%, rgba(190, 226, 168, .5), transparent 42%), radial-gradient(circle at 65% 30%, rgba(230, 224, 249, .6), transparent 35%), var(--sidebar-bg); }
.login-art .headline { font-family: var(--display); font-size: 34px; line-height: 1.14; color: var(--ink); max-width: 560px; }
.login-art .sub { color: #5d6470; max-width: 480px; margin-top: 14px; font-size: 14px; }
.login-art .pills { display: flex; flex-wrap: wrap; gap: 8px; }
.login-art .pill { padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.75); border: 1px solid rgba(150, 110, 70, .08); font-size: 12px; color: var(--ink-soft); box-shadow: var(--shadow-sm); }
.login-card-wrap { display: grid; place-items: center; padding: 32px; background: var(--paper); }
.login-card { width: 100%; max-width: 430px; background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--line); box-shadow: var(--shadow-md); padding: 30px; }
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-card .field { margin-bottom: 13px; }
.login-card .btn { width: 100%; padding: 10px; font-size: 14px; margin-top: 5px; }
.login-foot { font-size: 11px; color: var(--muted); text-align: center; margin-top: 18px; }

.report-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.print-only { display: none; }
.print-header { display: none; }
.company-block { text-align: center; margin-bottom: 14px; }
.company-block h2 { margin-bottom: 2px; }
.doc-title { text-align: center; font-family: var(--display); font-size: 20px; letter-spacing: .08em; text-transform: uppercase; margin: 4px 0 14px; }
.signature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 54px; text-align: center; font-size: 12px; }
.signature-grid div { border-top: 1px solid #555; padding-top: 6px; }
.print-note { border: 1px dashed #999; padding: 10px; min-height: 58px; font-size: 12px; }

.mobile-toggle { display: none; border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 7px 9px; font-size: 17px; line-height: 1; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(16,20,16,.5); z-index: 55; }

/* Module-specific color utilities */
.pill-icon { width: 32px; height: 32px; border-radius: 9px; display: inline-grid; place-items: center; font-size: 15px; background: var(--accent-tint); }
.table-person { display: flex; gap: 8px; align-items: center; }
.table-person .avatar { width: 28px; height: 28px; font-size: 11px; }
.progress { height: 5px; background: #f0f2f6; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.inline-form { display: inline; margin: 0; }
.header-search { display: flex; gap: 6px; }
.small-table table.data { font-size: 12px; }
.small-table table.data th { font-size: 10px; }
.audit-json { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); max-width: 360px; word-break: break-word; }
.pill-note { display: inline-block; padding: 2px 7px; border-radius: 4px; background: #f2f3f6; color: #6d6240; font-size: 11px; }

@media (max-width: 1200px) {
    .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .form-grid, form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-md); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .main { margin-left: 0; }
    .mobile-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .topbar-search { display: none; }
    .split { grid-template-columns: minmax(0, 1fr); }
    .login-page { grid-template-columns: 1fr; }
    .login-art { display: none; }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .content { padding: 14px; }
    .topbar { padding: 0 12px; height: 58px; }
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: minmax(0, 1fr); }
    .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .welcome-banner { padding: 20px; }
    .welcome-banner h1 { font-size: 22px; }
    .form-grid, form .form-grid, .form-grid.two, .form-grid.four { grid-template-columns: minmax(0, 1fr); }
    .page-head .actions { margin-left: 0; width: 100%; }
    .page-head .actions .btn { flex: 1; }
    .user-menu .user-text { display: none; }
    .card-head, .card-body { padding-left: 13px; padding-right: 13px; }
    h1 { font-size: 20px; }
    .kv { grid-template-columns: 110px minmax(0, 1fr); }
    .filters .field { min-width: 100%; }
    .filters .field.grow { min-width: 100%; }
    .pager { flex-direction: column; align-items: flex-start; }
}

@media print {
    body { background: #fff; font-size: 11px; }
    .sidebar, .topbar, .mobile-toggle, .page-head .actions, .no-print, .pager, .tabs, .nav-pills { display: none !important; }
    .main { margin: 0; }
    .content { padding: 0; }
    .card { border: 0; box-shadow: none; }
    .card-head { border-bottom: 1px solid #999; }
    .print-only { display: block !important; }
    .print-actions.print-only { display: none !important; }
    .print-header { display: block; }
    table.data th, table.data td { padding: 5px 6px; }
    .page-break { page-break-before: always; }
    a { color: #000; text-decoration: none; }
    .badge { border: 1px solid #999; }
}

/* Layout additions */
.topbar-title { min-width: 0; }
.topbar-title .page-title { font-weight: 700; font-size: 15px; color: var(--ink); }
.topbar-title .page-sub { font-size: 11px; color: var(--muted); }

/* Print document layout */
.print-page { background: #eceee7; }
.print-sheet { max-width: 1000px; margin: 26px auto; background: #fff; padding: 34px 40px; border: 1px solid var(--line); box-shadow: var(--shadow-md); }
.print-page .print-header { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #333; padding-bottom: 12px; margin-bottom: 20px; }
.print-page .print-header h1 { font-size: 22px; margin: 0 0 4px; }
.print-page .doc-title { text-align: right; margin: 0; }
.print-page .doc-title h2 { margin: 0 0 3px; letter-spacing: .08em; }
.print-page .print-note { margin-top: 28px; }
.print-actions { max-width: 1000px; margin: 0 auto 40px; display: flex; gap: 8px; }
.print-actions.print-only { display: flex; }
.print-page table.data { font-size: 12px; }
.print-page table.data th { background: #f1f3ec; }

/* Sales invoice layout based on the supplied reference. */
@page { margin: 10mm; }
.sales-sample-print { background: #fff; }
.sales-sample-print .print-header, .sales-sample-print .print-note { display: none; }
.sales-sample-print .print-sheet {
    width: 190mm;
    min-height: 277mm;
    max-width: none;
    margin: 0 auto;
    box-sizing: border-box;
    border: 0;
    box-shadow: none;
    color: #181d19;
    font-family: Arial, sans-serif;
}
.sales-letterhead { display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; border-bottom: 3px solid #315d40; padding: 4px 0 8px; }
.sales-company-logo { display: block; width: 68px; height: 68px; object-fit: contain; flex: 0 0 68px; align-self: center; }
.sales-company-copy { min-width: 0; }
.sales-company-name { font-size: 22px; line-height: 1.15; font-weight: 700; }
.sales-company-address { margin-top: 3px; color: #333; font-size: 10px; line-height: 1.25; }
.sales-title { position: relative; text-align: center; padding: 9px 0; font-size: 15px; text-decoration: underline; }
.sales-title span { position: absolute; right: 0; font-size: 10px; text-decoration: none; font-weight: 700; }
.sales-meta { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #48534b; font-size: 11px; line-height: 1.4; }
.sales-meta > div { padding: 6px 9px; min-width: 0; }
.sales-meta > div + div { border-left: 1px solid #48534b; }
.sales-meta > div > div { display: grid; grid-template-columns: 105px 1fr; gap: 5px; }
.sales-goods, .sales-history { width: 100%; border-collapse: collapse; color: #171d19; }
.sales-goods { margin-top: 10px; font-size: 10px; }
.sales-goods th, .sales-goods td, .sales-history th, .sales-history td { border: 1px solid #58655c; padding: 5px; }
.sales-goods th, .sales-history th { background: #f1f4ee; font-weight: 700; }
.sales-goods th:nth-child(2) { width: 39%; }
.sales-goods .num { text-align: right; white-space: nowrap; }
.sales-goods .center { text-align: center; }
.sales-goods tr { break-inside: avoid; }
.sales-goods thead { display: table-header-group; }
.sales-bottom { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; margin-top: 12px; font-size: 11px; }
.sales-history { font-size: 10px; margin: 4px 0 10px; }
.sales-history .empty-history { text-align: center; }
.sales-totals > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px; }
.sales-strong { font-weight: 700; border-bottom: 1px solid #aaa; }
.sales-grand { background: #f8ebd3; font-weight: 700; }
.sales-signatures { display: flex; justify-content: space-between; text-align: center; margin-top: 155px; gap: 20px; font-size: 11px; break-inside: avoid; }
.sales-signatures > div { border-top: 1px solid #333; width: 170px; padding-top: 5px; }
.sales-signature-image { display: block; width: 175px; height: 58px; object-fit: contain; margin: -5px auto 0; }
.sales-signatures .authorised-signature { border-top: 0; padding-top: 0; }
.sales-signatures .received-signature { margin-top: 58px; }
.authorised-signature-line { width: 170px; border-top: 1px solid #333; margin: 0 auto 5px; }
.branding-preview { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.branding-preview img { max-width: 150px; max-height: 65px; border: 1px solid var(--line); padding: 5px; background: #fff; object-fit: contain; }
.branding-actions { display: flex; gap: 8px; margin: 0 13px 13px; }
.split-qty { display: flex; align-items: center; gap: 3px; }
.split-qty input { width: 68px; min-width: 0; }
.split-qty span { color: var(--muted); }
.free-qty { display: flex; align-items: center; gap: 3px; margin-top: 4px; font-size: 11px; }
.free-qty input { width: 48px; min-width: 0; }
.unit-qty { display: flex; align-items: center; gap: 3px; }
.unit-qty input { width: 52px; min-width: 0; }
.unit-qty select { width: 70px; min-width: 0; }
.line-rate-carton-input { width: 100%; min-width: 0; }
.line-item-search { width: 100%; margin-bottom: 4px; }
.line-item.line-item-hidden { display: none; }
.gift-note-row { display: grid; grid-template-columns: auto auto; gap: 7px 12px; align-items: center; }
.gift-note-label { color: var(--muted); font-size: 11px; letter-spacing: .06em; }
.gift-note-label span { font-size: 10px; }
.gift-note-row textarea { grid-column: 1 / -1; width: 100%; }
.sales-declaration { margin-top: 25px; text-align: center; font-size: 10px; color: #333; }
.sales-note { margin: 12px 0 0; white-space: normal; }
.due-overdue td { background: #fff0ed; }
.package-report-table th, .package-report-table td { white-space: nowrap; }
.package-print-header { display: none; }
@media print {
    .package-sales-report .report-controls { display: none !important; }
    .package-sales-report { width: 100%; margin: 0; }
    .package-sales-report .card { border: 0; box-shadow: none; margin: 0; padding: 0; }
    .package-sales-report .card-head { border: 0; padding: 0 0 3px; }
    .package-sales-report .card-head h2 { font-size: 6px; margin: 0; font-weight: 700; }
    .package-sales-report .table-wrap { overflow: visible; }
    .package-sales-report .package-report-table { width: 100%; border-collapse: collapse; font-size: 6px; line-height: 1.05; }
    .package-sales-report .package-report-table th,
    .package-sales-report .package-report-table td { border: 1px solid #aab89f; padding: 2px 3px; color: #111; }
    .package-sales-report .package-report-table th { background: #eef1e9 !important; font-size: 6px; }
    .package-sales-report .package-report-table .total-row th { font-weight: 700; }
    .package-sales-report .package-print-header { display: none; text-align: center; border-bottom: 1px solid #315d40; padding-bottom: 5px; margin-bottom: 6px; font-size: 8px; }
    .package-sales-report .package-print-brand { display: flex; justify-content: center; align-items: center; gap: 7px; }
    .package-sales-report .package-print-brand img { width: 28px; height: 25px; object-fit: contain; }
    .package-sales-report .package-print-brand strong { display: block; font-size: 10px; }
    .package-sales-report .package-print-brand span { display: block; font-size: 4px; line-height: 1.1; }
    .package-sales-report .package-print-header h2 { margin: 3px 0 1px; font-size: 9px; color: #174e33; }
    body.print-package-summary .package-print-summary-header,
    body.print-package-invoices .package-print-invoices-header { display: block; }
    body.print-package-summary .package-invoices { display: none !important; }
    body.print-package-invoices .package-summary { display: none !important; }
    body.print-package-summary .package-print-brand img { width: 62px; height: 54px; }
    body.print-package-summary .package-print-brand strong { font-size: 27px; }
    body.print-package-summary .package-print-brand span { font-size: 12px; }
    body.print-package-summary .package-print-header h2 { margin: 10px 0 2px; font-size: 25px; }
    body.print-package-summary .package-print-header { font-size: 16px; padding-bottom: 9px; margin-bottom: 18px; }
    body.print-package-summary .package-summary .card-head { padding-bottom: 8px; }
    body.print-package-summary .package-summary .card-head h2 { font-size: 18px; }
    body.print-package-summary .package-summary .package-report-table { font-size: 14px; line-height: 1.15; }
    body.print-package-summary .package-summary .package-report-table th,
    body.print-package-summary .package-summary .package-report-table td { padding: 7px 9px; }
    body.print-package-summary .package-summary .package-report-table th { font-size: 14px; }
    body.print-package-invoices .package-print-brand img { width: 60px; height: 50px; }
    body.print-package-invoices .package-print-brand strong { font-size: 21px; }
    body.print-package-invoices .package-print-brand span { font-size: 9px; }
    body.print-package-invoices .package-print-header h2 { margin: 8px 0 3px; font-size: 18px; }
    body.print-package-invoices .package-print-header { font-size: 12px; padding-bottom: 10px; margin-bottom: 14px; }
    body.print-package-invoices .package-invoices .card-head { padding-bottom: 5px; }
    body.print-package-invoices .package-invoices .card-head h2 { font-size: 13px; }
    body.print-package-invoices .package-invoices .package-report-table { font-size: 13px; line-height: 1.2; }
    body.print-package-invoices .package-invoices .package-report-table th,
    body.print-package-invoices .package-invoices .package-report-table td { padding: 6px 7px; }
    body.print-package-invoices .package-invoices .package-report-table th { font-size: 12px; }
}
.due-print-header { display: none; }
@media print {
    .payment-due-report .page-head, .payment-due-report .report-controls { display: none !important; }
    .payment-due-report .card { border: 0; box-shadow: none; margin: 0; }
    .payment-due-report .table-wrap { overflow: visible; }
    .payment-due-report .due-print-header { display: block; text-align: center; border-bottom: 2px solid #315d40; padding: 0 0 7px; margin-bottom: 8px; font-size: 10px; }
    .payment-due-report .due-print-brand { display: flex; justify-content: center; align-items: center; gap: 8px; }
    .payment-due-report .due-print-brand img { width: 42px; height: 38px; object-fit: contain; }
    .payment-due-report .due-print-brand strong { display: block; font-size: 14px; }
    .payment-due-report .due-print-brand span { display: block; font-size: 7px; line-height: 1.2; }
    .payment-due-report .due-print-header h2 { margin: 6px 0 1px; font-size: 14px; color: #174e33; }
    .payment-due-report .due-tracker { width: 100%; border-collapse: collapse; font-size: 8px; }
    .payment-due-report .due-tracker th, .payment-due-report .due-tracker td { border: 1px solid #829084; padding: 3px 4px; color: #111; }
    .payment-due-report .due-tracker th { background: #f1f4ee !important; font-weight: 700; }
    .payment-due-report .due-tracker .badge { font-size: 8px; padding: 1px 4px; }
    .payment-due-report .due-overdue td { background: #fff0ed !important; }
}
@media print {
    .sales-sample-print .print-sheet { width: 190mm; min-height: 277mm; padding: 0; margin: 0 auto; }
    .sales-goods th, .sales-history th, .sales-grand { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Purchase invoice: strong grid lines and legible figures in preview and print. */
.purchase-invoice-print .print-sheet { color: #111; }
.purchase-invoice-print .print-header { border-bottom: 2px solid #222; }
.purchase-invoice-print .muted, .purchase-invoice-print .small { color: #333; }
.purchase-invoice-print table.data { width: 100%; border-collapse: collapse; border: 1px solid #333; font-size: 11px; color: #111; }
.purchase-invoice-print table.data th,
.purchase-invoice-print table.data td { border: 1px solid #555; padding: 6px 5px; color: #111; vertical-align: top; }
.purchase-invoice-print table.data th { background: #ececec; color: #111; font-size: 10px; font-weight: 700; }
.purchase-invoice-print table.data tfoot td { background: #f5f5f5; border: 1px solid #555; color: #111; font-weight: 700; }
.purchase-invoice-print table.data .num { color: #111; font-weight: 600; }
.purchase-invoice-print .totals { border: 1px solid #555; }
.purchase-invoice-print .totals .row { padding: 6px 8px; border-bottom: 1px solid #aaa; color: #111; }
.purchase-invoice-print .totals .row:last-child { border-bottom: 0; }
.purchase-invoice-print .totals .row.total { font-weight: 700; background: #f1f1f1; }
@media print {
    .purchase-invoice-print .print-sheet { padding: 0; }
    .purchase-invoice-print table.data { font-size: 9px; }
    .purchase-invoice-print table.data th { font-size: 8px; background: #eee !important; color: #000 !important; }
    .purchase-invoice-print table.data th, .purchase-invoice-print table.data td { border: 0.7pt solid #333 !important; padding: 4px 3px; color: #000 !important; }
    .purchase-invoice-print .muted, .purchase-invoice-print .small, .purchase-invoice-print .totals .row { color: #111 !important; }
    .purchase-invoice-print .totals { border: 0.7pt solid #333; }
}

/* Small helpers */
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack-sm { display: flex; flex-direction: column; gap: 4px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--accent-tint); color: var(--accent-deep); font-size: 11px; font-weight: 700; }
.text-mono { font-family: var(--mono); }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.badge-lg { font-size: 12px; padding: 4px 10px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: 1 / -1; }
/* Employee profile form */
.employee-page-head { margin-bottom: 14px; }
.employee-eyebrow { color: #b06436; font-size: 10px; font-weight: 800; letter-spacing: .12em; margin-bottom: 5px; }
.employee-form { max-width: 1240px; }
.employee-sections { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.employee-sections a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid #e8e0d8; border-radius: 7px; background: #fffaf6; color: #c75c11; font-size: 11px; font-weight: 800; text-decoration: none; }
.employee-sections a span { color: #5b4b41; font-size: 12px; font-weight: 700; }
.employee-sections a:hover { border-color: #e9a871; background: #fff1e5; }
.employee-card { scroll-margin-top: 20px; border: 1px solid #e3e7ed; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 2px 9px rgba(35, 48, 66, .04); }
.employee-card.mt-3 { margin-top: 12px; }
.employee-card .card-head { padding: 11px 15px; gap: 10px; background: #fff7ef; border-bottom: 1px solid #f1e3d6; }
.employee-card .card-head h2 { color: #303b4b; font-size: 14px; }
.employee-card .card-head p { margin: 2px 0 0; color: #7c8491; font-size: 11px; }
.employee-section-icon { display: grid; place-items: center; flex: 0 0 32px; height: 32px; border-radius: 8px; background: #ffe7d0; color: #c85e10; font-size: 11px; font-weight: 800; }
#employee-personal .card-head { background: #f3f7fc; border-color: #e1eaf5; }
#employee-personal .employee-section-icon { background: #dceafa; color: #35699c; }
#employee-education .card-head { background: #f3f9f5; border-color: #dfeee3; }
#employee-education .employee-section-icon { background: #dcefe1; color: #358254; }
#employee-salary .card-head { background: #f8f5fc; border-color: #ebe3f4; }
#employee-salary .employee-section-icon { background: #eaddf5; color: #775098; }
#employee-documents .card-head { background: #fdf8ef; border-color: #f2e8d6; }
#employee-documents .employee-section-icon { background: #f8e9ca; color: #9b722b; }
.employee-section-note { margin-left: auto; color: #8b96a6; font-size: 11px; }
.employee-card .card-body { padding: 15px; }
.employee-form .form-grid { gap: 12px 14px; }
.employee-form .form-grid.two { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.employee-form .field { gap: 4px; }
.employee-form .field label { color: #526071; font-size: 11px; }
.employee-form .field input:not([type=checkbox]):not([type=file]), .employee-form .field select { min-height: 34px; padding: 6px 9px; font-size: 12px; }
.employee-form .field input[type=file] { font-size: 11px; max-width: 100%; }
.employee-form .data th, .employee-form .data td { padding: 8px 10px; }
.employee-required { color: #d35432; }
.employee-form textarea { min-height: 56px; resize: vertical; }
.employee-sales-role { grid-column: span 2; padding: 8px 10px; border: 1px solid #e6ebf1; border-radius: 8px; background: #f8fafc; }
.employee-sales-role .employee-checkbox { display: flex; flex-direction: row; align-items: center; gap: 8px; color: #25344a; }
.employee-sales-role .employee-checkbox input { width: auto; }
.employee-form-actions { align-items: center; justify-content: flex-end; padding: 16px 0 24px; }
.employee-action-note { margin-right: auto; color: #7c8797; font-size: 12px; }
@media (max-width: 900px) { .employee-form .form-grid.four, .employee-form .form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .employee-sections a { flex: 1 1 40%; } .employee-card .card-head, .employee-card .card-body { padding: 12px; } .employee-form .form-grid.four, .employee-form .form-grid.two { grid-template-columns: minmax(0, 1fr); } .employee-section-note { width: 100%; margin-left: 42px; } .employee-sales-role { grid-column: span 1; } }
@media (max-width: 700px) { .form-grid .span-2, .form-grid .span-3, .form-grid .span-4 { grid-column: span 1; } }

/* ================================================================
   Motion & polish layer
   Entrance, interaction and feedback animations. Every effect is
   decorative only: content is fully visible without JS and with JS
   off, and all motion is disabled for prefers-reduced-motion users.
   ================================================================ */

@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slide-right { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes slide-down { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.93); } to { opacity: 1; transform: none; } }
@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(95, 141, 78, .35); }
    75% { box-shadow: 0 0 0 8px rgba(95, 141, 78, 0); }
    100% { box-shadow: 0 0 0 0 rgba(95, 141, 78, 0); }
}
@keyframes bounce-icon {
    0%, 100% { transform: translateY(0); }
    40% { transform: translateY(-4px); }
    65% { transform: translateY(-1px); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Page entrance — the main column rises in with a light stagger */
.content > * { animation: rise-in .38s var(--ease-out) both; }
.content > *:nth-child(2) { animation-delay: .05s; }
.content > *:nth-child(3) { animation-delay: .09s; }
.content > *:nth-child(4) { animation-delay: .13s; }
.content > *:nth-child(n+5) { animation-delay: .16s; }

/* Success / error notices drop in, then stay put */
.alert { animation: slide-down .34s var(--ease-out) both; }

/* Sidebar — links glide in when a module group is expanded */
.module-icon { transition: transform .2s var(--ease-spring); }
.nav-group > summary:hover .module-icon { transform: scale(1.12); }
.nav-group > summary .chev { transition: transform .2s var(--ease-out), color .2s ease; }
.nav-group[open] > summary .chev { color: #b3a796; }
.nav-group[open] .nav-children .nav-link { animation: slide-right .25s var(--ease-out) both; }
.nav-group[open] .nav-children .nav-link:nth-child(2) { animation-delay: .03s; }
.nav-group[open] .nav-children .nav-link:nth-child(3) { animation-delay: .06s; }
.nav-group[open] .nav-children .nav-link:nth-child(4) { animation-delay: .09s; }
.nav-group[open] .nav-children .nav-link:nth-child(n+5) { animation-delay: .11s; }
.nav-link { transition: background .16s ease, color .16s ease, border-color .16s ease; }
.nav-link .link-ico { transition: transform .2s var(--ease-spring); }
.nav-link:hover .link-ico, .nav-link.active .link-ico { transform: scale(1.18); }
.nav-group > summary { transition: background .16s ease; }

/* Topbar — shadow fades in while the page is scrolled */
.topbar { transition: box-shadow .28s ease, background .28s ease; }
.topbar.is-scrolled { background: rgba(253, 250, 245, .98); box-shadow: 0 4px 18px rgba(150, 110, 70, .1); }

/* Buttons — micro lift, press, focus ring and loading spinner */
.btn { transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .18s ease, transform .18s var(--ease-out); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); transition-duration: .05s; }
.btn-primary:hover { box-shadow: 0 5px 14px rgba(46, 145, 85, .32); }
.btn-danger:hover { box-shadow: 0 5px 14px rgba(214, 69, 69, .3); }
.btn-warn:hover { box-shadow: 0 5px 14px rgba(208, 138, 29, .3); }
.btn:disabled { transform: none; box-shadow: none; }
.btn:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 7px;
}
.btn-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn-loading::after {
    content: '';
    position: absolute;
    width: 13px; height: 13px;
    border-radius: 50%;
    border: 2px solid rgba(43, 38, 32, .16);
    border-top-color: rgba(43, 38, 32, .7);
    animation: spin .6s linear infinite;
}
.btn-loading.btn-primary::after, .btn-loading.btn-danger::after, .btn-loading.btn-warn::after {
    border-color: rgba(255, 255, 255, .32);
    border-top-color: #fff;
}

/* Stats and quick actions — lift with a colored halo on hover */
.stat, .quick-action { transition: transform .22s var(--ease-out), box-shadow .22s ease, border-color .22s ease; }
.stat:hover, .quick-action:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat.accent:hover, .quick-action:hover { animation: none; border-color: var(--accent); }
.stat.accent:hover { box-shadow: 0 8px 20px rgba(157, 137, 221, .3), 0 20px 44px rgba(150, 110, 70, .12); }
.stat.warn:hover { box-shadow: 0 8px 20px rgba(223, 163, 46, .28), 0 20px 44px rgba(150, 110, 70, .12); }
.quick-action .qi { transition: transform .25s var(--ease-spring), background .2s ease, box-shadow .25s ease; }
.quick-action:hover .qi { animation: bounce-icon .45s var(--ease-spring); box-shadow: 0 4px 10px rgba(95, 141, 78, .22); }
.quick-action:hover { border-color: var(--accent); }
.quick-action:hover strong { color: var(--accent-deep); }
.quick-action strong { transition: color .18s ease; }

/* Badges get a soft entrance; tables get a smooth row highlight */
.badge { transition: background .15s ease, color .15s ease; animation: pop-in .25s var(--ease-out) both; }
table.data tbody tr { transition: background .14s ease; }
table.data tbody tr:hover .num { color: var(--accent-deep); }

/* Pills, chips, tabs progress smoothly */
.tabs a, .nav-pills a, .pager a, .pager span { transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease; }
.tabs a:hover { background: var(--accent-tint); color: var(--accent-deep); text-decoration: none; }
.pager a:hover { transform: translateY(-1px); }
.input, input, select, textarea { transition: border-color .16s ease, box-shadow .18s ease, background .16s ease; }
.progress > span { transition: width .45s var(--ease-out); }

@media (hover: none) {
    /* Touch devices get no hover lift, just the tap feedback */
    .stat:hover, .quick-action:hover, .btn:hover { transform: none; box-shadow: var(--shadow-sm); }
}

/* Accessibility and print safety: strip all decorative motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-delay: 0ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    .btn-loading::after { display: none; }
    .btn-loading { color: inherit !important; pointer-events: auto; }
}
@media print {
    .content > *, .alert, .badge, .nav-group[open] .nav-children .nav-link { animation: none !important; }
}

/* ================================================================
   Admin-template layer — crisp white sidebar with numbered modules,
   vivid gradient KPI cards, circular icon chips, dark table headers
   and solid colour badges. Appended last so it wins the cascade.
   ================================================================ */

/* Surface: cool light-gray canvas, white panels */
:root {
    --paper: #ffffff;
    --line: #d3dae5;
    --line-strong: #bcc6d5;
    --sidebar-bg: #ffffff;
    --sidebar-line: #eef0f4;
    --sidebar-text: #6b7180;
    --shadow-sm: 0 2px 6px rgba(30, 41, 59, .06), 0 1px 2px rgba(30, 41, 59, .04);
    --shadow-lg: 0 10px 30px rgba(30, 41, 59, .12), 0 24px 48px rgba(30, 41, 59, .08);
    --shadow-md: 0 8px 22px rgba(30, 41, 59, .1), 0 18px 36px rgba(30, 41, 59, .06);
}

/* Forces the neutral hexes used by generic rules above */
table.data th { background: #f7f8fa; border-bottom-color: #eef0f4; }
table.data td { border-bottom-color: #dfe5ee; }
table.data tbody tr:hover { background: #fafbfd; }
table.data tfoot td { background: #f7f8fa; }
.list-plain li { border-bottom-color: #dfe5ee; }
.help-box { background: #f8f9fb; }
.readout { background: #f8f9fb; }
.card-foot { background: #fafbfd; }
.topbar { background: rgba(255, 255, 255, .92); }
.topbar.is-scrolled { background: rgba(255, 255, 255, .98); box-shadow: 0 4px 18px rgba(30, 41, 59, .08); }
.pager span.disabled { background: #f5f6fa; }

/* White sidebar with numbered modules */
.sidebar { border-right: 1px solid var(--sidebar-line); }
.brand-mark { box-shadow: 0 6px 14px rgba(239, 108, 0, .25); }
.brand-text strong { color: var(--ink); }
.brand-text span { color: #8b92a3; }
.sidebar-label, .nav-sub-label { color: #9aa2b2; }
.nav-group > summary { color: #3f4450; }
.nav-group > summary:hover { background: #f6f7fa; }
.nav-group[open] > summary { background: #f6f7fa; box-shadow: none; }
.nav-group > summary .chev { color: #9aa2b2; }
.nav-group[open] > summary .chev { color: #8b92a3; }
.nav-link { color: #565d6b; }
.nav-link:hover { color: var(--ink); background: #f6f7fa; }
.nav-link.active { color: #fff; background: linear-gradient(120deg, #f57c00, #e65100); box-shadow: 0 6px 14px rgba(230, 81, 0, .3); }
.nav-link .dot { display: none; }
.nav-link.active .dot { background: #f0c987; }
.module-icon { background: #f2f4f8; box-shadow: none; }
.nav-group > summary:hover .module-icon { transform: none; }

/* Tables: dark charcoal header like the template */
table.data th { background: #303243; color: #d8dce6; border-bottom: 2px solid #303243; letter-spacing: .03em; }
table.data tfoot td { border-top-color: #dde0e7; }
@media print {
    table.data th { background: #fff; color: #444; border-bottom: 1px solid #999; }
    table.data tbody tr:hover { background: transparent; }
}

/* Badges: solid vivid pills */
.badge-green { background: #34b26b; color: #fff; }
.badge-red { background: #e85a4f; color: #fff; }
.badge-amber { background: #f4b831; color: #6e5410; }
.badge-blue { background: #3f97e0; color: #fff; }
.badge-purple { background: #8e7dd6; color: #fff; }
.badge-gray { background: #eef0f4; color: #4c5361; }

/* Stats: circular icon chip on top, vivid gradient variants */
.stat { display: flex; flex-direction: column; }
.stat .stat-ico {
    order: 1;
    width: 44px; height: 44px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 19px;
    margin-bottom: 10px;
    background: var(--mint);
    box-shadow: 0 2px 8px rgba(30, 41, 59, .08);
}
.stat .label { order: 2; }
.stat .value { order: 3; margin-top: 2px; }
.stat .meta { order: 4; margin-top: 4px; }
.ico-clear { background: rgba(255, 255, 255, .22); box-shadow: none; }
.ico-green { background: var(--green-tint); }
.ico-purple { background: var(--purple-tint); }
.ico-blue { background: var(--blue-tint); }
.ico-amber { background: var(--amber-tint); }
.ico-red { background: var(--red-tint); }
.ico-teal { background: #def0ee; }

.stat.stat-vivid { border: 0; color: #fff; box-shadow: 0 12px 26px rgba(30, 41, 59, .17); }
.stat.stat-vivid .label, .stat.stat-vivid .meta { color: rgba(255, 255, 255, .85); }
.stat.stat-vivid .value { color: #fff; }
.stat-vivid-sales { background: linear-gradient(130deg, #f57c00, #e65100); }
.stat-vivid-purple { background: linear-gradient(130deg, #9b8ce0, #6a5ab8); }
.stat-vivid-blue { background: linear-gradient(130deg, #55b1f0, #2f7cc4); }
.stat-vivid-amber { background: linear-gradient(130deg, #f6b93b, #e8862f); }
.stat-vivid-coral { background: linear-gradient(130deg, #f3708a, #e04365); }
.stat.stat-vivid:hover { box-shadow: 0 14px 32px rgba(30, 41, 59, .22); }

/* Quick actions: circular colour-cycled chips */
.quick-actions .qi { border-radius: 50%; }
.quick-actions .quick-action:nth-child(6n+1) .qi { background: var(--mint); }
.quick-actions .quick-action:nth-child(6n+2) .qi { background: var(--lavender); }
.quick-actions .quick-action:nth-child(6n+3) .qi { background: var(--peach); }
.quick-actions .quick-action:nth-child(6n+4) .qi { background: var(--sun); }
.quick-actions .quick-action:nth-child(6n+5) .qi { background: #fae4ee; }
.quick-actions .quick-action:nth-child(6n+6) .qi { background: var(--blue-tint); }
.welcome-banner { background: #fff; padding: 30px; border-radius: 16px; border: 1px solid #cbd4e1; box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 14px rgba(16,24,40,.06); margin-bottom: 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.welcome-left { flex: 1 1 auto; min-width: 260px; }
.salutation { display: inline-flex; align-items: center; gap: 8px; background: #fff4e5; color: #b45309; padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.welcome-banner h1 { margin: 16px 0 8px; font-size: 28px; color: #111827; }
.welcome-banner p { color: #6b7280; font-size: 15px; }
.date-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #e5e7eb; padding: 6px 14px; border-radius: 8px; font-size: 13px; margin-top: 16px; color: #374151; white-space: nowrap; align-self: flex-start; }

.section-head { margin-bottom: 16px; }
.section-head h2 { font-size: 18px; color: #111827; }
.section-head p { color: #6b7280; font-size: 14px; }

.quick-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.q-action { background: #fff; border: 1px solid #cbd4e1; padding: 20px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; text-align: center; text-decoration: none; color: #374151; transition: 0.2s; box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 3px 10px rgba(16,24,40,.05); }
.q-action:hover { border-color: #f97316; box-shadow: 0 4px 12px rgba(249, 115, 22, 0.15); }
.q-action.is-active { border-color: #fb923c; box-shadow: 0 0 0 3px rgba(251, 146, 60, .18); }
.q-ico { width: 48px; height: 48px; display: grid; place-items: center; font-size: 20px; border-radius: 12px; margin-bottom: 12px; }
.ico-orange { background: #fff7ed; }
.ico-pink { background: #fff1f2; }
.ico-blue { background: #eff6ff; }
.ico-green { background: #f0fdf4; }
.ico-purple { background: #f5f3ff; }
.ico-teal { background: #f0fdfa; }
.ico-gray { background: #f9fafb; }

.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.stat-card { background: #fff; padding: 20px; border-radius: 12px; border: 1px solid #cbd4e1; position: relative; box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 3px 10px rgba(16,24,40,.05); }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.s-ico { font-size: 20px; display: block; }
.stat-card .label { font-size: 11px; color: #6b7280; font-weight: 700; letter-spacing: 0.5px; }
.stat-card .val { font-size: 20px; font-weight: 700; color: #111827; margin: 4px 0; }
.trend { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.trend.up { background: #dcfce7; color: #166534; }
.trend.down { background: #fee2e2; color: #991b1b; }
/* Salary vouchers and final payroll slips */
.print-sheet{max-width:900px;margin:20px auto;background:#fff;border:1px solid #bdc7d2;padding:28px;color:#172235}.print-title{display:flex;flex-direction:column;gap:5px;text-align:center;border-bottom:2px solid #213248;padding-bottom:12px;font-size:16px}.print-title strong{font-size:23px}.print-meta{display:grid;grid-template-columns:1fr 1fr;border:1px solid #bdc7d2;margin-top:18px}.print-meta>div{padding:10px 14px;line-height:1.65}.print-meta>div+div{border-left:1px solid #bdc7d2}.print-table{width:100%;border-collapse:collapse;margin-top:18px}.print-table th,.print-table td{border:1px solid #bdc7d2;padding:8px}.print-table th{background:#f2f5f8;text-align:left}.print-table .num{text-align:right}.signatures{display:grid;grid-template-columns:repeat(4,1fr);gap:24px;margin-top:90px;text-align:center}.signatures span{border-top:1px solid #273648;padding-top:8px;font-size:11px}@media print{.sidebar,.topbar,.no-print,.page-head,.flash,.toast{display:none!important}.main{margin:0!important;padding:0!important}.print-sheet{border:0;margin:0;max-width:none;padding:0}.print-title strong{font-size:20px}}
