:root {
  color-scheme: light;
  --paper: #f4f2ed;
  --panel: #fffefb;
  --ink: #252c27;
  --muted: #5d675f;
  --line: #dedfd5;
  --accent: #25513d;
  font: 15px/1.45 system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 41px;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer;
  background: var(--panel); color: var(--ink); text-decoration: none; font-weight: 600;
}
button:hover, .button:hover { background: #ebeee6; }
button:disabled { opacity: .45; cursor: default; }
.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.primary:hover { background: #193e2d; }
:focus-visible { outline: 2px solid #307854; outline-offset: 3px; }
input, select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 42px; color: var(--ink);
  background: #fcfbf7; border: 1px solid #ced3c7; border-radius: 7px; padding: 8px 10px;
}
textarea { resize: vertical; min-height: 76px; }
label { display: grid; gap: 5px; font-size: .86rem; font-weight: 600; min-width: 0; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 3rem); letter-spacing: -.055em; line-height: 1.05; overflow-wrap: anywhere; }
h2 { font-size: 1.1rem; letter-spacing: -.02em; margin-bottom: 12px; }
.wrap { max-width: 1260px; margin: auto; padding-inline: clamp(16px, 4vw, 56px); }
.top { background: var(--panel); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; gap: clamp(12px, 4vw, 42px); min-height: 67px; }
.brand, .nav { text-decoration: none; font-weight: 700; color: var(--ink); }
.brand { display: flex; align-items: center; gap: 9px; }
.mark { display: grid; place-items: center; width: 34px; height: 34px; background: #e2ebda; color: var(--accent); border-radius: 9px; font-size: 24px; }
.quiet { margin-left: auto; border-color: transparent; }
.content { padding-block: 34px 60px; }
.heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 0 0 24px; }
.eyebrow { color: var(--muted); margin-bottom: 8px; font-weight: 650; font-size: .82rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.metric { display: grid; justify-items: start; padding: 14px 16px; gap: 7px; border-radius: 10px; }
.metric span, .muted, small, .subline { color: var(--muted); }
.metric strong { font-size: 1.8rem; letter-spacing: -.05em; line-height: 1; }
.filters, .pagination { display: flex; align-items: end; gap: 12px; padding: 16px; }
.filters label:first-child { flex: 1; }
.filters label:last-child { width: min(35%, 220px); }
.pagination { align-items: center; justify-content: space-between; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 10px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 710px; text-align: left; }
th, td { padding: 13px 16px; border-block: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); background: #f5f6ef; }
td { max-width: 290px; overflow-wrap: anywhere; }
.numeric { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.order-link { font-weight: 700; text-underline-offset: 3px; }
small { display: block; margin-top: 3px; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 5px; font-weight: 650; font-size: .8rem; background: #edf0ea; white-space: nowrap; }
.s1, .s3 { background: #e2eaf5; color: #28456e; }
.s2 { background: #f5ead0; color: #705116; }
.s4, .s5 { background: #e1eddf; color: #2c5731; }
.s6 { background: #f5e1dc; color: #77362c; }
.empty { padding: 50px 16px; text-align: center; color: var(--muted); }
.back { display: inline-block; margin-bottom: 17px; text-underline-offset: 3px; }
.subline { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.detail { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(275px, 1fr); align-items: start; gap: 16px; }
.detail-main, .side { padding: clamp(14px, 3vw, 24px); }
.side { margin-bottom: 14px; }
.intake { max-width: 800px; }
fieldset { border: 0; padding: 0; min-width: 0; margin: 0 0 20px; }
legend { padding: 0; font-size: 1.07rem; font-weight: 700; margin-bottom: 10px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
fieldset > label, fieldset > .fields, #payment-form > label { margin-bottom: 10px; }
.error { color: #972f22; margin-bottom: 8px; }
.error:empty { display: none; }
form button { margin-top: 6px; }
dl { display: grid; grid-template-columns: minmax(115px, auto) 1fr; gap: 8px 13px; }
dt { color: var(--muted); }
dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.totals dd { text-align: right; }
.history { list-style: none; padding: 0; margin: 10px 0 0; }
.history li { border-top: 1px solid var(--line); padding-block: 8px; overflow-wrap: anywhere; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.login form { padding: 26px; width: min(100%, 390px); display: grid; gap: 14px; }
.login h1 { font-size: 2rem; }
#print { display: none; }
@media (max-width: 720px) {
  .detail { grid-template-columns: 1fr; }
  .heading { align-items: start; flex-direction: column; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .nav { display: none; }
}
@media (max-width: 410px) {
  .fields { grid-template-columns: 1fr; }
  .filters { align-items: stretch; flex-direction: column; }
  .filters label:last-child { width: auto; }
}
@media print {
  #app { display: none; }
  #print { display: block; color: #000; background: #fff; }
  #print dl { margin-block: 24px; }
  #print .signature { margin-top: 36px; }
}

.nav-strip { background: var(--panel); border-bottom: 1px solid var(--line); }
.nav-inner { display: flex; gap: 6px; overflow-x: auto; }
.nav-inner .nav { display: block; padding: 11px 12px; color: var(--muted); white-space: nowrap; border-bottom: 3px solid transparent; }
.nav-inner .nav.active { color: var(--accent); border-color: var(--accent); }
.nav-inner .nav:hover { color: var(--accent); background: #f5f6ef; }
.branch { display: flex; align-items: center; gap: 8px; }
.branch select { min-height: 34px; max-width: 215px; padding-block: 3px; }
.employee { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.employee span { color: var(--muted); }
.business-stack { display: grid; gap: 16px; }
.business-panel { padding: clamp(14px, 2.6vw, 24px); min-width: 0; }
.business-panel form, .order-extras form { display: grid; gap: 10px; }
.business-panel form > button, .order-extras form > button { justify-self: start; }
.business-panel .table-scroll { margin-block: 14px; }
.business-panel table { min-width: 530px; }
.business-panel summary { cursor: pointer; font-weight: 700; }
.business-panel[open] > summary { margin-bottom: 14px; }
.sub-details { border-top: 1px solid var(--line); padding: 12px 0; }
.sub-details summary span { font-weight: 400; color: var(--muted); margin-left: 10px; }
.sub-details form { margin-top: 16px; }
.form-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.check { display: flex; align-items: center; gap: 6px; }
.check input { min-height: auto; width: auto; }
.permission-grid { margin: 6px 0 0; }
.chips, .summary-values { display: flex; gap: 10px; flex-wrap: wrap; }
.chips { margin-top: 12px; }
.summary-values > div { background: #f5f6ef; color: var(--muted); padding: 10px 12px; border-radius: 6px; }
.summary-values strong { display: block; color: var(--ink); }
.business-panel form.inline-form, .order-extras form.inline-form, .cart-row {
  display: flex; align-items: end; flex-wrap: wrap; gap: 10px;
}
.inline-form label:first-child { flex: 1; min-width: min(200px,100%); }
.inline-form label:has(input[type="number"]) { min-width: 0; max-width: 130px; }
.inline-form .error { order: 3; width: 100%; }
.order-extras { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.order-extras .history .quiet { min-height: auto; margin-left: 8px; }
.order-extras .photos { display: grid; grid-template-columns: repeat(auto-fill,minmax(100px,1fr)); gap: 8px; margin-block: 8px; }
.photos img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--line); border-radius: 7px; }
.low-stock { color: #873f22; }
.print-note { white-space: pre-wrap; }
@media (max-width: 720px) {
  .top-inner { flex-wrap: wrap; gap: 4px 14px; padding-block: 6px; }
  .branch { order: 3; flex-basis: 100%; }
  .employee span { display: none; }
  .nav-inner { padding-inline: 9px; }
}
[hidden] { display: none !important; }
#tracking-link { margin-top: 10px; }
