/* ==========================================================================
   Stage Sprint — Podcast Booking Tracker
   Brand tokens sourced from podcastchallenge.lauriemabelis.com:
   Navy #000321 · Orange #ff6c00 · CTA #ff6240 · Muted #607179 · Grey #727171
   Type: Sora (headings) · Montserrat (labels, CTAs) · Inter (body)
   ========================================================================== */

:root{
  /* Ground · lifted from podcastchallenge.lauriemabelis.com */
  --navy: #000321;
  --navy-soft: #0d1029;
  --paper: #000321;
  --paper-raised: #0d1029;
  --surface-raised: #161b3a;

  /* Ink */
  --ink: #ffffff;
  --grey: #8996a0;
  --grey-soft: #607179;

  /* White tints, the dark-ground equivalent of the old navy washes */
  --tint-04: rgba(255,255,255,0.035);
  --tint-08: rgba(255,255,255,0.07);
  --tint-12: rgba(255,255,255,0.12);

  --orange: #ff6c00;
  --orange-dark: #e55f00;
  --orange-lift: #ff9147;   /* orange that still reads as text on navy */
  --cta: #ff6240;
  --cta-gradient: linear-gradient(135deg, #ff6c00 0%, #ff6240 100%);
  --orange-tint-10: rgba(255,108,0,0.10);
  --orange-tint-18: rgba(255,108,0,0.18);

  --line: rgba(255,108,0,0.14);
  --line-strong: rgba(255,255,255,0.18);

  --booked-ink: #8fb8ff;
  --booked-tint: rgba(143,184,255,0.16);

  --good: #3ddc97;
  --good-tint: rgba(61,220,151,0.14);
  --wait: #8996a0;
  --wait-tint: rgba(255,255,255,0.06);

  --font-display: 'Sora', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-label: 'Montserrat', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.35), 0 10px 30px rgba(0,0,0,0.35);
  --shadow-pop: 0 4px 14px rgba(0,0,0,0.45), 0 18px 44px rgba(0,0,0,0.5);
}


html{ color-scheme: dark; }
*{ box-sizing: border-box; }

/* An author `display` beats the browser's [hidden] rule, so elements we hide from
   JS (the sort bar, the open-link shortcut) stayed visible. Settle it once. */
[hidden]{ display: none !important; }
html{ -webkit-text-size-adjust: 100%; }

body{
  margin:0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3{ font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }

button{ font-family: inherit; }

/* ---------------------------------- Header ------------------------------- */

.app-header{
  background: var(--navy);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner{
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-lockup{
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark svg{ display:block; }

.brand-text{ display: flex; flex-direction: column; line-height: 1.15; }

.brand-name{
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.beta-chip{
  font-family: var(--font-label);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  background: var(--orange);
  color: var(--navy);
  padding: 2px 7px;
  border-radius: 100px;
}

.brand-sub{
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.02em;
}

.save-indicator{
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.06);
  padding: 6px 12px;
  border-radius: 100px;
  transition: background 0.25s ease, color 0.25s ease;
}

.save-indicator.just-saved{
  background: var(--orange-tint-18);
  color: #ffd8b8;
}

.save-dot{
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}

.save-indicator.just-saved .save-dot{ background: var(--orange); }

/* ----------------------------------- Main -------------------------------- */

.app-main{
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.page-head{ margin-bottom: 22px; }

.page-head h1{
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  line-height: 1.1;
}

.page-sub{
  margin: 8px 0 0;
  color: var(--grey);
  font-size: 15px;
  max-width: 780px;
}

/* ------------------------------- Phase nav ------------------------------- */

.phase-nav{
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}

.phase-tab{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px 12px;
  cursor: pointer;
  color: var(--grey);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.phase-tab:hover:not(.phase-tab-disabled){ color: var(--ink); }

.phase-tab .phase-num{
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
}

.phase-tab .phase-label{
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: inherit;
}

.phase-tab.active{
  color: var(--ink);
  border-bottom-color: var(--orange);
}

.phase-tab-disabled{
  cursor: default;
  opacity: 0.45;
}

.phase-tab-disabled .phase-label em{ font-style: normal; font-weight: 400; }

/* --------------------------------- Toolbar -------------------------------- */

.toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar-hint{
  margin: 0;
  color: var(--grey);
  font-size: 13.5px;
  max-width: 640px;
}

.toolbar-count{
  font-size: 12.5px;
  color: var(--grey-soft);
  font-weight: 500;
}

/* ---------------------------------- Buttons ------------------------------- */

.btn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn:active{ transform: translateY(1px); }

.btn-primary{
  background: var(--surface-raised);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-primary:hover{ background: #1e2450; border-color: rgba(255,255,255,0.3); }

/* Hero CTA · the pill treatment used across podcastchallenge.lauriemabelis.com */
.btn-cta{
  background: var(--cta-gradient);
  color: var(--navy);
  border-radius: 100px;
  padding: 12px 26px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(255,108,0,0.28);
}
.btn-cta:hover{ box-shadow: 0 6px 20px rgba(255,108,0,0.38); }

.btn-plus{ font-size: 15px; line-height: 1; font-weight: 700; }

.btn-secondary{
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-secondary:hover{ border-color: var(--orange); color: var(--orange); }

.btn-accent{
  background: var(--orange);
  color: var(--navy);
}
.btn-accent:hover{ background: var(--orange-dark); }

.btn-ghost{
  background: transparent;
  color: var(--grey);
  border-color: var(--line);
}
.btn-ghost:hover{ color: var(--ink); border-color: var(--line-strong); }

.btn-small{
  padding: 7px 12px;
  font-size: 12.5px;
}

/* Booked checkbox — a real checkbox, not a button, so the action reads as
   "check this off" rather than an ambiguous click target. */

.booked-checkbox{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  user-select: none;
}

.booked-checkbox input[type="checkbox"]{
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 21px;
  height: 21px;
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-raised);
  cursor: pointer;
  display: grid;
  place-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.booked-checkbox input[type="checkbox"]:hover{ border-color: var(--good); }

.booked-checkbox input[type="checkbox"]::before{
  content: "";
  width: 12px;
  height: 12px;
  transform: scale(0);
  transition: transform 0.12s ease;
  background: var(--navy);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 45% 62%);
}

.booked-checkbox input[type="checkbox"]:checked{
  background: var(--good);
  border-color: var(--good);
}

.booked-checkbox input[type="checkbox"]:checked::before{
  transform: scale(1);
}

/* ---------------------------------- Table --------------------------------- */

.table-scroll{
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-raised);
  box-shadow: var(--shadow-card);
  -webkit-overflow-scrolling: touch;
}

.tracker-table{
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}

.tracker-table thead th{
  text-align: left;
  font-family: var(--font-label);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--grey);
  background: var(--tint-04);
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}

.tracker-table tbody tr{
  border-bottom: 1px solid var(--line);
}

.tracker-table tbody tr:last-child{ border-bottom: none; }

.tracker-table tbody tr:hover{ background: var(--tint-04); }

.tracker-table td{
  padding: 14px 16px;
  vertical-align: top;
  font-size: 14px;
}

.col-status{ width: 190px; }
.col-name{ width: 200px; }
.col-date{ width: 150px; }
.col-link{ width: 200px; }
.col-notes{ width: 320px; }
.col-prep{ width: 290px; }
.col-extra{ width: 230px; }
.col-booked{ width: 140px; text-align: center; }

/* Phase 2 and 3 stack their reference fields into one column. */
.extra-field + .extra-field{ margin-top: 12px; }

/* The prep carried into Phase 3 reads rather than edits, so it is set as text
   and not as another row of inputs. */
.prep-recap{
  border-left: 2px solid var(--line);
  padding-left: 10px;
}

.prep-recap-line{
  margin: 0;
  font-size: 12px;
  color: var(--grey);
}

.prep-recap-empty{ font-style: italic; color: var(--grey-soft); }

.prep-recap-heading{
  margin: 9px 0 2px;
  font-family: var(--font-label);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-soft);
}

.prep-recap-text{
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
  white-space: pre-wrap;
}

/* Status cell */

.status-pill{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 100px;
  font-family: var(--font-label);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-pill.status-empty{ background: var(--tint-08); color: var(--grey); }
.status-pill.status-wait{ background: var(--wait-tint); color: var(--ink); }
.status-pill.status-followup{ background: var(--orange-tint-18); color: var(--orange-lift); }
.status-pill.status-booked{ background: var(--good-tint); color: var(--good); }

.status-sub{
  display: block;
  margin-top: 7px;
  font-size: 12px;
  color: var(--grey);
  line-height: 1.4;
}

.status-sub strong{ color: var(--ink); font-weight: 600; }

/* Inputs inside cells */

.cell-input, .cell-textarea{
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 7px 8px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cell-input:hover, .cell-textarea:hover{ background: var(--tint-04); }
.cell-input:focus, .cell-textarea:focus{
  outline: none;
  border-color: var(--orange);
  border-style: solid;
  background: var(--surface-raised);
}

/* An empty field should read as a question, not as blank table. The dashed
   outline says "type here"; the orange says "this one is not optional". Only
   the podcast name and the outreach date get the orange, so a new row shows at
   a glance what actually has to be filled in and the rest stays quiet. */

.cell-input.is-empty, .cell-textarea.is-empty{
  border-color: var(--line-strong);
  border-style: dashed;
  background: var(--tint-04);
}

.cell-input.is-empty::placeholder, .cell-textarea.is-empty::placeholder{
  color: var(--grey);
}

.cell-input.needs-input, .cell-textarea.needs-input{
  border-color: rgba(255,108,0,0.5);
  border-style: dashed;
  background: var(--orange-tint-10);
}

.cell-input.needs-input::placeholder, .cell-textarea.needs-input::placeholder{
  color: var(--orange-lift);
  opacity: 0.95;
}

input[type="date"].cell-input.needs-input{ color: var(--orange-lift); }

.name-input{
  font-weight: 600;
  font-size: 14.5px;
}

.cell-textarea{ resize: vertical; min-height: 40px; }

input[type="date"].cell-input{
  font-size: 13.5px;
  color: var(--ink);
}

/* color-scheme: dark already lightens the picker glyph, so no invert here.
   It just needs to stop being near-invisible. */
input[type="date"]::-webkit-calendar-picker-indicator{
  opacity: 0.55;
  cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover{ opacity: 1; }

.cell-input::placeholder, .cell-textarea::placeholder,
.inline-label input::placeholder, .inline-label textarea::placeholder{
  color: var(--grey-soft);
}

/* A pasted link is still a text field you can edit, with a shortcut out to it. */

.col-link{ position: relative; }

.cell-link-open{
  display: block;
  width: fit-content;
  margin: 5px 0 0;
  font-family: var(--font-label);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--grey);
  text-decoration: none;
  transition: color 0.15s ease;
}

.cell-link-open:hover{ color: var(--orange-lift); text-decoration: underline; }
.cell-link-open:focus-visible{ outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 4px; }

/* Notes + history cell */

.notes-cell{ min-width: 300px; }

/* Retired field, shown only where someone already wrote in it. */
.legacy-note{ margin-top: 12px; }

.history-list{
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 10px;
}

/* With no entries the list has nothing in it, so it must not hold open a gap
   between the general note and the button. */
.history-list:empty{ display: none; }

.history-list.is-expanded{ max-height: none; overflow: visible; }

.history-entry{
  background: var(--tint-04);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12.5px;
}

.history-entry-head{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding-right: 8px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 3px;
}

.history-tag{
  white-space: nowrap;
  font-family: var(--font-label);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 100px;
}

.history-tag.tag-outreach{ background: var(--tint-12); color: var(--ink); }
.history-tag.tag-followup{ background: var(--orange-tint-18); color: var(--orange-lift); }
.history-tag.tag-update{ background: var(--good-tint); color: var(--good); }
.history-tag.tag-booked{ background: var(--booked-tint); color: var(--booked-ink); }

.history-note{ color: var(--grey); line-height: 1.45; white-space: pre-wrap; }

.notes-actions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Inline forms (add update / follow up) */

.inline-form{
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 8px;
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inline-label{
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-label);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.inline-label input, .inline-label textarea{
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink);
  text-transform: none;
  letter-spacing: normal;
  background: var(--navy);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px;
  resize: vertical;
}

.inline-label input:focus, .inline-label textarea:focus{
  outline: none;
  border-color: var(--orange);
}

.inline-form-actions{
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 2px;
}

/* Booked cell */

.booked-cell{ text-align: center; }

.remove-row-btn{
  display: block;
  margin: 8px auto 0;
  font-size: 11px;
  color: var(--grey-soft);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.remove-row-btn:hover{ color: #ff8080; }

/* ------------------------------ Empty state ------------------------------- */

.empty-state{
  text-align: center;
  padding: 56px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--paper-raised);
}

.empty-title{
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
}

.empty-sub{
  color: var(--grey);
  font-size: 14px;
  margin: 0 0 18px;
}

/* ------------------------------- Backup panel ------------------------------ */

.backup-panel{
  margin-top: 36px;
  padding: 22px 24px;
  background: var(--tint-04);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.backup-copy h2{
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.backup-copy p{
  margin: 0;
  font-size: 13px;
  color: var(--grey);
  max-width: 520px;
  line-height: 1.5;
}

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

/* ---------------------------------- Footer -------------------------------- */

.app-footer{
  text-align: center;
  padding: 20px;
  color: var(--grey-soft);
  font-size: 12px;
}

/* ----------------------------------- Toast --------------------------------- */

.toast{
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 12px 20px;
  border-radius: 100px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
}

.toast.show{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.toast-error{ background: #7a1f1f; }

/* ---------------------------------- Mobile --------------------------------- */

/* ------------------- Prep + leverage checklists (Phase 2 / 3) --------------- */

.checklist{ margin-bottom: 10px; }

.checklist-progress{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  margin-bottom: 8px;
  border-radius: 100px;
  background: var(--tint-08);
  color: var(--grey);
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.checklist-progress.is-complete{
  background: var(--good-tint);
  color: var(--good);
}

.checklist-items{
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checklist-item{
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 4px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.checklist-item:hover{ background: var(--tint-04); }

.checklist-item input[type="checkbox"]{
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  margin: 1px 0 0;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-raised);
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.checklist-item input[type="checkbox"]:hover{ border-color: var(--good); }

.checklist-item input[type="checkbox"]::before{
  content: "";
  width: 9px;
  height: 9px;
  transform: scale(0);
  transition: transform 0.12s ease;
  background: var(--navy);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 45% 62%);
}

.checklist-item input[type="checkbox"]:checked{
  background: var(--good);
  border-color: var(--good);
}

.checklist-item input[type="checkbox"]:checked::before{ transform: scale(1); }
.checklist-item input[type="checkbox"]:focus-visible{ outline: 2px solid var(--orange); outline-offset: 2px; }

/* Ticked items step back so the eye lands on what is still outstanding. */
.checklist-item input[type="checkbox"]:checked + span{
  color: var(--grey);
  text-decoration: line-through;
  text-decoration-color: var(--grey-soft);
}

/* ------------------- Interview prep: logistics and content ----------------- */

/* Two halves of one cell. Logistics is a checklist because each item is done or
   not. Content is written, so it gets fields, not ticks. */

.prep-group-heading{
  font-family: var(--font-label);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--orange-lift);
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.prep-group-heading + .checklist{ margin-bottom: 16px; }

.content-fields{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.content-field + .content-field,
.content-fields + .content-field{ margin-top: 10px; }

.content-field-label{
  font-family: var(--font-label);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey);
  margin-bottom: 4px;
}

/* Phase 2 and 3 stack two or three controls in the status column. */
/* Two or three stacked controls, centred as a block rather than sitting side
   by side and wrapping mid-label. */
.booked-cell .booked-checkbox{
  display: flex;
  width: fit-content;
  margin: 0 auto;
}
.booked-cell .booked-checkbox + .booked-checkbox{ margin-top: 9px; }

/* ------------------------------ Sort bar (Phase 1) ------------------------- */

.sort-bar{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.sort-control{
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.sort-label{
  font-family: var(--font-label);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--grey-soft);
}

.sort-control select{
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 34px 8px 12px;
  cursor: pointer;
  /* caret drawn inline so nothing has to load from the network */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%238996a0' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 11px;
}

.sort-control select:hover{ border-color: rgba(255,255,255,0.3); }
.sort-control select:focus{ outline: none; border-color: var(--orange); }

/* --------------------- Editing a conversation entry ----------------------- */

.history-item{ display: flex; flex-direction: column; }

.history-entry{ position: relative; }

.history-entry-actions{
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 100px;
  background: var(--surface-raised);
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
  transition: opacity 0.15s ease;
}

.icon-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--grey);
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover{ color: var(--ink); background: var(--tint-08); border-color: var(--line-strong); }
.icon-btn-danger:hover{ color: #ff8080; background: rgba(255,90,90,0.12); border-color: rgba(255,90,90,0.4); }
.icon-btn:focus-visible{ outline: 2px solid var(--orange); outline-offset: 1px; }

/* Idle-hidden only where there is a real pointer. On touch they stay put,
   because there is no hover to reveal them with. */
@media (hover: hover){
  .history-entry-actions{ opacity: 0; }
  .history-entry:hover .history-entry-actions,
  .history-entry:focus-within .history-entry-actions{ opacity: 1; }
}

/* Touch devices have no hover to reveal them, so the buttons are always there
   and the entry header has to leave room rather than sit underneath. */
@media (hover: none){
  .history-entry-head{ padding-right: 60px; }
}

.history-entry.is-editing{
  border: 1px solid var(--orange);
  background: var(--orange-tint-10);
}

.history-edit-slot:not(:empty){ margin-top: 6px; }

.inline-hint{
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--grey);
}

/* ------------------------------ Toast action ------------------------------ */

.toast-text{ text-align: left; }

.toast-action{
  pointer-events: auto;
  flex-shrink: 0;
  border: 1px solid var(--orange);
  background: var(--orange-tint-18);
  color: var(--orange-lift);
  font-family: var(--font-label);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.toast-action:hover{ background: var(--orange); color: var(--navy); }

/* --------------------------------- Mobile ---------------------------------- */

/* A six-column table needs 1180px. Under about 900 that is no longer a table
   anyone can read, it is a horizontal scroll hunt, so each row becomes its own
   card and every cell carries the column name the hidden header used to give
   it (the data-label the row builders write). */

@media (max-width: 900px){
  .table-scroll{
    overflow: visible;
    border: none;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }

  .tracker-table{ min-width: 0; display: block; }
  .tracker-table thead{ display: none; }
  .tracker-table tbody{ display: block; }

  .tracker-table tbody tr{
    display: block;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    margin-bottom: 14px;
    overflow: hidden;
  }

  /* No hover on touch, and a stuck highlight on a card reads as selection. */
  .tracker-table tbody tr:hover{ background: var(--paper-raised); }
  .tracker-table tbody tr:last-child{ border-bottom: 1px solid var(--line); }

  .tracker-table td{
    display: block;
    width: auto;
    padding: 12px 14px;
  }

  .tracker-table td + td{ border-top: 1px solid var(--tint-08); }

  .tracker-table td[data-label]::before{
    content: attr(data-label);
    display: block;
    font-family: var(--font-label);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--grey);
    margin-bottom: 7px;
  }

  /* The status cell already says what it is, twice over. */
  .col-status[data-label]::before{ display: none; }

  .col-booked, .booked-cell{ text-align: left; }
  .booked-cell .booked-checkbox{ margin-left: 0; }
  .remove-row-btn{ margin: 10px 0 0; font-size: 13px; padding: 6px 0; }

  .notes-cell{ min-width: 0; }

  /* A scroll area inside a card inside a page is one scroll too many on touch. */
  .history-list{ max-height: none; overflow: visible; padding-right: 0; }

  /* 16px or iOS zooms the whole page in the moment a field takes focus, and
     never zooms back out. */
  .cell-input, .cell-textarea,
  .inline-label input, .inline-label textarea,
  .sort-control select{ font-size: 16px; }

  .name-input{ font-size: 16px; }
  .cell-textarea{ min-height: 52px; }

  /* Fingers, not cursors. */
  .icon-btn{ width: 40px; height: 40px; }
  .history-entry-head{ padding-right: 88px; }

  .checklist-item{ padding: 9px 4px; font-size: 13.5px; }
  .checklist-item input[type="checkbox"]{ width: 20px; height: 20px; margin-top: 0; }
  .checklist-item input[type="checkbox"]::before{ width: 12px; height: 12px; }

  .notes-actions .btn{ flex: 1 1 auto; justify-content: center; }
  .inline-form-actions{ justify-content: stretch; }
  .inline-form-actions .btn{ flex: 1; justify-content: center; }
}

@media (max-width: 720px){
  .app-header{ padding: 12px 16px; }
  .app-main{ padding: 20px 14px 48px; }
  .page-sub{ font-size: 14px; }
  .backup-panel{ flex-direction: column; align-items: flex-start; }
  .backup-actions{ width: 100%; }
  .backup-actions .btn{ flex: 1; justify-content: center; }
  .toolbar{ flex-direction: column; align-items: stretch; }
  .toolbar .btn-cta{ width: 100%; justify-content: center; }
  .btn{ min-height: 44px; }
  /* The sort control fills the width. It needs min-width:0, or the longest
     option keeps the select at full intrinsic width and pushes the whole page
     sideways. */
  .sort-bar{ align-items: stretch; max-width: 100%; }
  .sort-control{ width: 100%; min-width: 0; max-width: 100%; justify-content: space-between; }
  .sort-control select{ flex: 1 1 auto; min-width: 0; width: 100%; min-height: 40px; }

  /* Three tabs plus their phase numbers do not fit a phone. Let them slide
     rather than wrap into a second row that pushes the table down. */
  .phase-nav{
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .phase-nav::-webkit-scrollbar{ display: none; }
  .phase-tab{ flex: 0 0 auto; padding: 10px 14px 12px; }
  .phase-tab .phase-label{ font-size: 14px; }

  /* The save badge belongs on its own line here, not squeezed beside the mark. */
  .header-inner{ gap: 8px; }
  .save-indicator{ font-size: 11.5px; padding: 5px 10px; }

  .toast{
    left: 12px;
    right: 12px;
    bottom: 14px;
    transform: translateY(20px);
    max-width: none;
    border-radius: var(--radius-md);
    padding: 12px 16px;
  }
  .toast.show{ transform: translateY(0); }
  .toast-action{ padding: 8px 14px; }
}

@media (max-width: 420px){
  .app-main{ padding: 18px 10px 44px; }
  .tracker-table td{ padding: 11px 12px; }
  .brand-sub{ display: none; }
  .save-indicator .save-text{ font-size: 11px; }
  .phase-tab .phase-num{ font-size: 9px; }
  .status-pill{ font-size: 10px; }
}
