@font-face {
  font-family: Inter;
  src: url('/inter.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --navigation: #183D32;
  --action: #39785B;
  --background: #F4F6F5;
  --surface: #FFFFFF;
  --accent: #D6A345;
  --text: #202C28;
  font: 16px/1.55 Inter, system-ui, sans-serif;
  color: var(--text);
  background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; }
.navigation {
  min-height: 76px;
  padding: 12px clamp(16px, 5vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  color: var(--surface);
  background: var(--navigation);
  border-bottom: 3px solid var(--accent);
}

nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
main { max-width: 1440px; margin: auto; padding: clamp(16px, 5vw, 64px); }
.surface { background: var(--surface); border: 1px solid #dbe4df; border-radius: 12px; padding: clamp(18px, 4vw, 32px); }
.sign-in { max-width: 460px; margin: 24px auto; }
h1, h2 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: clamp(26px, 4vw, 38px); }
p { margin: 0 0 16px; }
.sign-in form { display: grid; gap: 8px; }
label { font-weight: 650; }
input, button { font: inherit; border-radius: 6px; min-height: 48px; padding: 8px 14px; }
input { color: var(--text); background: var(--surface); border: 1px solid #74857d; width: 100%; }
.sign-in button { margin-top: 10px; }
button { font-weight: 700; background: var(--action); color: var(--surface); border: 1px solid transparent; cursor: pointer; }
button.secondary { background: var(--navigation); border-color: #a9c4b8; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.error { color: #8d2323; font-weight: 650; }
nav a { color: inherit; padding: 8px 2px; text-decoration: none; }
nav a[aria-current] { border-bottom: 2px solid var(--accent); }
main a { color: var(--navigation); text-underline-offset: 3px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.page-heading h1 { margin: 0; }
main a.button { display: inline-flex; align-items: center; min-height: 48px; padding: 8px 14px; border-radius: 6px; background: var(--action); color: var(--surface); font-weight: 700; text-decoration: none; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid #dbe4df; }
th { background: var(--background); }
.customer-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.customer-form label { display: block; margin-bottom: 4px; }
.form-wide { grid-column: 1 / -1; }
textarea { display: block; width: 100%; padding: 8px 14px; font: inherit; color: var(--text); border: 1px solid #74857d; border-radius: 6px; resize: vertical; }
[hidden] { display: none !important; }
main:has(.field-layout) { max-width: 1920px; padding: clamp(12px, 2vw, 30px); }
.field-layout { display: grid; grid-template-columns: minmax(175px, 1fr) minmax(320px, 3.5fr) minmax(220px, 1.35fr); gap: 12px; align-items: start; }
.field-panel { padding: 16px; min-width: 0; }
.field-panel h2 { font-size: 1.2rem; }
.field-panel label { display: block; margin-top: 10px; }
.field-panel fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.field-panel select { width: 100%; }
select { min-height: 42px; max-width: 100%; color: var(--text); font: inherit; background: var(--surface); border: 1px solid #74857d; border-radius: 6px; padding: 5px 8px; }
.field-panel .check { display: flex; gap: 6px; align-items: center; margin-block: 12px; }
.field-panel .check input { width: 18px; min-height: 18px; }
.field-panel p { margin-block: 8px; }
.field-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-actions button, #add-entrance, #archive-field, #center-location { color: var(--navigation); background: var(--surface); border-color: #74857d; }
#center-location { margin-top: 6px; }
#field-notes, #archive-field { margin-block: 8px; }
.entrance-row { border-top: 1px solid #dbe4df; padding-bottom: 10px; }
.entrance-row .field-actions { margin-top: 8px; }
.field-list-item { display: block; width: 100%; text-align: left; color: var(--text); background: var(--background); margin-bottom: 6px; overflow-wrap: anywhere; }
.field-list-item[aria-pressed=true] { border-color: var(--action); border-left-width: 4px; }
.map-shell { min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid #dbe4df; border-radius: 12px; overflow: hidden; }
.map-toolbar, #map-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.map-toolbar { padding: 8px; }
.map-toolbar button { min-height: 42px; padding: 5px 9px; }
.map-toolbar button[aria-pressed=true] { background: var(--navigation); box-shadow: inset 0 -3px var(--accent); }
.map-canvas { height: clamp(440px, 68vh, 950px); background: #e4eae6; z-index: 0; }
.map-hint { padding: 8px; margin: 0; }
.map-shell:fullscreen, .map-expanded { height: 100%; width: 100%; border-radius: 0; }
.map-expanded { position: fixed; inset: 0; z-index: 2000; }
.map-shell:fullscreen .map-canvas, .map-expanded .map-canvas { height: auto; flex: 1; }
.vertex { border-radius: 50%; border: 2px solid #183d32; background: #fff; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.planning-surface { margin-bottom: 14px; }
.planning-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-block: 8px 14px; }
.planning-toolbar .control { flex: 1 1 145px; min-width: 0; max-width: 270px; }
.planning-toolbar select { width: 100%; min-height: 48px; }
.control label { display: block; margin-bottom: 4px; }
.planning-group { border: 1px solid #dbe4df; border-radius: 8px; padding: 12px; margin: 14px 0; min-width: 0; }
.planning-group legend { font-weight: 700; padding-inline: 6px; }
.repeatable-row { border-bottom: 1px solid #dbe4df; padding-bottom: 8px; }
.planning-surface button.outline { color: var(--navigation); background: var(--surface); border-color: #74857d; }
.planning-surface input[type=checkbox] { width: 20px; min-height: 20px; accent-color: var(--action); }
.registration-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 140px); align-items: center; gap: 12px; padding: 5px 0; }
.registration-field label { display: flex; align-items: center; gap: 6px; }
.registration-field input[type=checkbox] { flex: 0 0 20px; }
main:has(#dispatch) { max-width: 100%; padding: 20px; }
#dispatch:fullscreen { overflow: auto; background: var(--background); padding: 16px; }
.dispatch-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
@media (min-width: 1050px) {
  .dispatch-layout { display: flex; }
  .dispatch-layout > aside { flex: 0 0 clamp(220px, 19vw, 320px); }
  .dispatch-center { flex: 1 1 auto; }
}
.dispatch-center { min-width: 0; padding: 12px; }
.dispatch-metrics { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.machine-calendar th { white-space: nowrap; }
.machine-calendar tbody th { position: sticky; left: 0; z-index: 1; }
.machine-calendar td { min-width: 130px; vertical-align: top; border: 1px solid #dbe4df; padding: 6px; height: 76px; }
.calendar-card, .queue-order { display: block; width: 100%; margin-bottom: 5px; text-align: left; overflow-wrap: anywhere; }
.calendar-card { background: var(--navigation); font-size: .84rem; }
.calendar-capacity { font-size: .75rem; font-weight: 500; margin-bottom: 4px; white-space: normal; }
.queue-card { margin-top: 12px; padding: 10px; background: var(--background); border-radius: 6px; }
.queue-card summary { font-weight: 700; cursor: pointer; }
.queue-filters { margin-top: 10px; }
.queue-filters summary { cursor: pointer; }
.queue-card p { font-size: .9rem; }
#dispatch-dialog { width: min(540px, calc(100% - 24px)); max-height: 90vh; padding: 18px; color: var(--text); border: 1px solid var(--action); border-radius: 8px; }
#dispatch-dialog::backdrop { background: #202c2877; }
.dispatch-label { display: block; margin: 10px 0; }
.dispatch-label :is(input:not([type=checkbox]),select) { width: 100%; }
.office-shell { --nav-width: 176px; display: grid; grid-template-columns: var(--nav-width) minmax(0,1fr); min-height: 100dvh; }
.office-shell.nav-collapsed { --nav-width: 56px; }
.office-shell .navigation { position: sticky; top: 0; height: 100dvh; min-height: 0; display: flex; flex-direction: column; align-items: stretch; justify-content: start; gap: 14px; padding: 10px 8px; border: 0; border-right: 1px solid #386151; overflow: auto; }
.nav-brand { position: relative; display: flex; align-items: center; gap: 5px; min-height: 54px; padding: 0 2px; line-height: 1.16; font-size: .72rem; }
.nav-symbol { color: var(--accent); font-size: 1.35rem; }
#nav-toggle { margin-left: auto; background: #ffffff16; min-height: 29px; min-width: 21px; padding: 0 4px; font-size: 1.05rem; }
.office-shell nav { display: flex; flex-direction: column; align-items: stretch; gap: 4px; flex: 1; }
.office-shell nav a, .office-shell nav button { display: flex; align-items: center; gap: 7px; padding: 7px 6px; border: 0; border-radius: 5px; min-height: 36px; font-size: .76rem; text-align: left; font-weight: 550; width: 100%; }
.office-shell nav a:hover, .office-shell nav a[aria-current] { background: #ffffff17; }
.office-shell nav a[aria-current] .nav-icon { color: var(--accent); }
.office-shell nav form { margin-top: auto; }
.nav-icon { width: 22px; flex: 0 0 22px; text-align: center; font: 1.12rem/1 Inter, system-ui, sans-serif; }
.nav-collapsed :is(.nav-label,.nav-brand strong,.nav-symbol) { display: none; }
.nav-collapsed :is(.nav-brand,nav a,nav button) { justify-content: center; }
.nav-collapsed #nav-toggle { margin: 0; }
.office-shell main { width: 100%; max-width: none; margin: 0; min-width: 0; padding: 16px clamp(12px, 1.5vw, 26px); }
.office-shell h1 { font-size: clamp(1.3rem, 2vw, 1.95rem); margin-bottom: 10px; }
.office-shell h2 { font-size: 1.06rem; }
.login-brand { background: var(--navigation); color: var(--surface); padding: 14px 24px; font-weight: 700; }
.secondary-control, .dispatch-controls button, .queue-secondary { background: var(--surface); color: var(--navigation); border: 1px solid #c0cdc6; }
.dispatch-controls { align-items: end; margin: 4px 0 10px; }
.dispatch-controls .control { flex: 0 1 145px; }
.dispatch-controls :is(input,button) { min-height: 36px; padding: 5px 9px; }
#dispatch .dispatch-controls { column-gap: 6px; row-gap: 4px; }
#dispatch .dispatch-controls label { font-size: .76rem; margin-bottom: 2px; }
#dispatch .dispatch-controls :is(input,button,select) { min-height: 32px; padding: 3px 7px; font-size: .83rem; }
.period-nav { display: flex; gap: 3px; align-items: center; }
#view-switch button[aria-pressed=true] { background: var(--navigation); color: var(--surface); }
#dispatch .page-heading .button { min-height: 36px; padding: 5px 12px; }
#dispatch-status:empty { display: none; }
.dispatch-metrics { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); }
.kpi-card { background: var(--surface); padding: 8px 10px; border: 1px solid #dbe4df; border-radius: 7px; }
.kpi-card strong { display: block; font-size: clamp(1rem, 1.6vw, 1.52rem); line-height: 1.18; font-variant-numeric: tabular-nums; }
.kpi-card span { font-size: .73rem; }
.kpi-card[data-key=unplanned] { border-left: 3px solid var(--accent); }
#dispatch-calendar { min-height: max(440px, calc(100dvh - 235px)); max-height: calc(100dvh - 150px); overflow: auto; }
.machine-calendar { width: 100%; }
.machine-calendar thead th { position: sticky; top: 0; z-index: 2; background: #edf3ef; }
.machine-calendar thead th:first-child { left: 0; z-index: 3; }
.machine-calendar td { min-width: 87px; width: 12%; height: 94px; }
.machine-calendar.week { table-layout: fixed; min-width: 690px; }
.machine-calendar.week :is(th,td) { width: auto; min-width: 0; padding: 5px; }
.machine-calendar.week th:first-child { width: 115px; }
.machine-calendar.week tbody th { white-space: normal; font-size: .83rem; }
.machine-calendar:is(.day,.fortnight,.season) td { min-width: 106px; }
.calendar-card { color: var(--text); background: #e5efe9; border: 0; border-left: 3px solid var(--action); padding: 5px 6px; font-size: .7rem; min-height: 36px; overflow: hidden; }
.calendar-card[data-status=draft] { background: #eef0f2; border-color: #68727e; }
.calendar-card[data-status=worked], .work-status[data-state=completed] { background: #dceee3; border-color: #238454; }
.calendar-card[data-status=released], .work-status:is([data-state=assigned],[data-state=acknowledged]) { background: #deeafa; border-color: #335f9b; }
.calendar-card[data-status=running], .work-status:is([data-state=working],[data-state=paused]) { background: #ffe9d3; border-color: #ab5c12; }
.calendar-card[data-status=problem], .calendar-interruption, .sync-errors { background: #fbe5e5; border-color: #a72d2d; color: #762323; }
.calendar-today { background: #e9f4ea; box-shadow: inset 0 2px #39785b; }
.machine-calendar thead th.calendar-today { background: #d4ebd6; }
.capacity-meter, .harvest-meter { width: 100%; height: 8px; accent-color: #39785b; display: block; margin-block: 4px; }
.capacity-meter.overbooked { accent-color: #a72d2d; }
.harvest-meter { height: 14px; }
.calendar-interruption { background: #fbe5e5; color: #762323; }
.machine-checks { border: 1px solid #d9e3dd; margin: 6px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.machine-checks .dispatch-label { margin: 0; display: flex; gap: 4px; align-items: center; }
.machine-checks input { width: 17px; min-height: 17px; padding: 0; }
.map-legend { display: flex; flex-wrap: wrap; gap: 5px; }
.map-legend span { border-left: 4px solid; background: #f0f4f1; padding: 2px 7px; font-size: .82rem; }
.office-links a { display: block; margin-bottom: 4px; }
#office-summary { padding: 18px; }
.driver-app { max-width: 720px; margin-inline: auto; }
.driver-app .page-heading h1 { font-size: clamp(1.2rem,5vw,1.8rem); }
.driver-app :is(button,a.button) { min-height: 48px; }
.driver-app .driver-actions { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); }
.driver-install { margin-block: 14px; }
.driver-day { margin-block: 18px; }
.driver-job { padding: 14px; margin-bottom: 12px; }
.driver-job h3 { margin: 0 0 4px; font-size: 1.24rem; }
.driver-job p { margin-block: 6px; }
.driver-job .work-status { display: inline-flex; padding: 3px 9px; border-left: 4px solid; color: #202c28; font-weight: 700; border-radius: 4px; }
.driver-map { height: min(45vh,400px); width: min(500px,74vw); background: #ecf2ec; }
#driver-dialog { max-width: calc(100% - 18px); border: 1px solid #39785b; border-radius: 8px; color: #202c28; }
#driver-dialog::backdrop { background: #202c2885; }
#driver-dialog label { display: block; margin: 10px 0; }
.calendar-card[data-status=changed] { background: #faefd5; border-color: #946520; }
.mark-allocation { width: 15px; min-height: 15px; padding: 0; margin: 0; accent-color: var(--action); }
#workflow-dialog { width: min(920px, calc(100% - 24px)); max-height: 90vh; overflow: auto; border: 1px solid var(--action); border-radius: 8px; color: var(--text); }
#workflow-dialog::backdrop { background: #202c2877; }
#dispatch-insights { width: min(1100px, calc(100% - 24px)); max-height: 90vh; overflow: auto; border: 1px solid var(--action); border-radius: 8px; color: var(--text); }
#dispatch-insights::backdrop { background: #202c2877; }
#dispatch-insights:is(:fullscreen,.map-expanded) { width: 100%; max-width: none; height: 100%; max-height: none; }
#insights-map { height: min(53vh,510px); min-height: 230px; background: #e6eee8; margin-bottom: 10px; }
.calendar-card span, .calendar-card strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-card .calendar-card-timing { font-size: .64rem; font-variant-numeric: tabular-nums; }
.queue-card { padding: 8px; background: #fff; border: 1px solid #dbe4df; }
.queue-card p { margin: 5px 0; font-size: .76rem; }
.queue-card summary strong { color: var(--navigation); font-size: .83rem; }
.queue-summary { display: flex; align-items: start; gap: 5px; }
.queue-summary details { flex: 1; min-width: 0; }
.queue-grip { width: 26px; min-width: 26px; min-height: 30px; padding: 2px; cursor: grab; background: #edf3ef; color: var(--navigation); }
.queue-progress { display: flex; height: 5px; border-radius: 4px; overflow: hidden; background: #e8ecea; margin: 6px 0; }
.queue-progress span:nth-child(1) { background: #39785B; }
.queue-progress span:nth-child(2) { background: #83a795; }
.queue-progress span:nth-child(3) { background: #D6A345; }
.queue-secondary { min-height: 30px; padding: 4px 6px; font-size: .75rem; }
.registration-surface { padding: 14px; }
.registration-surface .planning-toolbar { margin-block: 6px 10px; }
.registration-surface :is(input:not([type=checkbox]), select) { min-height: 36px; padding-block: 5px; }
.registration-customer-summary { margin-block: 7px; color: var(--navigation); font-size: .87rem; }
.registration-fields :is(td,th) { padding: 6px 8px; white-space: nowrap; font-size: .82rem; }
.registration-fields td:last-child input { min-width: 90px; max-width: 140px; }
.registration-extras { border-block: 1px solid #dbe4df; padding-block: 8px; margin-bottom: 8px; }
.registration-extras summary { cursor: pointer; font-weight: 600; }
#registration-area { padding: 4px 8px; border-radius: 5px; color: var(--navigation); background: #e7f1eb; font-weight: 700; }
.calendar-interruption { display: block; color: #762323; background: #fbe5e5; border-radius: 4px; padding: 2px 4px; margin-bottom: 4px; font-size: .68rem; overflow-wrap: anywhere; }
@media (min-width:1050px) {
  .dispatch-layout > aside { flex: 0 0 auto; width: clamp(205px,16vw,305px); min-width: 175px; max-width: 31vw; max-height: calc(100dvh - 190px); overflow: auto; resize: horizontal; padding: 10px; }
}
@media (max-width:820px) {
  .dispatch-metrics { grid-template-columns: repeat(auto-fit,minmax(100px,1fr)); }
}
.pill { display: inline-block; padding: 3px 8px; border-radius: 6px; background: #e7f1eb; color: var(--navigation); }
.pill-open { background: #f5e9cf; color: var(--text); }
#planning-status:not(:empty) { position: sticky; bottom: 8px; z-index: 1; background: var(--surface); padding: 10px; border: 1px solid #74857d; border-radius: 6px; }
button:disabled { opacity: .65; cursor: default; }
@media (max-width: 860px) {
  .field-layout { grid-template-columns: 1fr; }
  .map-canvas { height: 55vh; min-height: 320px; }
}
