:root {
  /* Parchment, ink & Take Ivy — 1950s collegiate prep, refined */
  --green: #44563f;     /* muted moss */
  --yellow: #8a6d3b;    /* restrained bronze */
  --red: #7a3b34;       /* muted oxblood */
  --grey: #9a9384;      /* soft taupe-grey */
  --bg: #f5f3ee;        /* Rhodia notebook paper — clean barely-warm off-white */
  --surface: #edeae2;   /* slightly receded surface (header, chips) */
  --surface2: #e5e2d9;  /* wells, badges */
  --text: #2b3340;      /* deep navy ink */
  --text-muted: #7c776a;/* muted ink */
  --border: #ddd5c2;    /* faint rule */
  --accent: #34465f;    /* refined navy */
  --radius: 10px;
  --header-height: 88px;
}

/* Night mode — deep navy ground, gold lines/icons/accents, cream text */
:root[data-theme="night"] {
  --green: #7faa6a;     /* moss, lifted for dark ground */
  --yellow: #cdab5d;    /* gold */
  --red: #cc7d70;       /* warm oxblood */
  --grey: #8f876e;
  --bg: #0e1a30;        /* deep navy */
  --surface: #15243d;   /* raised navy (header, chips) */
  --surface2: #1d3050;  /* wells, badges */
  --text: #ece3cc;      /* cream */
  --text-muted: #b3a079;/* soft gold */
  --border: #8a7138;    /* gold rule */
  --accent: #cba85d;    /* gold accent */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Ensure [hidden] always wins over display rules set on specific elements */
[hidden] { display: none !important; }

body {
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Inline icon — sizes to the surrounding text, inherits its color */
.inline-icon {
  display: inline-flex;
  width: 1em;
  height: 1em;
  vertical-align: -0.13em;
}
.inline-icon svg {
  width: 100%;
  height: 100%;
}

/* Editorial label — uppercase, letter-spaced, for datelines & meta */
.label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.66rem;
  font-weight: 600;
}

#app {
  max-width: 600px;
  margin: 0 auto;
  padding-bottom: 80px;
  min-height: 100vh;
  background: var(--bg);
}

/* ── Header ─────────────────────────────────────────────────────────────── */

#header {
  padding: 16px 18px 11px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.trip-title {
  font-size: 1.4rem;
  font-weight: 600;
  font-variant-caps: small-caps;
  letter-spacing: 0.04em;
  line-height: 1.1;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trip-title .inline-icon svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
}

.home-link svg { width: 19px; height: 19px; }
.home-link:active { opacity: 0.6; }
@media (pointer: fine) {
  .home-link:hover { color: var(--text); border-color: var(--text); }
}

.header-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
}

.today-date {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text-muted);
}

.weather-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Trips screen (full-page, shown on login) ───────────────────────────── */

.trips-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.trips-screen-inner {
  max-width: 600px;
  margin: 0 auto;
  padding: 48px 0 48px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.trips-screen-head {
  padding: 0 18px 28px;
  border-bottom: 1px solid var(--border);
}

.trips-screen-title {
  font-size: 2rem;
  font-weight: 600;
  font-variant-caps: small-caps;
  letter-spacing: 0.06em;
  line-height: 1;
  margin-bottom: 6px;
}

.trips-screen-subtitle {
  color: var(--text-muted);
  margin: 0;
}

.trip-list {
  display: flex;
  flex-direction: column;
  padding: 10px 0;
}

.trip-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: background 0.1s;
}

.trip-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.trip-item-chevron {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.12s, color 0.12s;
}

.trip-item-chevron svg { width: 20px; height: 20px; }

.trip-item:last-child {
  border-bottom: none;
}

.trip-item:active {
  background: var(--surface2);
}

.trip-item.active {
  background: var(--surface2);
}

@media (pointer: fine) {
  .trip-item:hover {
    background: var(--surface2);
  }
  .trip-item:hover .trip-item-chevron {
    color: var(--text);
    transform: translateX(3px);
  }
}

.trip-item-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.trip-item-dates {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.trip-item-status {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.trip-item-status.current  { color: var(--green); }
.trip-item-status.upcoming { color: var(--yellow); }
.trip-item-status.past     { color: var(--grey); }

.trips-empty {
  padding: 20px 16px;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-muted);
}

.btn-new-trip {
  display: block;
  width: calc(100% - 32px);
  margin: 20px 16px 0;
  padding: 13px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-new-trip:active {
  opacity: 0.85;
}

/* ── New-trip form ───────────────────────────────────────────────────────── */

.new-trip-form {
  padding: 16px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ntf-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ntf-field label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.ntf-field input {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}

.ntf-field input:focus {
  border-color: var(--accent);
}

.ntf-row {
  display: flex;
  gap: 10px;
}

.ntf-row .ntf-field {
  flex: 1;
  min-width: 0;
}

.ntf-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
}

.ntf-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.ntf-actions {
  display: flex;
  gap: 10px;
}

.btn-ntf-cancel {
  flex: 1;
  padding: 12px;
  background: var(--surface2);
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-ntf-submit {
  flex: 2;
  padding: 12px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-ntf-submit:disabled {
  opacity: 0.5;
}

.ntf-error {
  font-size: 0.82rem;
  color: var(--red);
  margin: 0;
}

.ntf-hint {
  font-size: 0.74rem;
  font-style: italic;
  color: var(--text-muted);
  margin: 0;
}

/* Select reuses the field input styling */
.ntf-field select {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}

.ntf-field select:focus {
  border-color: var(--accent);
}

/* ── Admin: user access management ──────────────────────────────────────── */

/* Discreet admin link at the bottom of the trips list */
.admin-link {
  align-self: center;
  margin: 30px 16px 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  border-bottom: 1px dotted var(--border);
  padding-bottom: 1px;
  cursor: pointer;
}

.admin-link:active { opacity: 0.6; }
@media (pointer: fine) {
  .admin-link:hover { color: var(--text); border-bottom-color: var(--text); }
}

/* Admin page (full screen, like the trips screen) */
.admin-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-screen-inner {
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 18px 48px;
}

.admin-screen-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.admin-back {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  cursor: pointer;
}

.admin-back:active { opacity: 0.6; }
@media (pointer: fine) {
  .admin-back:hover { color: var(--text); }
}

.admin-screen-title {
  font-size: 2rem;
  font-weight: 600;
  font-variant-caps: small-caps;
  letter-spacing: 0.06em;
  line-height: 1;
  margin: 0;
}

.admin-section {
  margin-top: 20px;
  padding-top: 8px;
}

.admin-heading {
  color: var(--text-muted);
  margin-bottom: 12px;
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.user-row:last-child {
  border-bottom: none;
}

.user-row.revoked {
  opacity: 0.5;
}

.user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}

.user-role {
  font-size: 0.56rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 5px;
}

.user-meta {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.user-self {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.user-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.user-access,
.user-reset-logins {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}

.user-access {
  color: var(--red);
}

.user-access.restore {
  color: var(--green);
}

.user-access:active,
.user-reset-logins:active {
  opacity: 0.6;
}

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

.btn-add-user {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-add-user:active {
  opacity: 0.8;
}

/* Admin simulate panel — deliberately understated, set apart from Access */
.sim-panel {
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  opacity: 0.72;
}

.sim-panel-label {
  color: var(--text-muted);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

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

.sim-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.sim-chip .inline-icon svg { width: 13px; height: 13px; }

.sim-chip.active {
  border-color: var(--text);
  color: var(--text);
}

.sim-date-input {
  padding: 4px 8px;
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.72rem;
}

.sim-reset {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0 2px;
}

.add-user-form {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Shared footer sits at the bottom of the trips screen */
.trips-screen-inner > .app-footer {
  margin-top: auto;
  border-top: none;
}

/* ── Week strip ─────────────────────────────────────────────────────────── */

.week-strip {
  display: flex;
  justify-content: safe center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.week-strip::-webkit-scrollbar {
  display: none;
}

.day-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 46px;
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s, opacity 0.2s;
}

.day-chip:active {
  opacity: 0.7;
}

.day-note-slot {
  height: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.day-note-slot svg {
  width: 11px;
  height: 11px;
}

.day-label {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
  min-height: 0.55rem;
}

.day-label.depart, .day-label.return { color: var(--text-muted); }

.day-chip.is-today .day-num {
  background: var(--text);
  color: var(--bg);
  border-radius: 50%;
}

.day-time {
  font-size: 0.6rem;
  color: var(--text-muted);
  line-height: 1;
}

.day-dow {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.day-num {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
}

.day-remaining {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--yellow);
  line-height: 1;
}

.day-check {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1;
}

.day-chip.grey  .day-dot { background: var(--grey); opacity: 0.4; }
.day-chip.yellow .day-dot { background: var(--yellow); }
.day-chip.green  .day-dot { background: var(--green); }
.day-chip.red    .day-dot { background: var(--red); }

.day-chip.active {
  border-color: var(--text);
}

.day-chip.green.active  { border-color: var(--green); }
.day-chip.yellow.active { border-color: var(--yellow); }
.day-chip.red.active    { border-color: var(--red); }

/* ── Missed banner ──────────────────────────────────────────────────────── */

.missed-banner {
  background: var(--red);
  color: #f5f3ee;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  position: sticky;
  top: var(--header-height);
  z-index: 90;
  letter-spacing: 0.02em;
}

/* ── Day view ───────────────────────────────────────────────────────────── */

.day-view {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.day-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 2px 4px;
}

.day-note {
  font-family: 'Bodoni 72', 'Didot', 'Bodoni MT', 'Book Antiqua', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 400;
  font-style: italic;
  padding: 2px 4px;
  margin: 0;
}

.depart-note { color: var(--red); }
.return-note  { color: var(--green); }
.rain-note    { color: var(--blue, #4a6fa5); }

/* ── Group card ─────────────────────────────────────────────────────────── */

.group-card {
  padding-top: 14px;
}

.group-card.group-done {
  opacity: 0.75;
}

.group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
}

.group-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.group-icon svg {
  width: 100%;
  height: 100%;
}

.group-label {
  font-weight: 600;
  font-size: 1rem;
  font-variant-caps: small-caps;
  letter-spacing: 0.05em;
  flex: 1;
}

.group-timerange {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-muted);
}

.group-fraction {
  font-size: 0.75rem;
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.group-label.done {
  text-decoration: line-through;
  color: var(--text-muted);
}

.forgot-link {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 10px;
  flex-shrink: 0;
  margin: -10px -6px -10px -8px;
}

.forgot-link svg {
  width: 16px;
  height: 16px;
}

.forgot-link:active {
  opacity: 0.6;
}

/* ── Task row ───────────────────────────────────────────────────────────── */

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  transition: background 0.12s;
  user-select: none;
}


.task-row:active {
  background: var(--surface2);
}

.task-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--grey);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
  color: var(--bg);
  font-weight: 700;
}

.task-row.complete .task-checkbox {
  background: var(--green);
  border-color: var(--green);
}

.task-row.skipped .task-checkbox {
  background: var(--grey);
  border-color: var(--grey);
}

.task-row.missed .task-checkbox {
  border-color: var(--red);
}

.task-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.task-icon svg {
  width: 100%;
  height: 100%;
}

.task-detail-btn {
  display: none; /* shown only on pointer-capable devices via hover */
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 6px;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

/* Only reveal on devices with a fine pointer (mouse/trackpad, not touch) */
@media (pointer: fine) {
  .task-detail-btn { display: block; opacity: 0; transition: opacity 0.15s; }
  .task-row:hover .task-detail-btn { opacity: 1; }
  .task-detail-btn:hover { background: var(--surface2); color: var(--text); }
}

.task-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.task-title {
  font-size: 0.92rem;
  letter-spacing: 0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.task-row.complete .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-row.skipped .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-row.missed .task-title {
  color: var(--red);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.time-badge {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.4;
}

.missed-badge {
  background: rgba(122, 59, 52, 0.14);
  color: var(--red);
}

.skipped-badge {
  background: rgba(154, 140, 112, 0.22);
  color: var(--grey);
}

.skip-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ── Task notes (inline, under the row) ─────────────────────────────────── */

.task-notes {
  margin: 0 14px 8px 42px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-note {
  border-left: 2px solid var(--border);
  padding: 2px 0 2px 10px;
}

.task-note-body {
  font-size: 0.84rem;
  font-style: italic;
  line-height: 1.4;
  color: var(--text);
}

.task-note-meta {
  margin-top: 1px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ── Notes in the detail panel ──────────────────────────────────────────── */

.notes-section {
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.notes-heading {
  color: var(--text-muted);
  margin-bottom: 10px;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.notes-list .task-note {
  border-left-color: var(--accent);
  position: relative;
  padding-right: 28px;
}

.note-delete {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
}

.note-delete:active {
  opacity: 0.6;
}

.notes-empty {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.notes-section textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  resize: none;
  height: 64px;
  line-height: 1.4;
}

.notes-section textarea:focus {
  outline: 1px solid var(--grey);
}

.btn-add-note {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-add-note:active {
  opacity: 0.85;
}

/* ── Detail panel (bottom sheet) ────────────────────────────────────────── */

.detail-panel {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.detail-panel.open {
  opacity: 1;
  pointer-events: all;
}

.detail-panel-inner {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  padding: 20px 16px 36px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-panel.open .detail-panel-inner {
  transform: translateY(0);
}

.detail-close {
  float: right;
  background: var(--surface2);
  border: none;
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.detail-content h3 {
  font-size: 1.05rem;
  margin-bottom: 10px;
  margin-top: 4px;
  line-height: 1.3;
}

.detail-content p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 8px;
}

.detail-time {
  color: var(--yellow) !important;
  font-size: 0.8rem !important;
}

.detail-done {
  color: var(--green) !important;
  font-size: 0.8rem !important;
  display: flex;
  align-items: center;
  gap: 5px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn-complete,
.btn-skip {
  flex: 1;
  padding: 13px 8px;
  border-radius: var(--radius);
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-complete:active,
.btn-skip:active {
  opacity: 0.8;
}

.btn-complete {
  background: var(--green);
  color: var(--bg);
}

.btn-skip {
  background: var(--surface2);
  color: var(--text);
}

.skip-area {
  margin-top: 14px;
}

.skip-area textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.875rem;
  resize: none;
  height: 80px;
  font-family: inherit;
  line-height: 1.4;
}

.skip-area textarea:focus {
  outline: 1px solid var(--grey);
}

.btn-confirm-skip {
  width: 100%;
  margin-top: 10px;
  padding: 13px;
  background: var(--grey);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

/* ── Footer (user + logout) ─────────────────────────────────────────────── */

.app-footer {
  margin-top: 28px;
  padding: 22px 16px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-user {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
}

.theme-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.remember-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-muted);
  cursor: pointer;
}

.remember-label input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 7px 16px;
}

.theme-toggle:active {
  opacity: 0.7;
}

.print-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 7px 16px;
}

.print-btn:active {
  opacity: 0.7;
}

.logout-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0;
}

.logout-link:active {
  opacity: 0.6;
}

/* ── Error screen ───────────────────────────────────────────────────────── */

.error-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px;
  text-align: center;
  gap: 10px;
}

.error-screen p:first-child {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.error-screen p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ── Auth gate ─────────────────────────────────────────── */
.auth-gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.auth-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.auth-box h1 {
  font-size: 2.2rem;
  font-weight: 600;
  font-variant-caps: small-caps;
  letter-spacing: 0.06em;
  color: var(--text);
  margin: 0;
  line-height: 1;
}

.auth-subtitle {
  color: var(--text-muted);
  margin: -6px 0 4px;
}

.auth-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
  font-style: italic;
}

.auth-form {
  display: flex;
  gap: 8px;
  width: 100%;
}

.auth-form input {
  flex: 1;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.auth-form input:focus {
  border-color: var(--accent);
}

.auth-form button {
  padding: 12px 18px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-error {
  color: var(--red);
  font-size: 0.85rem;
  margin: 0;
}

/* ── Printable schedule ─────────────────────────────────────────────────── */

/* Hidden on screen; revealed only for print. */
.print-view { display: none; }

@media print {
  /* Hide the live app; show only the print sheet. */
  #app, #trips-screen, #auth-gate, #detail-panel { display: none !important; }

  .print-view {
    display: block !important;
    color: #000;
    background: #fff;
    font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
    line-height: 1.4;
  }

  @page { size: landscape; margin: 1.2cm; }

  .print-header { border-bottom: 2px solid #000; padding-bottom: 8pt; }
  .print-view h1 {
    font-size: 20pt;
    font-variant-caps: small-caps;
    letter-spacing: 0.04em;
    margin: 0;
  }
  .print-view h2 { font-size: 14pt; font-weight: 600; margin: 3pt 0 0; }
  .print-range { font-style: italic; font-size: 11pt; margin: 4pt 0 0; }

  .print-summary { margin-top: 10pt; font-size: 10.5pt; }
  .print-summary p { margin: 2pt 0; }

  .print-section { margin-top: 14pt; }
  .print-page-break { page-break-before: always; }

  .print-view h3 {
    font-size: 13pt;
    border-bottom: 1px solid #000;
    padding-bottom: 3pt;
    margin: 0 0 8pt;
  }
  .print-view h4 { font-size: 11pt; margin: 9pt 0 3pt; }

  .print-group, .print-day { page-break-inside: avoid; }

  .print-view ul { margin: 0 0 6pt; padding-left: 15pt; }
  .print-view li { margin: 3pt 0; font-size: 10.5pt; }

  .print-task-title { font-weight: 600; }
  .print-meta { font-style: italic; }
  .print-desc { font-size: 9.5pt; color: #222; margin-top: 1pt; }

  .print-time { font-style: italic; color: #444; font-size: 8.5pt; }

  .print-box {
    display: inline-block;
    width: 11pt;
    height: 11pt;
    border: 1.5px solid #000;
    flex-shrink: 0;
  }

  /* Landscape schedule table */
  .print-sched-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8.5pt;
    table-layout: fixed;
  }

  .print-sched-table thead th {
    border: 1px solid #000;
    padding: 4pt 3pt;
    text-align: center;
    font-weight: 700;
    font-size: 8pt;
    background: #f0f0f0;
  }

  .print-col-task {
    width: 32%;
    text-align: left !important;
    padding-left: 4pt !important;
  }

  .print-sched-table tbody td {
    border: 1px solid #ccc;
    padding: 3pt;
    vertical-align: middle;
  }

  .print-group-row td {
    background: #e8e8e8;
    font-weight: 700;
    font-size: 8pt;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3pt 4pt;
    border: 1px solid #aaa;
  }

  .print-task-cell {
    font-size: 8.5pt;
    line-height: 1.3;
  }

  .print-check-cell {
    text-align: center;
    width: auto;
  }
}
