:root {
  color-scheme: light;
  --choc: #321c14;
  --ink: #211a17;
  --cream: #fbf7f1;
  --card: #fffdfa;
  --green: #357c2a;
  --red: #b8323c;
  --amber: #946000;
  --line: #e8ddd2;
  --muted: #71655c;
  --shadow: 0 12px 30px #57381c18;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f2ece6; color: var(--ink); font-family: Inter, "Segoe UI", Arial, sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #ca8d31; outline-offset: 2px; }
[hidden] { display: none !important; }
.application { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 4; height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 28px; background: var(--choc); color: white; box-shadow: 0 2px 8px #0002; }
.wordmark { display: flex; gap: 11px; align-items: center; color: white; text-decoration: none; letter-spacing: .04em; }
.wordmark strong, .wordmark small { display: block; }
.wordmark strong { font-size: 13px; }
.wordmark small { margin-top: 3px; font-size: 9px; opacity: .76; letter-spacing: .15em; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid #d5b68f; border-radius: 50%; color: #f3d9b8; font: 700 27px Georgia, serif; }
.brand-mark.small { width: 37px; height: 37px; font-size: 20px; }
.topbar-actions { display: flex; align-items: center; gap: 13px; }
.sync-state { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 10px; border: 1px solid #ffffff50; border-radius: 99px; font-size: 10px; font-weight: 800; letter-spacing: .07em; white-space: nowrap; }
.sync-state[data-state="SAVED"] { color: #d3f0c4; border-color: #9ac987; }
.sync-state[data-state="OFFLINE"], .sync-state[data-state="SAVE FAILED"] { color: #ffd3d3; border-color: #e4a0a0; }
.sync-state[data-state="SAVING"], .sync-state[data-state="SYNCING"], .sync-state[data-state="CONFLICT"] { color: #ffe3aa; border-color: #e8c46f; }
.profile-button { display: flex; align-items: center; gap: 9px; border: 0; color: white; background: transparent; font-weight: 700; }
.role-badge { padding: 4px 8px; border-radius: 99px; background: #ffffff20; font-size: 10px; text-transform: uppercase; }
.layout { max-width: 1600px; min-height: calc(100vh - 68px); margin: auto; display: grid; grid-template-columns: 248px minmax(0, 1fr); background: var(--cream); }
.sidebar { position: sticky; top: 68px; height: calc(100vh - 68px); min-height: 480px; display: flex; flex-direction: column; padding: 22px 14px; border-right: 1px solid var(--line); background: #fffaf5; overflow: auto; }
.sidebar-heading { margin: 15px 10px 7px; color: #87796d; font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.nav-link { width: 100%; min-height: 42px; margin: 1px 0; padding: 9px 11px; border: 0; border-radius: 8px; color: #54473e; background: transparent; text-align: left; }
.nav-link:hover { background: #f0e7dc; }
.nav-link.active { color: var(--choc); background: #efe3d5; font-weight: 800; }
.nav-link.logout-link { color: var(--red); }
.sidebar-bottom { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.build-label { display: block; padding: 12px 11px 0; color: #918276; font-size: 10px; }
.main-content { min-width: 0; padding: 30px clamp(18px, 4vw, 58px) 60px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-heading h1 { margin: 0; color: var(--choc); font: 700 clamp(25px, 4vw, 35px) Georgia, serif; }
.page-heading p { max-width: 680px; margin: 8px 0 0; color: var(--muted); line-height: 1.5; }
.eyebrow { margin: 0 0 7px; color: #97714c; font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.muted { color: var(--muted); }
.primary-button, .secondary-button { min-height: 42px; padding: 10px 15px; border-radius: 8px; font-weight: 750; }
.primary-button { border: 1px solid var(--choc); color: white; background: var(--choc); }
.primary-button:hover { background: #4a2c20; }
.secondary-button { border: 1px solid #d2c3b4; color: var(--choc); background: white; }
.secondary-button:hover { background: #f7f0e8; }
.full-width { width: 100%; margin-top: 10px; }
.mobile-only { display: none; }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.module-tile, .record-card, .panel, .empty-state, .account-row { border: 1px solid var(--line); border-radius: 13px; background: var(--card); box-shadow: 0 3px 12px #57381c08; }
.module-tile { min-height: 122px; padding: 17px; color: var(--ink); text-align: left; transition: transform .12s, box-shadow .12s; }
.module-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tile-group { color: #987553; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.module-tile strong { display: block; margin-top: 10px; color: var(--choc); font: 700 20px Georgia, serif; }
.module-tile small { display: block; margin-top: 7px; color: var(--muted); line-height: 1.4; }
.dashboard-section { margin: 22px 0 28px; }
.dashboard-section h2, .dashboard-modules-title { margin: 0 0 13px; color: var(--choc); font: 700 21px Georgia, serif; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; }
.dashboard-tile { min-height: 145px; }
.dashboard-tile strong { margin-top: 0; }
.dashboard-status { display: block; margin-top: 12px; color: var(--choc); font-size: 12px; font-weight: 750; }
.dashboard-modules-title { margin-top: 26px; }
.notification-preferences { margin: 18px 0; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.notification-preferences h2 { margin: 0 0 6px; color: var(--choc); font: 700 21px Georgia, serif; }
.notification-preferences fieldset { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin: 16px 0; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.notification-preferences legend { padding: 0 5px; color: var(--choc); font-weight: 750; }
.notification-preference { display: flex; align-items: center; gap: 8px; min-height: 34px; color: var(--ink); font-size: 13px; }
.notification-preference input { accent-color: var(--choc); }
.quiet-hours-fields { display: flex; flex-wrap: wrap; gap: 12px; }
.quiet-hours-fields label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.quiet-hours-fields input { min-height: 38px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: white; }
.notification-filters, .notification-bulk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.notification-filters input, .notification-filters select { min-height: 38px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.notification-filters input { flex: 1 1 220px; }
.notification-bulk-actions { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.notification-bulk-actions label { display: flex; align-items: center; gap: 6px; margin-right: auto; font-size: 13px; }
.notification-list { display: grid; gap: 9px; }
.notification-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.notification-card.unread { border-left: 4px solid #b16d29; }
.notification-card p { margin: 5px 0; color: var(--ink); }
.notification-card small { color: var(--muted); }
.record-list { display: grid; gap: 12px; }
.work-board { margin: 18px 0; }
.work-board h2 { margin: 0 0 10px; color: var(--choc); font: 700 23px Georgia, serif; }
.work-item-list { display: grid; gap: 9px; }
.work-item-card { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); }
.work-item-card > div { flex: 1; min-width: 0; }
.work-item-card h3 { margin: 0; color: var(--choc); font-size: 15px; overflow-wrap: anywhere; }
.work-item-card p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.work-item-note { border-left: 2px solid var(--gold); padding-left: 8px; }
.work-item-evidence { width: 84px; height: 64px; object-fit: cover; border-radius: 7px; }
.status-pill.complete { color: #285d3a; background: #e2f2e7; }
.shopping-group-heading { margin: 16px 0 2px; color: var(--choc); font: 700 20px Georgia, serif; }
.waste-report { display: grid; gap: 9px; margin: 16px 0; }
.waste-report h2 { margin: 6px 0 0; color: var(--choc); font: 700 21px Georgia, serif; }
.waste-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; }
.waste-metric { padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.waste-metric strong, .waste-metric span { display: block; }
.waste-metric strong { color: var(--choc); font-size: 20px; }
.waste-metric span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.waste-product-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 11px; border-bottom: 1px solid var(--line); background: var(--card); }
.waste-product-row strong { flex: 0 0 auto; color: var(--choc); }
.record-card { padding: 16px 18px; }
.record-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.record-card h3 { margin: 0; color: var(--choc); font-size: 17px; overflow-wrap: anywhere; }
.record-meta { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.record-detail { margin: 11px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.record-actions { display: flex; gap: 8px; margin-top: 13px; flex-wrap: wrap; }
.small-button { min-height: 36px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--choc); background: white; font-size: 12px; font-weight: 700; }
.small-button.danger { color: var(--red); }
.status-pill { flex: 0 0 auto; padding: 5px 9px; border-radius: 99px; color: #58452e; background: #f2e8d7; font-size: 11px; font-weight: 800; }
.status-pill.adverse { color: #8d2028; background: #fbe4e3; }
.empty-state { padding: 28px; color: var(--muted); text-align: center; }
.panel { padding: 19px; }
.panel h2 { margin: 0 0 10px; color: var(--choc); font: 700 23px Georgia, serif; }
.panel + .panel { margin-top: 15px; }
.page-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.account-list { display: grid; gap: 10px; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; }
.account-row strong, .account-row small { display: block; }
.account-row small { margin-top: 4px; color: var(--muted); }
.food-safety-note, .info-banner { margin: 0 0 16px; padding: 12px 14px; border: 1px solid #e8cf9b; border-radius: 9px; color: #634616; background: #fff7e5; line-height: 1.45; }
.error-message { color: var(--red); line-height: 1.4; }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(140deg, #f8f2eb, #e8d9c8); }
.login-card { width: min(100%, 420px); padding: 34px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.login-card .brand-mark { margin-bottom: 20px; background: var(--choc); }
.login-card h1 { margin: 0; color: var(--choc); font: 700 36px Georgia, serif; }
.login-card form { display: grid; gap: 9px; margin-top: 24px; }
.login-card label, .field { color: #594b40; font-size: 13px; font-weight: 700; }
.login-card input, .field input, .field select, .field textarea { width: 100%; min-height: 42px; margin: 3px 0 8px; padding: 10px 11px; border: 1px solid #d9cabb; border-radius: 7px; color: var(--ink); background: white; }
.login-footnote { margin: 17px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.record-dialog { width: min(680px, calc(100vw - 28px)); max-height: min(90vh, 900px); padding: 0; border: 0; border-radius: 16px; background: var(--cream); box-shadow: 0 18px 70px #0005; }
.record-dialog::backdrop { background: #20171299; }
.record-dialog form { padding: 22px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.dialog-heading h2 { margin: 0; color: var(--choc); font: 700 25px Georgia, serif; }
.icon-button { width: 42px; height: 42px; border: 1px solid #ffffff30; border-radius: 8px; color: inherit; background: transparent; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 13px; }
.field { display: block; }
.field.wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea { display: block; font-weight: 400; }
.field input[type="checkbox"] { width: auto; min-height: auto; margin: 9px 5px 9px 0; }
.field textarea { resize: vertical; }
.field small { display: block; margin: -3px 0 8px; color: var(--muted); font-weight: 400; line-height: 1.4; }
.order-line-editor { display: grid; grid-template-columns: minmax(0, 1fr) 100px auto; align-items: start; gap: 8px; }
.order-line-editor select, .order-line-editor input { min-width: 0; min-height: 42px; padding: 9px; border: 1px solid #d9cabb; border-radius: 7px; background: white; }
.order-lines { grid-column: 1 / -1; display: grid; gap: 6px; }
.order-lines > p { margin: 2px 0 8px; color: var(--muted); }
.order-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.receipt-line-editor { display: grid; gap: 10px; }
.receipt-line-inputs, .receipt-line { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(80px, .7fr) minmax(100px, .8fr) minmax(100px, .8fr) auto; align-items: center; gap: 8px; }
.receipt-line-editor input { min-width: 0; min-height: 42px; padding: 8px; border: 1px solid #d9cabb; border-radius: 7px; background: white; }
.receipt-line-editor h3 { margin: 0; }
.receipt-lines { display: grid; gap: 7px; }
.holiday-coverage { margin: 0 0 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.holiday-coverage h2 { margin: 0; font-size: 17px; }
.holiday-coverage > p { margin: 6px 0 12px; color: var(--muted); }
.holiday-coverage-list { display: grid; gap: 7px; }
.holiday-coverage-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; }
.holiday-coverage-row strong { margin-left: auto; font-size: 12px; }
.payroll-entry { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(110px, .8fr) minmax(85px, .6fr) minmax(100px, 1fr); align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.payroll-entry input, .payroll-entry select { min-width: 0; min-height: 40px; padding: 7px; border: 1px solid #d9cabb; border-radius: 7px; background: white; }
.payroll-core-list { display: grid; gap: 7px; }
.payroll-core-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(110px, .7fr) minmax(100px, .7fr); align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.payroll-core-row input, .payroll-core-row select { width: 100%; min-width: 0; min-height: 40px; padding: 7px; border: 1px solid #d9cabb; border-radius: 7px; background: white; }
.checklist-heading { grid-column: 1 / -1; margin: 11px 0 2px; color: var(--choc); }
.checklist-heading:first-child { margin-top: 0; }
.export-list { display: grid; gap: 10px; }
.export-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.export-row strong { margin-right: auto; }
.margin-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 16px; }
.margin-summary small, .margin-summary strong { display: block; }
.margin-summary strong { margin-top: 7px; color: var(--choc); font-size: 22px; }
.margin-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.margin-row { min-width: 760px; display: grid; grid-template-columns: 2.4fr repeat(5, minmax(100px, 1fr)); gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); align-items: center; }
.margin-row:last-child { border-bottom: 0; }
.margin-header { position: sticky; top: 0; color: var(--choc); background: #f3eadf; }
.margin-warning { color: #8d2028; background: #fff2ef; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 9; max-width: min(400px, calc(100vw - 40px)); padding: 13px 16px; border-radius: 9px; color: white; background: #2c211b; box-shadow: var(--shadow); }
.toast.error { background: #8d242c; }
.sidebar-shade { display: none; }
.audit-row { padding: 12px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.audit-row:first-child { border-top: 0; }
.audit-row small { display: block; margin-top: 5px; color: var(--muted); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr); }
  .topbar { padding: 0 18px; }
  .sidebar { padding-inline: 10px; }
}
@media (max-width: 680px) {
  .topbar { height: 60px; padding: 0 12px; gap: 7px; }
  .mobile-only { display: inline-grid; place-items: center; flex: 0 0 auto; }
  .topbar .icon-button { width: 40px; height: 40px; }
  .wordmark { gap: 7px; }
  .brand-mark.small { width: 32px; height: 32px; font-size: 17px; }
  .wordmark strong { font-size: 11px; }
  .wordmark small { font-size: 8px; }
  .topbar-actions { gap: 6px; }
  .sync-state { min-height: 23px; padding: 3px 7px; font-size: 8px; }
  .profile-button { gap: 4px; padding: 4px; font-size: 12px; }
  .role-badge { display: none; }
  .layout { min-height: calc(100vh - 60px); display: block; }
  .sidebar { position: fixed; z-index: 7; top: 60px; bottom: 0; left: 0; width: min(300px, 85vw); height: auto; min-height: 0; transform: translateX(-105%); transition: transform .18s ease; box-shadow: 10px 0 24px #0002; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-shade.open { position: fixed; inset: 60px 0 0; z-index: 6; display: block; background: #20171266; }
  .main-content { padding: 22px 14px 40px; }
  .page-heading { align-items: stretch; flex-direction: column; gap: 12px; margin-bottom: 17px; }
  .page-heading .primary-button, .page-tools { width: 100%; }
  .page-tools > * { flex: 1; }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .module-tile { min-height: 110px; padding: 13px; }
  .module-tile strong { font-size: 17px; }
  .module-tile small { font-size: 11px; }
  .record-card { padding: 13px; }
  .work-item-card { align-items: flex-start; flex-wrap: wrap; }
  .work-item-card .small-button { margin-left: auto; }
  .record-top { gap: 7px; }
  .record-card h3 { font-size: 15px; }
  .account-row { align-items: flex-start; }
  .record-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 18px); border-radius: 13px; }
  .record-dialog form { max-height: calc(100dvh - 18px); padding: 17px 14px; overflow-y: auto; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .field.wide { grid-column: auto; }
  .order-line-editor { grid-template-columns: minmax(0, 1fr) 78px; }
  .order-line-editor button { grid-column: 1 / -1; }
  .receipt-line-inputs, .receipt-line { grid-template-columns: minmax(0, 1fr) minmax(75px, .5fr); }
  .receipt-line-inputs input:nth-child(n + 3), .receipt-line button { grid-column: 1 / -1; }
  .holiday-coverage-row { align-items: flex-start; flex-wrap: wrap; }
  .holiday-coverage-row strong { margin-left: 0; }
  .payroll-entry { grid-template-columns: minmax(0, 1fr) minmax(90px, .8fr); }
  .payroll-entry input, .payroll-entry select { width: 100%; }
  .payroll-core-row { grid-template-columns: minmax(0, 1fr) minmax(100px, .8fr); }
  .payroll-core-row strong { grid-column: 1 / -1; }
  .export-row { align-items: stretch; }
  .export-row strong { flex-basis: 100%; }
  .dialog-actions { position: sticky; bottom: -17px; padding: 12px 0 4px; background: var(--cream); }
  .dialog-actions button { flex: 1; }
  .toast { right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); left: 10px; max-width: none; }
}
@media (max-width: 360px) {
  .overview-grid { grid-template-columns: 1fr; }
  .profile-button #profile-name { max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
