:root {
    color-scheme: light;
    font: 100% system-ui, sans-serif;
    color: #172a21;
    background: #f3f6f4;
    --forest: #142d23;
    --green: #286449;
    --line: #dce5df;
    --muted: #52675b;
    --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
:focus-visible { outline: 3px solid #32846f; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 4vw, 2.8rem); line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.15rem; }
.muted, .page-header p, .empty-state p { color: var(--muted); line-height: 1.5; }
.layout { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { background: var(--forest); padding: 32px 20px; color: #e5f0e9; display: flex; flex-direction: column; gap: 46px; }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; font-size: 1.25rem; font-weight: 750; letter-spacing: -.03em; white-space: nowrap; }
.brand-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #c1ebcb; color: #234b36; font-size: 1.4rem; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a, .logout button { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 9px; color: inherit; text-decoration: none; border: 0; background: transparent; font-size: .95rem; white-space: nowrap; }
.sidebar nav a[aria-current], .sidebar nav a:hover, .logout button:hover { background: #2b4a3a; color: #fff; }
.logout { margin-top: auto; }
.content { width: min(100%, 1440px); padding: clamp(22px, 4vw, 54px); margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px; margin-bottom: 30px; }
.page-header p { margin-top: 8px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { display: grid; gap: 10px; padding: 19px; text-decoration: none; color: var(--muted); font-size: .9rem; }
.stat strong { color: #172a21; font-size: 2rem; letter-spacing: -.05em; overflow-wrap: anywhere; }
.stat.low strong { color: #86510a; }
.stat.empty strong { color: #a43b43; }
a.stat:hover { border-color: var(--green); }
.section-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 13px; padding: 18px 20px; }
.count { display: inline-block; vertical-align: middle; font-size: .85rem; padding: 4px 8px; background: #edf4ef; color: #365243; border-radius: 20px; margin-left: 4px; }
.filters, .actions, .form-actions, .pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.filters input { width: min(250px, 100%); }
.reset, .actions { font-size: .9rem; }
.actions a { white-space: nowrap; font-weight: 650; text-underline-offset: 3px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 14px 16px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
th { background: #f6f8f7; color: var(--muted); font-size: .875rem; white-space: nowrap; }
td { font-size: .9375rem; }
td:first-child, th:first-child { padding-left: 20px; }
td small { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; }
.badge { display: inline-block; border-radius: 20px; padding: 5px 9px; font-weight: 650; font-size: .875rem; white-space: nowrap; }
.badge.available, .message.success { color: #24573b; background: #e7f4eb; }
.badge.low { color: #774500; background: #fff1d8; }
.badge.empty, .message.error { color: #932e38; background: #fdebed; }
.empty-state { text-align: center; padding: 50px 20px; border-top: 1px solid var(--line); }
.empty-state p { margin-top: 8px; }
.empty-state .button { margin-top: 18px; }
.empty-icon { display: grid; place-items: center; margin: 0 auto 15px; width: 52px; height: 52px; border-radius: 14px; background: #e7f1ea; color: var(--green); font-size: 1.65rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 15px; border: 1px solid transparent; border-radius: 8px; text-decoration: none; font-size: .9375rem; font-weight: 650; }
.primary { background: var(--green); color: white; }
.primary:hover { background: #1d5039; }
.secondary { color: #263c30; background: white; border-color: #bdcdc2; }
.secondary:hover { background: #edf4ef; }
input, select, textarea { min-width: 0; min-height: 44px; padding: 9px 11px; border-radius: 8px; border: 1px solid #bdcdc2; background: #fff; color: #172a21; }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, #52675b 50%), linear-gradient(135deg, #52675b 50%, transparent 50%); background-position: right 15px center, right 10px center; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; }
label { display: grid; gap: 7px; font-size: .9375rem; font-weight: 650; }
label input, label select, label textarea { width: 100%; font-weight: 400; }
.form-panel, .auth-card { padding: clamp(20px, 4vw, 32px); }
.form-panel { max-width: 700px; }
.invoice-preview { margin-top: 24px; }
.stack, .form-grid { display: grid; gap: 18px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.item-summary { display: grid; gap: 4px; padding: 14px; border-radius: 8px; background: #edf4ef; }
.item-summary span { color: var(--muted); }
.message { padding: 13px 16px; margin-bottom: 16px; border-radius: 8px; }
.pagination { padding: 16px 20px; border-top: 1px solid var(--line); }
.auth { min-height: 100vh; display: grid; padding: 20px; place-items: center; background: linear-gradient(145deg, #142d23, #315f48); }
.auth-card { width: min(100%, 430px); }
.auth-card h1 { margin: 24px 0 18px; font-size: 2rem; }
@media (max-width: 850px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
    .sidebar { padding: 16px 20px; flex-direction: row; gap: 10px 18px; align-items: center; flex-wrap: wrap; }
    .sidebar nav { display: flex; flex-wrap: wrap; }
    .logout { margin: 0 0 0 auto; }
}
@media (max-width: 560px) {
    .sidebar nav { order: 1; width: 100%; }
    .sidebar nav a, .logout button { padding: 8px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters input { width: 100%; }
    .form-grid { grid-template-columns: 1fr; }
}
