:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #18313d;
  background: #f2f6f7;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(145deg, #f4f7f6 0%, #e9f0f2 100%);
}

button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #94c8d2;
  outline-offset: 2px;
}

.admin-shell {
  display: flex;
  flex-direction: column;
  width: min(100% - 32px, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 20px;
}

body[data-admin-state="dashboard_loading"] .admin-shell,
body[data-admin-state="ready"] .admin-shell,
body[data-admin-state="dashboard_error"] .admin-shell {
  width: min(100% - 48px, 1240px);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 32px;
}

.admin-brand {
  color: #15323e;
  font-size: 1.25rem;
  font-weight: 850;
  letter-spacing: .14em;
  text-decoration: none;
}

.admin-label, .admin-eyebrow {
  color: #56727b;
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.admin-card {
  width: 100%;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid #d8e3e5;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgb(24 49 61 / 8%);
}

.admin-card h1 { margin: 8px 0 12px; font-size: clamp(1.65rem, 4vw, 2.2rem); }
.admin-status { min-height: 1.5em; color: #526b75; line-height: 1.55; }
.admin-card h2 { margin: 22px 0 4px; font-size: 1.2rem; }
.admin-hint { margin: 0; color: #526b75; font-size: .88rem; line-height: 1.5; }
.admin-error { color: #9b2c2c; line-height: 1.5; }

.admin-form, .admin-membership { display: grid; gap: 12px; margin-top: 26px; }
.admin-form label, .admin-membership label { font-size: .9rem; font-weight: 700; }

.admin-form input, .admin-membership select, .dashboard-switch select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #bacbd0;
  border-radius: 8px;
  background: #fff;
  color: inherit;
}

.admin-form button, .admin-membership button, .admin-action {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid #173a48;
  border-radius: 8px;
  background: #173a48;
  color: #fff;
  font-weight: 750;
  cursor: pointer;
}

.admin-form button, .admin-membership button { min-height: 48px; margin-top: 8px; }
.admin-secondary { margin-top: 20px; padding: 10px 0; border: 0; background: transparent; color: #315b69; font-weight: 700; text-decoration: underline; cursor: pointer; }
.admin-footer { margin-top: auto; padding-top: 32px; text-align: center; }
.admin-footer a { color: #45636d; font-size: .9rem; }

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid #e0e9eb;
}

.dashboard-header h1 { margin: 6px 0; }
.admin-organisation-name { margin: 0; color: #315b69; font-size: .9rem; font-weight: 750; letter-spacing: .025em; }
.dashboard-updated { margin: 4px 0 0; color: #5a717a; font-size: .82rem; }
.dashboard-controls { display: flex; align-items: end; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.dashboard-switch { min-width: 180px; }
.dashboard-switch label { display: block; margin-bottom: 5px; color: #526b75; font-size: .8rem; font-weight: 700; }
.dashboard-switch select { min-height: 44px; }
.admin-action-secondary { border-color: #c7d7dc; background: #fff; color: #315b69; }
.admin-action:hover { background: #245061; }
.admin-action-secondary:hover { background: #f0f6f7; }
.dashboard-feedback { margin: 28px 0 4px; padding: 16px 18px; border-radius: 10px; background: #edf4f6; color: #315b69; line-height: 1.5; }
.dashboard-feedback-error { background: #fff3f1; color: #8f342f; }
.admin-route-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 24px; }
.admin-route-nav a { display: inline-flex; align-items: center; min-height: 42px; padding: 8px 14px; border: 1px solid #d7e3e6; border-radius: 999px; color: #315b69; background: #fff; font-size: .9rem; font-weight: 700; text-decoration: none; }
.admin-route-nav a:hover, .admin-route-nav a:focus-visible { border-color: #7aa7b4; background: #f1f7f8; }
#admin-route-nav[data-current="dashboard"] a[href="#dashboard"],
#admin-route-nav[data-current="reservations"] a[href="#reservations"],
#admin-route-nav[data-current="reservation"] a[href^="#reservation="],
#admin-route-nav[data-current="fleet"] a[href="#fleet"],
#admin-route-nav[data-current="payments"] a[href="#payments"] { border-color: #173a48; background: #173a48; color: #fff; }
.dashboard-route-content { display: grid; gap: 12px; margin-top: 8px; }
.dashboard-route-title { margin: 8px 0 2px; color: #18313d; font-size: 1.35rem; }
.dashboard-detail-group { display: grid; gap: 6px; margin-top: 12px; padding: 16px; border: 1px solid #dce7e9; border-radius: 12px; background: #f8fbfb; }
.dashboard-detail-group h3 { margin: 0; color: #18313d; font-size: 1rem; }
.dashboard-detail-link { display: inline-flex; width: fit-content; margin-top: 8px; color: #245f73; font-size: .88rem; font-weight: 700; text-underline-offset: 3px; }
.dashboard-detail-link:focus-visible { outline: 3px solid #7aa7b4; outline-offset: 2px; }
.dashboard-job-item { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; padding: 10px 0; border-top: 1px solid #e8eff0; }
.dashboard-job-item:first-of-type { border-top: 0; }
.dashboard-job-item .dashboard-item-detail { margin: 0; }
.service-job-action { min-height: 40px; padding: 8px 14px; }
.service-job-feedback { margin-top: 12px; }
.machine-assignment-item { min-width: 0; padding: 12px 0; border-top: 1px solid #e8eff0; }
.machine-assignment-item:first-of-type { border-top: 0; }
.machine-assignment-heading { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.machine-assignment-picker { display: grid; gap: 10px; margin-top: 12px; padding: 12px; border: 1px solid #dce7e9; border-radius: 10px; background: #fff; }
.machine-assignment-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid #e1eaec; border-radius: 8px; color: #263f49; overflow-wrap: anywhere; }
.machine-assignment-option input { flex: 0 0 auto; width: 18px; height: 18px; margin: 2px 0 0; accent-color: #245f73; }
.machine-assignment-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.machine-assignment-controls .admin-action { min-height: 44px; }
.machine-assignment-status { margin: 6px 0; color: #506973; font-size: .86rem; line-height: 1.45; overflow-wrap: anywhere; }
.reservation-notes { min-width: 0; }
.reservation-note-list { display: grid; gap: 10px; }
.reservation-note-item { min-width: 0; padding: 12px 0; border-top: 1px solid #e8eff0; }
.reservation-note-meta { margin: 0 0 6px; color: #627982; font-size: .78rem; line-height: 1.45; overflow-wrap: anywhere; }
.reservation-note-body { margin: 0; color: #263f49; font-size: .9rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.reservation-note-label { display: grid; gap: 6px; margin-top: 8px; color: #315b69; font-size: .88rem; font-weight: 700; }
.reservation-note-input { width: 100%; min-height: 110px; padding: 10px 12px; border: 1px solid #c7d7dc; border-radius: 8px; color: #263f49; font: inherit; font-weight: 400; resize: vertical; }
.reservation-note-input:focus-visible { outline: 3px solid #7aa7b4; outline-offset: 2px; }
.reservation-note-count { margin: 0; color: #627982; font-size: .78rem; text-align: right; font-variant-numeric: tabular-nums; }
.reservation-note-submit { justify-self: start; }
.delivery-inspection-entry { flex: 1 0 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; padding: 12px; border: 1px solid #dce7e9; border-radius: 10px; background: #f8fbfb; }
.delivery-inspection-entry h4, .delivery-inspection-entry p { margin: 0; }
.inspection-policy { color: #526b75; font-size: .82rem; font-weight: 700; }
.inspection-policy-required { color: #8f342f; }
.inspection-anomaly-summary { color: #8f342f; font-size: .82rem; font-weight: 700; }
.inspection-meta { margin: 0; color: #627982; font-size: .82rem; line-height: 1.5; overflow-wrap: anywhere; }
.inspection-subject-card { display: grid; gap: 10px; min-width: 0; padding: 16px; border: 1px solid #dce7e9; border-radius: 12px; background: #f8fbfb; }
.inspection-subject-card h3, .inspection-subject-card h4 { margin: 0; color: #18313d; }
.inspection-checklist-card { display: grid; gap: 8px; min-width: 0; padding: 12px; border: 1px solid #e1eaec; border-radius: 9px; background: #fff; }
.inspection-checklist-label { margin: 0; color: #263f49; font-weight: 700; overflow-wrap: anywhere; }
.inspection-field-label { display: grid; gap: 5px; color: #315b69; font-size: .86rem; font-weight: 700; }
.inspection-select, .inspection-note, .inspection-summary { width: 100%; min-width: 0; min-height: 44px; padding: 9px 10px; border: 1px solid #c7d7dc; border-radius: 8px; background: #fff; color: #263f49; font: inherit; font-weight: 400; }
.inspection-note { min-height: 72px; resize: vertical; }
.inspection-summary { min-height: 110px; resize: vertical; }
.inspection-select:focus-visible, .inspection-note:focus-visible, .inspection-summary:focus-visible { outline: 3px solid #7aa7b4; outline-offset: 2px; }
.inspection-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.inspection-controls .admin-action { min-height: 44px; }

.dashboard-section { min-width: 0; }
.dashboard-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 30px 0 14px; }
.dashboard-section-heading h2 { margin: 0; color: #18313d; font-size: 1.2rem; }
.dashboard-section-note { color: #6a8189; font-size: .78rem; }
.dashboard-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.dashboard-summary-card { display: flex; flex-direction: column; justify-content: space-between; min-height: 116px; padding: 18px; border: 1px solid #dce7e9; border-radius: 12px; background: #f8fbfb; }
.dashboard-summary-label { color: #4d6771; font-size: .88rem; line-height: 1.35; }
.dashboard-summary-value { margin-top: 12px; color: #173a48; font-size: clamp(1.6rem, 3vw, 2rem); line-height: 1; }

.dashboard-primary-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px; }
.dashboard-secondary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.dashboard-list { display: grid; align-content: start; gap: 10px; }
.dashboard-list-item { min-width: 0; padding: 14px 16px; border: 1px solid #dce7e9; border-left: 4px solid #7aa7b4; border-radius: 10px; background: #fff; }
.dashboard-action-overdue { border-left-color: #b84138; background: #fff8f7; }
.dashboard-action-delivery { border-left-color: #267399; }
.dashboard-action-collection { border-left-color: #4d8470; }
.dashboard-action-payment { border-left-color: #b27d20; background: #fffdf7; }
.dashboard-item-title { margin: 0 0 5px; color: #173a48; font-size: .96rem; line-height: 1.4; }
.dashboard-item-name { margin: 4px 0; color: #263f49; font-size: .9rem; font-weight: 700; }
.dashboard-item-detail { margin: 4px 0 0; color: #506973; font-size: .86rem; line-height: 1.45; overflow-wrap: anywhere; }
.dashboard-empty { margin: 0; padding: 20px; border: 1px dashed #ccdadd; border-radius: 10px; color: #526b75; line-height: 1.5; }
.dashboard-count-list { overflow: hidden; border: 1px solid #dce7e9; border-radius: 12px; }
.dashboard-count-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 16px; }
.dashboard-count-row + .dashboard-count-row { border-top: 1px solid #edf2f3; }
.dashboard-count-label { color: #4d6771; font-size: .9rem; }
.dashboard-count-value { color: #173a48; font-variant-numeric: tabular-nums; }
.operational-incident-list { display: grid; gap: 8px; }
.operational-incident-review { display: grid; gap: 10px; margin-top: 12px; padding: 12px; border: 1px solid var(--admin-border, #d9dee8); border-radius: 10px; background: var(--admin-surface-muted, #f7f8fa); }
.operational-incident-field { display: grid; gap: 5px; font-weight: 600; }
.operational-incident-input { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--admin-border, #cbd2dc); border-radius: 6px; font: inherit; }
.operational-incident-help, .operational-incident-message { margin: 0; color: var(--admin-text-muted, #596273); font-size: .9rem; }
.operational-incident-save { justify-self: start; }
.operational-incident-item { padding: 12px 14px; border: 1px solid #dce7e9; border-radius: 9px; background: #fbfdfd; }
.operational-incident-classification { margin: 6px 0 0; color: #6b5520; font-size: .82rem; font-weight: 700; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .dashboard-primary-grid { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 680px) {
  .dashboard-header { flex-direction: column; }
  .dashboard-controls { width: 100%; justify-content: flex-start; }
  .dashboard-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-secondary-grid { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 480px) {
  .admin-shell, body[data-admin-state="dashboard_loading"] .admin-shell,
  body[data-admin-state="ready"] .admin-shell,
  body[data-admin-state="dashboard_error"] .admin-shell { width: min(100% - 24px, 520px); padding-top: 18px; }
  .admin-header { padding-bottom: 20px; }
  .admin-card { padding: 20px; }
  .dashboard-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-switch { grid-column: 1 / -1; min-width: 0; }
  .dashboard-controls .admin-action { padding-inline: 8px; }
  .dashboard-summary-grid { grid-template-columns: 1fr; }
  .dashboard-summary-card { min-height: 92px; }
  .dashboard-section-heading { display: block; }
  .dashboard-section-note { display: block; margin-top: 5px; }
}
