:root {
  color-scheme: light;
  --ink: #14273f;
  --muted: #506479;
  --primary: #096856;
  --primary-dark: #075445;
  --accent: #dcf5ee;
  --paper: #fff;
  --canvas: #f4f7fa;
  --border: #d9e2eb;
  --soft-border: #e6edf4;
  --radius: 12px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--primary-dark); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid #219f86;
  outline-offset: 2px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1.2; letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; letter-spacing: -.015em; }
h3 { font-size: .95rem; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.shell { width: min(1460px, calc(100% - 64px)); margin-inline: auto; }
.main { padding-block: 34px 50px; }
.top { background: var(--ink); color: white; }
.top-inner { min-height: 68px; display: flex; gap: 26px; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: white; font-weight: 800; letter-spacing: .065em; font-size: 1.06rem; text-decoration: none; }
.brand-mark { width: 29px; height: 29px; border-radius: 7px; display: grid; place-items: center; background: #b6eddf; color: #074a3d; }
.brand-mark svg { width: 21px; height: 21px; stroke: currentColor; stroke-width: 1.65; stroke-linejoin: round; stroke-linecap: round; }
.top nav { display: flex; gap: 4px; flex: 1; align-items: center; }
.top nav a { text-decoration: none; color: #e2ebf4; border-radius: 6px; padding: 9px 12px; font-size: .88rem; font-weight: 600; white-space: nowrap; }
.top nav a:hover, .top nav a[aria-current] { background: #304862; color: white; }
.account { display: flex; gap: 10px; align-items: center; font-size: .84rem; }
.account span { max-width: 17ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button, input, select, textarea { font: inherit; }
.button { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px; padding: 8px 13px; border-radius: 7px; border: 1px solid var(--border); background: var(--paper); color: var(--ink); font-size: .88rem; font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap; }
.button:hover { background: #edf3f7; border-color: #b2c1cf; }
.button.primary { background: var(--primary); border-color: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.button.quiet { min-height: 35px; background: transparent; border-color: #58728b; color: white; }
.button.quiet:hover { background: #304862; }
.button.danger { background: #a62e33; border-color: #a62e33; color: white; }
button:disabled { cursor: default; opacity: .6; }
.page-head { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 15px; margin-bottom: 24px; }
.page-head p { margin-top: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.panel { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); }
.date-panel { display: flex; gap: 12px; align-items: end; }
.week { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.day-card { min-height: 67px; display: flex; flex-direction: column; gap: 3px; justify-content: center; padding: 9px 11px; background: white; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--ink); }
.day-card span { color: var(--muted); font-size: .78rem; }
.day-card strong { font-size: 1.04rem; }
.day-card:hover, .day-card.selected { background: var(--accent); border-color: #7ebaac; }
.date-picker { display: flex; align-items: end; gap: 5px; }
.date-picker input { width: 143px; }
.board-heading { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 10px; margin: 26px 0 12px; }
.board-heading > a { font-size: .88rem; font-weight: 630; }
.count { font-size: .81rem; font-weight: 500; margin-left: 5px; }
.count-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding-inline: 6px; background: #ecf2f8; color: var(--ink); border-radius: 15px; font-size: .75rem; }
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; align-items: start; }
.lane { background: #eaf0f6; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-width: 0; }
.lane-head { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin: 3px 2px 9px; }
.lane-head .count-chip { background: white; }
.delivery-card { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 8px; overflow-wrap: anywhere; }
.delivery-card:target { border-color: var(--primary); }
.card-top { display: flex; align-items: baseline; gap: 6px; font-weight: 650; line-height: 1.3; }
.card-top a { color: var(--ink); }
.sequence { min-width: 1.4em; font-size: .76rem; color: var(--primary-dark); }
.delivery-card p { font-size: .81rem; margin-top: 6px; }
.products { white-space: pre-line; }
.card-actions { display: flex; min-height: 35px; align-items: center; justify-content: space-between; margin-top: 5px; gap: 5px; font-size: .82rem; }
.reorder { display: flex; gap: 3px; }
.icon-button { width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--border); background: var(--paper); color: var(--ink); cursor: pointer; font-size: 1rem; }
.icon-button:hover:not([disabled]) { background: var(--accent); }
.add-team { display: block; padding: 8px 3px 4px; font-size: .82rem; font-weight: 650; }
.lane-empty { padding: 10px 3px; }
.unassigned, .detail, .error-page { margin-top: 20px; padding: 20px; }
.empty { color: var(--muted); font-size: .91rem; }
.panel.empty, td.empty { padding: 25px; }
.unassigned > .empty { margin-top: 12px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--soft-border); padding: 12px 0; margin-top: 7px; overflow-wrap: anywhere; }
.list-row a { font-weight: 600; }
.list-row .muted { display: block; margin-top: 3px; font-size: .86rem; }
.fields { display: grid; gap: 17px; }
.editor { padding: 24px; max-width: 820px; }
.form-grid { display: grid; gap: 15px; grid-template-columns: 1fr 1fr; }
label { display: grid; gap: 5px; color: var(--ink); font-weight: 620; font-size: .86rem; min-width: 0; }
input:not([type=hidden]), select, textarea { width: 100%; min-width: 0; min-height: 42px; padding: 8px 10px; background: white; color: var(--ink); border: 1px solid #bac9d6; border-radius: 7px; font-weight: 400; }
textarea { resize: vertical; }
.detail-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin-bottom: 22px; }
.detail-grid > div { min-width: 0; }
.detail-grid .wide { grid-column: 1 / -1; }
dt { font-size: .83rem; color: var(--muted); }
dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.multiline { white-space: pre-wrap; }
.cancel-form p { margin-block: 8px; }
summary { cursor: pointer; width: fit-content; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding: 15px; margin-bottom: 16px; }
.filters label { flex: 0 1 168px; }
.filters label.grow { flex: 1 1 250px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { background: #edf3f7; text-align: left; color: #344a61; white-space: nowrap; font-size: .82rem; }
th, td { border-bottom: 1px solid var(--soft-border); padding: 12px 14px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); margin-top: 3px; }
td .button { min-height: 36px; }
.number { text-align: right; white-space: nowrap; }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.stats > div { display: grid; gap: 5px; padding: 16px; }
.stats strong { font-size: clamp(1rem, 2.6vw, 1.65rem); overflow-wrap: anywhere; }
.notice { border-radius: 7px; padding: 11px 13px; margin-bottom: 15px; color: #094b3c; background: #e0f5ee; border: 1px solid #a9dccf; }
.notice.error { color: #7d2227; background: #fce9e9; border-color: #e2b6b7; }
.notice.change a { font-weight: 700; }
.login { width: min(100%, 410px); margin: 42px auto; padding: 25px; }
.login .muted { margin: 6px 0 19px; }
.error-page h1 { margin-bottom: 15px; }
@media (max-width: 1150px) {
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 32px); }
  .top-inner { flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-block: 9px; }
  .top nav { order: 3; flex: 1 0 100%; gap: 1px; overflow-x: auto; }
  .top nav a { padding-inline: 8px; }
  .main { padding-top: 24px; }
  .date-panel { display: grid; }
  .week { gap: 4px; }
  .day-card { padding: 6px 3px; min-height: 54px; text-align: center; }
  .day-card span { font-size: .64rem; overflow-wrap: anywhere; }
  .day-card strong { font-size: .84rem; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 440px) {
  .board, .form-grid { grid-template-columns: 1fr; }
  .top nav a { font-size: .8rem; }
  .editor { padding: 15px; }
  .filters label { flex: 1 1 130px; }
  .filters label.grow { flex-basis: 100%; }
}

.dispatch-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.dispatch-sheet { min-width: 0; overflow: hidden; }
.dispatch-sheet h3 {
  padding: 9px 12px;
  background: #245c9f;
  color: white;
  text-align: center;
}
.dispatch-sheet th, .dispatch-sheet td {
  padding: 8px 10px;
  border-right: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.dispatch-sheet th:last-child, .dispatch-sheet td:last-child { border-right: 0; }
.dispatch-sheet tbody tr:nth-child(even) { background: #f0f6fd; }
.dispatch-sheet tr:target { background: var(--accent) !important; }
.dispatch-board table { table-layout: fixed; }
.dispatch-board th:nth-child(1) { width: 32%; }
.dispatch-board th:nth-child(2) { width: 45%; }
.dispatch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: .78rem; }
.dispatch-actions .icon-button { width: 28px; height: 28px; }
.dispatch-sheet .add-team { padding: 9px 10px; border-top: 1px solid var(--border); }
.dispatch-pending { margin-top: 20px; }
.dispatch-pending h2 { padding: 10px 12px; background: #fff1c7; color: #594000; }
@media (max-width: 760px) {
  .dispatch-board { grid-template-columns: 1fr; }
}
.dispatch-board { align-items: stretch; }
.dispatch-board .dispatch-sheet { display: flex; flex-direction: column; }
.dispatch-board .add-team { margin-top: auto; }
.dispatch-board .dispatch-team-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  text-align: left;
}
.dispatch-team-summary {
  margin-inline-start: auto;
  max-width: 100%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.dispatch-board tr[data-delivery-row] { cursor: pointer; }
.dispatch-board tr[data-delivery-row]:hover,
.dispatch-board tr[data-delivery-row]:focus-within { background: #e1edf9; }
.dispatch-row-link { color: inherit; text-decoration: none; font-weight: 600; }