:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #66717e;
  --line: #d8dde3;
  --panel: #ffffff;
  --bg: #f3f6f8;
  --brand: #19706d;
  --brand-dark: #105653;
  --accent: #c76b33;
  --soft: #e8f3f2;
  --shadow: 0 12px 28px rgba(30, 41, 59, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(15, 47, 51, 0.84), rgba(15, 47, 51, 0.84)),
    radial-gradient(circle at top left, rgba(25, 112, 109, 0.36), transparent 32%),
    #0f2f33;
}

.login-shell {
  width: min(100%, 440px);
}

.login-card {
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.22);
  padding: clamp(24px, 6vw, 36px);
}

.login-card h1 {
  color: var(--ink);
  font-size: clamp(30px, 8vw, 42px);
}

.login-copy {
  color: var(--muted);
  margin-bottom: 24px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form button {
  margin-top: 4px;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: #9a4317;
  font-weight: 700;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 24px clamp(16px, 4vw, 42px);
  background: #0f2f33;
  color: white;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px clamp(16px, 4vw, 42px);
  background: white;
  border-bottom: 1px solid var(--line);
}

.app-nav button,
.app-nav .nav-link {
  background: #eef3f4;
  color: var(--brand-dark);
  border: 1px solid #cbd8da;
  padding: 9px 12px;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
}

.app-nav button.active,
.nav-group.active > .nav-menu-toggle {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.nav-group {
  position: relative;
}

.nav-menu-toggle::after {
  content: " v";
  font-size: 11px;
}

.nav-submenu {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: none;
  gap: 6px;
  left: 0;
  min-width: 170px;
  padding: 8px;
  position: absolute;
  top: calc(100% + 6px);
  z-index: 20;
}

.nav-group.open .nav-submenu,
.nav-group:focus-within .nav-submenu {
  display: grid;
}

.nav-submenu button {
  text-align: left;
  width: 100%;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: #a8dcda;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: 18px;
  padding: 22px clamp(16px, 4vw, 42px) 36px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.allocation-panel,
.contracts-panel {
  grid-column: 1 / -1;
  min-width: 0;
}

.side-stack {
  display: grid;
  gap: 18px;
  align-content: start;
}

.diary-panel,
.invoicing-panel,
.subbie-pay-panel,
.weekly-panel,
.costs-panel {
  grid-column: 1 / -1;
}

.pending-panel {
  grid-column: 1 / -1;
}

.dashboard-panel {
  grid-column: 1 / -1;
}

.dashboard-grid,
.rego-dashboard,
.chase-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.dashboard-tile,
.rego-card {
  display: grid;
  gap: 6px;
  align-content: start;
  min-height: 96px;
  border: 1px solid #b8dad8;
  background: var(--soft);
  color: var(--brand-dark);
  text-align: left;
}

.dashboard-tile span,
.rego-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.dashboard-tile strong,
.rego-card strong {
  font-size: 28px;
}

.rego-card small {
  color: var(--ink);
  font-weight: 700;
}

.chase-panel {
  grid-column: 1 / -1;
}

.chase-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 8px;
}

.chase-form textarea {
  grid-column: 1 / -3;
}

.chase-table-wrap {
  margin-top: 14px;
}

.dashboard-subtitle {
  margin-top: 20px;
}

.empty-mini {
  color: var(--muted);
  margin: 0;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.section-title span {
  color: var(--brand-dark);
  background: var(--soft);
  border: 1px solid #b8dad8;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  white-space: nowrap;
}

.section-title.small {
  margin-bottom: 10px;
}

.title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.title-actions select {
  min-width: 180px;
}

.title-actions .search-combo {
  flex: 1 1 260px;
  min-width: 240px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c8d0d8;
  border-radius: 6px;
  color: var(--ink);
  background: white;
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(25, 112, 109, 0.14);
}

.wide {
  grid-column: 1 / -1;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.actions,
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

button,
.link-button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: white;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

button:hover,
.link-button:hover {
  background: var(--brand-dark);
}

.secondary {
  background: #eef3f4;
  color: var(--brand-dark);
  border: 1px solid #cbd8da;
}

.secondary:hover {
  background: #dfeaec;
}

.send-button {
  background: var(--accent);
}

.send-button:hover {
  background: #a95426;
}

.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: white;
}

.ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.hidden {
  display: none;
}

.message-box {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.dispatch-workbench {
  display: grid;
  grid-template-columns: minmax(330px, 0.8fr) minmax(520px, 1.2fr);
  gap: 16px;
  align-items: start;
}

.contract-panel,
.job-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
}

.contract-panel {
  position: sticky;
  top: 12px;
}

.contract-panel-wide,
.job-panel-wide {
  max-width: 1120px;
}

.contract-panel-wide {
  position: static;
}

.contract-panel .section-title span,
.job-panel .section-title span {
  background: #fff7ef;
  border-color: #edc7ae;
  color: #8f481d;
}

.contract-list {
  display: grid;
  gap: 8px;
  max-height: 340px;
  margin-bottom: 16px;
  overflow: auto;
  padding-right: 4px;
}

.contract-list li {
  align-items: center;
}

.contract-split-panel {
  align-items: center;
  border: 1px solid #b8dad8;
  border-radius: 8px;
  background: var(--soft);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(260px, 1fr) 110px 170px auto;
  margin-bottom: 12px;
  padding: 10px;
}

.contract-split-toolbar label {
  display: grid;
  gap: 5px;
}

.contract-split-toolbar label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.contract-split-panel input,
.contract-split-panel select,
.contract-split-panel button {
  min-height: 38px;
  padding: 8px 9px;
}

.contract-form-title {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
  padding-top: 12px;
  text-transform: uppercase;
}

.compact-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pending-form {
  align-items: start;
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(140px, 0.75fr) minmax(160px, 0.8fr) minmax(95px, 0.55fr) minmax(95px, 0.55fr);
  gap: 10px;
}

.pending-form .client-picker-field,
.pending-form .location-picker-field,
.pending-form #pendingPickupAddress,
.pending-form #pendingDeliveryAddress,
.pending-form textarea {
  grid-column: span 2;
}

.pending-form .pending-toggle {
  align-self: stretch;
}

.pending-form textarea {
  min-height: 76px;
}

.inline-toggle {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  min-height: 42px;
  padding: 0 11px;
}

.inline-toggle input {
  margin: 0;
  width: auto;
}

.pending-table-wrap {
  margin-top: 14px;
}

.pending-table tbody tr {
  border-left: 5px solid transparent;
}

.pending-table tbody tr.pending-status-good {
  background: #f5fbf7;
  border-left-color: #2f8f5b;
}

.pending-table tbody tr.pending-status-changed {
  background: #fff9e8;
  border-left-color: #d8a31d;
}

.pending-table tbody tr.pending-status-problem {
  background: #fff1ef;
  border-left-color: #c65343;
}

.pending-status-select {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  min-height: 34px;
  padding: 6px 10px;
}

.pending-status-select.pending-status-good {
  background: #e9f7ee;
  border-color: #b9dcc5;
  color: #23613c;
}

.pending-status-select.pending-status-changed {
  background: #fff2c7;
  border-color: #efd17b;
  color: #7a5608;
}

.pending-status-select.pending-status-problem {
  background: #ffe1dd;
  border-color: #efb3aa;
  color: #8a3127;
}

.planner-panel {
  grid-column: 1 / -1;
}

.planner-fleet {
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  padding-bottom: 16px;
}

.planner-truck-rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 10px;
}

.planner-truck-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  border: 1px solid #b8dad8;
  border-radius: 8px;
  background: var(--soft);
  padding: 10px;
}

.planner-truck-row header,
.planner-truck-inputs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.planner-truck-row small {
  color: var(--muted);
  font-weight: 700;
}

.planner-truck-inputs input {
  flex: 1 1 210px;
}

.bulk-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.bulk-form textarea,
.bulk-form button {
  grid-column: 1 / -1;
}

.planner-results {
  display: grid;
  gap: 10px;
}

.plan-summary {
  display: grid;
  gap: 9px;
  border: 1px solid #b8dad8;
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.plan-summary p {
  color: var(--muted);
  margin: 0;
}

.plan-rego-summaries {
  display: grid;
  gap: 8px;
}

.plan-rego-summary {
  background: white;
  border: 1px solid #c8d0d8;
  border-radius: 8px;
  display: grid;
  gap: 7px;
  padding: 10px 11px;
}

.plan-rego-summary > strong {
  color: var(--brand-dark);
}

.plan-day {
  display: grid;
  gap: 10px;
  border-top: 2px solid #b8dad8;
  padding-top: 12px;
}

.plan-day > header {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}

.plan-day > header strong {
  color: var(--brand-dark);
  font-size: 17px;
}

.plan-day-metrics,
.plan-day-flow {
  display: grid;
  gap: 8px;
}

.plan-day-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.plan-unplanned {
  border: 1px dashed #c8d0d8;
  border-radius: 8px;
  background: #fafcfc;
  padding: 10px 12px;
}

.plan-saved-work {
  border: 1px solid #c8d0d8;
  border-radius: 8px;
  background: #f5f8f8;
  display: grid;
  gap: 5px;
  padding: 10px 12px;
}

.plan-saved-work p {
  color: var(--muted);
  margin: 0;
}

.plan-unplanned summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 700;
}

.plan-unplanned-rows {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.plan-unplanned-row {
  display: flex;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  justify-content: space-between;
  padding-top: 8px;
}

.plan-unplanned-row p {
  color: var(--muted);
  font-size: 13px;
  margin: 3px 0 0;
}

.plan-card {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
}

.plan-card header,
.plan-metrics,
.plan-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}

.plan-card p {
  margin: 0;
}

.plan-route {
  color: var(--ink);
  font-weight: 700;
}

.plan-move {
  color: var(--muted);
  font-size: 13px;
}

.plan-detail {
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.plan-detail summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.plan-detail .plan-metrics {
  margin-top: 8px;
}

.plan-metrics span,
.plan-flag {
  border-radius: 6px;
  background: var(--soft);
  color: var(--brand-dark);
  font-weight: 700;
  padding: 5px 8px;
}

.plan-flag.warning {
  background: #fff0d9;
  color: #7a4a00;
}

.plan-flag.good {
  background: #dff3e5;
  color: #176037;
}

.plan-flag.danger {
  background: #ffe0de;
  color: #8a281f;
}

.weekly-form {
  display: grid;
  grid-template-columns: 0.75fr 0.7fr 1fr 1.25fr 1.25fr auto 0.7fr 0.7fr 0.7fr 0.85fr auto auto;
  gap: 8px;
}

.weekly-start-row {
  display: grid;
  align-items: end;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.weekly-start-row label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
}

.weekly-location-help {
  color: var(--muted);
  font-size: 12px;
  grid-column: 1 / -1;
  margin: 0;
}

.inline-status {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 0;
}

.weekly-summary {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.weekly-summary div {
  border: 1px solid #b8dad8;
  border-radius: 6px;
  background: var(--soft);
  padding: 10px 11px;
}

.weekly-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.weekly-summary strong {
  color: var(--brand-dark);
  font-size: 18px;
}

.cost-form {
  display: grid;
  grid-template-columns: 0.75fr repeat(6, minmax(0, 1fr)) auto auto auto;
  gap: 8px;
}

.quote-form {
  display: grid;
  grid-template-columns: 0.75fr 1.1fr 1.1fr 1.1fr 1.1fr auto 0.75fr 0.75fr 0.7fr 0.7fr 0.85fr;
  gap: 8px;
}

.quote-cost-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.quote-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.quote-tabs button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.quote-map {
  width: 100%;
  height: min(62vh, 620px);
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 14px;
}

.quote-map-legs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.quote-leg {
  border: 1px solid #b8dad8;
  border-radius: 6px;
  background: var(--soft);
  color: var(--brand-dark);
  padding: 8px 10px;
  font-weight: 700;
}

.quote-leg.fuel {
  background: #fff5d9;
  border-color: #e3bf63;
  color: #6f5000;
}

.cost-summary,
.quote-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.cost-summary div,
.quote-summary div {
  border: 1px solid #b8dad8;
  border-radius: 6px;
  background: var(--soft);
  padding: 10px 11px;
}

.cost-summary span,
.quote-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.cost-summary strong,
.quote-summary strong {
  color: var(--brand-dark);
  font-size: 18px;
}

.weekly-table-wrap {
  margin-top: 14px;
}

.weekly-map-panel {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.costs-table-wrap {
  margin-top: 14px;
}

.weekly-table {
  min-width: 1460px;
}

.costs-table {
  min-width: 1450px;
}

.profit-positive {
  color: var(--brand-dark);
  font-weight: 700;
}

.profit-negative {
  color: #9a4317;
  font-weight: 700;
}

.rego-summary-row td {
  background: #f8fafb;
  color: var(--brand-dark);
  font-weight: 700;
}

.pending-table {
  min-width: 1180px;
}

.mini-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.mini-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.mini-list strong {
  display: block;
}

.mini-list span {
  color: var(--muted);
  font-size: 13px;
}

.location-columns {
  display: grid;
  gap: 18px;
}

.location-columns > div {
  background: #f8fbfc;
  border: 1px solid #e1e8ee;
  border-radius: 8px;
  padding: 14px;
}

.location-columns h3 {
  color: var(--brand-dark);
  font-size: 15px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.location-list {
  gap: 10px;
  margin-top: 0;
}

.location-card {
  align-items: flex-start;
  background: #ffffff;
  border-color: #e1e8ee;
  border-left: 4px solid var(--brand);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
}

.location-card.empty-location {
  border-left-color: #d0d9e2;
  grid-template-columns: 1fr;
}

.location-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.location-copy strong {
  color: var(--ink);
  font-size: 15px;
}

.location-address {
  color: #263542;
  font-weight: 700;
}

.location-details {
  color: var(--muted);
}

.location-meta {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 260px;
}

.location-actions button {
  min-width: 78px;
}

.location-edit-card {
  border-left-color: var(--accent);
  grid-template-columns: 1fr;
}

.location-edit-form {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.location-edit-form > strong,
.location-edit-form label:nth-of-type(2),
.location-edit-form label:nth-of-type(3),
.location-edit-actions {
  grid-column: 1 / -1;
}

.location-edit-toggle {
  align-self: end;
}

.location-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.delete-button {
  flex: 0 0 auto;
  background: #fff5ef;
  color: #9a4317;
  border: 1px solid #efc4a9;
  padding: 7px 9px;
}

.delete-button:hover {
  background: #f8e6db;
}

.edit-button {
  background: #eef3f4;
  color: var(--brand-dark);
  border: 1px solid #cbd8da;
  padding: 7px 9px;
}

.edit-button:hover {
  background: #dfeaec;
}

.link-button-inline {
  display: inline-block;
  text-decoration: none;
}

.row-actions {
  display: flex;
  gap: 8px;
  min-width: 130px;
}

.search {
  max-width: 260px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1460px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #f8fafb;
}

.status-select {
  min-width: 130px;
}

.sms-pill {
  display: inline-block;
  border-radius: 999px;
  background: #eef3f4;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.sms-pill.sent {
  background: #e8f3f2;
  color: var(--brand-dark);
}

.sms-pill.failed {
  background: #fff5ef;
  color: #9a4317;
}

.sms-pill.edited {
  background: #fff8e6;
  color: #7a5a00;
}

.diary-title {
  align-items: flex-start;
  gap: 14px;
}

.diary-week-label {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.diary-week-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 14px 0 18px;
}

.diary-daysheet {
  display: grid;
  gap: 16px;
}

.diary-day {
  border: 1px solid #dce5ea;
  border-radius: 8px;
  background: #f8fbfc;
  overflow: hidden;
}

.diary-day-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: #0f2f33;
  color: #ffffff;
}

.diary-day-header h3 {
  margin: 0;
  font-size: 17px;
}

.diary-day-summary {
  display: block;
  margin-top: 3px;
  color: #d5e6e8;
  font-size: 12px;
  font-weight: 700;
}

.diary-rego-group {
  margin: 12px;
  border: 1px solid #e0e8ed;
  border-radius: 8px;
  background: #ffffff;
}

.diary-rego-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border-bottom: 1px solid #e6edf1;
  background: #f4f8fa;
}

.diary-rego-header h4 {
  margin: 0;
  font-size: 15px;
  color: var(--brand-dark);
}

.diary-rego-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.diary-job-list {
  display: grid;
  gap: 0;
}

.diary-job-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, auto);
  gap: 14px;
  padding: 13px 12px;
  border-bottom: 1px solid #edf1f4;
}

.diary-job-card:last-child {
  border-bottom: 0;
}

.diary-job-main {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.diary-job-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.diary-job-title strong {
  color: var(--brand-dark);
}

.diary-job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.diary-badge {
  border: 1px solid #dce5ea;
  border-radius: 999px;
  background: #f8fafb;
  color: #42515f;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.diary-route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.diary-stop {
  display: grid;
  gap: 3px;
  min-width: 0;
  border-left: 3px solid #b8dad8;
  padding-left: 9px;
}

.diary-stop span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.diary-stop strong {
  color: var(--ink);
  font-size: 14px;
}

.diary-stop p,
.diary-note {
  margin: 0;
  color: #52616e;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.diary-note {
  border-left: 3px solid #e4c7a5;
  padding-left: 9px;
}

.diary-job-side {
  display: grid;
  gap: 8px;
  align-content: start;
  justify-items: end;
}

.diary-status-select {
  width: 150px;
}

.diary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.diary-actions .edit-button,
.diary-actions .delete-button {
  padding: 6px 8px;
}

.diary-invoice-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(100px, 0.45fr) minmax(140px, 0.65fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  border-top: 1px solid #eef2f5;
  padding-top: 10px;
}

.diary-invoice-panel label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.diary-invoice-panel input {
  width: 100%;
  min-height: 38px;
}

.diary-invoice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
  align-items: center;
}

.ready-button {
  background: var(--brand);
  color: #ffffff;
  border: 1px solid var(--brand);
  padding: 8px 10px;
  border-radius: 6px;
  font-weight: 700;
}

.ready-button.is-ready {
  background: #e8f3f2;
  color: var(--brand-dark);
}

.invoice-status-pill {
  display: inline-block;
  border-radius: 999px;
  background: #eef3f4;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.invoice-ready {
  background: #e8f3f2;
  color: var(--brand-dark);
}

.invoice-drafted {
  background: #fff8e6;
  color: #7a5a00;
}

.invoice-invoiced {
  background: #edf7ed;
  color: #2f6f3a;
}

.invoice-review-list {
  display: grid;
  gap: 12px;
}

.accounts-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.accounts-summary-card {
  display: grid;
  gap: 5px;
  border: 1px solid #dce5ea;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #ffffff;
  padding: 13px;
}

.accounts-summary-card span,
.accounts-summary-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.accounts-summary-card strong {
  font-size: 22px;
  color: var(--ink);
}

.accounts-summary-card em,
.accounts-group-card em {
  color: #9a4317;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.accounts-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: 12px 0 16px;
}

.accounts-toolbar label {
  display: grid;
  gap: 5px;
  min-width: 180px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.xero-json-panel {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}

.xero-payload-status {
  border: 1px solid #dce5ea;
  border-radius: 8px;
  background: #f8fbfc;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}

.xero-payload-status.is-valid {
  border-color: #b8dad8;
  background: #e8f3f2;
  color: var(--brand-dark);
}

.xero-payload-status.is-invalid {
  border-color: #efc4a9;
  background: #fff5ef;
  color: #9a4317;
}

.xero-json-panel textarea {
  width: 100%;
  min-height: 190px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  resize: vertical;
}

.accounts-group-card {
  border: 1px solid #dce5ea;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.accounts-group-card summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  list-style: none;
  border-bottom: 1px solid #e6edf1;
  background: #f4f8fa;
  padding: 12px;
}

.accounts-group-card summary::-webkit-details-marker {
  display: none;
}

.accounts-group-card summary strong {
  color: var(--brand-dark);
  font-size: 16px;
}

.accounts-group-card summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.accounts-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  border-bottom: 1px solid #edf1f4;
  padding: 10px 12px;
}

.invoice-review-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(165px, auto);
  gap: 14px;
  border: 1px solid #dce5ea;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.subbie-pay-card {
  grid-template-columns: minmax(0, 1fr) minmax(165px, auto);
}

.accounts-select {
  display: flex;
  gap: 7px;
  align-items: start;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.invoice-review-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.invoice-review-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 8px;
}

.invoice-review-meta span {
  display: grid;
  gap: 3px;
  border: 1px solid #e4ebef;
  border-radius: 8px;
  background: #f8fbfc;
  padding: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.invoice-review-meta small {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.xero-preview-panel {
  display: grid;
  gap: 9px;
  border: 1px solid #e1e8ee;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #f8fbfc;
  padding: 11px;
}

.xero-preview-panel > strong {
  color: var(--brand-dark);
  font-size: 14px;
}

.xero-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
}

.xero-line-preview {
  margin: 0;
  color: #42515f;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.invoice-review-actions {
  display: grid;
  gap: 8px;
  align-content: start;
  justify-items: stretch;
}

.readiness-badge {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.readiness-green {
  background: #e8f3f2;
  color: var(--brand-dark);
}

.readiness-amber {
  background: #fff8e6;
  color: #7a5a00;
}

.readiness-red {
  background: #fff5ef;
  color: #9a4317;
}

.pay-ready {
  background: #fff8e6;
  color: #7a5a00;
}

.pay-paid {
  background: #e8f3f2;
  color: var(--brand-dark);
}

.diary-empty {
  border: 1px dashed #cbd8da;
  border-radius: 8px;
  background: #f8fbfc;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

@media (max-width: 860px) {
  .app-header,
  .layout {
    display: block;
  }

  .dashboard-grid,
  .rego-dashboard,
  .chase-dashboard {
    grid-template-columns: 1fr;
  }

  .header-actions,
  .side-stack,
  .weekly-panel,
  .costs-panel,
  .chase-panel,
  .invoicing-panel,
  .subbie-pay-panel,
  .diary-panel {
    margin-top: 18px;
  }

  .nav-group {
    width: 100%;
  }

  .nav-menu-toggle {
    width: 100%;
  }

  .nav-submenu {
    margin-top: 6px;
    position: static;
  }

  .diary-title {
    display: grid;
  }

  .diary-title .search,
  .diary-week-controls button,
  .diary-status-select {
    width: 100%;
    max-width: none;
  }

  .diary-job-card,
  .diary-route-grid,
  .diary-invoice-panel,
  .invoice-review-card {
    grid-template-columns: 1fr;
  }

  .accounts-toolbar,
  .accounts-group-actions {
    display: grid;
  }

  .accounts-toolbar label {
    min-width: 0;
  }

  .diary-job-side,
  .invoice-review-actions {
    justify-items: stretch;
  }

  .diary-actions,
  .diary-invoice-actions {
    justify-content: flex-start;
  }

  .form-grid,
  .compact-form,
  .dispatch-workbench,
  .contract-split-panel,
  .bulk-form,
  .chase-form,
  .weekly-start-row,
  .weekly-form,
  .quote-form,
  .quote-cost-grid,
  .cost-form,
  .pending-form,
  .input-row {
    grid-template-columns: 1fr;
  }

  .weekly-summary,
  .cost-summary,
  .quote-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pending-form .client-picker-field,
  .pending-form .location-picker-field,
  .pending-form #pendingPickupAddress,
  .pending-form #pendingDeliveryAddress,
  .pending-form textarea {
    grid-column: auto;
  }

  .chase-form textarea {
    grid-column: auto;
  }

  .contract-panel {
    position: static;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .search {
    max-width: none;
  }
}

/* UI polish pass: visual/layout only. */
:root {
  --ink: #16202a;
  --muted: #64707d;
  --line: #dce3ea;
  --panel: #ffffff;
  --bg: #eef3f6;
  --brand: #176f6b;
  --brand-dark: #0d4f4d;
  --accent: #c76531;
  --soft: #eef8f7;
  --warning-soft: #fff4dc;
  --danger-soft: #fff0ed;
  --shadow: 0 10px 24px rgba(15, 31, 45, 0.07);
  --shadow-soft: 0 3px 10px rgba(15, 31, 45, 0.05);
}

body {
  background:
    linear-gradient(180deg, #e8f0f3 0, #eef3f6 240px),
    var(--bg);
}

.app-header {
  background: linear-gradient(135deg, #102c31 0%, #17474a 62%, #245a50 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 30px rgba(12, 28, 34, 0.16);
  padding-block: 22px;
}

.app-header h1 {
  line-height: 1;
}

.header-actions {
  justify-content: flex-end;
}

.app-header .secondary {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.app-header .secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.app-nav {
  align-items: center;
  box-shadow: 0 1px 0 rgba(15, 31, 45, 0.04);
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-nav button,
.app-nav .nav-link {
  background: transparent;
  border-color: transparent;
  color: #31515a;
  min-height: 38px;
  padding: 9px 11px;
}

.app-nav button:hover,
.app-nav .nav-link:hover {
  background: #edf4f6;
}

.app-nav button.active,
.nav-group.active > .nav-menu-toggle {
  background: #e6f4f3;
  border-color: #abd4d1;
  color: var(--brand-dark);
}

.layout {
  grid-template-columns: 1fr;
  margin: 0 auto;
  max-width: 1540px;
  padding-top: 24px;
}

.panel {
  border-color: #e1e8ee;
  box-shadow: var(--shadow);
  padding: clamp(16px, 2vw, 24px);
}

.section-title {
  border-bottom: 1px solid #edf1f4;
  padding-bottom: 12px;
}

.section-title.small {
  border-bottom: 0;
  padding-bottom: 0;
}

.section-title h2 {
  font-size: clamp(21px, 2vw, 26px);
  line-height: 1.15;
}

.section-title h3 {
  color: #24313b;
  font-size: 15px;
}

.section-title span,
.inline-status,
#plannerStatus {
  border-radius: 999px;
}

.dashboard-grid {
  grid-template-columns: repeat(6, minmax(140px, 1fr));
}

.dashboard-tile,
.rego-card,
.weekly-summary div,
.cost-summary div,
.quote-summary div {
  background: #ffffff;
  border-color: #dbe9e8;
  box-shadow: var(--shadow-soft);
}

.dashboard-tile {
  min-height: 118px;
  padding: 16px;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.dashboard-tile:hover {
  background: #ffffff;
  border-color: #9accca;
  box-shadow: 0 12px 22px rgba(20, 83, 80, 0.1);
  transform: translateY(-1px);
}

.dashboard-tile strong {
  color: var(--ink);
  font-size: clamp(25px, 2.3vw, 34px);
  letter-spacing: 0;
}

.rego-dashboard,
.chase-dashboard {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.rego-card {
  border-left: 4px solid var(--brand);
  padding: 14px;
}

.form-grid {
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-grid label:not(.wide) {
  grid-column: span 2;
}

label {
  color: #52616e;
}

input,
select,
textarea {
  border-color: #d0d9e2;
  min-height: 42px;
}

textarea {
  line-height: 1.4;
}

.input-row {
  align-items: stretch;
}

.client-picker-field,
.location-picker-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field-label-row {
  align-items: center;
  color: #52616e;
  display: flex;
  font-weight: 700;
  gap: 10px;
  justify-content: space-between;
}

.quiet-button {
  background: #edf6f6;
  border: 1px solid #d6e8e7;
  color: #215b59;
  font-size: 12px;
  min-height: 30px;
  padding: 5px 9px;
}

.quiet-button:hover {
  background: #dff0ef;
}

.inline-add-panel {
  background: #ffffff;
  border: 1px solid #d6e8e7;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 9px;
}

.location-picker-field .inline-add-panel,
.saved-location-field .inline-add-panel {
  gap: 10px;
  grid-template-columns: 1fr;
  grid-column: 1 / -1;
  margin-top: 2px;
  padding: 12px;
  width: min(100%, 560px);
}

.location-picker-field .inline-add-panel input,
.location-picker-field .inline-add-panel textarea,
.saved-location-field .inline-add-panel input,
.saved-location-field .inline-add-panel textarea {
  grid-column: 1 / -1;
  width: 100%;
}

.location-picker-field .inline-add-actions,
.saved-location-field .inline-add-actions {
  justify-content: flex-start;
}

.inline-add-panel.hidden {
  display: none;
}

.inline-add-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.inline-add-actions button {
  min-height: 34px;
  min-width: 86px;
  padding: 7px 10px;
}

.inline-add-suggestion {
  background: #f5fbfa;
  border: 1px dashed #9fcfcc;
  color: #195b58;
  font-size: 13px;
  justify-content: flex-start;
  min-height: 34px;
  padding: 7px 9px;
  text-align: left;
}

.search-combo {
  position: relative;
  width: 100%;
}

.search-combo-native {
  bottom: 0;
  height: 1px;
  left: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  width: 1px;
}

.search-combo-trigger {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d0d9e2;
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  min-height: 42px;
  overflow: hidden;
  padding: 9px 38px 9px 11px;
  position: relative;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.search-combo-trigger::after {
  color: #6b7885;
  content: "v";
  font-size: 12px;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.search-combo-trigger.is-empty {
  color: #71808f;
}

.search-combo-panel {
  background: #ffffff;
  border: 1px solid #cad8d9;
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(22, 32, 42, 0.16);
  display: grid;
  gap: 8px;
  left: 0;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
}

.search-combo-panel.hidden {
  display: none;
}

.search-combo-input {
  min-height: 38px;
}

.search-combo-options {
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
}

.search-combo-option {
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #25313c;
  justify-content: flex-start;
  min-height: 36px;
  padding: 8px 9px;
  text-align: left;
  white-space: normal;
}

.search-combo-option:hover,
.search-combo-option.selected {
  background: #edf6f6;
  border-color: #c9e1df;
  color: #194f4c;
}

.search-combo-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 9px;
}

button,
.link-button {
  min-height: 40px;
}

.job-panel,
.contract-panel {
  background: #ffffff;
  border-color: #e1e8ee;
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.job-panel-wide,
.contract-panel-wide {
  max-width: none;
}

.contracts-workbench {
  display: grid;
  gap: 16px;
}

.contract-bank-list {
  border-bottom: 1px solid #edf1f4;
  padding-bottom: 4px;
}

.contract-card {
  background: #ffffff;
  border: 1px solid #e1e8ee;
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(22, 32, 42, 0.04);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 11px 12px;
}

.contract-card-main,
.contract-card-text {
  min-width: 0;
}

.contract-card-text {
  display: grid;
  gap: 7px;
}

.contract-card-title {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.contract-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.contract-card-metrics span {
  background: #f5fbfa;
  border: 1px solid #d6e8e7;
  border-radius: 999px;
  color: #215b59;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
}

.contract-card-route {
  color: #52616e;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.contract-card-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.contract-card-actions button {
  min-height: 34px;
  padding: 7px 10px;
}

.contract-form {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
}

.contract-form textarea,
.contract-form button {
  grid-column: auto;
}

.contract-form-section {
  background: #f8fbfc;
  border: 1px solid #e1e8ee;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.contract-form-section h4 {
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.contract-form-section label,
.contract-form-section .client-picker-field,
.contract-split-toolbar label {
  color: #52616e;
  font-weight: 700;
}

.contract-form-section label > span {
  display: block;
  font-size: 12px;
  margin-bottom: 5px;
}

.contract-form-section label > .field-label-row,
.saved-location-field > .field-label-row {
  display: flex;
}

.contract-section-grid,
.contract-stop-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.contract-section-grid label:first-child,
.contract-section-grid .client-picker-field:first-child {
  grid-column: 1 / -1;
}

.contract-stop-grid .wide {
  grid-column: 1 / -1;
}

.contract-exfarm-toggle {
  align-self: end;
  background: #ffffff;
  grid-column: 1 / -1;
  margin-top: 0;
}

.contract-notes-section {
  grid-column: 1 / -1;
}

.contract-form-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.contract-form-actions button {
  min-width: 150px;
}

@media (max-width: 860px) {
  .contract-split-panel,
  .contract-form,
  .contract-section-grid,
  .contract-stop-grid,
  .contract-card {
    grid-template-columns: 1fr;
  }

  .contract-card-actions {
    justify-content: flex-start;
  }

  .contract-card-actions button,
  .contract-form-actions button {
    flex: 1 1 120px;
  }
}

.message-box {
  background: #f8fbfc;
  border: 1px solid #e1e8ee;
  border-radius: 8px;
  margin-top: 18px;
  padding: 14px;
}

.message-box textarea {
  background: #ffffff;
}

.planner-fleet {
  background: #f8fbfc;
  border: 1px solid #e1e8ee;
  border-radius: 8px;
  margin-bottom: 18px;
  padding: 16px;
}

.planner-truck-row {
  background: #ffffff;
  border-color: #dbe9e8;
  box-shadow: var(--shadow-soft);
  padding: 12px;
}

.planner-output {
  display: grid;
  gap: 12px;
}

.plan-summary {
  background: #f5fbfa;
  border-color: #b9dcda;
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.plan-rego-summaries {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.plan-rego-summary {
  border-color: #e1e8ee;
  box-shadow: var(--shadow-soft);
}

.plan-day {
  background: #ffffff;
  border: 1px solid #e1e8ee;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  padding: 14px;
}

.plan-day > header {
  border-bottom: 1px solid #edf1f4;
  padding-bottom: 10px;
}

.plan-card {
  border-color: #e1e8ee;
  box-shadow: var(--shadow-soft);
  gap: 10px;
  padding: 13px 14px;
}

.plan-card header {
  align-items: flex-start;
}

.plan-card header strong {
  font-size: 15px;
}

.plan-metrics {
  justify-content: flex-start;
}

.plan-metrics span,
.plan-flag {
  background: #edf6f6;
  border: 1px solid #d6e8e7;
  color: #215b59;
  font-size: 12px;
}

.plan-flag {
  line-height: 1.35;
}

.plan-flag.warning {
  background: var(--warning-soft);
  border-color: #eed8a8;
}

.plan-flag.danger {
  background: var(--danger-soft);
  border-color: #efc7c0;
}

.weekly-start-row,
.weekly-form,
.cost-form,
.quote-form {
  background: #f8fbfc;
  border: 1px solid #e1e8ee;
  border-radius: 8px;
  padding: 12px;
}

.weekly-form {
  grid-template-columns: minmax(160px, 0.9fr) minmax(120px, 0.7fr) minmax(120px, 0.7fr) minmax(120px, 0.7fr) minmax(180px, 1fr) minmax(180px, 1fr);
}

.weekly-form button,
.weekly-form input,
.weekly-form select {
  min-width: 0;
}

.weekly-summary {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.weekly-summary div,
.cost-summary div,
.quote-summary div {
  border-left: 4px solid var(--brand);
  padding: 13px 14px;
}

.weekly-summary strong,
.cost-summary strong,
.quote-summary strong {
  color: var(--ink);
  font-size: 20px;
}

.cost-summary,
.quote-summary {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.cost-form {
  grid-template-columns: minmax(100px, 0.8fr) repeat(3, minmax(110px, 1fr)) repeat(3, minmax(130px, 1fr));
}

.cost-form button {
  min-width: 120px;
}

.quote-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.quote-form button {
  min-width: 130px;
}

.quote-cost-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.table-wrap {
  border: 1px solid #e1e8ee;
  border-radius: 8px;
  background: #ffffff;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  background: #f3f7f9;
  color: #52616e;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:nth-child(even) td {
  background: #fbfdfe;
}

tbody tr:hover td {
  background: #f4faf9;
}

td {
  color: #263542;
}

.sms-pill,
.edit-button,
.delete-button,
.secondary {
  border-radius: 6px;
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .form-grid,
  .weekly-form,
  .cost-form,
  .quote-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid label:not(.wide) {
    grid-column: span 1;
  }
}

@media (max-width: 860px) {
  .app-header {
    display: grid;
    gap: 16px;
  }

  .app-nav {
    max-height: 48vh;
    overflow-y: auto;
    position: static;
  }

  .app-nav button,
  .app-nav .nav-link {
    justify-content: center;
    width: 100%;
  }

  .layout {
    padding: 14px 12px 28px;
  }

  .panel,
  .job-panel,
  .contract-panel,
  .planner-fleet,
  .weekly-start-row,
  .weekly-form,
  .cost-form,
  .quote-form {
    padding: 14px;
  }

  .dashboard-grid,
  .form-grid,
  .weekly-form,
  .cost-form,
  .quote-form,
  .quote-cost-grid {
    grid-template-columns: 1fr;
  }

  .form-grid label:not(.wide) {
    grid-column: 1 / -1;
  }

  .input-row,
  .title-actions,
  .actions {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .title-actions > *,
  .actions > *,
  .input-row > * {
    width: 100%;
  }

  .plan-day > header,
  .plan-card header,
  .plan-unplanned-row {
    align-items: stretch;
    flex-direction: column;
  }

  .weekly-summary,
  .cost-summary,
  .quote-summary,
  .plan-rego-summaries {
    grid-template-columns: 1fr;
  }

  .quote-map {
    min-height: 320px;
  }

  .location-columns > div {
    padding: 12px;
  }

  .location-card {
    grid-template-columns: 1fr;
  }

  .location-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
    width: 100%;
  }

  .location-actions button {
    width: 100%;
  }

  .location-edit-form {
    grid-template-columns: 1fr;
  }

  .location-edit-actions {
    flex-direction: column;
  }
}

.allocation-panel > .section-title {
  margin-bottom: 14px;
}

.dispatch-job-form {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.dispatch-job-form .job-entry-card {
  background: #ffffff;
  border: 1px solid #e1e8ee;
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
}

.dispatch-job-form .job-header-card,
.dispatch-job-form .load-card,
.dispatch-job-form .notes-message-card {
  grid-column: 1 / -1;
}

.dispatch-job-form .pickup-card {
  grid-column: span 6;
}

.dispatch-job-form .delivery-card {
  grid-column: span 6;
}

.job-entry-heading {
  align-items: center;
  border-bottom: 1px solid #edf1f4;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-bottom: 10px;
}

.job-entry-heading h3 {
  color: #1f2c36;
  font-size: 16px;
  margin: 0;
}

.job-entry-heading span {
  background: #e6f4f3;
  border: 1px solid #abd4d1;
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 10px;
  white-space: nowrap;
}

.job-entry-grid,
.notes-message-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.header-grid {
  grid-template-columns: minmax(150px, 0.75fr) minmax(230px, 1.25fr) minmax(230px, 1.25fr) minmax(150px, 0.75fr);
}

.load-grid {
  grid-template-columns: minmax(160px, 1fr) minmax(105px, 0.6fr) repeat(2, minmax(145px, 0.75fr)) minmax(260px, 1.5fr);
}

.stop-grid {
  grid-template-columns: minmax(0, 1fr) minmax(135px, 0.45fr);
}

.stop-grid .saved-location-field,
.stop-grid .address-field,
.stop-grid .details-field {
  grid-column: 1 / -1;
}

.notes-message-grid {
  align-items: stretch;
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
}

.dispatch-job-form .message-box {
  background: #f8fbfc;
  border: 1px solid #e1e8ee;
  border-radius: 8px;
  margin: 0;
  padding: 12px;
}

.dispatch-job-form .message-box textarea,
.dispatch-job-form #jobDiary {
  min-height: 174px;
}

.map-action-row {
  grid-template-columns: minmax(0, 1fr) minmax(112px, auto) minmax(112px, auto);
}

.dispatch-actions {
  border-top: 1px solid #edf1f4;
  justify-content: flex-end;
  padding-top: 12px;
}

.dispatch-actions #saveAllocationButton {
  min-width: 220px;
}

.dispatch-actions .send-button {
  min-width: 120px;
}

.dispatch-actions .secondary,
.dispatch-actions .link-button {
  min-width: 105px;
}

.dispatch-job-form label {
  min-width: 0;
}

.dispatch-job-form input,
.dispatch-job-form select,
.dispatch-job-form textarea {
  min-width: 0;
}

@media (max-width: 1200px) {
  .dispatch-job-form .pickup-card,
  .dispatch-job-form .delivery-card {
    grid-column: 1 / -1;
  }

  .header-grid,
  .load-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .load-grid .contract-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .dispatch-job-form {
    grid-template-columns: 1fr;
  }

  .dispatch-job-form .job-entry-card,
  .dispatch-job-form .pickup-card,
  .dispatch-job-form .delivery-card {
    grid-column: 1 / -1;
  }

  .job-entry-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-grid,
  .load-grid,
  .stop-grid,
  .notes-message-grid,
  .map-action-row {
    grid-template-columns: 1fr;
  }

  .dispatch-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dispatch-actions > * {
    width: 100%;
  }
}
