:root {
  color-scheme: light;
  --ink: #191b21;
  --muted: #505e67;
  --paper: #f5f7f8;
  --white: #fff;
  --table-surface: rgb(255 255 255 / 84%);
  --line: #d7dfe3;
  --border: #aebbc3;
  --navy: #123c69;
  --navy-dark: #102d4a;
  --blue-light: #e8eff5;
  --teal: #254e58;
  --teal-light: #e7f1ef;
  --focus: #1265a3;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; isolation: isolate; }
body.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(rgb(245 247 248 / 53%), rgb(245 247 248 / 61%)),
    url("/ship.webp") center / cover no-repeat;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.top { background: var(--ink); color: var(--white); border-bottom: 1px solid #3b4652; }
.top :focus-visible { outline-color: #abd8f9; }
.top-inner, .shell { max-width: 1152px; width: 100%; margin-inline: auto; padding-inline: 32px; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; }
.brand { display: flex; align-items: center; gap: 16px; padding-block: 8px; text-decoration: none; }
.brand img { display: block; width: 185px; height: auto; }
.brand-app { padding-left: 16px; border-left: 1px solid #5c6571; color: #e2e6e9; font-size: .9rem; font-weight: 650; }
nav { display: flex; align-items: stretch; gap: 18px; min-height: inherit; }

.btn { min-height: 40px; border: 1px solid transparent; border-radius: 4px; padding: 8px 12px; line-height: 1.25; font-size: .875rem; font-weight: 650; }
.btn:disabled { opacity: .65; cursor: wait; }
.nav-btn { position: relative; padding-inline: 3px; color: #e2e6e9; background: transparent; border: 0; border-radius: 0; white-space: nowrap; }
.nav-btn[aria-pressed=true], .nav-btn:hover { color: var(--white); }
.nav-btn[aria-pressed=true]::after { position: absolute; content: ""; inset: auto 0 -1px; height: 2px; background: #abd8f9; }
.nav-btn[data-action=logout] { padding-left: 14px; }
.primary { background: var(--navy); border-color: var(--navy); color: var(--white); }
.primary:hover { background: var(--navy-dark); border-color: var(--navy-dark); }
.admin-access {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 2;
  min-height: 44px;
  padding-inline: 12px;
  font-size: .76rem;
  font-weight: 600;
  color: var(--muted);
  background: rgb(245 247 248 / 90%);
  border-color: var(--line);
}
.admin-access:hover, .admin-access[aria-pressed=true] { color: var(--navy); background: var(--white); }
.secondary { background: var(--white); border-color: var(--border); color: var(--navy-dark); }
.secondary:hover, .text-btn:hover { background: var(--blue-light); }
.text-btn { color: var(--navy); background: transparent; }
.danger-text { color: #8d2929; background: transparent; }
.danger-text:hover { background: #f6eeef; }
.danger { background: #8d2929; color: var(--white); }
.danger:hover { background: #6f1e1e; }
#app { flex: 1; padding-block: 33px 48px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3.1rem); font-weight: 690; letter-spacing: -.043em; }
h2 { font-size: clamp(1.2rem, 3vw, 1.58rem); font-weight: 680; letter-spacing: -.025em; }
h3 { font-size: 1.075rem; font-weight: 700; letter-spacing: -.012em; }

.round-header {
  display: flex;
  min-height: 172px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.round-copy { display: flex; flex-direction: column; align-items: start; justify-content: center; }
.round-date { margin: 0 0 8px; font-size: .82rem; font-weight: 580; color: var(--muted); }
.round-date::first-letter { text-transform: uppercase; }
.round-progress { width: min(100%, 310px); margin-top: 17px; color: var(--muted); font-size: .85rem; }
.round-progress strong { color: var(--ink); }
progress { display: block; width: 100%; height: 4px; margin-top: 7px; padding: 0; border: 0; border-radius: 2px; overflow: hidden; appearance: none; background: var(--line); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--teal); }
progress::-moz-progress-bar { background: var(--teal); }

.work { margin-top: 25px; }
.section-head, .page-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 14px; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: .85rem; }
.page-head { margin: 13px 0 24px; }
.scope-selects { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.select-label { color: var(--muted); font-size: .75rem; font-weight: 650; min-width: 0; }
.select-label select { display: block; width: 100%; min-height: 38px; margin-top: 3px; font-size: .85rem; font-weight: 550; }
select, input, textarea { padding: 8px 10px; color: var(--ink); background: var(--white); border: 1px solid var(--border); border-radius: 4px; }
select { max-width: min(100%, 270px); }

.filters { display: flex; align-items: stretch; flex-wrap: wrap; column-gap: 18px; row-gap: 0; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.chip { min-height: 40px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 6px 2px 8px; color: var(--muted); background: transparent; white-space: nowrap; }
.chip:hover { color: var(--navy); }
.chip[aria-pressed=true] { color: var(--navy); border-bottom-color: var(--navy); }
.count { margin-left: 3px; color: var(--muted); font-size: .84em; font-variant-numeric: tabular-nums; }

.wash-list, .rows { background: var(--table-surface); border: 1px solid var(--line); border-radius: 5px; }
.wash-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(86px, auto) 244px;
  grid-template-rows: min-content auto;
  grid-template-areas: "title status actions" "description . actions";
  align-items: start;
  column-gap: clamp(10px, 2vw, 24px);
  padding: 17px 19px;
}
.wash-row + .wash-row, .rows li + li { border-top: 1px solid var(--line); }
.wash-title { grid-area: title; }
.group { font-size: .81rem; color: var(--muted); margin: 3px 0 0; }
.description { color: var(--muted); font-size: .87rem; margin: 8px 0 0; }
.wash-details { grid-area: description; }
.rewash-note { margin: 8px 0 0; padding: 6px 8px; border-left: 2px solid #9b6166; color: #65343a; background: #f6eeef; font-size: .85rem; white-space: pre-wrap; }
.badge {
  display: inline-flex; align-items: center; justify-self: start; gap: 5px; white-space: nowrap;
  padding: 3px 7px; border-radius: 3px; font-size: .77rem; font-weight: 650; line-height: 1.4;
}
.badge.open { color: #465660; background: #edf1f3; }
.badge.active { color: var(--navy); background: var(--blue-light); }
.badge.rewash { color: #65343a; background: #f6eeef; }
.badge.done { color: var(--teal); background: var(--teal-light); }
.status-symbol { min-width: 10px; font-size: .93rem; line-height: 1; text-align: center; }
.wash-row > .badge { grid-area: status; margin-top: 1px; }
.wash-actions { grid-area: actions; display: flex; flex-direction: column; align-items: end; justify-content: center; gap: 3px; align-self: center; }
.wash-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.wash-actions > .text-btn { min-height: 36px; padding-inline: 4px; font-weight: 560; }
.wash-actions > .text-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

.empty { margin: 0; padding: 20px; background: var(--white); border: 1px solid var(--line); border-radius: 4px; color: var(--muted); }
.officer-head { margin-top: 22px; }
.follow-up { display: grid; gap: 22px; margin-top: 22px; }
.follow-up h2 { margin-bottom: 9px; }
.rows { list-style: none; padding: 0; margin: 0; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 18px; }
.report-group h3 { margin-bottom: 8px; }
.report-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 3px 12px; padding: 11px 14px; }
.report-receipt { font-size: .82rem; color: var(--muted); }
.status-row, .admin-row { padding: 14px 18px; display: grid; align-items: center; gap: 12px; }
.status-row { grid-template-columns: minmax(0, 1fr) minmax(92px, auto) minmax(130px, .55fr); }
.admin-row { grid-template-columns: minmax(0, 1fr) auto; }
.row-title, .receipt { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.row-title span, .receipt span { font-size: .82rem; color: var(--muted); }
.receipt strong { font-size: .88rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-tools .filters { margin-bottom: 0; }

.issue-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; }
.issue-cards .card { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 16px; background: var(--white); border: 1px solid var(--line); border-radius: 4px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-controls { margin-top: auto; }
.confirmed { color: var(--teal); font-weight: 650; font-size: .83rem; }
.issue-copy { white-space: pre-wrap; }
.issue-image img { display: block; width: 100%; max-height: 200px; object-fit: contain; background: var(--paper); border-radius: 3px; }

.footer { padding-block: 16px calc(64px + env(safe-area-inset-bottom)); color: var(--muted); border-top: 1px solid var(--line); font-size: .78rem; }
dialog { width: min(calc(100% - 24px), 460px); max-height: 90dvh; padding: 22px; border: 1px solid var(--border); border-radius: 6px; color: var(--ink); }
dialog::backdrop { background: #1425368c; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.close { flex: 0 0 36px; min-height: 36px; font-size: 1.25rem; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--ink); }
.dialog-copy { margin: 6px 0 12px; font-size: .91rem; color: var(--muted); }
#fields label { display: block; margin-top: 11px; font-weight: 650; font-size: .9rem; }
#fields small { font-weight: 400; }
#fields input, #fields select, #fields textarea { display: block; width: 100%; max-width: none; margin-top: 4px; min-height: 43px; font-size: 1rem; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px; margin-top: 19px; }
.form-error { color: #8d2929; font-size: .9rem; margin-bottom: 0; }
.toast { position: fixed; z-index: 3; bottom: calc(68px + env(safe-area-inset-bottom)); right: 14px; max-width: calc(100vw - 28px); border-radius: 4px; padding: 11px 15px; color: var(--white); background: var(--navy-dark); }

@media (max-width: 720px) {
  body.app-shell::before { background-position: 26% center; }
  .top-inner, .shell { padding-inline: 16px; }
  .top-inner { min-height: 62px; gap: 8px; }
  nav { gap: 10px; }
  .nav-btn { font-size: .8rem; padding-inline: 1px; }
  .brand img { width: 146px; }
  .brand-app { display: none; }
  #app { padding-block: 24px 35px; }
  .round-header { min-height: 125px; padding-bottom: 15px; }
  .round-progress { margin-top: 10px; }
  .work { margin-top: 20px; }
  .wash-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title status" "description description" "actions actions";
    gap: 0 9px;
    padding: 13px 12px;
  }
  .wash-actions { align-items: start; gap: 0; margin-top: 9px; }
  .wash-actions > .text-btn { min-height: 40px; margin-left: -4px; }
  .section-head { align-items: start; flex-wrap: wrap; }
  .page-head { align-items: start; flex-direction: column; margin-top: 3px; }
  .status-row, .admin-row { padding-inline: 12px; gap: 8px 10px; }
}
@media (max-width: 480px) {
  .top-inner:has([data-action=logout]) { flex-wrap: wrap; gap: 0; }
  .top-inner:has([data-action=logout]) .brand { min-height: 42px; }
  nav:has([data-action=logout]) { width: 100%; min-height: 42px; }
  .nav-btn[data-action=logout] { margin-left: auto; padding-left: 3px; }
  .work .section-head { flex-direction: column; }
  .filters { gap: 0 12px; }
  .chip { padding-inline: 1px; }
  .count { margin-left: 1px; }
  .status-row { grid-template-columns: minmax(0, 1fr) auto; }
  .receipt { grid-column: 1 / -1; grid-row: 2; }
  .admin-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 360px) {
  .brand img { width: 119px; }
  .filters { column-gap: 8px; }
  .wash-row { padding-inline: 9px; gap: 0 7px; }
  .wash-controls .btn { padding-inline: 9px; }
}

.department-picker { max-width: 550px; }
.department-picker-intro { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 20px; }
.department-picker-intro p { margin: 8px 0 0; color: var(--ink); }
.officer-illustration { flex: 0 0 auto; width: auto; height: clamp(98px, 20vw, 146px); margin-right: 8px; }
.department-picker ul {
  list-style: none; margin: 0; padding: 0;
  background: var(--table-surface); border: 1px solid var(--line); border-radius: 5px;
}
.department-picker li + li { border-top: 1px solid var(--line); }
.department-option {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 51px; padding-inline: 16px; color: var(--navy-dark); background: transparent;
  text-align: left; font-size: 1rem;
}
.department-option:hover { background: var(--blue-light); }
.department-option span { font-size: 1.45rem; line-height: 1; }
.department-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px 14px;
  margin-bottom: 12px; border-bottom: 1px solid var(--line);
}
.department-bar p { margin: 0; color: var(--muted); font-size: .875rem; }
.department-bar strong { margin-left: 5px; color: var(--ink); }
.admin-note { margin: 0 0 12px; font-size: .88rem; }
.department-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 14px 18px; }
.settings-panel {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 12px 16px; padding: 16px 18px; max-width: 640px;
  background: var(--table-surface); border: 1px solid var(--line); border-radius: 5px;
}
.with-icon { display: inline-flex; gap: 6px; align-items: center; }
.action-icon { flex: 0 0 auto; object-fit: contain; }
.chip .action-icon, .admin-access .action-icon { width: 15px; height: 15px; }
.department-picker h1 { display: flex; align-items: center; gap: 10px; }
.department-picker h1 .action-icon { width: 32px; height: 32px; }

.entry-page {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 24px;
}
.entry-card {
  width: min(100%, 340px);
  padding: 31px clamp(20px, 7vw, 32px) 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
}
.entry-card > img { display: block; margin: 0 auto; object-fit: contain; }
.entry-card h1 { margin: 16px 0 25px; font-size: 1.45rem; letter-spacing: .08em; text-align: center; }
.entry-card label { display: block; margin: 0 0 5px; font-size: .9rem; font-weight: 650; }
.entry-card input { display: block; width: 100%; min-height: 46px; }
.entry-card .btn { width: 100%; min-height: 44px; margin-top: 13px; }

.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.hovis-status { margin: 8px 0; font-size: .875rem; }
.hovis-status strong { color: var(--navy-dark); }
.receipt .btn { justify-self: start; margin-top: 5px; }
.inspection-label { color: var(--teal); font-size: .8rem; font-weight: 650; }
.inspection-label span { display: block; margin-top: 1px; font-weight: 500; }
.inspection-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.inspection-actions [data-action=inspect] .action-icon { width: 32px; height: 20px; }
.inspection-actions .text-btn { padding-inline: 6px; }
.rewash-history { grid-column: 1 / -1; font-size: .84rem; color: var(--muted); }
.report-row .rewash-history { flex-basis: 100%; }
.rewash-history summary { width: fit-content; cursor: pointer; color: var(--navy); font-weight: 650; }
.rewash-history ol { margin: 5px 0 0; padding-left: 20px; }
.rewash-history li { padding: 4px 0; }
.rewash-history li + li { border-top: 0; }
.rewash-history p { margin: 2px 0 0; color: var(--ink); white-space: pre-wrap; }
#fields .check-field {
  display: flex; align-items: center; gap: 8px; min-height: 40px;
}
#fields .check-field input { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: var(--navy); }

.calendar {
  max-width: 550px; padding: clamp(12px, 4vw, 22px); background: var(--table-surface);
  border: 1px solid var(--line); border-radius: 5px;
}
.calendar-tools { margin-bottom: 4px; }
.calendar-tools .btn { min-height: 38px; }
.calendar-help { margin: 0 0 17px; color: var(--muted); font-size: .81rem; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.calendar-header h2 { font-size: 1.18rem; }
.calendar-header h2::first-letter { text-transform: uppercase; }
.calendar-header .btn { min-height: 40px; min-width: 40px; font-size: 1.25rem; }
.calendar-header .btn:disabled, .calendar-day:disabled { opacity: .5; cursor: default; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 12px 0; }
.calendar-weekday { text-align: center; color: var(--muted); font-size: .73rem; }
.calendar-day {
  min-height: 40px; padding: 5px 0; color: var(--navy-dark); background: var(--white);
  border: 1px solid var(--line); border-radius: 4px; font-size: .84rem; font-weight: 620;
}
.calendar-day.planned { background: var(--teal-light); border-color: var(--teal); }
.calendar-day.exception { border-style: dashed; border-color: var(--muted); }
.calendar-day[aria-current=date] { text-decoration: underline; text-underline-offset: 3px; }
.calendar-day:hover:not(:disabled) { background: var(--blue-light); }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: .75rem; }
.calendar-legend span::before {
  display: inline-block; width: 9px; height: 9px; margin-right: 5px; border: 1px solid var(--teal);
  border-radius: 2px; vertical-align: baseline; content: "";
}
.calendar-legend .planned::before { background: var(--teal-light); }
.calendar-legend .exception::before { border-color: var(--muted); border-style: dashed; }
