:root {
  color-scheme: light;
  --ink: #172a20;
  --muted: #50675b;
  --green: #174833;
  --dark: #133b2a;
  --accent: #bde092;
  --paper: #fff;
  --wash: #f1f5ef;
  --line: #dce5dd;
  --radius: 14px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--wash); min-width: 300px; }
a { color: #1b5b3b; font-weight: 650; text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px;
  padding: .66rem 1rem; border: 1px solid var(--green); border-radius: 9px;
  background: var(--green); color: white; line-height: 1.25; font-weight: 700; cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { filter: brightness(.95); }
button:disabled { opacity: .58; cursor: wait; }
.secondary { background: #f8fbf7; color: var(--green); border-color: #bdcfc1; }
.quiet { background: transparent; border-color: #587666; color: #e0ede4; min-height: 38px; }
:focus-visible { outline: 3px solid #659441; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.85rem, 4.8vw, 2.78rem); line-height: 1.09; letter-spacing: -.045em; margin-bottom: .65rem; }
h2 { font-size: 1.22rem; letter-spacing: -.018em; margin-bottom: 1rem; }
h3 { font-size: 1rem; margin: 1rem 0 .55rem; }
p { line-height: 1.5; }
small, .help { color: var(--muted); }
.skip-link { position: absolute; top: -100vw; left: 1rem; padding: 1rem; z-index: 9; background: white; }
.skip-link:focus { top: 1rem; }
.layout { display: grid; min-height: 100vh; grid-template-columns: 228px minmax(0,1fr); }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; z-index: 3;
  padding: 26px 16px 18px; background: var(--dark); color: #fff; overflow-y: auto;
}
.wordmark { display: flex; align-items: center; gap: .7rem; color: inherit; text-decoration: none; font-size: 1.17rem; font-weight: 750; line-height: 1.1; }
.sidebar .wordmark { margin: 2px 0 32px 4px; }
.brand-mark {
  flex: 0 0 39px; width: 39px; height: 39px; display: grid; place-items: center; border-radius: 11px;
  color: #1a412d; background: var(--accent); font-size: .9rem; font-weight: 850; letter-spacing: -.05em;
}
.product { display: block; margin-top: .35rem; color: #b7d0be; font-size: .54rem; font-weight: 760; letter-spacing: .055em; white-space: nowrap; }
.sidebar nav { display: grid; gap: .3rem; }
.sidebar nav a { display: flex; align-items: center; gap: .75rem; padding: .63rem .72rem; color: #d8e8db; font-size: .92rem; text-decoration: none; border-radius: 8px; min-height: 43px; }
.sidebar nav a span { color: #c4dcac; width: 19px; font-size: 1.1rem; text-align: center; }
.sidebar nav a:hover, .sidebar nav .current { background: #28553d; color: white; }
.sidebar nav .current { box-shadow: inset 3px 0 0 var(--accent); }
.sidebar nav hr { width: 100%; border: 0; border-top: 1px solid #436653; margin: .75rem 0; }
.sidebar-end { display: grid; align-items: end; gap: .7rem; margin-top: auto; padding-top: 1.1rem; }
.profile { display: flex; align-items: center; gap: .6rem; font-size: .84rem; overflow-wrap: anywhere; }
.profile-icon { display: grid; place-items: center; flex: 0 0 29px; height: 29px; border-radius: 50%; background: #3c624b; color: #e0f4d5; font-size: .6rem; }
.topbar {
  height: 62px; background: #fcfdfb; border-bottom: 1px solid var(--line); padding: 0 clamp(1rem, 3.2vw, 2.9rem);
  display: flex; align-items: center; gap: .85rem; justify-content: space-between;
}
.top-context { color: var(--ink); text-decoration: none; font-size: .91rem; white-space: nowrap; }
.top-context span { color: #698274; margin: 0 .3rem; }
.top-end { margin-left: auto; }
.menu-toggle { display: none; min-height: 36px; padding: .45rem; }
.unit-picker { display: flex; align-items: center; gap: .55rem; font-size: .83rem; }
.unit-picker label { margin: 0; }
.unit-picker select { min-height: 36px; margin: 0; padding: .37rem; width: auto; max-width: 15rem; }
.page { max-width: 1480px; margin: 0 auto; padding: clamp(1rem, 3vw, 2.55rem); }
.hero {
  position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
  padding: clamp(1.5rem, 3.7vw, 3.1rem); min-height: 200px; border-radius: 17px; background: #193f2d; color: white;
}
.hero::after {
  position: absolute; z-index: -1; content: ""; width: 360px; height: 360px; right: -140px; top: -147px; transform: rotate(-20deg);
  border-radius: 80px; border: 26px solid #52775b; box-shadow: 0 0 0 24px #315740, inset 0 0 0 27px #2d543c; opacity: .75;
}
.hero h1 { font-size: clamp(2.1rem, 4.5vw, 3.55rem); margin-bottom: .7rem; }
.hero p { margin: 0; color: #e0ecdf; font-size: clamp(.88rem, 1.4vw, 1.05rem); }
.hero time { font-size: .83rem; white-space: nowrap; color: #d9e9d9; }
.section { margin-top: 1.65rem; }
.section-heading, .card-heading, .page-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .75rem; }
.page-heading { margin-bottom: 1.25rem; }
.page-heading p { margin-bottom: 0; color: var(--muted); }
.section-heading a, .card-heading a { font-size: .88rem; }
.action-grid, .metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .72rem; }
.action {
  display: flex; flex-direction: column; gap: .55rem; position: relative; min-height: 124px; align-items: flex-start;
  padding: .92rem; color: var(--ink); background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none;
}
.action:hover, .metric:hover { border-color: #7daa8b; }
.action.prominent { background: #dfedce; border-color: #c8ddba; }
.action strong { display: block; line-height: 1.2; padding-right: .25rem; }
.action small { display: block; font-size: .78rem; margin-top: .25rem; }
.action-icon, .metric-icon, .activity-icon { display: inline-grid; place-items: center; width: 33px; height: 33px; border-radius: 8px; color: #245d3d; background: #e8f2e5; font-size: 1.2rem; font-weight: 680; }
.prominent .action-icon { background: #cce2b4; }
.action-arrow { position: absolute; inset: .95rem .85rem auto auto; color: #436a50; }
.metric {
  display: grid; grid-template-columns: auto 1fr; gap: .17rem .6rem; align-items: center; padding: .83rem;
  color: var(--ink); text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.metric-icon { grid-row: span 2; font-size: 1rem; }
.metric strong { font-size: 1.43rem; line-height: 1; }
.metric > span:last-child { font-size: .75rem; color: var(--muted); }
.amber .metric-icon { background: #f7efdc; color: #775817; }
.dashboard-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: .95rem; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.card-heading { padding: 1rem 1.12rem .75rem; }
.card-heading h2 { margin: 0; }
.activity, .link-row { display: flex; justify-content: space-between; align-items: center; gap: .65rem; padding: .72rem 1.1rem; min-height: 45px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.activity:hover, a.link-row:hover { background: #f4f9f3; }
.activity > span:nth-child(2) { flex: 1; }
.activity small { display: block; }
.activity time, .link-row span:last-child { color: var(--muted); font-size: .83rem; }
.activity-icon { flex: 0 0 33px; }
.empty { min-height: 170px; display: grid; place-content: center; text-align: center; padding: 1rem; gap: .35rem; border-top: 1px solid var(--line); }
.empty span { color: #5e8b68; font-size: 1.5rem; }
.empty p { margin: 0; color: var(--muted); font-size: .85rem; }
.count { padding: .13rem .46rem; border-radius: 50px; background: #eef3e9; color: #365744; font-size: .81rem; font-weight: 700; }
.form-card { padding: clamp(.9rem, 2vw, 1.4rem); }
.form-card p:last-child { margin-bottom: 0; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .9rem; }
.stack { display: grid; gap: .9rem; }
.form-page { max-width: 970px; }
.back { display: inline-block; padding: .35rem 0; margin: 0 0 .5rem; }
label { font-weight: 670; display: block; font-size: .89rem; margin-bottom: .34rem; }
input:not([type="checkbox"]):not([type="hidden"]), select, textarea {
  border: 1px solid #b9cbbc; border-radius: 8px; color: var(--ink); background: #fcfefb;
  min-height: 44px; padding: .58rem .65rem; max-width: 100%; width: 100%; margin: .2rem 0;
}
textarea { resize: vertical; }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; vertical-align: text-bottom; accent-color: var(--green); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .63rem; margin: .45rem 0; }
.toolbar input[type="text"], .toolbar select, #code { max-width: 395px; }
.form-card > form p { max-width: 100%; margin-bottom: .8rem; }
.form-card > form > label:not(:first-child) { margin-top: .7rem; }
.amount-row { align-items: end; grid-template-columns: minmax(0, 1fr) minmax(85px, .45fr) auto; margin-bottom: .75rem; }
.amount-row label { margin: 0; }
.amount-row button { margin-bottom: .2rem; }
.scanner { margin: .55rem 0; }
.scanner video { display: block; background: #162e23; margin-top: .55rem; max-height: 280px; width: 100%; border-radius: 10px; object-fit: contain; }
.scanner-status { margin: .45rem 0; color: var(--muted); }
.eligible { margin-bottom: 0; }
.flash, .errorlist { padding: .65rem .9rem; border-radius: 9px; background: #e7f0e3; color: #284936; border: 1px solid #c9dbc9; }
.flash.error, .errorlist { background: #fcece9; color: #8c3028; border-color: #f1c5c0; }
.errorlist { list-style-position: inside; }
.flash ul { margin: 0; padding-left: 1rem; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; min-width: 100%; font-size: .88rem; }
th, td { white-space: nowrap; padding: .65rem .55rem; border-bottom: 1px solid var(--line); text-align: left; }
th { background: #ecf3eb; font-weight: 710; }
.facts { display: grid; grid-template-columns: minmax(105px, .3fr) minmax(0,1fr); gap: .55rem .75rem; }
dt { font-weight: 700; }
dd { margin: 0; overflow-wrap: anywhere; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(120px,170px)); gap: .65rem; }
.photo-grid img { width: 100%; height: 135px; object-fit: cover; border-radius: 8px; }
.qr { width: 115px; height: 115px; border: 1px solid var(--line); }
.history-row { border-bottom: 1px solid var(--line); padding: .55rem 0; }
.history-row p { margin-bottom: .45rem; }
dialog { color: var(--ink); padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); width: min(470px, 95vw); }
dialog::backdrop { background: #10251bc4; }
.login-shell { min-height: 100dvh; display: grid; justify-items: center; align-content: center; gap: 1.4rem; padding: 1.2rem; background: linear-gradient(145deg,#143b29 0,#1c4e34 48%,#e9f2e3 48%); }
.login-brand { color: white; }
.login-card { width: min(420px,100%); padding: 1.7rem; background: white; border-radius: 16px; box-shadow: 0 13px 32px #12291e23; }
.login-card h1 { font-size: 2rem; }
.login-card button { width: 100%; margin-bottom: .75rem; }
@media (max-width: 1040px) {
  .layout { grid-template-columns: 184px minmax(0,1fr); }
  .sidebar { padding-inline: 10px; }
  .content { min-width: 0; }
}
@media (max-width: 800px) {
  .layout { display: block; }
  .sidebar { display: none; position: fixed; top: 55px; left: 0; width: min(235px, 82vw); height: calc(100dvh - 55px); }
  .sidebar.is-open { display: flex; }
  .menu-toggle { display: inline-flex; }
  .topbar { position: sticky; z-index: 2; top: 0; height: 55px; }
  .hero { min-height: 173px; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 530px) {
  .action-grid, .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero { display: block; }
  .hero time { display: block; margin-top: .75rem; }
  .desktop-break, .unit-picker label { display: none; }
  .unit-picker select { max-width: 131px; }
  .topbar { gap: .42rem; }
  .top-context { font-size: .76rem; }
  .top-context span { margin: 0 .1rem; }
  .field-grid { grid-template-columns: 1fr; }
  .amount-row { grid-template-columns: minmax(0,1fr) minmax(74px,.5fr); }
  .amount-row button { justify-self: start; }
  .metric { padding: .63rem; }
}
