/* ═══════════════════════════════════════════════════════════
   TOUR MANAGER — Styles
   Dark theme, mobile-first. Shares the OHTTEK Touring OS
   design language with the Transport app.
   ═══════════════════════════════════════════════════════════ */

/* ── Design tokens (dark = default) — MONOCHROME ───────────────
   Black/dark-grey + white only. Status is NOT carried by hue: it's
   carried by treatment (inversion / fill / weight) + the text labels.
   The status tokens below are a neutral greyscale hierarchy so any
   rule that still references them stays on-palette:
     urgent (red)    → brightest (white)
     positive (green/teal) → light grey
     info (blue/amber/purple) → mid grey
   ──────────────────────────────────────────────────────────── */
:root {
  /* Surfaces — neutral dark grey, true black-ish */
  --bg:       #141414;
  --bg2:      #1c1c1c;
  --bg3:      #242424;
  --bg4:      #2e2e2e;
  --bg5:      #3a3a3a;
  --border:   #383838;
  --border-l: #4d4d4d;

  /* Text — white → grey */
  --tx1: #f5f5f5;
  --tx2: #b0b0b0;
  --tx3: #868686;

  /* Accent — white */
  --ac:      #ffffff;
  --ac-dim:  #d6d6d6;
  --ac-bg:   rgba(255,255,255,.08);
  --ac-glow: rgba(255,255,255,.12);

  /* Status → greyscale (meaning comes from treatment + labels, not hue) */
  --green:  #dadada; --green-bg:  rgba(255,255,255,.10);
  --amber:  #a8a8a8; --amber-bg:  rgba(255,255,255,.07);
  --red:    #ffffff; --red-bg:    rgba(255,255,255,.16);
  --blue:   #a8a8a8; --blue-bg:   rgba(255,255,255,.07);
  --purple: #a8a8a8; --purple-bg: rgba(255,255,255,.07);
  --teal:   #dadada; --teal-bg:   rgba(255,255,255,.10);

  /* Radii — squared off (sharp, editorial UI) */
  --radius:    0;
  --radius-sm: 0;
  --radius-lg: 0;

  /* Layout */
  --nav-h: 64px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px;

  /* Typography (NEW) */
  --font-display: 'Lora', Georgia, 'Times New Roman', serif;
  --font-body:    'Lora', Georgia, 'Times New Roman', serif;
  --font-mono:    'Lora', Georgia, 'Times New Roman', serif;

  color-scheme: dark;
}

/* ── Light theme — MONOCHROME (white / grey / black) ───────── */
body.light {
  --bg:       #ececec;
  --bg2:      #ffffff;
  --bg3:      #f4f4f4;
  --bg4:      #e6e6e6;
  --bg5:      #d8d8d8;
  --border:   #d2d2d2;
  --border-l: #b8b8b8;

  --tx1: #121212;
  --tx2: #555555;
  --tx3: #6e6e6e;

  --ac:      #121212;
  --ac-dim:  #333333;
  --ac-bg:   rgba(0,0,0,.06);
  --ac-glow: rgba(0,0,0,.08);

  /* Status → greyscale (urgent = darkest/black, the rest mid greys) */
  --green:  #3a3a3a; --green-bg:  rgba(0,0,0,.08);
  --amber:  #555555; --amber-bg:  rgba(0,0,0,.06);
  --red:    #000000; --red-bg:    rgba(0,0,0,.13);
  --blue:   #555555; --blue-bg:   rgba(0,0,0,.06);
  --purple: #555555; --purple-bg: rgba(0,0,0,.06);
  --teal:   #3a3a3a; --teal-bg:   rgba(0,0,0,.08);

  color-scheme: light;
}
body.light input, body.light select, body.light textarea { color-scheme: light; }

/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--tx1);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

input, select, textarea, button { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--ac); text-decoration: none; }

/* ── Display / mono typography ────────────────────────────── */
.page-header h2,
.modal-hd h3,
.empty-state p {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.3px;
}
.tour-hero-name,
.cl-hero-name,
.stage-title {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.4px;
}
.stage-count,
.parsed-event-date,
#conn-chip {
  font-family: var(--font-mono);
}

/* ── Focus-visible (a11y) ─────────────────────────────────── */
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
/* .form-input has its own :focus ring (border-color + box-shadow), so suppress
   the generic outline only for it. The segmented/filter/pin controls keep a
   dedicated inset ring so keyboard focus is always visible. */
.form-input:focus-visible { outline: none; }
.pin-digit:focus-visible,
.seg-btn:focus-visible,
.filter-btn:focus-visible {
  outline: 2px solid var(--ac); outline-offset: -2px;
}

/* ── Inert background while a dialog is open ───────────────────
   When a modal opens, the app shell + bottom nav are marked [inert].
   Native inert (all current browsers) already blocks focus/pointer/AT;
   this rule is a defensive fallback for any engine without it and gives
   a subtle "disabled" affordance. The modal/backdrop/toasts are never
   inert, so they stay fully interactive. */
[inert] {
  pointer-events: none;
  cursor: default;
  user-select: none;
}

/* ── App shell ────────────────────────────────────────────── */
/* Bottom inset = nav height + iPhone home-indicator safe area */
#app { position: fixed; inset: 0 0 calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)) 0; overflow: hidden; }

/* Top padding reserves a band for the fixed language pill (top-left) and
   connection chip (top-right) so they never overlap the page header / back link. */
.page { display: none; flex-direction: column; height: 100%; overflow: hidden; padding-top: 38px; }
.page.active { display: flex; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s4) var(--s4) var(--s3);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.page-header h2 { font-size: 18px; font-weight: 600; }

.page-body {
  flex: 1; overflow-y: auto; padding: var(--s4);
  -webkit-overflow-scrolling: touch;
}

/* ── Bottom navigation ────────────────────────────────────── */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; background: var(--bg2); border-top: 1px solid var(--border); z-index: 100;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: var(--s2) 0; color: var(--tx3); transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn.active { color: var(--ac); }
.nav-btn:active { background: var(--bg3); }
.nav-icon { font-size: 20px; line-height: 1; }
/* Text-only bottom nav — labels carry the whole button, so bump legibility */
.nav-label { font-size: 13px; font-weight: 600; letter-spacing: 0.2px; }
.nav-btn.active .nav-label { font-weight: 700; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 10px var(--s4); border-radius: var(--radius);
  font-size: 14px; font-weight: 600;
  transition: opacity 0.15s, background 0.15s; white-space: nowrap; line-height: 1.4;
}
.btn:active { opacity: 0.8; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--ac); color: var(--bg); }
.btn-primary:hover { background: var(--ac-dim); }
.btn-ghost { background: var(--bg3); color: var(--tx2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg4); }
.btn-danger { background: var(--bg3); color: var(--tx1); border: 1px solid var(--border-l); font-weight: 700; }
.btn-danger:hover { background: var(--bg4); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Auth screen (LIVE sign-in / sign-up / create band) ───── */
#auth-screen {
  position: fixed; inset: 0; z-index: 400;
  background: var(--bg);
  display: none; align-items: center; justify-content: center;
  padding: var(--s4); overflow-y: auto;
}
.auth-card {
  width: 100%; max-width: 360px;
  background: var(--bg2); border: 1px solid var(--border);
  padding: var(--s6) var(--s5);
  display: flex; flex-direction: column; gap: var(--s3);
}
.auth-brand {
  font-family: var(--font-display); font-weight: 800; font-size: 24px;
  letter-spacing: -0.4px; color: var(--tx1);
}
.auth-sub { font-size: 14px; color: var(--tx2); line-height: 1.5; margin-bottom: var(--s2); }
.auth-error {
  font-size: 13px; font-weight: 600; color: var(--tx1);
  background: var(--red-bg); border: 1px solid var(--border-l);
  padding: var(--s2) var(--s3);
}
.auth-toggle { font-size: 13px; color: var(--tx3); text-align: center; margin-top: var(--s2); }
.auth-toggle a { color: var(--tx1); font-weight: 600; text-decoration: underline; cursor: pointer; }

/* ── Band members + grants (admin Settings) ───────────────── */
.member-row {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) 0; border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }
.member-row-main { flex: 1; min-width: 0; }
.member-name { font-size: 14px; font-weight: 600; color: var(--tx1); }
.member-email { font-size: 12px; color: var(--tx3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-tag {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--bg4); color: var(--tx2); padding: 1px 5px;
}
.role-badge {
  flex-shrink: 0; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--tx2); border: 1px solid var(--border-l); padding: 2px 8px;
}
.grant-row {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) 0;
}
.grant-tour { flex: 1; min-width: 0; font-size: 14px; color: var(--tx1); overflow-wrap: anywhere; }
.grant-seg { flex: 0 0 auto; }
.grant-seg .seg-btn { padding: 6px 10px; font-size: 12px; min-height: 36px; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s4); }
.form-group:last-child { margin-bottom: 0; }
.form-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--tx3); }
.form-input {
  background: var(--bg4); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px var(--s3); color: var(--tx1); width: 100%; outline: none; transition: border-color 0.15s;
  font-size: 16px;   /* >=16px globally to avoid iOS focus-zoom on all touch devices, not just <=768px */
}
.form-input:focus { border-color: var(--ac); box-shadow: 0 0 0 3px var(--ac-bg); }
.form-input::placeholder { color: var(--tx2); }  /* tx2 for strict WCAG AA (4.5:1) on the input surface */
select.form-input { font-size: 16px; }
textarea.form-input { resize: vertical; min-height: 70px; font-size: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.form-hint { font-size: 11px; color: var(--tx3); margin-top: 4px; }
.lbl-opt { color: var(--tx3); font-weight: 400; }

/* Form section grouping label (S3-2 modal: Day-of times / Venue contact) */
.form-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--tx3);
  margin: var(--s4) 0 var(--s2); padding-top: var(--s3);
  border-top: 1px solid var(--border);
}
.form-section-label .lbl-opt { letter-spacing: 0.3px; }

/* Segmented control (owner / status picker) */
.seg { display: flex; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.seg-status { flex-wrap: wrap; }
.seg-btn {
  flex: 1; padding: 7px 10px; font-size: 13px; font-weight: 500;
  border-radius: 0; background: transparent; color: var(--tx3);
  transition: background 0.15s, color 0.15s; white-space: nowrap;
}
.seg-btn.active { background: var(--bg4); color: var(--tx1); }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 0;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase;
}
.badge::before {
  content: ''; width: 4px; height: 4px; border-radius: 0;
  background: currentColor; flex-shrink: 0;
}
.badge-ready   { background: transparent; color: var(--tx1); border: 1px solid var(--border-l); }
.badge-missing { background: var(--ac);   color: var(--bg);   border: 1px solid var(--ac); }

/* ── Icon button ──────────────────────────────────────────── */
.icon-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: 14px; color: var(--tx3); transition: background 0.15s;
  -webkit-tap-highlight-color: transparent; flex-shrink: 0;
}
.icon-btn:hover, .icon-btn:active { background: var(--bg4); color: var(--tx1); }

/* Compact text action button (row Edit / Delete) — replaces emoji icon-btns */
.row-action {
  flex-shrink: 0; padding: 8px 12px; min-height: 40px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.2px;
  color: var(--tx2); background: var(--bg3); border: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}
.row-action:hover, .row-action:active { background: var(--bg4); color: var(--tx1); }

/* ── Tour hero (Shows tab) ────────────────────────────────── */
.tour-hero {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--s4); margin-bottom: var(--s4);
}
.tour-hero-top { display: flex; align-items: center; justify-content: space-between; }
.tour-hero-switch { text-align: left; background: none; border: none; padding: 0; flex: 1; min-width: 0; cursor: pointer; }
.tour-hero-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--tx3); }
.tour-hero-switch:hover .tour-hero-label { color: var(--ac); }
.tour-hero-name { font-size: 22px; font-weight: 700; color: var(--tx1); margin-top: 2px; }

/* Tour switcher modal */
.tour-rows { display: flex; flex-direction: column; gap: var(--s2); }
.tour-row {
  display: flex; align-items: center; gap: var(--s2);
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--s2) var(--s3);
}
.tour-row-active { border-color: var(--ac); background: var(--ac-bg); }
.tour-row-main { flex: 1; min-width: 0; text-align: left; background: none; border: none; padding: 6px 0; cursor: pointer; }
.tour-row-name { display: block; font-size: 15px; font-weight: 600; color: var(--tx1); }
.tour-row-meta { display: block; font-size: 12px; color: var(--tx3); margin-top: 1px; }
.tour-row-check { color: var(--ac); font-weight: 700; padding: 0 var(--s2); }
.tour-hero-sub { font-size: 13px; color: var(--tx2); margin-top: var(--s3); }

/* Progress ring */
.ring-wrap { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.ring-bg { fill: none; stroke: var(--bg4); stroke-width: 5; }
.ring-fg { fill: none; stroke: var(--ac); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 0.4s ease; }
.ring-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--tx1);
}

/* ── Show cards ───────────────────────────────────────────── */
.show-list { display: flex; flex-direction: column; gap: var(--s3); }
.show-card {
  display: flex; align-items: center; gap: var(--s3);
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--s4); cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.show-card:hover { background: var(--bg3); border-color: var(--ac); }
.show-card-main { flex: 1; min-width: 0; }
.show-card-head { display: flex; align-items: center; gap: var(--s2); margin-bottom: 3px; }
.show-venue { font-size: 15px; font-weight: 600; color: var(--tx1); }
.show-meta { font-size: 13px; color: var(--tx3); margin-bottom: var(--s2); }
.show-progress-text { font-size: 12px; color: var(--tx3); margin-top: 5px; }
.show-card-actions { display: flex; align-items: center; gap: var(--s2); flex-shrink: 0; }
.show-chevron { font-size: 22px; color: var(--tx3); }

/* Progress bar */
.progress-bar { height: 6px; background: var(--bg4); border-radius: 0; overflow: hidden; }
.progress-fill { height: 100%; background: var(--tx1); border-radius: 0; transition: width 0.3s ease; }

/* ── Checklist hero ───────────────────────────────────────── */
.cl-hero {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--s4); margin-bottom: var(--s4);
}
.cl-back { font-size: 13px; color: var(--ac); font-weight: 500; margin-bottom: var(--s3); padding: 0; }
.cl-hero-name { font-size: 20px; font-weight: 700; color: var(--tx1); }
.cl-hero-sub { font-size: 13px; color: var(--tx2); margin: 2px 0 var(--s3); }
.cl-hero-stats { display: flex; flex-wrap: wrap; gap: var(--s3); font-size: 12px; color: var(--tx3); margin-top: var(--s2); }

/* Per-show key info (S3-2) — label/value grid in the checklist hero */
.cl-keyinfo {
  display: grid; grid-template-columns: auto 1fr; gap: 5px var(--s3);
  margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--border);
}
.ki-row { display: contents; }
.ki-label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px; color: var(--tx3);
  align-self: baseline; white-space: nowrap;
}
.ki-val { font-size: 13px; color: var(--tx1); min-width: 0; overflow-wrap: anywhere; }
.ki-tel { color: var(--tx1); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.ki-tel:hover { color: var(--ac); }

/* Day-sheet action (S3-3) in the checklist hero / run-sheet action in tour hero */
.cl-hero-actions,
.tour-hero-actions { display: flex; gap: var(--s2); margin-top: var(--s3); }

/* Day-sheet preview (S3-3) inside the modal */
.daysheet-preview {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.55;
  color: var(--tx1); background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--s3);
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 50vh; overflow-y: auto;
}
.stat-missing { color: var(--tx1); font-weight: 700; }
.stat-ready { color: var(--tx2); font-weight: 600; }

/* Owner filter */
.owner-filter {
  display: flex; gap: var(--s2); margin-bottom: var(--s4);
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px;
}
.filter-btn {
  flex: 1; padding: 7px; min-height: 44px; font-size: 13px; font-weight: 500; color: var(--tx3);
  border-radius: 0; transition: background 0.15s, color 0.15s;
}
.filter-btn.active { background: var(--bg4); color: var(--tx1); }

/* ── Stage sections ───────────────────────────────────────── */
.stage { margin-bottom: var(--s5); }
.stage-head {
  display: flex; align-items: center; gap: var(--s2);
  margin-bottom: var(--s2); padding-bottom: var(--s2); border-bottom: 1px solid var(--border);
}
.stage-title { font-size: 14px; font-weight: 600; color: var(--tx1); flex: 1; }
.stage-count { font-size: 12px; font-weight: 600; color: var(--tx3); background: var(--bg3); padding: 2px 8px; border-radius: 0; }
.stage-actions { display: flex; gap: 4px; flex-shrink: 0; }
.stage-add,
.stage-menu {
  width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--bg3);
  border: 1px solid var(--border); color: var(--tx2); font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.stage-add:hover,
.stage-menu:hover { background: var(--bg4); color: var(--tx1); }
.stage-menu { letter-spacing: 1px; }   /* widen the ⋯ glyph for legibility */

/* ── Action sheet (stage bulk actions) ─────────────────────── */
.action-sheet { display: flex; flex-direction: column; gap: var(--s2); }
.action-sheet-sub {
  font-size: 12px; color: var(--tx3); padding: 0 0 var(--s2);
  border-bottom: 1px solid var(--border); margin-bottom: var(--s1);
}
.action-sheet-row {
  width: 100%; text-align: left; padding: 14px var(--s4); border-radius: var(--radius-sm);
  background: var(--bg3); border: 1px solid var(--border); color: var(--tx1);
  font-size: 15px; font-weight: 500; transition: background 0.15s;
  min-height: 48px;
}
.action-sheet-row:hover { background: var(--bg4); }
.action-sheet-row.action-sheet-danger { color: var(--red); }
.action-sheet-row.action-sheet-danger:hover { background: var(--bg4); }
.stage-tasks { display: flex; flex-direction: column; gap: var(--s2); }
.stage-empty { font-size: 12px; color: var(--tx3); font-style: italic; padding: var(--s2) 0; }

/* ── Task rows ────────────────────────────────────────────── */
.task-row {
  display: flex; align-items: center; gap: var(--s3);
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--s2) var(--s3); transition: border-color 0.15s;
}
.task-row.status-missing { border-color: var(--border-l); }
.task-row.status-done { opacity: 0.72; }

.status-chip {
  width: 44px; height: 44px; border-radius: 0; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; border: 1.5px solid var(--border);
  background: var(--bg3); color: var(--tx3); transition: all 0.15s;
}
.status-chip.status-open    { background: var(--bg3); color: var(--tx3); border-color: var(--border); }
.status-chip.status-missing { background: var(--ac);  color: var(--bg);  border-color: var(--ac); font-weight: 800; }
.status-chip.status-sent    { background: var(--bg4); color: var(--tx2); border-color: var(--border-l); }
.status-chip.status-done    { background: var(--bg2); color: var(--tx2); border-color: var(--border); }

.task-main {
  flex: 1; min-width: 0; min-height: 44px; cursor: pointer;
  display: flex; flex-direction: column; justify-content: center; text-align: left;
}
.task-title { font-size: 14px; color: var(--tx1); line-height: 1.35; }
.task-row.status-done .task-title { text-decoration: line-through; color: var(--tx2); }
.task-notes { font-size: 12px; color: var(--tx3); margin-top: 2px; }
.task-status-label { font-size: 11px; font-weight: 600; }
.task-meta-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); margin-top: 2px; }
/* Due-date pill (S3-4) — neutral when upcoming, red when overdue */
.task-due {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 0;
  background: var(--bg4); color: var(--tx2); white-space: nowrap;
}
.task-due-over { background: var(--ac); color: var(--bg); }
.status-text-tx3   { color: var(--tx3); }
.status-text-red   { color: var(--red); }
.status-text-blue  { color: var(--blue); }
.status-text-green { color: var(--green); }

.task-link {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  background: var(--bg3); border: 1px solid var(--border); text-decoration: none;
  transition: background 0.15s;
}
.task-link:hover { background: var(--bg4); }

.owner-chip {
  flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 8px 12px; border-radius: 0;
  min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: 0.3px; border: 1px solid transparent;
}
.owner-blue  { background: var(--bg4); color: var(--tx1); border-color: var(--border-l); }
.owner-amber { background: transparent; color: var(--tx2); border-color: var(--border-l); }

/* ── Needs attention (alerts) ─────────────────────────────── */
.alert-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--s3) var(--s4); margin-bottom: var(--s4);
}
.alert-stat { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 0; }
.alert-stat-overdue { background: var(--ac); color: var(--bg); }
.alert-stat-missing { background: transparent; color: var(--tx1); border: 1px solid var(--border-l); }
.alert-stat-open { background: var(--bg4); color: var(--tx2); }
.alert-stat-sub { font-size: 12px; color: var(--tx3); }

.alert-group { margin-bottom: var(--s4); }
.alert-group-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2);
  margin-bottom: var(--s2); padding-bottom: var(--s2); border-bottom: 1px solid var(--border);
}
.alert-group-venue { font-size: 14px; font-weight: 600; color: var(--tx1); }
.alert-group-meta { font-size: 12px; color: var(--tx3); }

.alert-row {
  display: flex; align-items: center; gap: var(--s3);
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--s2) var(--s3); margin-bottom: var(--s2); cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.alert-row:hover { background: var(--bg3); border-color: var(--ac); }
.alert-row.status-missing { border-color: var(--border-l); }
.alert-row-overdue { border-color: var(--border-l); border-left: 3px solid var(--ac); }
.alert-row-main { flex: 1; min-width: 0; }
.alert-row-title { font-size: 14px; color: var(--tx1); }
.alert-row-meta { font-size: 12px; color: var(--tx3); margin-top: 1px; }

/* ── Settings cards ───────────────────────────────────────── */
.set-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--s4); margin-bottom: var(--s4);
}
.set-card-title { font-size: 10px; font-weight: 700; color: var(--tx3); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: var(--s3); }
.set-btn-col { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s3); }
.set-about .me-notes { margin-bottom: 0; }
.me-notes { font-size: 13px; color: var(--tx2); margin-bottom: var(--s3); line-height: 1.6; }
.ical-url-row { display: flex; gap: var(--s2); }
.ical-url-row .form-input { flex: 1; }

/* ── Calendar import ──────────────────────────────────────── */
.file-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s2); padding: var(--s5); margin-top: var(--s3);
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.file-drop:hover { border-color: var(--ac); background: var(--ac-bg); }
.file-drop-icon { font-size: 26px; }
.file-drop-text { font-size: 13px; color: var(--tx3); }
.cal-empty-msg { font-size: 13px; color: var(--tx3); font-style: italic; padding: var(--s3) 0; }

/* ── Task attachments (per-task files) ────────────────────── */
.att-list { display: flex; flex-direction: column; gap: var(--s2); }
.att-empty { font-size: 13px; color: var(--tx3); font-style: italic; padding: var(--s2) 0; margin: 0; }
.att-row {
  display: flex; align-items: center; gap: var(--s2);
  background: var(--bg3); border: 1px solid var(--border); border-radius: 0; padding: var(--s2) var(--s3);
}
.att-icon {
  flex-shrink: 0; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px; color: var(--tx3);
  background: var(--bg4); border: 1px solid var(--border);
  background-size: cover; background-position: center; overflow: hidden;
}
.att-icon-img { color: transparent; border-color: var(--border-l); }
.att-drop.att-dragover { border-color: var(--ac); background: var(--ac-bg); }
.att-open {
  flex: 1; display: flex; align-items: baseline; gap: var(--s2); min-width: 0;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left; color: var(--tx1);
}
.att-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px; text-decoration: underline; text-underline-offset: 2px; }
.att-open:hover .att-name { color: var(--ac); }
.att-size { font-size: 11px; color: var(--tx3); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.att-del {
  flex-shrink: 0; width: 28px; height: 28px; background: none; border: 1px solid var(--border);
  color: var(--tx3); cursor: pointer; font-size: 12px; line-height: 1;
}
.att-del:hover { color: var(--tx1); border-color: var(--border-l); }
.att-drop { margin-top: var(--s2); padding: var(--s3); }
/* "N files" chip on a task row (mirrors the due badge) */
.task-files {
  font-size: 11px; color: var(--tx3); border: 1px solid var(--border);
  padding: 1px 6px; white-space: nowrap;
}

.parsed-list { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s2); }
.parsed-event {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--s3) var(--s4);
}
.parsed-event-added { opacity: 0.6; }
.parsed-event-info { flex: 1; min-width: 0; }
.parsed-event-date { font-size: 11px; color: var(--blue); font-weight: 700; margin-bottom: 2px; }
.parsed-event-name { font-size: 14px; color: var(--tx1); font-weight: 500; }
.parsed-event-loc  { font-size: 12px; color: var(--tx3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Empty state / loading ────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 50px var(--s4); gap: var(--s3); min-height: 260px;
}
.empty-icon { font-size: 48px; line-height: 1; }
.empty-state p { color: var(--tx2); font-size: 15px; }
.empty-sub { color: var(--tx3) !important; font-size: 13px !important; max-width: 280px; }
.loading-spinner { padding: 40px; text-align: center; color: var(--tx3); font-size: 14px; }

/* ── Modal ────────────────────────────────────────────────── */
#modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 200; backdrop-filter: blur(2px); }
#modal-bg.open { display: block; }
#modal {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg2); border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border); border-bottom: none; z-index: 201;
  max-height: 90dvh; flex-direction: column; overflow: hidden;
  transform: translateY(20px); opacity: 0; transition: transform 0.2s ease, opacity 0.2s ease;
}
#modal.open { display: flex; transform: translateY(0); opacity: 1; }
.modal-hd { display: flex; align-items: center; justify-content: space-between; padding: var(--s4); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-hd h3 { font-size: 16px; font-weight: 600; }
.modal-close { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); font-size: 13px; color: var(--tx3); transition: background 0.15s, color 0.15s; }
.modal-close:hover { background: var(--bg3); color: var(--tx1); }
#modal-body { overflow-y: auto; padding: var(--s4); flex: 1; -webkit-overflow-scrolling: touch; }
#modal-foot { padding: var(--s3) var(--s4); border-top: 1px solid var(--border); display: flex; gap: var(--s3); justify-content: flex-end; flex-shrink: 0; }
.confirm-msg { font-size: 14px; line-height: 1.7; color: var(--tx2); padding: var(--s2) 0 var(--s4); }

/* ── Toasts ───────────────────────────────────────────────── */
#toasts {
  position: fixed; top: var(--s4); left: 50%; transform: translateX(-50%); z-index: 500;
  display: flex; flex-direction: column; gap: var(--s2); pointer-events: none;
  max-width: calc(100vw - 32px); min-width: 240px;
}
.toast {
  display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s4);
  border-radius: var(--radius); font-size: 14px; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4); animation: toast-in 0.2s ease; pointer-events: auto;
}
@keyframes toast-in { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast-s { background: var(--bg3); color: var(--tx1); border: 1px solid var(--border-l); }
.toast-e { background: var(--bg3); color: var(--tx1); border: 1px solid var(--ac); }
.toast-i { background: var(--bg3);      color: var(--tx2);   border: 1px solid var(--border); }
.toast-w { background: var(--bg3); color: var(--tx1); border: 1px solid var(--border-l); }

/* ── Connection chip ──────────────────────────────────────── */
#conn-chip {
  position: fixed; top: var(--s3); right: var(--s3); font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 0; z-index: 50; letter-spacing: 0.3px;
}
.conn-local { background: var(--bg3); color: var(--tx2); border: 1px solid var(--border); }
.conn-live  { background: var(--ac); color: var(--bg); border: 1px solid var(--ac); }

/* ── Language toggle (top-left, fixed — EN ⇄ DA) ──────────── */
.lang-toggle {
  position: fixed; top: var(--s3); left: var(--s3); z-index: 60;
  font-family: var(--font-body); font-size: 11px; font-weight: 700;
  letter-spacing: 1px; padding: 4px 9px; border-radius: 0;
  background: var(--bg2); color: var(--tx2); border: 1px solid var(--border);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.lang-toggle:hover { background: var(--bg3); color: var(--tx1); border-color: var(--border-l); }
.lang-toggle:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; }

/* ── Mobile polish (S2-5) ─────────────────────────────────── */
@media (max-width: 768px) {
  /* Prevent iOS auto-zoom on input focus (needs font-size ≥ 16px).
     .form-input/select/textarea already carry 16px globally. */
  .seg-btn { font-size: 16px; }
  .btn-sm { font-size: 14px; }

  /* The checklist controls (.status-chip, .task-link, .task-main, .owner-chip,
     .stage-add/.stage-menu, .filter-btn) now meet the WCAG 2.5.5 / iOS HIG 44px
     target at ALL widths from their base rules — no mobile-only override needed.
     The remaining shell controls only need the 44px treatment on touch widths. */
  .seg-btn     { min-height: 44px; }
  .icon-btn    { width: 44px; height: 44px; }
  .modal-close { width: 44px; height: 44px; }
  .nav-btn     { min-height: 48px; }

  /* Keep the modal clear of the home indicator */
  #modal-foot { padding-bottom: calc(var(--s3) + env(safe-area-inset-bottom, 0px)); }
}

/* ── Desktop tweaks ───────────────────────────────────────── */
@media (min-width: 769px) {
  #app, #bottom-nav { max-width: 540px; left: 50%; transform: translateX(-50%); }
  #modal { max-width: 540px; left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); border-radius: var(--radius); border-bottom: 1px solid var(--border); max-height: 85vh; }
  #modal.open { transform: translate(-50%, -50%); }
}
