/* =====================================================================
   Charterly brand layer (Oct 2026 redesign)
   Loaded after styles.css. Presentation only — no behaviour lives here.
   Palette from the Charterly Brand Board.
   ===================================================================== */

:root {
  --turquoise: #1CCED7;
  --aqua: #29B4F5;
  --marine: #0F67E8;
  --deep-ocean: #0A4CCF;
  --coral: #FF5B47;
  --sail-red: #FF3153;
  --warm-coral: #FF8A63;
  --seafoam: #DDF4F4;
  --charcoal: #1E2430;

  --ink: var(--charcoal);
  --muted: #56657a;
  --page: #F4F9FA;
  --surface: #ffffff;
  --fill: #EEF4F7;
  --line: #DCE6EC;
  --radius: 14px;
  --radius-sm: 10px;
  --ocean-gradient: linear-gradient(115deg, var(--deep-ocean) 0%, var(--marine) 50%, var(--turquoise) 135%);
  --sail-gradient: linear-gradient(90deg, var(--warm-coral), var(--sail-red));
  --shadow: 0 1px 2px rgba(16, 40, 80, 0.05), 0 4px 16px rgba(16, 40, 80, 0.04);

  /* the original dark "mac" surface tokens, re-pointed at the light palette */
  --mac-surface: #ffffff;
  --mac-surface-strong: #ffffff;
  --mac-surface-soft: var(--fill);
  --mac-border: var(--line);
  --mac-highlight: #EEF4F7;
  --mac-shadow: 0 12px 32px rgba(16, 40, 80, 0.10);

  color-scheme: light;
  font-family: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
}

body {
  background: var(--page);
  background-image: none;
  color: var(--ink);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--ink); }

.dashboard-greeting h2,
.charter-summary-title h3,
.topbar h2,
.topbar h3,
.modal-sheet > .section-header h3 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.2px;
}

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

:focus-visible {
  outline: 3px solid #7cc0ff;
  outline-offset: 2px;
}

/* Themed artwork watermarks were tuned for a dark page; keep them very faint. */
.theme-artwork-symbol { opacity: 0.035; }
.theme-artwork-blob { opacity: 0.08; }

/* ---------- Shell: side menu + content ---------- */

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding: 0;
  font-family: "Figtree", ui-sans-serif, system-ui, sans-serif;
  background: var(--page);
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.side-brand {
  padding: 4px 6px 14px;
}

.side-brand img {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
}

.side-nav-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 2px;
  flex: 0 0 auto;
}

.side-nav-heading {
  margin: 14px 12px 4px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
}

.nav button,
.side-nav-utility {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #3d4a5c;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
}

.nav button span,
.side-nav-utility span {
  font-size: 15px;
  font-weight: inherit;
}

.nav .tab-icon,
.side-nav-utility .tab-icon {
  display: inline-flex;
  opacity: 1;
  font-size: 0;
}

.nav button:hover,
.side-nav-utility:hover {
  background: #EEF8F8;
}

.nav button.active {
  background: var(--seafoam);
  color: var(--deep-ocean);
  font-weight: 700;
  box-shadow: none;
}

.side-nav-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.side-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 2px;
}

.side-avatar {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sail-gradient);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}

.side-account-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.side-account-text strong {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.content {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 26px clamp(16px, 3vw, 40px) 48px;
}

/* Phone tab bar is hidden on wide screens */
.tab-bar { display: none; }

/* ---------- Pills, chips, badges ---------- */

.pill {
  min-height: 24px;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  background: var(--fill);
}

.pill.good { background: #E2F6EA; color: #14653a; }
.pill.warn { background: #FFE6DE; color: #A3311F; }

.type-chip,
.cabin-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.cabin-chip { background: var(--fill); color: #34465c; font-weight: 600; }
.type-chip.type-confirmed { background: #E3EEFD; color: var(--deep-ocean); }
.type-chip.type-hold { background: #FFE6DE; color: #A3311F; }
.type-chip.type-owner { background: var(--seafoam); color: #0B6870; }
.type-chip.type-blocked { background: #ECEFF3; color: #3e4c5e; }
.type-chip.type-haulout { background: #ECE8F7; color: #4b3a86; }

/* ---------- Buttons & fields ---------- */

.primary,
.secondary,
.danger,
.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14.5px;
  text-decoration: none;
}

.primary,
.dashboard-command-actions .primary,
.dashboard-hero-actions .primary { background: var(--marine); color: #fff; border: 0; box-shadow: none; }
.primary:hover,
.dashboard-command-actions .primary:hover { background: var(--deep-ocean); }
.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.secondary:hover { background: var(--fill); }
.danger { background: #fff; color: #B4232F; border: 1px solid #F3C4C8; }
.danger:hover { background: #FFF0F1; }

.mini {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13.5px;
}

.primary svg,
.secondary svg { width: 18px; height: 18px; }

input,
select,
textarea {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #C8D4E3;
  border-radius: var(--radius-sm);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--marine);
  outline: 3px solid rgba(15, 103, 232, 0.18);
  outline-offset: 0;
}

label { color: #34465c; }

/* ---------- Cards / panels ---------- */

.panel,
.section-card,
.widget-card,
.metric,
.dashboard-widget-card,
.calendar-day,
.timeline-item,
.file-row,
.archive-card,
.nested-card,
.active-charter-card,
.modal-sheet {
  background: var(--surface);
  backdrop-filter: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-card .section-card { box-shadow: none; }

.empty {
  color: var(--muted);
  border-color: var(--line);
}

.modal-backdrop { background: rgba(14, 30, 56, 0.45); }

/* ---------- Dashboard header ---------- */

.dashboard-command-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 0;
  margin-bottom: 4px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.dashboard-greeting {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dashboard-date {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.dashboard-greeting h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

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

.dashboard-vessel-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}

.dashboard-vessel-filter select {
  border: 0;
  background: transparent;
  font-weight: 700;
  min-height: 36px;
}

.more-menu { position: relative; }

.more-menu > summary {
  list-style: none;
  cursor: pointer;
}

.more-menu > summary::-webkit-details-marker { display: none; }

.more-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(16, 40, 80, 0.14);
}

.more-menu-list > * {
  justify-content: flex-start;
  border: 0;
  width: 100%;
}

/* ---------- Charter summary (read view) ---------- */

.charter-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.charter-summary-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.charter-summary-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.charter-avatar {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--seafoam);
  color: var(--deep-ocean);
  font-weight: 800;
  font-size: 19px;
}

.charter-summary-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.charter-summary-title h3 {
  margin: 0;
  font-size: 25px;
}

.charter-summary-identity p { margin: 2px 0 0; }

.contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contact-link { color: var(--deep-ocean); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
  align-items: start;
}

.summary-card-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
}

.summary-card-block h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.summary-field {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.summary-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}

.summary-value { font-weight: 600; }
.summary-detail { font-size: 14px; color: var(--muted); }
.summary-text { margin: 0; white-space: pre-line; }

.summary-gratuity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.summary-big {
  font-size: 24px;
  font-weight: 800;
}

.summary-guest {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid #EEF2F7;
}

.summary-guest-initials {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--fill);
  color: #34465c;
  font-size: 12.5px;
  font-weight: 800;
}

.summary-guest-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.summary-guest-text small,
.summary-stop small {
  display: block;
  font-size: 13.5px;
  color: var(--muted);
}

.occasion-note {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #FFF0EA;
  color: #7a3a2a;
}

.occasion-note strong { color: #A3311F; }

.summary-stop {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.stop-number {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--marine);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.summary-hint { margin: 0; font-size: 13.5px; }

/* ---------- Charter list ---------- */

.record-button {
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
}

.record-button:hover { background: #F1F8FA; }

.record-button.active {
  background: var(--seafoam);
  box-shadow: inset 3px 0 0 var(--marine);
}

.charter-list-section h4 {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 12px;
}

/* ---------- More sheet (phone) ---------- */

.more-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.more-nav-utility {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.more-sync {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

/* ---------- Phone & small tablet ---------- */

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .side-nav { display: none; }

  .content { padding: 18px 16px 24px; }

  .tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    max-width: none;
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(8px);
  }

  .tab-bar button {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 50px;
    padding: 4px 0;
    text-align: center;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    color: var(--muted);
  }

  .tab-bar button span.nav-label { font-size: 11.5px; }

  .tab-bar button.active {
    background: transparent;
    color: var(--marine);
  }

  .dashboard-greeting h2 { font-size: 25px; }

  .dashboard-command-actions { width: 100%; }
  .dashboard-vessel-filter { flex: 1 1 100%; }

  .more-menu-list { left: 0; right: auto; }

  .modal-sheet {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* The original menu was a boxed toolbar; flatten it for the side menu. */
.side-nav-list,
.tab-bar,
.more-nav {
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

/* styles.css gives every direct child of .app-shell position: relative;
   the menu and tab bar need their own positioning back. */
.app-shell > .side-nav { position: sticky; top: 0; }

/* Segmented controls (Week/Month/Year, report types, etc.) */
.segmented-control {
  background: var(--fill);
  border-color: var(--line);
  box-shadow: none;
}
.segmented-control button { color: #3d4a5c; font-weight: 600; }
.segmented-control button.active {
  background: #fff;
  color: var(--deep-ocean);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(16, 40, 80, 0.15);
}
.segmented button.active { color: #fff; }

/* Dashboard cards size to their content instead of stretching */
.dashboard-feature-grid,
.widget-card-grid { align-items: start; }

/* Charter list: search gets its own full-width line */
.charter-list-filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.charter-list-filter-bar input[type="search"] { grid-column: 1 / -1; min-height: 42px; }

@media (max-width: 900px) {
  .app-shell > .tab-bar { position: fixed; }
  .todo-row.editable { grid-template-columns: auto minmax(0, 1fr) auto; }
  .todo-row.editable button { grid-column: auto; }
}

/* Calendar event colours from the brand palette */
.calendar-event { color: #fff; border-radius: 8px; }
.calendar-event.confirmed { background: var(--marine); }
.calendar-event.hold { background: #E5492F; }
.calendar-event.owner { background: #0E8F97; }
.calendar-event.blocked { background: #7A8799; }
.calendar-event.haulout { background: #5B4BA8; }
.calendar-day.today { border-color: var(--marine); box-shadow: inset 0 0 0 1px var(--marine); }

/* Charters on phone: list first, tap a charter to open it, "All charters" to go back */
.charter-back { display: none; }

@media (max-width: 900px) {
  .charters-grid { grid-template-columns: minmax(0, 1fr); }
  .charters-grid[data-detail-open="false"] > .charter-detail-panel { display: none; }
  .charters-grid[data-detail-open="true"] > .charter-list-panel { display: none; }
  .charter-back {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    margin: -6px 0 6px -4px;
    padding: 0 4px;
    background: transparent;
    color: var(--deep-ocean);
    font-weight: 700;
    font-size: 15px;
  }

  /* Month calendar on phone reads as an agenda: only days with something on */
  .calendar-grid:not(.calendar-grid-week) .calendar-day:not(:has(.calendar-event)) { display: none; }

  .dashboard-greeting { width: 100%; }
}

/* Sheets (Settings, Help, More) float above the page and the tab bar */
.app-shell > .modal-backdrop { position: fixed; z-index: 40; }
.calendar-day.today .calendar-day-number { background: var(--marine); color: #fff; }

/* Dashboard reminders widget: checkbox · priority dot · title/date · Snooze */
.todo-row.reminder-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-radius: 0;
  background: transparent;
  border-top: 1px solid #EEF2F7;
}
.todo-row.reminder-row:first-child { border-top: 0; }
.todo-row.reminder-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--marine);
}
.todo-row.reminder-row > span:not(.reminder-priority-dot) {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  min-width: 0;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.todo-row.reminder-row small { font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.todo-row.reminder-row.overdue small { color: #C2361F; font-weight: 700; }
.todo-row.reminder-row .reminder-priority-dot { width: 10px; height: 10px; border: 0; border-radius: 50%; }
.reminder-priority-dot { background: var(--aqua); }
.reminder-priority-dot.priority-low { background: #9AA8B8; }
.reminder-priority-dot.priority-high { background: var(--warm-coral); }
.reminder-priority-dot.priority-urgent { background: var(--sail-red); }

/* Checkboxes and radio buttons everywhere: normal size, brand colour.
   (The general "input" rule made them full-width boxes.) */
input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--marine);
  vertical-align: middle;
}
input[type="checkbox"]:focus,
input[type="radio"]:focus { outline: none; }

/* Reminders list: checkbox sits beside the title */
.record-button .record-title:has(> input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 10px;
}
.record-button .record-title:has(> input[type="checkbox"]) + .record-meta { padding-left: 30px; }

/* Segmented controls wrap instead of running off the edge */
.segmented-control { flex-wrap: wrap; max-width: 100%; }

/* Charter summary: photos, files, wide cards */
.summary-wide { grid-column: 1 / -1; }
.summary-card-block h4 small { font-weight: 600; font-size: 13px; margin-left: 4px; }
.summary-stars { color: #E5A100; letter-spacing: 1px; font-size: 15px; }
.summary-guest-photo {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.summary-guest-text small { overflow-wrap: anywhere; }
.summary-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.summary-photos img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--fill);
}
.summary-files { display: flex; flex-direction: column; gap: 6px; }
.summary-file {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--deep-ocean);
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.summary-file::before { content: "📄"; }
.summary-file:hover { background: var(--fill); }
.dashboard-sync-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 4px; font-size: 13.5px; color: var(--muted); }

@media (max-width: 900px) {
  .summary-photos { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .summary-guest { flex-wrap: wrap; }
  .summary-guest .cabin-chip { margin-left: 52px; }
  .summary-guest-text { flex-basis: calc(100% - 60px); }
}

/* ---------- Sign in / Create account ---------- */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 15% 10%, rgba(28, 206, 215, 0.14), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(15, 103, 232, 0.12), transparent 45%),
    var(--page);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 24px;
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(16, 40, 80, 0.12);
}
/* styles.css lays .auth-brand out as a grid with justify-items: start, which
   left-pins the heading; centre the grid items too (Chris, 2026-10-28). */
.auth-brand { text-align: center; justify-items: center; margin-bottom: 20px; }
.auth-wordmark { width: 210px; max-width: 80%; height: auto; }
.auth-title {
  margin: 14px 0 2px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 26px;
  font-weight: 700;
}
.auth-brand p { margin: 0; }
#auth-form { display: flex; flex-direction: column; gap: 12px; }
#auth-form .field { margin: 0; }
#auth-form input { min-height: 46px; font-size: 16px; }
.auth-name-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-submit { width: 100%; min-height: 48px; margin-top: 6px; font-size: 16px; }
.auth-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #FFE6DE;
  color: #A3311F;
  font-weight: 600;
  font-size: 14px;
}
.auth-switch { margin: 18px 0 0; text-align: center; color: var(--muted); }
.auth-switch .link-button {
  background: transparent;
  color: var(--deep-ocean);
  font-weight: 700;
  padding: 4px;
}
@media (max-width: 380px) { .auth-name-row { grid-template-columns: 1fr; } }
.auth-wordmark { display: block; margin: 0 auto; }

/* ---------- Themes ----------
   The Charterly theme uses the exact Brand Board colours above. Every other
   theme in Settings recolours the same pieces from its own colours, and uses
   its own typeface. */
.app-shell:not([data-theme="charterly"]) {
  --marine: color-mix(in srgb, var(--theme-accent) 55%, var(--theme-banner-end));
  --deep-ocean: color-mix(in srgb, var(--theme-accent) 35%, var(--theme-banner-end));
  --aqua: var(--theme-accent);
  --turquoise: var(--theme-accent);
  --seafoam: color-mix(in srgb, var(--theme-accent) 14%, #ffffff);
  --page: color-mix(in srgb, var(--theme-accent) 6%, #f7f8fa);
  --fill: color-mix(in srgb, var(--theme-accent) 8%, #f3f5f7);
  --ocean-gradient: linear-gradient(115deg, var(--theme-banner-start), var(--theme-banner-end));
  --sail-gradient: linear-gradient(90deg, var(--theme-button), var(--theme-accent));
  font-family: var(--theme-font);
}
.app-shell:not([data-theme="charterly"]) .side-nav { background: color-mix(in srgb, var(--theme-accent) 3%, #ffffff); }
.app-shell .nav button.active { background: var(--seafoam); color: var(--deep-ocean); }

/* ---------- Sign-in, matched to AuthGateView ---------- */
.auth-column { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 22px; align-items: stretch; }
.auth-brand { text-align: center; justify-items: center; margin: 0; }
.auth-wordmark { width: 280px; max-width: 80%; }
.auth-title { font-size: 32px; margin: 14px 0 6px; }
.auth-brand p { max-width: 400px; margin: 0 auto; }
.auth-card { max-width: none; display: flex; flex-direction: column; gap: 16px; border-radius: 24px; }
.auth-mode { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
.auth-mode button { min-height: 38px; }
.auth-error { background: #FFF1E6; color: #B4520A; }
.auth-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-switch { margin: 0; }
.auth-site-link { align-self: center; color: var(--deep-ocean); font-weight: 600; text-decoration: none; font-size: 14px; }
.auth-site-link:hover { text-decoration: underline; }

/* ---------- Profile photo ---------- */
.side-avatar-photo { object-fit: cover; padding: 0; }
.settings-profile-photo { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; display: block; margin-bottom: 8px; }

/* ---------- Health & Safety ---------- */
.health-alert-field label { color: #B4232F; font-weight: 700; }
.health-alert-field textarea { border-color: #F3C4C8; }
.health-alert-banner {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: #FDECEE; color: #8E1B26; border: 1px solid #F3C4C8;
}
.health-alert-banner strong { color: #B4232F; }
.health-alert-chip {
  display: inline-block; margin: 6px 0 0; padding: 5px 9px; border-radius: 8px;
  background: #FDECEE; color: #B4232F; font-size: 13px; font-weight: 700;
}

/* ---------- Crew documents ---------- */
.crew-documents { margin-top: 14px; padding-top: 12px; border-top: 1px solid #EEF2F7; display: flex; flex-direction: column; gap: 8px; }
.crew-documents-header { font-size: 14px; }
.crew-document-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.crew-document-text { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.crew-document-text small { color: var(--muted); font-size: 13px; }
.doc-status { font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.doc-status-valid { background: #E2F6EA; color: #14653a; }
.doc-status-soon { background: #FFF1DC; color: #8a4b00; }
.doc-status-expired { background: #FDECEE; color: #B4232F; }
.doc-status-none { background: var(--fill); color: var(--muted); }
.small-note { font-size: 13px; margin: 0; }
.value-alert { color: #B4232F; }
.value-warn { color: #B4520A; }
.dashboard-feature-grid > *, .widget-card-grid > * { align-self: start; height: auto; min-height: 0; }

/* ---------- Dashboard: neater widgets ---------- */
.dashboard-stack { display: flex; flex-direction: column; gap: 16px; }

.dashboard-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  align-items: stretch;
}
.dashboard-stat-grid .dashboard-widget-card {
  min-height: 0;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
}
.dashboard-stat-grid .widget-symbol {
  width: 36px; height: 36px; border-radius: 10px; box-shadow: none;
}
.dashboard-stat-grid .widget-symbol svg { width: 18px; height: 18px; }
.dashboard-stat-grid .dashboard-widget-card h3 { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.dashboard-stat-grid .dashboard-widget-card strong { font-size: 21px; line-height: 1.15; }
.dashboard-stat-grid .dashboard-widget-card p {
  margin: 4px 0 0; font-size: 13px; line-height: 1.35; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.dashboard-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  align-items: start;
}
.dashboard-list-grid > .panel { padding: 16px 18px; }
.dashboard-list-grid .section-header h3 { font-size: 17px; margin: 0; }

/* Checklist widget: tighter rows */
.dashboard-list-grid .todo-row.editable { padding: 4px 0; gap: 8px; background: transparent; }
.dashboard-list-grid .todo-row.editable input:not([type="checkbox"]) { min-height: 36px; padding: 6px 10px; }
.dashboard-list-grid .todo-list { display: flex; flex-direction: column; gap: 2px; }
.dashboard-list-grid .field { margin-bottom: 6px; }

/* Active charter card: less empty space */
.active-charter-card { padding: 18px 22px; }
.active-charter-card h3 { font-size: 30px; margin: 4px 0; }
.active-charter-card .progress-track { margin-top: 10px; }
.active-charter-actions { margin-top: 10px; }

/* Notes boards a bit shorter */
.widget-pair-grid .chalkboard-text { min-height: 150px; }

@media (max-width: 900px) {
  .dashboard-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dashboard-stat-grid .dashboard-widget-card { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px; }
  .dashboard-stat-grid .widget-symbol { width: 28px; height: 28px; border-radius: 8px; }
  .dashboard-stat-grid .widget-symbol svg { width: 15px; height: 15px; }
  .dashboard-stat-grid .dashboard-widget-card strong { font-size: 18px; }
  .dashboard-command-actions { display: grid; grid-template-columns: 1fr 1fr 1.4fr; }
  .dashboard-command-actions .dashboard-vessel-filter { grid-column: 1 / -1; }
  .dashboard-command-actions .more-menu > summary { width: 100%; }
  .active-charter-card { padding: 16px; }
  .active-charter-card h3 { font-size: 26px; }
}
@media (max-width: 900px) {
  .dashboard-command-actions { grid-template-columns: auto auto minmax(0, 1fr); }
  .dashboard-command-actions > * { white-space: nowrap; padding-left: 12px; padding-right: 12px; }
}

/* ---------- Dashboard sections (collapsible) ---------- */
.dash-all-links { order: 9; margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.dash-all-links .link-button { background: none; border: 0; padding: 2px; color: var(--deep-ocean); font-weight: 600; font-size: 13px; }

.dash-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dash-section-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px 0 18px;
  user-select: none;
}
.dash-section-summary::-webkit-details-marker { display: none; }
.dash-section-summary:hover { background: #F7FBFC; }
.dash-section-title { font-weight: 800; font-size: 16px; white-space: nowrap; }
.dash-section-hint {
  flex: 1 1 auto; min-width: 0; color: var(--muted); font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-chevron { flex: 0 0 auto; color: var(--muted); transition: transform 160ms ease; transform: rotate(-90deg); }
.dash-section[open] .dash-chevron { transform: rotate(0deg); }
.dash-section[open] > .dash-section-summary { border-bottom: 1px solid #EEF2F7; }
.dash-section-body { padding: 14px 16px 16px; }

/* Widgets inside a section lose their own card frame and duplicate title */
.dash-section-body > .panel,
.dash-section-body > .active-charter-card {
  border: 0; box-shadow: none; padding: 0; margin: 0; background: transparent; border-radius: 0;
}
.dash-section-body > .panel > .section-header { justify-content: flex-end; margin: 0 0 6px; min-height: 0; }
.dash-section-body > .panel > .section-header h3 { display: none; }
.dash-section-body > .active-charter-card .active-charter-label { display: none; }
.dash-section-boardless .dash-section-body { padding: 12px; }
.dash-section-body > .chalkboard-card { margin: 0; }

/* Uniform tiles inside "At a glance" */
.dashboard-stat-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.dashboard-stat-grid .dashboard-widget-card {
  min-height: 112px; background: #F8FBFC; box-shadow: none; border: 1px solid #E6EEF2;
}

.dashboard-list-grid { align-items: start; }

@media (max-width: 900px) {
  .dash-all-links { margin-left: 0; width: 100%; }
  .dash-section-summary { min-height: 50px; padding: 0 12px 0 14px; }
  .dash-section-hint { font-size: 13px; }
  .dash-section-body { padding: 12px; }
  .dashboard-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-stat-grid .dashboard-widget-card { min-height: 0; }
}

/* ---------- Feedback toast ---------- */
#charterly-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  z-index: 60; max-width: calc(100vw - 32px);
  padding: 11px 18px; border-radius: 12px;
  background: var(--charcoal); color: #fff; font: 600 14px/1.3 "Figtree", system-ui, sans-serif;
  box-shadow: 0 10px 30px rgba(16, 40, 80, 0.25);
  opacity: 0; pointer-events: none; transition: opacity 160ms ease, transform 160ms ease;
}
#charterly-toast.visible { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 900px) { #charterly-toast { bottom: calc(84px + env(safe-area-inset-bottom)); } }

/* Gratuity summary tiles act as filters */
.metric[data-gratuity-filter] { cursor: pointer; text-align: left; }
.metric[aria-pressed="true"] { border-color: var(--marine); box-shadow: inset 0 0 0 1px var(--marine); background: #F2F7FF; }
#charterly-toast { display: flex; align-items: center; gap: 14px; pointer-events: none; }
#charterly-toast.visible { pointer-events: auto; }
#charterly-toast button { background: transparent; border: 0; color: #7CC8FF; font-weight: 800; padding: 4px 2px; cursor: pointer; }

/* ---------- Calendar header: one tidy toolbar ---------- */
.calendar-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.calendar-header h3 { margin: 0; }
.calendar-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.calendar-controls .segmented-control { flex-wrap: nowrap; }
@media (max-width: 900px) {
  .calendar-header > div:first-child { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .calendar-header > div:first-child p { margin: 0; }
  .calendar-controls {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .calendar-controls .segmented-control { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); }
  .calendar-controls [data-action="new-record"] { grid-column: 1 / -1; }
  .calendar-controls button { min-height: 40px; width: 100%; }
  .calendar-day { min-height: 0; padding: 8px 10px; gap: 6px; }
  .calendar-day-number { font-size: 14px; }
  .calendar-event { min-height: 0; padding: 6px 8px; }
}
.calendar-event small { color: rgba(255, 255, 255, 0.86); }
.calendar-day-weekday { display: none; }
@media (max-width: 900px) {
  .calendar-grid:not(.calendar-grid-week) .calendar-day { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; }
  .calendar-grid:not(.calendar-grid-week) .calendar-day:not(:has(.calendar-event)) { display: none; }
  .calendar-grid:not(.calendar-grid-week) .calendar-day-weekday { display: block; font-weight: 700; font-size: 14px; color: var(--muted); }
  .calendar-grid:not(.calendar-grid-week) .calendar-events { grid-column: 1 / -1; }
}

/* ---------- Phone: tidier lists and controls ---------- */
@media (max-width: 900px) {
  /* Segmented controls stay side by side instead of stacking into a list */
  .segmented-control { display: flex; flex-wrap: wrap; width: 100%; }
  .segmented-control button { flex: 1 1 auto; min-height: 38px; }

  /* Gratuity totals: two per row */
  .metric-band { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric-band .metric { min-height: 0; padding: 12px; }
  .metric-band .metric strong { font-size: 18px; }

  /* Payments: one card per charter instead of a wide table */
  .payment-table { border: 0; overflow: visible; gap: 8px; }
  .payment-row.payment-head { display: none; }
  .payment-row {
    min-width: 0;
    grid-template-columns: 1fr auto;
    gap: 2px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px;
  }
  .payment-row:last-child { border-bottom: 1px solid var(--line); }
  .payment-row > :nth-child(1) { grid-column: 2; grid-row: 1; font-size: 12px; font-weight: 700; text-align: right; }
  .payment-row > :nth-child(2) { grid-column: 1; grid-row: 1; font-weight: 700; font-size: 15px; }
  .payment-row > :nth-child(3), .payment-row > :nth-child(4), .payment-row > :nth-child(6), .payment-row > :nth-child(7) { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
  .payment-row > :nth-child(5) { grid-column: 1 / -1; font-weight: 800; font-size: 16px; }
  .payment-row > :nth-child(7):not(:empty)::before { content: "Follow-up: "; }
  .payment-row > :nth-child(8) { grid-column: 1 / -1; margin-top: 6px; }
}
@media (max-width: 900px) {
  .native-page-stack, .native-page-stack > .panel { min-width: 0; max-width: 100%; }
  .gratuity-filter-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .gratuity-filter-bar > * { min-width: 0; width: 100%; }
  .gratuity-filter-bar input[type="search"], .gratuity-filter-bar input:first-child { grid-column: 1 / -1; }
  .metric-band .metric { min-width: 0; overflow: hidden; }
}

/* ---- Compact photos (2026-10-27) ---- */
.summary-photos { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; max-width: 760px; }
.summary-photos a { display: block; border-radius: var(--radius-sm); overflow: hidden; }
.summary-photos img { aspect-ratio: 1; transition: opacity .15s; }
.summary-photos a:hover img { opacity: .85; }
.photo-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 112px)); gap: 8px; }
.photo-tile { gap: 6px; min-width: 0; }
.photo-tile a, .photo-tile-placeholder { min-height: 0; aspect-ratio: 1; }
.photo-tile .mini { width: 100%; min-height: 30px; padding: 4px 6px; font-size: 12.5px; }
.profile-photo-column { width: 96px; }
.profile-photo { width: 96px; height: 96px; border-radius: 50%; }
.vessel-photo-column { width: 100%; max-width: 280px; }
.vessel-photo { border-radius: var(--radius-sm); }
.settings-profile-photo { width: 64px; height: 64px; }
@media (max-width: 900px) {
  .summary-photos { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .profile-photo-column, .profile-photo { width: 72px; }
  .profile-photo { height: 72px; }
  .vessel-photo-column { max-width: 100%; }
}
