:root {
  color-scheme: light;
  font-family: 'Aptos', 'Segoe UI', system-ui, sans-serif;
  color: #2b2008;
  background: #fbf6e2;
  /* Palette taken from Euproctis fraterna: golden-yellow wings, dark brown spots, orange-brown tufts. */
  --ink: #2b2008;
  --muted: #61563a;
  --line: #eadfae;
  --primary: #f2c200;
  --primary-hover: #dcae00;
  --primary-ink: #2b1c00;
  --primary-dark: #7a4d00;
  --sidebar: #2e2209;
  --tint: #fcefb0;
  --surface: #fff;
  --spot: #5a3a10;
  --rust: #b4530f;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
:disabled { cursor: not-allowed; opacity: .6; }
:focus-visible { outline: 3px solid #a86f00; outline-offset: 3px; }
.sidebar :focus-visible, .auth-panel :focus-visible { outline-color: #ffd84d; }
button, a { touch-action: manipulation; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
svg { flex: 0 0 auto; width: 20px; height: 20px; }
[tabindex="-1"]:focus { outline: none; }
.muted { color: var(--muted); }
.optional { color: var(--muted); font-weight: 450; }
.visually-hidden, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; z-index: 10; top: 12px; left: 12px; padding: 8px 16px; background: white; border-radius: 8px; }
.boot { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.boot .card { max-width: 440px; display: grid; gap: 16px; }
.print-root { display: none; }

.brand { width: fit-content; display: inline-flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; font-weight: 750; font-size: 1.55rem; letter-spacing: -.045em; }
.brand img { display: block; }
.workspace { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; padding: 29px 16px 20px; background: var(--sidebar); color: #fff; }
.side-top > .brand { margin: 0 0 33px 10px; }
.sidebar nav { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #f4e8c2; font-size: .9375rem; font-weight: 620; text-align: left; }
.nav-item svg { color: #e0c46a; }
.nav-item:hover { background: #45330f; }
.nav-item.current { background: #5a4112; color: #fff; border-color: #8c6a1e; }
.nav-item.current svg { color: #ffd84d; }
.sidebar-account { border-top: 1px solid #5e4818; padding: 16px 1px 0; display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.identity strong, .identity div span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity strong { font-size: .9rem; }
.identity div span { margin-top: 2px; color: #e3d3a2; font-size: .8125rem; }
.avatar { flex: 0 0 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-weight: 750; }
.icon-button { display: grid; flex: 0 0 36px; height: 36px; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #f1dfa6; }
.icon-button:hover { background: #5a4112; color: white; }
.work-area { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 66px; padding: 10px clamp(20px, 3.6vw, 52px); background: var(--surface); border-bottom: 3px solid var(--primary); font-size: .9375rem; font-weight: 650; }
.top-date { display: inline-flex; gap: 7px; align-items: center; color: var(--muted); font-size: .875rem; font-weight: 550; }
.top-date svg { width: 17px; height: 17px; color: var(--primary-dark); }
.content { max-width: 1430px; margin: 0 auto; padding: 34px clamp(20px, 3.6vw, 52px) 48px; }
.page-heading { margin-bottom: 23px; }
.page-heading h1 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); line-height: 1.12; font-weight: 750; letter-spacing: -.045em; }
.page-heading p { margin-top: 8px; color: var(--muted); line-height: 1.5; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 21px; }
.stat, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 2px 4px #5a3a100d; }
.stat { display: flex; align-items: center; gap: 13px; min-height: 86px; padding: 15px 17px; }
.stat p { color: var(--muted); font-size: .875rem; font-weight: 600; }
.stat strong { display: block; margin-top: 3px; line-height: 1; font-size: 1.65rem; letter-spacing: -.035em; }
.icon-tile { display: inline-grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 11px; }
.sage { background: var(--tint); color: var(--primary-dark); }
.green { background: #e5efcf; color: #3b5a12; }
.amber { background: #ffe6bd; color: #8a4300; }
.red { background: #fde0d2; color: #9c2f08; }
.neutral { background: #f3eed8; color: var(--muted); }
.two-column { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 19px; align-items: start; }
.config-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
.stack { display: grid; gap: 19px; }
.card { min-width: 0; padding: 23px; }
.card-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 24px; }
.card-heading h2 { font-size: 1.145rem; font-weight: 750; line-height: 1.3; letter-spacing: -.018em; }
.card-heading p { margin-top: 3px; color: var(--muted); font-size: .875rem; line-height: 1.4; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 14px; }
.full-width { grid-column: 1 / -1; }
fieldset { margin: 0; min-width: 0; padding: 0; border: 0; }
label { display: grid; gap: 7px; min-width: 0; font-size: .875rem; font-weight: 680; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid #d8c987; border-radius: 8px; padding: 9px 11px; background: #fff; color: var(--ink); font-size: 1rem; font-weight: 450; }
input::placeholder, textarea::placeholder { color: #6f6446; }
input[type="checkbox"], input[type="radio"] { width: 18px; min-height: 18px; height: 18px; padding: 0; accent-color: var(--rust); }
select:disabled { background-color: #f6f1da; }
textarea { resize: vertical; min-height: 85px; }
select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) center, calc(100% - 12px) center; background-size: 5px 5px; background-repeat: no-repeat; }
.form-stack { display: grid; gap: 16px; }
.form-stack > .button { justify-self: start; }
.form-help { font-size: .875rem; color: var(--muted); line-height: 1.4; margin-top: -7px; }
.form-error { font-size: .875rem; color: #a32439; line-height: 1.4; }
.form-error:empty { display: none; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 8px 15px; border: 1px solid transparent; border-radius: 8px; font-size: .9375rem; font-weight: 700; text-decoration: none; text-align: center; }
.button svg { width: 17px; height: 17px; }
.button-primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 2px 2px #5a3a1030; }
.button-primary:not(:disabled):hover { background: var(--primary-hover); }
.button-small { min-height: 34px; padding: 5px 9px; font-size: .875rem; white-space: nowrap; }
.button-quiet { color: var(--primary-dark); background: #fbf3cd; border-color: #ecdd9a; }
.button-quiet:not(:disabled):hover { background: var(--tint); }
.text-button { padding: 3px 0; border: 0; background: transparent; color: var(--primary-dark); font-size: .875rem; font-weight: 750; }
.text-button:hover { text-decoration: underline; }
.visit-preview, .inline-alert { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 8px; line-height: 1.35; font-size: .875rem; }
.visit-preview svg, .inline-alert svg { width: 17px; height: 17px; }
.inline-alert { flex-wrap: wrap; margin-bottom: 17px; color: #6c3e08; background: #fff0cf; }
.inline-alert span { flex: 1 0 60%; }
.inline-alert .text-button { margin-inline-start: auto; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 17px; }
.form-actions .form-error { flex: 1 1 220px; }
.ward-summary .card-heading { margin-bottom: 12px; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 28px 9px; text-align: center; }
.empty.compact { padding: 18px 8px 21px; }
.empty p { max-width: 25ch; color: var(--muted); font-size: .875rem; line-height: 1.45; }
.card-footer { padding-top: 13px; border-top: 1px solid var(--line); margin-top: 6px; }
.date-list, .account-list, .role-list, .concern-list { display: grid; list-style: none; padding: 0; margin: 0; }
.date-list li { display: flex; align-items: center; gap: 11px; min-height: 63px; padding: 8px 0; }
.date-list li + li { border-top: 1px solid var(--line); }
.date-square { display: grid; place-content: center; justify-items: center; flex: 0 0 47px; min-height: 47px; border-radius: 8px; background: var(--tint); color: var(--primary-dark); }
.date-square > strong { font-size: 1.25rem; line-height: 1.1; }
.date-list li > div:nth-child(2) > span, .account-list li > div > span, .role-list span { display: block; color: var(--muted); font-size: .875rem; margin-top: 3px; }
.date-list li > div { min-width: 0; overflow-wrap: anywhere; }
.role-list li { padding: 11px 0; }
.role-list li + li { border-top: 1px solid var(--line); }

.filters { display: grid; grid-template-columns: minmax(130px, 2fr) minmax(115px, 1fr) minmax(150px, 1fr); gap: 10px; }
.board-filters { grid-template-columns: minmax(150px, 2fr) minmax(150px, 1fr); }
.search-field { position: relative; }
.search-field input { padding-left: 36px; }
.search-field svg { position: absolute; top: 12px; left: 11px; width: 18px; height: 18px; color: var(--muted); }
.result-count { padding: 14px 0 10px; color: var(--muted); font-size: .875rem; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 600px; border-collapse: collapse; }
th { background: #f8efc4; text-align: left; }
th, td { padding: 11px 12px; font-size: .875rem; vertical-align: top; }
td { border-top: 1px solid var(--line); overflow-wrap: anywhere; }
td:first-child:not(.check-cell), td.check-cell + td { min-width: 190px; }
td > strong + span, td > span { display: block; margin-top: 4px; color: var(--muted); }
td > span.badge { display: inline-flex; margin-top: 6px; }
.check-cell { width: 44px; padding-right: 0; }
.flags .badge { margin: 0 5px 5px 0; }
.repeat-row { background: #fff8e4; }
.badge { display: inline-flex; align-items: center; min-height: 27px; padding: 3px 9px; border-radius: 20px; font-size: .8125rem; font-weight: 650; white-space: nowrap; }
.badge-green { background: #e5efcf; color: #36540f; }
.badge-amber { background: #ffe2b0; color: #7a3c00; }
.badge-gold { background: var(--tint); color: #6b4300; }
.badge-red { background: #fcd9c8; color: #8d2606; }
.badge-neutral { background: #f1ecd6; color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ward-board + .ward-board { margin-top: 20px; }
.ward-board-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.ward-board-head h3 { font-size: 1.0625rem; overflow-wrap: anywhere; }
.check-line { display: inline-flex; grid-auto-flow: column; align-items: center; gap: 7px; margin-left: auto; font-weight: 650; }
.mode-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: -8px 0 16px; font-size: .875rem; }
.action-bar { position: sticky; bottom: 14px; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 14px; margin-top: 16px; padding: 12px 16px; border-radius: 12px; background: var(--sidebar); color: #fff; box-shadow: 0 6px 22px #2e220955; }
.action-bar > span { margin-right: auto; }
.action-bar .button-quiet { background: #4a3813; border-color: #7a5d1d; color: #ffe9a5; }
.action-bar .button-quiet:not(:disabled):hover { background: #5f4818; }
.period-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 10px; background: #f6efcf; }
.period-tabs button { min-height: 36px; padding: 6px 14px; border: 0; border-radius: 7px; background: transparent; color: var(--primary-dark); font-weight: 700; font-size: .9rem; }
.period-tabs button:hover { background: #fcf5d3; }
.period-tabs button.current { background: var(--primary); color: var(--primary-ink); box-shadow: 0 1px 2px #5a3a1033; }
.report-filters { display: grid; grid-template-columns: auto minmax(130px, 1fr) minmax(170px, 1.3fr); gap: 10px; align-items: end; }
.report-filters:has(#from) { grid-template-columns: repeat(2, minmax(130px, 1fr)) minmax(130px, 1fr) minmax(170px, 1.3fr); }
.date-nav { display: flex; align-items: center; gap: 4px; }
.date-nav .icon-button { color: var(--primary-dark); background: #fbf3cd; flex-basis: 42px; height: 42px; }
.date-nav .icon-button:hover { background: var(--tint); color: var(--primary-dark); }
.report-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 20px 0 14px; }
.report-head h3 { font-size: 1.2rem; }
.export-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ward-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.concern-list li { display: grid; gap: 6px; padding: 15px 0; }
.concern-list li + li { border-top: 1px solid var(--line); }
.concern-list p { line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.concern-top { display: flex; flex-wrap: wrap; gap: 6px; }
.meta { color: var(--muted); font-size: .8125rem; line-height: 1.4; overflow-wrap: anywhere; }
.team-add { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.account-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 13px 0; overflow-wrap: anywhere; }
.account-list li + li { border-top: 1px solid var(--line); }
.account-actions { display: flex; flex-wrap: wrap; gap: 6px; }
dialog { width: min(440px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 12px; padding: 22px; color: var(--ink); box-shadow: 0 16px 60px #2e220966; }
dialog::backdrop { background: #2e220988; }
dialog > p { margin: 8px 0 18px; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.choice-list { display: grid; gap: 9px; margin-bottom: 4px; }
.choice { display: flex; grid-auto-flow: column; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; padding: 13px 14px; border: 1px solid #e3d48f; border-radius: 10px; background: #fffbe8; color: var(--ink); text-align: left; font-weight: 400; }
.choice:hover, .choice:has(input:checked) { border-color: var(--rust); background: var(--tint); }
.choice svg { color: var(--primary-dark); width: 22px; height: 22px; }
.choice strong { display: block; font-size: .975rem; }
.choice small { display: block; margin-top: 2px; color: var(--muted); font-size: .8125rem; overflow-wrap: anywhere; }
.choice > span { min-width: 0; }
dialog > .choice-list + .dialog-actions, dialog > h2 + p + .choice-list { margin-top: 0; }
.notice:not(:empty) { position: fixed; z-index: 20; right: 18px; bottom: 18px; max-width: min(400px, calc(100% - 36px)); padding: 12px 16px; border-radius: 9px; background: var(--sidebar); color: white; box-shadow: 0 4px 16px #2e22093b; overflow-wrap: anywhere; border-left: 5px solid var(--primary); }
.notice.notice-error:not(:empty) { background: #8e263c; border-left-color: #ffb3c2; }

.auth-shell { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); min-height: 100vh; }
.auth-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(28px, 5vh, 58px) clamp(24px, 4.7vw, 92px) 30px;
  color: #fff;
  background-color: var(--sidebar);
  background-image: linear-gradient(180deg, #2e2209f2, #2e2209e0 30%, #2e220994 62%, #2e220933 100%),
    url('/spray-operator.jpg');
  background-size: cover;
  background-position: center, 60% 30%;
}
.auth-copy { margin-top: clamp(40px, 10vh, 120px); }
.auth-title { max-width: 12ch; line-height: 1; font-size: clamp(2.6rem, 5.2vw, 5.4rem); font-weight: 780; letter-spacing: -.052em; text-wrap: balance; color: #ffe04a; }
.auth-description { max-width: 40ch; margin-top: 20px; color: #fbf1cf; font-size: clamp(1rem, 1.4vw, 1.2rem); line-height: 1.55; }
.moth-card { display: flex; align-items: center; gap: 14px; width: fit-content; max-width: 100%; margin: auto 0 0; padding: 10px 16px 10px 10px; border-radius: 14px; background: #2e2209d9; border: 1px solid #8c6a1e; backdrop-filter: blur(4px); }
.moth-card img { width: 108px; height: 72px; object-fit: cover; border-radius: 9px; flex: 0 0 auto; }
.moth-card strong { display: block; font-style: italic; color: #ffe04a; }
.moth-card span { display: block; max-width: 26ch; margin-top: 3px; color: #f1e3b0; font-size: .875rem; line-height: 1.4; }
.photo-credit { margin-top: 18px; color: #d9c98f; font-size: .75rem; line-height: 1.4; max-width: 60ch; }
.auth-form-wrap { display: grid; place-items: center; padding: 45px clamp(22px, 5vw, 72px); }
.auth-form-card { width: min(100%, 444px); padding: clamp(22px, 4vw, 42px); background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--primary); border-radius: 17px; box-shadow: 0 14px 42px #5a3a1020; }
.auth-form-card h1 { font-size: clamp(1.7rem, 2.8vw, 2.2rem); line-height: 1.15; letter-spacing: -.044em; margin-top: 16px; }
.auth-form-card > p { line-height: 1.5; margin-top: 9px; margin-bottom: 25px; }
.auth-form-card .button { width: 100%; }
.auth-form-card input, .auth-form-card .button { min-height: 46px; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 200px minmax(0, 1fr); }
  .card { padding: 19px; }
  .stat { padding: 12px; }
  .report-filters, .report-filters:has(#from) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
  .two-column { grid-template-columns: minmax(0, 1fr); }
  .auth-panel { padding: 40px 26px 24px; }
}
@media (max-width: 670px) {
  .workspace { display: block; }
  .sidebar { position: static; height: auto; overflow: visible; padding: 12px 14px; }
  .side-top { display: contents; }
  .side-top > .brand { margin: 0 0 9px; }
  .sidebar nav { order: 3; display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-item { width: auto; min-height: 38px; padding: 6px 8px; gap: 5px; font-size: .8125rem; }
  .nav-item svg { width: 17px; height: 17px; }
  .sidebar-account { position: absolute; right: 12px; top: 12px; max-width: 57%; border: 0; padding: 0; }
  .avatar { display: none; }
  .topbar { min-height: 49px; }
  .content { padding-top: 22px; }
  .page-heading { margin-bottom: 16px; }
  .stats { gap: 8px; margin-bottom: 14px; }
  .stat { align-items: flex-start; flex-direction: column; gap: 7px; padding: 9px; }
  .stat .icon-tile { width: 31px; height: 31px; flex-basis: 31px; border-radius: 8px; }
  .stat .icon-tile svg { width: 17px; height: 17px; }
  .stat p { font-size: .8125rem; }
  .stat strong { font-size: 1.35rem; }
  .filters, .board-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-field { grid-column: 1 / -1; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-panel { padding: 22px 24px 24px; }
  .auth-copy { margin-top: 25px; }
  .auth-title { max-width: 14ch; font-size: clamp(2.1rem, 9vw, 3rem); }
  .auth-description { margin-top: 10px; }
  .moth-card { margin-top: 24px; }
  .auth-form-wrap { padding: 24px 20px 36px; }
}
@media (max-width: 440px) {
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar { font-size: .85rem; }
  .top-date { font-size: .8125rem; }
  .content { padding-inline: 14px; }
  .card { padding: 15px; }
  .card-heading { margin-bottom: 19px; }
  .filters, .board-filters, .report-filters, .report-filters:has(#from) { grid-template-columns: minmax(0, 1fr); }
  .action-bar > span { flex: 1 0 100%; }
}

@media print {
  @page { size: A4 landscape; margin: 1.2cm; }
  body { background: #fff; color: #000; }
  #app, #notice, .skip-link, dialog { display: none !important; }
  .print-root { display: block; font-family: Arial, sans-serif; }
  .print-root h1 { font-size: 20pt; margin-bottom: 4pt; }
  .print-root h2 { font-size: 13pt; margin: 14pt 0 5pt; }
  .print-root p { margin: 2pt 0; font-size: 10pt; }
  .print-root table { width: 100%; min-width: 0; margin-top: 4pt; }
  .print-root th, .print-root td { border: 1px solid #888; padding: 3pt 5pt; font-size: 8.5pt; }
  .print-root th { background: #f5e08a; }
  .print-root tr { break-inside: avoid; }
  .print-root thead { display: table-header-group; }
  .print-foot { margin-top: 10pt !important; color: #555; font-size: 8pt !important; }
}
