:root {
  --river: #2a6b8f;
  --river-dark: #1a4a66;
  --canyon: #8b5a3c;
  --sage: #7a8a6f;
  --sand: #f3ead7;
  --dusk: #2c2a3a;
  --paper: #fbf7ee;
  --ink: #1d2025;
  --muted: #6b6b75;
  --good: #3f8a5e;
  --warn: #c8851a;
  --bad: #b04a3a;
  --line: #e3dccb;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--river); text-decoration: none; }
a:hover { text-decoration: underline; }

header.topbar {
  background: var(--river-dark);
  color: var(--paper);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  flex-wrap: nowrap;
}
header.topbar .brand { font-weight: 700; font-size: 18px; letter-spacing: .3px; white-space: nowrap; }
header.topbar .brand small { font-weight: 400; opacity: .8; margin-left: 8px; }
header.topbar nav { display: flex; align-items: center; flex-wrap: wrap; }
header.topbar nav a {
  color: var(--paper);
  margin-left: 18px;
  font-size: 14px;
  opacity: .85;
  white-space: nowrap;
}
header.topbar nav a.active { opacity: 1; border-bottom: 2px solid var(--sand); padding-bottom: 2px; }
header.topbar .who { font-size: 13px; opacity: .8; text-align: right; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header.topbar .hamburger {
  display: none;
  background: none; border: 1px solid rgba(255,255,255,.3); color: var(--paper);
  padding: 8px 12px; border-radius: 6px; font-size: 18px; cursor: pointer;
  line-height: 1; margin-left: auto;
}

@media (max-width: 780px) {
  header.topbar {
    padding: 12px 14px;
    flex-wrap: wrap;
  }
  header.topbar .brand { font-size: 16px; flex: 1; min-width: 0; }
  header.topbar .brand small { display: none; }
  header.topbar .hamburger { display: inline-block; order: 2; margin-left: 8px; }
  header.topbar .who {
    order: 3; width: 100%; text-align: left; max-width: none;
    font-size: 12px; margin-top: 4px;
  }
  header.topbar nav {
    order: 4;
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    background: rgba(0,0,0,.12);
    border-radius: 8px;
    margin-top: 10px;
    padding: 6px 0;
  }
  header.topbar nav.open { display: flex; }
  header.topbar nav a {
    margin-left: 0;
    padding: 12px 16px;
    font-size: 16px;
    opacity: 1;
    border-bottom: 1px solid rgba(255,255,255,.1);
  }
  header.topbar nav a:last-child { border-bottom: none; }
  header.topbar nav a.active {
    background: rgba(255,255,255,.08);
    border-bottom: 1px solid rgba(255,255,255,.1);
    padding-bottom: 12px;
  }
}

main { max-width: 960px; margin: 0 auto; padding: 24px 20px 100px; }
h1 { font-size: 28px; margin: 0 0 4px; }
h2 { font-size: 20px; margin: 28px 0 12px; color: var(--river-dark); }
h3 { font-size: 16px; margin: 16px 0 6px; }
@media (max-width: 780px) {
  main { padding: 16px 14px 110px; }
  h1 { font-size: 22px; }
  h2 { font-size: 17px; margin: 20px 0 10px; }
  input, select, textarea { max-width: none; width: 100%; }
  .countdown { padding: 18px; }
  .countdown .big { font-size: 34px; }
  .gap-radar { grid-template-columns: repeat(2, 1fr); }
  .meal-grid { grid-template-columns: 1fr !important; }
  .gear-row { flex-wrap: wrap; gap: 6px; }
  .gear-row .item { flex-basis: 100%; }
  .gear-row .who { text-align: left; min-width: 0; }
  /* Rhonda chat widget — shrink FAB a bit and make panel full-width */
  #rhonda-fab { width: 52px; height: 52px; bottom: 16px; right: 16px; font-size: 22px; }
  #rhonda-panel {
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 90px) !important;
    bottom: 10px !important;
    right: 10px !important;
  }
}
.subtitle { color: var(--muted); margin: 0 0 20px; }

.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.countdown {
  background: linear-gradient(135deg, var(--river) 0%, var(--river-dark) 100%);
  color: var(--paper);
  padding: 22px 24px;
  border-radius: 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.countdown .big { font-size: 42px; font-weight: 700; line-height: 1; }
.countdown .label { font-size: 13px; opacity: .8; text-transform: uppercase; letter-spacing: 1px; }
.countdown .when { font-size: 14px; opacity: .9; }

.gap-radar { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.gap {
  background: white; border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  text-align: center;
}
.gap .n { font-size: 28px; font-weight: 700; }
.gap .lbl { font-size: 12px; color: var(--muted); }
.gap.ok { border-color: var(--good); background: #f1f8f3; }
.gap.ok .n { color: var(--good); }
.gap.warn { border-color: var(--warn); background: #fcf6ea; }
.gap.warn .n { color: var(--warn); }
.gap.bad { border-color: var(--bad); background: #faecea; }
.gap.bad .n { color: var(--bad); }

.note-pill {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: middle;
}
.note-pill.critical { background: #faecea; color: var(--bad); }
.note-pill.required { background: #fcf6ea; color: var(--warn); }
.note-pill.logistics { background: #e8f0f6; color: var(--river-dark); }
.note-pill.food { background: #eef2ea; color: var(--good); }

button, .btn {
  background: var(--river);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
button:hover, .btn:hover { background: var(--river-dark); }
button.ghost { background: transparent; color: var(--river); border: 1px solid var(--river); }
button.ghost:hover { background: var(--river); color: white; }
button.danger { background: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  width: 100%;
  max-width: 360px;
}
label { font-size: 13px; color: var(--muted); display: block; margin-top: 10px; }

.boat {
  background: white; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px;
}
.boat .head { display: flex; justify-content: space-between; align-items: baseline; }
.boat .name { font-weight: 700; font-size: 17px; }
.boat .meta { color: var(--muted); font-size: 13px; }
.boat .crew { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.crew-chip {
  background: var(--sand); color: var(--ink); padding: 4px 10px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--line);
}
.crew-chip.captain { background: var(--river); color: white; border-color: var(--river-dark); font-weight: 600; }
.crew-chip.dog { background: #e9e1cf; }
.crew-chip button { background: none; color: var(--bad); padding: 0 0 0 6px; font-size: 14px; font-weight: 700; }

.meal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 720px) { .meal-grid { grid-template-columns: 1fr; } }
.meal {
  background: white; border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.meal.claimed { background: #f1f8f3; border-color: var(--good); }
.meal .day { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.meal .slot { font-weight: 700; font-size: 16px; }
.meal .by { font-size: 13px; color: var(--good); }
.meal .dish { font-size: 13px; color: var(--ink); }
.meal .actions { margin-top: 6px; }

.gear-cat { margin-top: 18px; }
.gear-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.gear-row:last-child { border-bottom: none; }
.gear-row .item { flex: 1; }
.gear-row .qty { color: var(--muted); font-size: 13px; min-width: 70px; }
.gear-row .who { color: var(--good); font-size: 13px; min-width: 110px; text-align: right; }
.gear-row.claimed { background: #f6faf7; }

.checklist label {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
  color: var(--ink); margin-top: 0;
}
.checklist input[type=checkbox] { width: auto; margin: 0; }
.checklist label.packed { color: var(--muted); text-decoration: line-through; }

/* Route timeline */
.route-hero {
  background: linear-gradient(180deg, #d9e8f0 0%, var(--paper) 100%);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
}
.route-hero h2 { margin-top: 0; }
.route-hero .stats { display: flex; gap: 24px; margin-top: 12px; flex-wrap: wrap; }
.route-hero .stat { font-size: 13px; color: var(--muted); }
.route-hero .stat b { font-size: 22px; color: var(--river-dark); display: block; }

.timeline { position: relative; padding-left: 36px; }
.timeline::before {
  content: ''; position: absolute; left: 14px; top: 6px; bottom: 6px;
  width: 3px;
  background: linear-gradient(180deg, var(--river) 0%, var(--sage) 50%, var(--canyon) 100%);
  border-radius: 2px;
}
.tp {
  position: relative; padding: 12px 14px 16px; margin-bottom: 8px;
}
.tp::before {
  content: ''; position: absolute; left: -29px; top: 18px;
  width: 16px; height: 16px; border-radius: 50%;
  background: white; border: 3px solid var(--river);
  box-shadow: 0 0 0 3px var(--paper);
}
.tp.rapid::before { border-color: var(--bad); }
.tp.camp::before { border-color: var(--good); }
.tp.wildlife::before { border-color: var(--sage); }
.tp.landmark::before { border-color: var(--canyon); }
.tp.put-in::before, .tp.take-out::before { border-color: var(--dusk); background: var(--dusk); }
.tp .head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tp .mile { font-weight: 700; color: var(--river-dark); font-variant-numeric: tabular-nums; }
.tp .name { font-weight: 700; font-size: 16px; }
.tp .day-pill {
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  background: var(--sand); color: var(--ink); text-transform: uppercase; letter-spacing: .5px;
}
.tp .type-pill {
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .5px;
}
.tp.rapid .type-pill { background: #faecea; color: var(--bad); }
.tp.camp .type-pill { background: #f1f8f3; color: var(--good); }
.tp.wildlife .type-pill { background: #eef2ea; color: var(--sage); }
.tp.landmark .type-pill { background: #f6ede4; color: var(--canyon); }
.tp.put-in .type-pill, .tp.take-out .type-pill { background: var(--dusk); color: white; }
.tp .desc { color: var(--ink); font-size: 14px; margin-top: 6px; }

.empty { color: var(--muted); font-style: italic; padding: 20px; text-align: center; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: white; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.2);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
