/* HMBA Design System — crew checklist */
:root {
  --hmb-navy: #0c2f45;
  --hmb-deep: #0c447c;
  --hmb-blue: #1ea9e1;
  --hmb-amber: #f5a623;
  --hmb-sand: #f6f1e7;
  --hmb-mist: #dce9f2;
  --hmb-slate: #5f5e5a;
  --hmb-white: #ffffff;
  --hmb-danger: #cf2e2e;
  --hmb-ok: #00a878;

  --bg: var(--hmb-sand);
  --surface: var(--hmb-white);
  --text: var(--hmb-navy);
  --text-muted: var(--hmb-slate);
  --border: color-mix(in srgb, var(--hmb-navy) 12%, white);
  --primary: var(--hmb-blue);
  --accent: var(--hmb-amber);
  --focus: var(--hmb-blue);

  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;

  --r-sm: 8px;
  --r-md: 14px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgb(12 47 69 / 6%), 0 8px 24px rgb(12 47 69 / 8%);

  --font: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --lh: 1.45;
  --tap: 48px;
  --max: 40rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, color-mix(in srgb, var(--hmb-blue) 18%, transparent), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, color-mix(in srgb, var(--hmb-amber) 14%, transparent), transparent 55%),
    var(--bg);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--hmb-deep);
}

button,
input,
select {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: var(--s-4);
  padding-bottom: calc(var(--s-6) + env(safe-area-inset-bottom, 0px));
}

/* Header */
.app-header {
  display: flex;
  gap: var(--s-3);
  align-items: center;
  margin-bottom: var(--s-4);
}

.app-header__logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  object-fit: contain;
  padding: 4px;
  flex: 0 0 auto;
}

.app-header__text {
  min-width: 0;
}

.app-header__brand {
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.app-header__title {
  margin: 0.1rem 0 0;
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  line-height: 1.2;
  color: var(--hmb-navy);
}

.app-header__meta {
  margin: 0.25rem 0 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-4);
}

.lang-switch {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 3px;
  box-shadow: var(--shadow-1);
}

.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  min-height: 36px;
  min-width: 44px;
  padding: 0 0.75rem;
  border-radius: var(--r-pill);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--fs-sm);
}

.lang-switch button[aria-pressed="true"] {
  background: var(--hmb-navy);
  color: var(--hmb-white);
}

/* Progress card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  padding: var(--s-4);
}

.progress-card {
  margin-bottom: var(--s-4);
}

.progress-card__top {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  align-items: baseline;
  margin-bottom: var(--s-3);
}

.progress-card__label {
  font-weight: 700;
  color: var(--hmb-navy);
}

.progress-card__count {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--hmb-mist);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--hmb-blue), color-mix(in srgb, var(--hmb-blue) 55%, var(--hmb-amber)));
  transition: width 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
  .progress > span {
    transition: none;
  }
}

/* Callout */
.callout {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  margin-bottom: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--hmb-amber) 16%, white);
  border: 1px solid color-mix(in srgb, var(--hmb-amber) 45%, white);
  color: var(--hmb-navy);
  font-size: var(--fs-sm);
}

.callout__icon {
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--hmb-amber);
  color: var(--hmb-navy);
  font-weight: 800;
  font-size: 0.85rem;
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

.chip {
  min-height: 40px;
  padding: 0 0.9rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  font-size: var(--fs-sm);
}

.chip[aria-pressed="true"] {
  background: var(--hmb-mist);
  border-color: color-mix(in srgb, var(--hmb-blue) 35%, white);
  color: var(--hmb-deep);
}

/* Sections */
.section {
  margin-bottom: var(--s-4);
}

.section__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) 0;
  margin-bottom: var(--s-2);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
}

.section__title {
  margin: 0;
  font-size: var(--fs-sm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hmb-deep);
}

.section__count {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-2);
}

/* Checkbox row */
.check-row {
  display: grid;
  grid-template-columns: var(--tap) 1fr;
  gap: var(--s-2);
  align-items: start;
  min-height: var(--tap);
  padding: var(--s-2);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.check-row:hover {
  border-color: color-mix(in srgb, var(--hmb-blue) 35%, var(--border));
}

.check-row.is-checked {
  background: color-mix(in srgb, var(--hmb-blue) 8%, white);
  border-color: color-mix(in srgb, var(--hmb-blue) 28%, var(--border));
}

.check-row.is-checked .check-row__title {
  color: color-mix(in srgb, var(--hmb-navy) 70%, var(--hmb-slate));
}

.check-row__box {
  width: 28px;
  height: 28px;
  margin: 10px auto 0;
  border-radius: 8px;
  border: 2px solid color-mix(in srgb, var(--hmb-navy) 28%, white);
  display: grid;
  place-items: center;
  background: var(--hmb-white);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.check-row.is-checked .check-row__box {
  background: var(--hmb-blue);
  border-color: var(--hmb-blue);
  color: white;
}

.check-row__box svg {
  width: 16px;
  height: 16px;
  opacity: 0;
}

.check-row.is-checked .check-row__box svg {
  opacity: 1;
}

.check-row__title {
  margin: 0.55rem 0 0;
  font-weight: 600;
  font-size: var(--fs-md);
}

.check-row__hint {
  margin: 0.2rem 0 0.45rem;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* Actions */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-5);
}

.btn {
  min-height: 44px;
  padding: 0 1rem;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  font-size: var(--fs-sm);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--hmb-navy);
}

.btn--danger {
  background: color-mix(in srgb, var(--hmb-danger) 10%, white);
  border-color: color-mix(in srgb, var(--hmb-danger) 35%, white);
  color: var(--hmb-danger);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* States */
.state {
  padding: var(--s-6) var(--s-4);
  text-align: center;
  color: var(--text-muted);
}

.state--error {
  color: var(--hmb-danger);
}

.footer-note {
  margin-top: var(--s-6);
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* Trip picker (index) */
.trip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-3);
}

.trip-card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}

.trip-card:hover {
  border-color: color-mix(in srgb, var(--hmb-blue) 40%, var(--border));
}

.trip-card__title {
  margin: 0;
  font-size: var(--fs-lg);
  color: var(--hmb-navy);
}

.trip-card__meta {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.trip-card__id {
  margin-top: 0.6rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-xs);
  color: var(--hmb-deep);
}

@media print {
  body {
    background: white;
  }
  .toolbar,
  .filters,
  .actions,
  .lang-switch {
    display: none !important;
  }
  .check-row {
    break-inside: avoid;
    box-shadow: none;
  }
}
