/* RoadWork — hand-written styles, no framework. Light and dark themes via CSS variables. */

:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --border: #e1e4e9;
  --border-strong: #c7cdd5;
  --text: #18202a;
  --text-muted: #5a6573;
  --brand: #17212b;
  --brand-text: #f8fafc;
  --brand-muted: #c3cdd8;
  --lane: #f2b705;
  --primary: #1d5fd1;
  --primary-hover: #174fae;
  --primary-soft: #e8f0fd;
  --drive: #1d5fd1;
  --drive-soft: #edf3fd;
  --stay: #0e7c66;
  --stay-soft: #e3f4ef;
  --option: #9a5b06;
  --option-soft: #fdf1dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --success: #067647;
  --success-soft: #e6f6ee;
  --info-soft: #eaf2fd;
  --star: #e8a400;
  --google-credit: #5e5e5e; /* Google's attribution colors: #5E5E5E, #1F1F1F or white */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 9%);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1319;
    --surface: #151c24;
    --surface-muted: #1a232d;
    --border: #273240;
    --border-strong: #3a4757;
    --text: #e6eaef;
    --text-muted: #9ba6b4;
    --brand: #0a0f14;
    --primary: #6ea8ff;
    --primary-hover: #8dbbff;
    --primary-soft: #16263d;
    --drive: #6ea8ff;
    --drive-soft: #142236;
    --stay: #3cc9a6;
    --stay-soft: #102d27;
    --option: #f0b45a;
    --option-soft: #33260f;
    --danger: #ff8a7d;
    --danger-soft: #3a1714;
    --success: #4ad295;
    --success-soft: #0f2d20;
    --info-soft: #16263d;
    --star: #f5c040;
    --google-credit: #ffffff;
    --shadow: 0 1px 2px rgb(0 0 0 / 45%);
  }
}

/* ---- Base ---------------------------------------------------------------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0 0 0.5rem;
  line-height: 1.25;
}

h1 {
  font-size: 1.75rem;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.2rem;
}

h3 {
  font-size: 1rem;
}

p {
  margin: 0 0 0.75rem;
}

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

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-inline: 20px; /* horizontal only, so sections can set their own vertical padding */
}

.skip-link {
  position: absolute;
  left: -9999px;
}

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

.skip-link:focus {
  left: 12px;
  top: 12px;
  z-index: 1000;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
}

.icon {
  flex-shrink: 0;
  vertical-align: -3px;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 0.875rem;
}

address {
  font-style: normal;
}

/* ---- Header & footer ------------------------------------------------------ */

.site-header {
  position: relative;
  background: var(--brand);
  color: var(--brand-text);
}

/* Dashed lane line along the bottom of the header. */
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: repeating-linear-gradient(90deg, var(--lane) 0 28px, transparent 28px 48px);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  min-height: 62px;
  padding-top: 8px;
  padding-bottom: 11px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-text);
  font-size: 1.15rem;
  font-weight: 700;
}

.brand:hover {
  text-decoration: none;
}

.brand .icon {
  color: var(--lane);
}

.main-nav {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 4px;
}

.main-nav a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--brand-muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.main-nav a:hover {
  color: #fff;
  background: rgb(255 255 255 / 8%);
  text-decoration: none;
}

.main-nav a[aria-current="page"] {
  color: #fff;
  background: rgb(255 255 255 / 15%);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--brand-muted);
  font-size: 0.9rem;
}

.user-menu form {
  margin: 0;
}

.btn.btn-header {
  color: #e6ecf2;
  background: transparent;
  border-color: rgb(255 255 255 / 28%);
}

.btn.btn-header:hover {
  background: rgb(255 255 255 / 10%);
}

main {
  flex: 1;
  padding-top: 28px;
  padding-bottom: 48px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding-top: 16px;
  padding-bottom: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---- Page structure --------------------------------------------------------- */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header p {
  margin: 0;
  color: var(--text-muted);
}

.page-header p.route {
  margin-top: 6px;
  color: var(--text);
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-header .eyebrow {
  margin-bottom: 4px;
}

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

.actions form {
  margin: 0;
}

.card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 1.05rem;
}

.card-title .icon {
  color: var(--text-muted);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 22px 0 10px;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-sidebar {
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  align-items: start;
}

.stack > * + * {
  margin-top: 20px;
}

/* ---- Buttons & badges ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--surface-muted);
  text-decoration: none;
}

.btn-primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

@media (prefers-color-scheme: dark) {
  .btn-primary {
    color: #08111d;
  }
}

.btn-danger {
  color: var(--danger);
  background: transparent;
  border-color: currentColor;
}

.btn-danger:hover {
  background: var(--danger-soft);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.btn-link {
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: 0;
  cursor: pointer;
}

.btn-link:hover {
  text-decoration: underline;
}

.inline-form {
  display: inline;
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  vertical-align: 1px;
}

.badge-upcoming {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: transparent;
}

.badge-travel,
.badge-option,
.badge-warn {
  color: var(--option);
  background: var(--option-soft);
  border-color: transparent;
}

.badge-in_progress {
  color: var(--stay);
  background: var(--stay-soft);
  border-color: transparent;
}

/* ---- Messages ---------------------------------------------------------------- */

.messages {
  display: grid;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.message {
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.message-success {
  color: var(--success);
  background: var(--success-soft);
  border-color: transparent;
}

.message-info {
  background: var(--info-soft);
  border-color: transparent;
}

.message-warning {
  color: var(--option);
  background: var(--option-soft);
  border-color: transparent;
}

.message-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}

/* ---- Trip pieces ------------------------------------------------------------------ */

.route {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.route-arrow {
  color: var(--text-muted);
}

.featured-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.featured-title {
  margin-bottom: 4px;
  font-size: 1.5rem;
}

.featured-title a {
  color: var(--text);
}

.week {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.day {
  min-height: 98px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-top: 4px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.day-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
}

.day-name {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.day-date {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.today-tag {
  padding: 0 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
}

.day-headline {
  margin-top: 6px;
  font-weight: 600;
  line-height: 1.3;
}

.day-detail {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.day-drive_out,
.day-drive_home {
  background: var(--drive-soft);
  border-top-color: var(--drive);
}

.day-stay {
  border-top-color: var(--stay);
}

.day-option {
  background: var(--option-soft);
  border-top-color: var(--option);
}

.day-home {
  opacity: 0.65;
}

.day-today {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.windows {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.window {
  padding: 12px 16px;
  background: var(--surface-muted);
  border-left: 4px solid var(--drive);
  border-radius: var(--radius-sm);
}

.window-early_return {
  border-left-color: var(--option);
}

.window-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}

.window-name {
  display: grid;
  gap: 2px;
}

/* The early drive home is folded away: its heading opens it. */
.window-summary {
  display: block;
  cursor: pointer;
  list-style: none;
}

.window-summary::-webkit-details-marker {
  display: none;
}

.window-summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

.window-fold {
  display: inline-flex;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

details[open] > .window-summary .window-fold {
  transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
  .window-fold {
    transition: none;
  }
}

/* "Recommended" on the early drive home: meant to be seen while it's folded. */
.badge-recommended {
  gap: 5px;
  padding: 4px 12px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--surface);
  background: var(--sev-0);
  border-color: transparent;
}

.window-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.window-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.window-notes {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.coming-next {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 0;
  padding: 12px 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

.coming-next .icon {
  margin-top: 2px;
  color: var(--option);
}

.map {
  height: 340px;
  overflow: hidden;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.map-embed {
  display: block;
  width: 100%;
}

.map-big {
  height: 520px;
}

/* ---- Trip tabs (Weather, Evenings, Routing: each its own page) ------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  margin: -8px 0 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
  text-decoration: none;
}

.tab[aria-current="page"] {
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.nws-clear {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  color: var(--success);
}

.map-label {
  font-weight: 600;
}

/* ---- Lists ------------------------------------------------------------------------- */

.list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.list > .list-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.list-item-main {
  flex: 1 1 260px;
  min-width: 0;
}

.list-item-title {
  font-weight: 600;
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 12px 0 0;
  font-size: 0.95rem;
}

.kv dt {
  color: var(--text-muted);
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 3px 10px;
  font-size: 0.85rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.location-ok {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.location-ok .icon {
  color: var(--stay);
}

.location-missing {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.empty {
  padding: 40px 20px;
  text-align: center;
}

.empty > .icon {
  color: var(--text-muted);
}

.empty p {
  max-width: 46ch;
  margin: 8px auto 16px;
  color: var(--text-muted);
}

.onboarding {
  margin-bottom: 20px;
}

/* ---- Forms ---------------------------------------------------------------------------- */

.form {
  max-width: 800px;
}

.form-card {
  max-width: 560px;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.form-section {
  min-width: 0;
  margin: 0 0 28px;
  padding: 0 0 24px;
  border: 0;
  border-bottom: 1px solid var(--border);
}

.form-section > legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.form-section-help {
  margin: -4px 0 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.subsection {
  margin: 18px 0 10px;
  font-size: 0.95rem;
}

.subsection .muted {
  font-weight: 400;
}

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.fields-1 {
  grid-template-columns: 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-wide {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.92rem;
  font-weight: 600;
}

.field .optional {
  margin-left: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 400;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="time"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field-checkbox label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checkbox-grid label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 500;
}

/* A choice between a few options, each with a line about what it means. */
.choice-field {
  min-width: 0;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.choice-field > legend {
  margin-bottom: 8px;
  padding: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.choice-list label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  height: 100%;
  padding: 10px 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.choice-list label:has(input:checked) {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.choice-list label:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.7;
}

.choice-list .help {
  display: block;
  margin-top: 2px;
  font-weight: 400;
}

input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.help {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.help ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.error {
  margin: 0;
  color: var(--danger);
  font-size: 0.88rem;
}

.has-error input,
.has-error select,
.has-error textarea {
  border-color: var(--danger);
}

.form-errors {
  margin-bottom: 18px;
  padding: 12px 16px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
}

.form-errors p {
  margin: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.disclosure {
  padding: 0 16px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.disclosure > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  font-weight: 600;
  cursor: pointer;
}

.disclosure[open] {
  padding-bottom: 16px;
}

.disclosure[open] > summary {
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* ---- Auth pages ------------------------------------------------------------------------- */

.auth {
  max-width: 420px;
  margin: 24px auto;
}

.auth .card {
  padding: 28px;
}

.auth h1 {
  font-size: 1.5rem;
}

.auth-brand {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 10px;
  color: var(--lane);
  background: var(--brand);
  border-radius: 12px;
}

.auth-alt {
  margin: 16px 0 0;
  text-align: center;
}

/* ---- Small screens ------------------------------------------------------------------------ */

@media (max-width: 860px) {
  .grid-sidebar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 1.45rem;
  }

  .container {
    padding-inline: 16px;
  }

  .user-name {
    display: none;
  }

  /* Phone header: brand and log out on the first row, nav links across the second. */
  .header-inner {
    gap: 6px 12px;
  }

  .user-menu {
    order: 2;
    margin-left: auto;
  }

  .main-nav {
    order: 3;
    flex: 1 1 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -10px;
  }

  .main-nav a {
    padding: 6px 10px;
    white-space: nowrap;
  }

  .kv {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .kv dt {
    margin-top: 6px;
  }

  .week {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---- Travel outlook ----------------------------------------------------------------------- */

:root {
  --sev-0: #0e7c66;
  --sev-1: #a3620a;
  --sev-2: #c2410c;
  --sev-3: #b42318;
  --sev-0-soft: #e3f4ef;
  --sev-1-soft: #fdf1dc;
  --sev-2-soft: #fde7da;
  --sev-3-soft: #fdecea;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sev-0: #3cc9a6;
    --sev-1: #f0b45a;
    --sev-2: #ff9a62;
    --sev-3: #ff8a7d;
    --sev-0-soft: #102d27;
    --sev-1-soft: #33260f;
    --sev-2-soft: #3a1f12;
    --sev-3-soft: #3a1714;
  }
}

.sev-0 {
  --sev: var(--sev-0);
  --sev-soft: var(--sev-0-soft);
}

.sev-1 {
  --sev: var(--sev-1);
  --sev-soft: var(--sev-1-soft);
}

.sev-2 {
  --sev: var(--sev-2);
  --sev-soft: var(--sev-2-soft);
}

.sev-3 {
  --sev: var(--sev-3);
  --sev-soft: var(--sev-3-soft);
}

.badge.sev {
  color: var(--sev);
  background: var(--sev-soft);
  border-color: transparent;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.card-head .card-title {
  margin-bottom: 0;
}

.card-head form {
  margin: 0;
}

.advice-headline {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 6px;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
}

.advice-headline .icon {
  margin-top: 3px;
  color: var(--primary);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 8px 0 0;
  padding: 8px 12px;
  color: var(--option);
  background: var(--option-soft);
  border-radius: var(--radius-sm);
}

.outlook-windows {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

/* Updating on its own: a status line with a small spinner, older content dimmed. */
.outlook-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
  color: var(--text-muted);
}

.outlook-status:empty {
  display: none;
}

.is-updating .outlook-status::before {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: outlook-spin 0.9s linear infinite;
}

@keyframes outlook-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-updating .outlook-status::before {
    animation: none;
  }
}

.outlook.is-updating .advice-headline,
.outlook.is-updating .outlook-windows,
.outlook-summary.is-updating .advice-headline {
  opacity: 0.6;
}

/* National Weather Service alerts and the second-opinion forecast. */
.nws-alerts {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.nws-alert {
  padding: 8px 12px;
  background: var(--sev-soft);
  border-left: 4px solid var(--sev);
  border-radius: 4px;
}

.nws-alert summary {
  cursor: pointer;
}

.nws-alert summary .icon,
.nws-summary .icon {
  color: var(--sev, var(--option));
  vertical-align: -2px;
}

.nws-alert p {
  margin: 6px 0 0;
}

.nws-note {
  margin: 8px 0 0;
}

.nws-note .icon {
  vertical-align: -2px;
}

.nws-summary {
  margin: 4px 0;
}

.outlook-window {
  padding: 14px 16px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.outlook-window.is-inactive {
  opacity: 0.7;
}

.window-advice {
  margin: 8px 0 0;
}

.departures {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.departure {
  display: flex;
  flex-direction: column;
  min-width: 88px;
  padding: 6px 10px;
  font-size: 0.82rem;
  line-height: 1.3;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--sev);
  border-radius: var(--radius-sm);
}

button.departure {
  font-family: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.departure:hover {
  border-color: var(--primary);
  border-left-color: var(--sev);
}

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

/* The time you're looking at (the recommended one, until you pick another). */
.departure.is-selected {
  background: var(--primary-soft);
  border-color: var(--primary);
  border-left-color: var(--sev);
  box-shadow: 0 0 0 1px var(--primary);
}

.departure.is-best:not(.is-selected) {
  border-color: var(--primary);
  border-left-color: var(--sev);
}

.departure-summary {
  margin: 12px 0 0;
}

.plan-time {
  margin: 10px 0 0;
}

.plan-note {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 10px 0 0;
  color: var(--sev-0);
  font-weight: 600;
}

/* Your planned time, when the advice suggests a different one. */
.departure.is-goal:not(.is-best) {
  border-style: dashed;
  border-left-style: solid;
}

.window-goal {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.departure-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.departure-rating {
  color: var(--text-muted);
}

.departure-traffic {
  color: var(--option);
  font-weight: 600;
}

.route-detail {
  margin-top: 10px;
}

.route-detail > summary {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}

.checkpoints {
  display: grid;
  gap: 3px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.checkpoint {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 2px 12px;
  padding: 6px 10px;
  font-size: 0.86rem;
  background: var(--surface);
  border-left: 4px solid var(--sev);
  border-radius: 4px;
}

.checkpoint-time {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.early-return {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 0;
  padding: 10px 14px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
}

.early-return .icon {
  margin-top: 3px;
  color: var(--primary);
}

.outlook-notes {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.outlook-source {
  margin: 14px 0 0;
}

.outlook-summary {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.outlook-summary .advice-headline {
  margin: 0 0 4px;
  font-size: 1rem;
}

@media (max-width: 640px) {
  .map-big {
    height: 380px;
  }

  .tab {
    padding: 10px;
  }

  .checkpoint {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .checkpoint-weather {
    grid-column: 2;
  }
}

/* ---- Stops on the drive, evenings ------------------------------------------------------------ */

.stops {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.stops-title {
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text-muted);
}

.stop-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stop-head {
  font-size: 0.9rem;
}

.stop-head .icon {
  margin-right: 2px;
  color: var(--option);
}

.stop-options {
  margin: 2px 0 0 20px;
  line-height: 1.6;
}

.drive-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: 12px 0 0;
}

.nights {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.night {
  padding: 8px 12px;
  background: var(--surface-muted);
  border-left: 4px solid var(--sev);
  border-radius: 4px;
}

.night-head {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  align-items: baseline;
}

.night-plan {
  margin-top: 2px;
  font-size: 0.92rem;
}

.picks-grid {
  margin-top: 4px;
}

/* Other restaurants nearby: as many columns as fit. */
.picks-others {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
}

.others-intro {
  margin: -4px 0 10px;
}

/* ...and the ones closed on the nights you're there, folded away behind a button. */
.others-closed {
  margin-top: 12px;
}

.others-closed > summary {
  width: fit-content;
  list-style: none;
}

.others-closed > summary::-webkit-details-marker {
  display: none;
}

.others-closed > summary .icon-chevron {
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.others-closed[open] > summary {
  margin-bottom: 10px;
}

.others-closed[open] > summary .icon-chevron {
  transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
  .others-closed > summary .icon-chevron {
    transition: none;
  }
}

.section-count {
  padding: 1px 7px;
  font-size: 0.75rem;
  letter-spacing: 0;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.picks {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pick {
  position: relative; /* for the note button in its top right corner */
  padding: 10px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.pick-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  padding-right: 30px; /* room for the note button */
}

/* What Claude found on the web about whether a place is open; amber when it isn't. */
.pick-checked {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin: 4px 0;
}

.pick-checked .icon {
  flex: none;
  margin-top: 2px;
}

.pick-checked.is-warn {
  color: var(--option);
  font-weight: 600;
}

/* Your note on a place: the button in the top right corner of its box... */
.note-toggle {
  position: absolute;
  z-index: 1; /* above a closed place's dimmed name, which is drawn over it otherwise */
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.note-toggle:hover,
.note-toggle:focus-visible {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-strong);
}

.note-toggle.has-note {
  color: var(--option);
  background: var(--option-soft);
  border-color: color-mix(in srgb, var(--option) 35%, transparent);
}

/* ...the pop-up to write it in (centered, over a dimmed page)... */
.note-popup {
  width: min(28rem, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgb(16 24 40 / 25%);
}

.note-popup::backdrop {
  background: rgb(10 15 20 / 40%);
}

.note-title {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.note-popup textarea {
  min-height: 7.5rem;
}

.note-help {
  margin: 6px 0 0;
}

.note-status {
  margin: 4px 0 0;
  color: var(--danger);
}

.note-status:empty {
  display: none;
}

.note-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.note-actions .note-delete {
  margin-left: auto;
}

/* ...and the note itself, in the place's box. */
.pick-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 6px 0;
  padding: 6px 8px;
  background: var(--option-soft);
  border-left: 3px solid var(--option);
  border-radius: var(--radius-sm);
}

.pick-note .icon {
  flex: none;
  margin-top: 2px;
  color: var(--option);
}

.pick-note p {
  margin: 0;
  overflow-wrap: anywhere;
}

.pick-name {
  font-weight: 600;
}

.pick-why {
  margin: 4px 0;
  font-size: 0.92rem;
}

/* A place's star rating and its hours on the nights you're there, in one box under its
   name. What's Google's is set apart and credited, as Google's terms require. */
.pick-facts {
  display: grid;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  margin: 6px 0;
  padding: 4px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.fact {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 6px;
  align-items: start;
  margin: 0;
}

.fact .icon {
  margin-top: 3px;
}

.fact .icon-star {
  color: var(--star);
  fill: currentColor;
}

/* Hours in amber when it's closed on one of the nights you're there. */
.fact.is-warn {
  color: var(--option);
  font-weight: 600;
}

.fact .google-credit,
.fact-source {
  margin-left: 4px;
}

/* Where hours from the map data came from, next to Google's rating. */
.fact-source {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
}

/* A pick that turned out to be closed every night you're there: flagged, not suggested.
   (Google's rating and credit stay at full strength: Google asks that they stay legible.
   So do your note and its button.) */
.pick.is-closed > :not(.pick-facts, .pick-note, .pick-checked, .note-toggle, .note-popup) {
  opacity: 0.55;
}

.google-credit {
  font-family: Roboto, Arial, sans-serif;
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
  color: var(--google-credit);
  white-space: nowrap; /* Google: don't wrap "Google Maps" onto two lines */
}

/* ---- Spacing utilities (last, so they win over component defaults) ---------------------- */

.mt-sm {
  margin-top: 8px;
}

.mt {
  margin-top: 16px;
}

.mt-lg {
  margin-top: 24px;
}

/* Updates (administrators) */
.update-card > * + * {
  margin-top: 12px;
}

.update-changes {
  max-height: 22rem;
  overflow: auto;
  margin: 0;
  padding: 12px;
  font-size: 0.875rem;
  white-space: pre-wrap;
  background: var(--option-soft);
  border-radius: var(--radius-sm);
}

/* Administrators' pages */
.manage-form {
  max-width: 34rem;
}

.key-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* The administrators' menu: down the left on a wide screen, the usual row of tabs on a
   narrow one. */
.admin-main {
  min-width: 0;
}

.admin-layout > .side-nav {
  margin-top: 0;
}

@media (min-width: 861px) {
  .admin-layout {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
  }

  .side-nav {
    position: sticky;
    top: 16px;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    overflow: visible;
    border-bottom: 0;
  }

  .side-nav .tab {
    margin: 0;
    padding: 9px 12px;
    border-bottom: 0;
    border-left: 3px solid transparent;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  }

  .side-nav .tab:hover {
    background: var(--surface-muted);
  }

  .side-nav .tab[aria-current="page"] {
    border-left-color: var(--primary);
    background: var(--primary-soft);
  }
}

/* Settings: the HTTPS certificate */
.plain-table {
  width: 100%;
  border-collapse: collapse;
}

.plain-table th,
.plain-table td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.plain-table thead th {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.plain-table tbody th {
  font-weight: 400;
  overflow-wrap: anywhere;
}

.plain-table td p {
  margin: 6px 0 0;
}

.fingerprint {
  overflow-wrap: anywhere;
  font-size: 0.8rem;
}

.choice {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice legend {
  margin-bottom: 12px;
  padding: 0;
  font-weight: 600;
}

.choice-option {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.choice-option > label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.choice-option > p {
  margin: 0;
}

.choice-option:has(> label input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* Sharing a trip with groups */
.shared-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.9rem;
}

.check-list {
  display: grid;
  gap: 8px;
}

.check-list label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
}

.field > .label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

/* Admin, Settings: how Let's Encrypt is getting on */
.cert-progress {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.cert-progress-title {
  margin: 0;
  font-size: 1rem;
}

.cert-attempt {
  display: grid;
  gap: 10px;
}

.cert-attempt + .cert-attempt {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.cert-attempt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.cert-attempt p {
  margin: 0;
}

.cert-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cert-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.cert-step-mark {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}

.cert-step-done .cert-step-mark {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.cert-step-failed .cert-step-mark {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.cert-step-doing .cert-step-mark {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.cert-step-waiting .cert-step-text {
  color: var(--text-muted);
}

.cert-step-doing .cert-step-text {
  font-weight: 600;
}

.cert-step-detail {
  display: block;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.cert-step-failed .cert-step-detail {
  color: var(--danger);
}

.cert-record {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.cert-record-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.cert-record-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 14px;
  margin: 0;
}

.cert-record-list dt {
  color: var(--text-muted);
}

.cert-record-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.cert-error {
  overflow-wrap: anywhere;
}

.cert-log summary {
  cursor: pointer;
  font-weight: 600;
}

.cert-log-lines {
  max-height: 22rem;
  margin: 10px 0 0;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cert-log-error {
  color: var(--danger);
}

.cert-log-debug {
  color: var(--text-muted);
}

.cert-before {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--option-soft);
  color: var(--option);
}
