:root {
  --plum: #7b2d4e;
  --plum-dark: #5c1f3a;
  --gold: #c8a04e;
  --gold-soft: #e8d3a2;
  --bg: #faf4ef;
  --card: #ffffff;
  --ink: #2c2230;
  --muted: #8a7d84;
  --line: #ece1e6;
  --green: #2e8b57;
  --shadow: 0 2px 10px rgba(92, 31, 58, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { font-family: 'Cormorant Garamond', Georgia, serif; margin: 0; }

/* The whole header group (banner + view switch + day tiles) sticks to the top
   as one unit, so it never half-collapses regardless of its (variable) height. */
.topstack {
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow);
}

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: linear-gradient(120deg, var(--plum), var(--plum-dark));
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.ring { font-size: 34px; line-height: 1; }
.brand h1 { font-size: 30px; font-weight: 700; letter-spacing: 0.5px; }
.brand .sub { margin: 0; font-size: 12px; opacity: 0.8; letter-spacing: 1.5px; text-transform: uppercase; }

.countdown {
  text-align: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(232, 211, 162, 0.4);
  border-radius: 12px;
  padding: 6px 18px;
}
.cd-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold-soft); }
.cd-value { font-size: 18px; font-weight: 700; white-space: nowrap; }

.clock {
  text-align: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(232, 211, 162, 0.4);
  border-radius: 12px;
  padding: 6px 16px;
}
.clk-date { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold-soft); }
.clk-time { font-size: 18px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

.me { display: flex; align-items: center; gap: 8px; }
.me-btn, .notify-btn {
  background: rgba(255, 255, 255, 0.14); color: #fff;
  border: 1px solid rgba(232, 211, 162, 0.45); border-radius: 20px;
  padding: 7px 14px; font-size: 13px;
}
.me-btn:hover, .notify-btn:hover { background: rgba(255, 255, 255, 0.26); }
.notify-btn.on { background: var(--gold); color: var(--plum-dark); border-color: var(--gold); }

.theme-toggle {
  background: rgba(255, 255, 255, 0.14); color: #fff;
  border: 1px solid rgba(232, 211, 162, 0.45); border-radius: 50%;
  width: 38px; height: 38px; font-size: 16px; flex: 0 0 auto; line-height: 1;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.26); }

.status { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; }
.presence { display: flex; align-items: center; gap: 6px; position: relative; cursor: pointer; }
.presence-list {
  display: none; position: absolute; top: 130%; right: 0; z-index: 60;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,0.3); padding: 8px;
  min-width: 170px; text-align: left; cursor: default;
}
.presence:hover .presence-list, .presence:focus .presence-list, .presence.open .presence-list { display: block; }
.pl-head { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 2px 4px 6px; }
.pl-row { display: flex; align-items: center; gap: 8px; padding: 4px 4px; font-size: 13px; }
.pl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: 0 0 auto; }
.pl-anon { color: var(--muted); font-style: italic; }
.presence .dot { width: 8px; height: 8px; border-radius: 50%; background: #9ad29a; box-shadow: 0 0 6px #9ad29a; }
.conn { opacity: 0.75; }
.conn.off { color: #ffb4b4; }
.sync-paused { font-size: 11px; color: var(--gold-soft); opacity: 0.9; }

/* "who's editing" flags */
.being-edited { position: relative; box-shadow: inset 3px 0 0 var(--gold); }
.edit-flag {
  position: absolute; top: -7px; right: 8px; z-index: 8;
  background: var(--gold); color: var(--plum-dark);
  font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2); pointer-events: none; white-space: nowrap;
}

/* ---- Day bar ---- */
.daybar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  overflow-x: auto;
  background: #fff;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.daytab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 8px 14px;
  cursor: pointer;
  text-align: left;
  min-width: 120px;
  transition: all 0.15s;
  font-family: inherit;
  color: var(--ink);
}
.daytab:hover { border-color: var(--gold); }
.daytab .dt-dow { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.daytab .dt-title { font-weight: 600; font-size: 14px; margin-top: 2px; }
.daytab .dt-meta { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 6px; align-items: center; }
.daytab.active { background: linear-gradient(120deg, var(--plum), var(--plum-dark)); color: #fff; border-color: var(--plum-dark); }
.daytab.active .dt-dow, .daytab.active .dt-meta { color: var(--gold-soft); }
.daytab.deadline { border-color: var(--gold); }
.daytab.deadline .dt-title::after { content: ' ★'; color: var(--gold); }
.daytab.active.deadline .dt-title::after { color: var(--gold-soft); }
.daytab .pill {
  background: var(--plum); color: #fff; border-radius: 20px;
  padding: 1px 7px; font-size: 10px; font-weight: 600;
}
.daytab.active .pill { background: var(--gold); color: var(--plum-dark); }
.daytab.today { box-shadow: 0 0 0 2px var(--gold-soft); }

/* ---- View switch bar ---- */
.viewbar {
  display: flex; gap: 8px; padding: 8px 20px; background: #fff;
  border-bottom: 1px solid var(--line);
}
.viewtab {
  background: transparent; color: var(--muted); border: 1px solid transparent;
  padding: 7px 16px; border-radius: 20px; font-size: 14px; font-weight: 600;
}
.viewtab:hover { background: var(--bg); color: var(--plum); }
.viewtab.active { background: linear-gradient(120deg, var(--plum), var(--plum-dark)); color: #fff; }
/* Recap link — sits to the far right of the view bar, opens the standalone page */
.recap-link { margin-left: auto; text-decoration: none; display: inline-flex; align-items: center; color: var(--gold); }
.recap-link:hover { background: var(--bg); color: var(--plum); }

/* ---- Seating planner ---- */
.seating { display: grid; grid-template-columns: 1fr 372px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .seating { grid-template-columns: 1fr; } }

.floorplan-wrap {
  position: relative; width: 100%; overflow: auto;
  background:
    linear-gradient(0deg, rgba(123,45,78,0.04) 1px, transparent 1px) 0 0 / 100% 40px,
    var(--card);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.floorplan { position: relative; width: 960px; height: 720px; transform-origin: top left; }
.undo-btn {
  position: absolute; top: 10px; right: 10px; z-index: 40;
  background: #fff; color: var(--plum-dark); border: 1px solid var(--line);
  padding: 7px 13px; font-size: 13px; border-radius: 20px; box-shadow: var(--shadow);
}
.undo-btn:hover:not(:disabled) { border-color: var(--gold); background: var(--bg); }
.undo-btn:disabled { opacity: 0.4; cursor: default; }
.fit-btn { right: auto; left: 10px; }

.fixture {
  position: absolute; display: grid; place-items: center; text-align: center;
  border-radius: 8px; font-size: 13px; font-weight: 700; color: #6b6168;
  background: #ece7ea; border: 1px dashed #c9bcc4; padding: 2px;
}
.fixture.fx-stage { background: #e3dde0; writing-mode: vertical-rl; transform: rotate(180deg); }
.fixture.fx-cake { border-radius: 50%; background: #f6ecef; color: var(--plum); border-style: solid; }
.fixture.fx-dj, .fixture.fx-entrance { background: #e8eef0; color: #4a6470; }

.ftable {
  position: absolute; display: flex; flex-direction: column; align-items: center;
  justify-content: center; cursor: grab; border: 2px solid; font-weight: 700;
  color: #2c2230; transition: box-shadow 0.12s, transform 0.08s; box-sizing: border-box;
}
.ftable, .fixture { touch-action: none; user-select: none; -webkit-user-select: none; }
.fixture { cursor: grab; }
.ftable.dragging, .fixture.dragging {
  opacity: 0.92; box-shadow: 0 8px 22px rgba(92, 31, 58, 0.35); z-index: 30; cursor: grabbing;
  transition: none;
}
.ftable.round { border-radius: 50%; }
.ftable.long, .ftable.head { border-radius: 8px; }
.ftable .ft-name { font-size: 14px; }
.ftable .ft-occ { font-size: 11px; opacity: 0.8; font-weight: 600; }
.ftable.fill-empty { background: #fff; border-color: #cdbfc7; color: var(--muted); }
.ftable.fill-some { background: #eef4ef; border-color: var(--green); }
.ftable.fill-full { background: #fbf2dd; border-color: var(--gold); }
.ftable.fill-over { background: #fbe4e4; border-color: #b3261e; color: #b3261e; }
.ftable.sel { box-shadow: 0 0 0 4px var(--gold-soft); transform: scale(1.04); z-index: 5; }
.ftable.hl { box-shadow: 0 0 0 4px var(--plum), 0 0 14px var(--plum); z-index: 6; }
.ftable.multi-sel, .fixture.multi-sel { outline: 3px solid var(--plum); outline-offset: 1px; z-index: 7; }
.floorplan { touch-action: none; }
.marquee {
  position: absolute; z-index: 25; pointer-events: none;
  border: 1.5px dashed var(--plum); background: rgba(123, 45, 78, 0.10);
}
.sel-hint, .floor-hint {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 41;
  bottom: 10px; padding: 5px 12px; border-radius: 20px; font-size: 12px; white-space: nowrap;
}
.sel-hint { background: var(--plum); color: #fff; font-weight: 600; box-shadow: var(--shadow); }
.floor-hint { background: rgba(0,0,0,0.45); color: #fff; opacity: 0.7; pointer-events: none; }

/* panel */
.seat-panel { display: flex; flex-direction: column; gap: 14px; }
.seat-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.seat-stats .stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 4px; text-align: center; box-shadow: var(--shadow);
}
.seat-stats .stat b { display: block; font-size: 20px; color: var(--plum); }
.seat-stats .stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

.seat-search input { width: 100%; }
.search-results:not(:empty) { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.sr-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.sr-row:hover { background: var(--bg); }
.sr-row .g-name { flex: 1; font-size: 14px; }
.sr-where { font-size: 12px; font-weight: 700; color: var(--plum); }
.sr-row.unseated .sr-where { color: var(--muted); }

.gdot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }

.table-card, .seat-controls, .guest-list {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; box-shadow: var(--shadow);
}
.tc-head { display: flex; align-items: center; gap: 10px; }
.tc-title { font-family: 'Cormorant Garamond', serif; font-size: 24px; font-weight: 700; color: var(--plum); flex: 1; }
.tc-occ { font-size: 13px; font-weight: 700; color: var(--green); }
.tc-occ.over { color: #b3261e; }
.tc-edit { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.tc-edit label { font-size: 12px; color: var(--muted); }
.cap-input { width: 64px; }
.tc-guests { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.tc-guest { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.tc-guest .g-name { flex: 1; font-size: 14px; }
.seat-here { margin-top: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; max-height: 160px; overflow-y: auto; }
.gchip {
  background: #fff; border: 1.5px solid var(--line); color: var(--ink);
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.gchip:hover { background: var(--bg); }
.danger-btn { width: 100%; margin-top: 12px; background: #fbe4e4; color: #b3261e; padding: 9px; font-size: 13px; }
.danger-btn:hover { background: #f6d2d2; }

.party-input { width: 56px; }
.seat-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mini-btn { background: var(--bg); border: 1px solid var(--line); color: var(--plum-dark); padding: 7px 12px; font-size: 13px; }
.mini-btn:hover { border-color: var(--gold); }
.bulk-area { margin-top: 10px; }
.bulk-area textarea {
  width: 100%; font-family: inherit; font-size: 16px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px; resize: vertical;
}

.gl-head { font-family: 'Cormorant Garamond', serif; font-size: 22px; font-weight: 700; color: var(--plum-dark); margin-bottom: 6px; }
.gl-group { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 0 4px; }
.guest-row { display: flex; flex-direction: column; gap: 6px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.gr-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.guest-row .g-name { flex: 1; min-width: 110px; font-size: 14px; }
.guest-row.unseated { background: #fffaf0; }
.guest-row.unseated .g-name::after { content: ' • unseated'; color: var(--gold); font-size: 11px; font-weight: 600; }
.count-edit { display: inline-flex; align-items: center; gap: 4px; }
.count-edit label { font-size: 11px; color: var(--muted); font-weight: 700; }
.count-input { width: 50px; padding: 6px 6px; text-align: center; }
.assign-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-left: 4px; }
.assign-lbl { font-size: 12px; color: var(--muted); }
.assign-select { max-width: 150px; font-size: 13px; padding: 5px 8px; }
.group-chip {
  display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto;
  background: transparent; border: 1px solid var(--line); border-radius: 20px; padding: 4px 7px;
}
.group-chip:hover { border-color: var(--gold); background: var(--bg); }
.gc-caret { font-size: 9px; color: var(--muted); line-height: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---- Main / views ---- */
main { padding: 20px; max-width: 1200px; margin: 0 auto; }
.dayhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.dayhead h2 { font-size: 36px; color: var(--plum); }
.dayhead .date { color: var(--muted); font-size: 15px; font-weight: 500; }
.dayhead .badge {
  background: var(--gold-soft); color: var(--plum-dark);
  padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.5px;
}
.progress-line { font-size: 13px; color: var(--muted); margin: 2px 0 22px; }

.cols { display: grid; grid-template-columns: 1fr 1.1fr; gap: 22px; align-items: start; }
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; } }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.panel-head h3 { font-size: 22px; color: var(--plum-dark); }
.panel-body { padding: 8px 18px 18px; }

/* ---- Itinerary timeline ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid; grid-template-columns: 84px 1fr auto; gap: 12px; align-items: center;
  padding: 11px 0; border-bottom: 1px dashed var(--line);
}
.timeline li:last-child { border-bottom: none; }
.timeline .time { font-weight: 700; color: var(--plum); font-size: 14px; }
.timeline .what { font-size: 15px; }
.timeline li.adhan { background: #f3f0fa; border-radius: 8px; }
.timeline li.adhan .time { color: #5b3a8a; }
.timeline li.adhan .what { color: #4a3470; font-weight: 600; }
.timeline .row-actions { transition: opacity 0.15s; }

/* ---- Live day progress: past / now / next ---- */
/* Elapsed items fade back; the in-progress item lights up; a "Now" marker
   floats between what's done and what's coming. */
.timeline li.past { opacity: 0.5; transition: opacity 0.2s; }
.timeline li.past .time { color: var(--muted); }
.timeline li.current {
  opacity: 1;
  background: rgba(46, 139, 87, 0.10);
  border-radius: 8px;
  border-bottom-color: transparent;
  box-shadow: inset 4px 0 0 var(--green);
  padding-left: 12px; padding-right: 8px;
}
.timeline li.current .time { color: var(--green); }
.timeline .now-marker {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-bottom: none; opacity: 1;
}
.now-marker .nm-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 4px rgba(46, 139, 87, 0.18); flex: 0 0 auto;
  animation: nmpulse 2s ease-in-out infinite;
}
.now-marker .nm-time {
  font-size: 12px; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--green); white-space: nowrap;
}
.now-marker::after {
  content: ''; flex: 1; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--green), transparent);
}
@keyframes nmpulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.16); }
  50% { box-shadow: 0 0 0 6px rgba(46, 139, 87, 0.05); }
}

/* ---- Tasks ---- */
.tasklist { list-style: none; margin: 0; padding: 0; position: relative; }
.task {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.task:last-child { border-bottom: none; }
.task .check {
  width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--gold);
  cursor: pointer; flex: 0 0 auto; display: grid; place-items: center;
  background: #fff; transition: all 0.15s; font-size: 15px; color: #fff;
}
.task .check:hover { border-color: var(--plum); }
.task.done .check { background: var(--green); border-color: var(--green); }
.task .body { flex: 1; min-width: 0; }
.task .text { font-size: 15px; word-break: break-word; }
.task.done .text { text-decoration: line-through; color: var(--muted); }
.assignees { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.assignee {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
  background: var(--gold-soft); color: var(--plum-dark);
  padding: 2px 4px 2px 9px; border-radius: 20px;
}
.assignee .chip-x {
  background: rgba(92, 31, 58, 0.15); color: var(--plum-dark);
  width: 16px; height: 16px; border-radius: 50%; font-size: 13px; line-height: 1;
  padding: 0; display: grid; place-items: center;
}
.assignee .chip-x:hover { background: var(--plum); color: #fff; }
.assignee.me { background: var(--plum); color: #fff; }
.assignee.me .chip-x { background: rgba(255, 255, 255, 0.28); color: #fff; }
.assignee.add { cursor: pointer; padding: 2px 9px; }
.assignee.add:hover { background: var(--gold); }
.assignee.add.empty { background: #f0eaee; color: var(--muted); font-weight: 500; }
.assignee.add.empty:hover { background: var(--gold-soft); color: var(--plum-dark); }

/* multi-select picker button (add-task row) */
.btn-assign {
  background: #fff; color: var(--plum-dark); border: 1px solid var(--line);
  padding: 9px 14px; font-size: 14px;
}
.btn-assign:hover { border-color: var(--gold); }

/* floating checkbox menu */
.people-menu {
  position: absolute; z-index: 100; background: #fff;
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(92, 31, 58, 0.22);
  padding: 6px; min-width: 170px; max-height: 320px; overflow-y: auto;
}
.people-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; cursor: pointer; font-size: 14px; user-select: none;
}
.people-row:hover { background: var(--bg); }
.people-row.sel { background: var(--gold-soft); font-weight: 600; color: var(--plum-dark); }
.people-row input { width: 17px; height: 17px; accent-color: var(--plum); cursor: pointer; }
.people-done {
  width: 100%; margin-top: 4px; background: var(--plum); color: #fff; padding: 8px;
  font-size: 13px;
}
.people-done:hover { background: var(--plum-dark); }

.task-actions { display: flex; flex: 0 0 auto; }

/* Only mouse/trackpad devices get the hover-to-reveal behavior. On touch
   screens these controls are always visible, so every action is a single tap
   (no "first tap = hover, second tap = click" double-tap on iOS). */
@media (hover: hover) and (pointer: fine) {
  .timeline .row-actions { opacity: 0; }
  .timeline li:hover .row-actions { opacity: 1; }
  .task .act { opacity: 0; }
  .task:hover .act { opacity: 1; }
}

/* Bigger, easier touch targets on phones/tablets. */
@media (hover: none) {
  .icon-btn { padding: 8px 10px; font-size: 16px; }
  .drag-handle { font-size: 20px; padding: 6px; }
  .assignee .chip-x { width: 20px; height: 20px; font-size: 15px; }
}

/* drag handle for reordering tasks */
.drag-handle {
  flex: 0 0 auto; align-self: center;
  cursor: grab; color: var(--muted);
  font-size: 16px; line-height: 1; padding: 4px;
  touch-action: none; /* so dragging on touch reorders instead of scrolling */
  user-select: none; -webkit-user-select: none;
}
.drag-handle:hover { color: var(--plum); }
.drag-handle:active { cursor: grabbing; }
/* dated tasks aren't draggable (date-ordered) — invisible spacer keeps alignment */
.handle-static { visibility: hidden; cursor: default; pointer-events: none; }
.task.drag-active {
  opacity: 0.9; background: var(--bg); border-radius: 10px;
  box-shadow: var(--shadow); border-bottom-color: transparent;
}

/* inline itinerary editor */
.timeline li.editing { grid-template-columns: auto 1fr auto; gap: 10px; }
.timeline li.editing .time-input { width: auto; }

/* ---- Inputs / buttons ---- */
.add-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.add-row .grow { flex: 1; min-width: 140px; }
input:not([type=checkbox]):not([type=radio]), select {
  /* 16px keeps iOS Safari from auto-zooming when a field gets focus.
     The viewport stays pinch-zoomable — we never disable user scaling. */
  font-family: inherit; font-size: 16px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
input:not([type=checkbox]):not([type=radio]):focus, select:focus { outline: none; border-color: var(--gold); }
.time-input { width: 120px; flex: 0 0 auto; }
button {
  font-family: inherit; cursor: pointer; border: none; border-radius: 10px;
  font-weight: 600; transition: transform 0.08s, background 0.15s;
}
button:active { transform: scale(0.97); }
.btn-primary { background: var(--plum); color: #fff; padding: 9px 16px; font-size: 14px; }
.btn-primary:hover { background: var(--plum-dark); }
.icon-btn { background: transparent; color: var(--muted); padding: 4px 7px; font-size: 14px; line-height: 1; }
.icon-btn:hover { color: var(--plum); background: var(--line); }

.empty-note { color: var(--muted); font-size: 14px; padding: 12px 0; font-style: italic; }

/* deadline chip on a task */
.deadline-chip {
  display: inline-flex; align-items: center; margin-top: 6px; margin-left: 2px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  background: #eef3ee; color: #2e6b46; padding: 2px 9px; border-radius: 20px;
}
.deadline-chip:hover { background: #e0ece2; }
.deadline-chip.overdue { background: #fbe4e4; color: #b3261e; }
.btn-assign.set { background: var(--gold-soft); border-color: var(--gold); color: var(--plum-dark); }

/* deadline popover */
.deadline-menu { min-width: 250px; padding: 12px; }
.deadline-menu .dl-label { font-weight: 600; font-size: 13px; margin-bottom: 8px; color: var(--plum-dark); }
.deadline-menu input[type=datetime-local] { width: 100%; }
.deadline-menu .dl-hint { font-size: 11px; color: var(--muted); margin: 8px 0; }
.deadline-menu .dl-actions { display: flex; gap: 8px; }
.deadline-menu .people-done { flex: 1; margin-top: 0; }
.deadline-menu .dl-clear { background: #f0eaee; color: var(--muted); padding: 8px 14px; }
.deadline-menu .dl-clear:hover { background: var(--line); color: var(--plum-dark); }

/* daily AI summary */
.summary {
  background: linear-gradient(120deg, #fff9ec, #fdf3e3);
  border: 1px solid var(--gold-soft); border-radius: 14px;
  padding: 12px 16px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.summary.empty { background: #fff; border-style: dashed; }
.sum-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sum-label { font-weight: 700; color: var(--plum-dark); font-size: 14px; }
.sum-btn {
  background: var(--plum); color: #fff; padding: 6px 12px; font-size: 12px; border-radius: 20px;
}
.sum-btn:hover { background: var(--plum-dark); }
.sum-btn:disabled { opacity: 0.6; cursor: default; }
.sum-text { margin: 8px 0 0; font-size: 15px; line-height: 1.5; color: var(--ink); }
.summary.empty .sum-text { color: var(--muted); font-style: italic; }

/* ---- Filter bar ---- */
.filterbar {
  position: sticky; bottom: 0; z-index: 18;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 20px; background: #fff; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.filterbar select { padding: 6px 10px; }
.filterbar .toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---- TV / big-screen tuning ---- */
@media (min-width: 1400px) {
  body { font-size: 17px; }
  .brand h1 { font-size: 36px; }
  .dayhead h2 { font-size: 44px; }
  .panel-head h3 { font-size: 26px; }
  .timeline .what, .task .text { font-size: 17px; }
}

@media (max-width: 600px) {
  /* Tidy stacked header: brand row, then the two info tiles, then controls. */
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; position: static; }
  .brand { order: 0; flex: 1 1 100%; }
  .brand h1 { font-size: 24px; }
  .brand .sub { font-size: 10px; }
  .ring { font-size: 28px; }
  .clock { order: 1; flex: 1 1 calc(50% - 4px); padding: 6px 8px; }
  .countdown { order: 1; flex: 1 1 calc(50% - 4px); padding: 6px 8px; }
  .me { order: 2; flex-wrap: wrap; }
  .theme-toggle { order: 2; }
  .status { order: 2; margin-left: auto; align-items: flex-end; }
  main { padding: 14px; }
  .daybar { top: 0; position: static; }

  /* Once scrolled, collapse the banner to a slim bar so the view tabs + day
     tiles stay pinned without the full header eating the screen. The big title,
     clock, and countdown tuck away; scroll back to the top to bring them back. */
  .topbar, .brand h1, .ring { transition: padding 0.18s ease, font-size 0.18s ease; }
  body.scrolled .topbar { padding: 6px 12px; }
  body.scrolled .brand { flex: 0 1 auto; }
  body.scrolled .brand .sub { display: none; }
  body.scrolled .brand h1 { font-size: 18px; }
  body.scrolled .ring { font-size: 22px; }
  body.scrolled .clock,
  body.scrolled .countdown { display: none; }
}

/* ---- MC & DJ brief (program) ---- */
.program { display: flex; flex-direction: column; gap: 18px; }
.prog-head { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-start; justify-content: space-between; }
.prog-head h2 { font-family: 'Cormorant Garamond', serif; font-size: 30px; color: var(--plum); }
.prog-sub { font-size: 13px; color: var(--muted); margin-top: 2px; max-width: 60ch; }
.prog-export { display: flex; flex-wrap: wrap; gap: 8px; }

.prog-list { list-style: none; margin: 0; padding: 0; position: relative; }
.prog-list.entrances { counter-reset: entr; }
.prog-list.cues { counter-reset: cue; }
.prog-list.speeches { counter-reset: spch; }
.prog-row {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  margin-bottom: 10px; background: var(--bg);
}
.prog-list.entrances > .prog-row { counter-increment: entr; }
.prog-list.cues > .prog-row { counter-increment: cue; }
.prog-list.speeches > .prog-row { counter-increment: spch; }
.prog-row.drag-active { background: var(--card); box-shadow: var(--shadow); }
.pr-top { display: flex; align-items: center; gap: 10px; }
.pr-fields { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.prog-num {
  flex: 0 0 auto; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px;
  background: var(--plum); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.prog-list.entrances > .prog-row .prog-num::before { content: counter(entr); }
.prog-list.cues > .prog-row .prog-num::before { content: counter(cue); }
.prog-list.speeches > .prog-row .prog-num::before { content: counter(spch); }
.prog-input {
  font-family: inherit; font-size: 14px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
}
.prog-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.prog-who { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; }
.prog-song { flex: 1 1 220px; min-width: 0; }
.prog-time { width: 96px; flex: 0 0 auto; }
.prog-title { flex: 1; min-width: 0; font-weight: 600; }
.prog-note { width: 100%; margin-top: 8px; resize: vertical; min-height: 38px; }
.prog-lines-wrap { margin-top: 8px; }
.prog-lines-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.prog-lines { width: 100%; resize: vertical; min-height: 56px; line-height: 1.6; }
.prog-empty { color: var(--muted); font-style: italic; padding: 10px 2px; }

.prog-notes-ta {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--ink); line-height: 1.5;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  resize: vertical; min-height: 80px;
}
.prog-notes-ta:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }

/* ---- Read-only mode (signed out) — hide every edit affordance ---- */
body.readonly .add-row,
body.readonly .task-actions,
body.readonly .row-actions,
body.readonly .drag-handle,
body.readonly .reorder,
body.readonly .assignee .chip-x,
body.readonly .assignee.add,
body.readonly .sum-btn,
body.readonly .seat-controls,
body.readonly .seat-actions,
body.readonly .bulk-area,
body.readonly .tc-edit,
body.readonly .danger-btn,
body.readonly .seat-here,
body.readonly .undo-btn,
body.readonly .fit-btn,
body.readonly .guest-row .icon-btn,
body.readonly .prog-row .icon-btn { display: none !important; }

/* Things that stay visible but must not respond to taps/typing */
body.readonly .check,
body.readonly .prog-input,
body.readonly .prog-notes-ta,
body.readonly .assign-select,
body.readonly .group-chip,
body.readonly .count-input,
body.readonly .cap-input,
body.readonly .ftable,
body.readonly .fixture { pointer-events: none !important; }

/* ---- Sign-in menu ---- */
.signin-menu { min-width: 224px; }
.signin-head { font-weight: 700; color: var(--plum); padding: 4px 6px 8px; font-size: 14px; }
.signin-sub { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 6px 4px; }
.signin-pw { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--card); color: var(--ink); }
.signin-pw:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.signin-err:not(:empty) { color: #c0392b; font-size: 12px; padding: 5px 6px 0; }
.signout-row { color: var(--plum); border-top: 1px solid var(--line); margin-top: 4px; font-weight: 600; }

/* ===================== Dark mode (navy accent) ===================== */
[data-theme="dark"] {
  color-scheme: dark;
  --plum: #708cf2;        /* navy-blue accent (brighter for contrast) */
  --plum-dark: #4760bf;   /* deeper navy (gradients, button hover) */
  --gold: #e7c069;
  --gold-soft: #3a4a7d;
  --bg: #0c111f;
  --card: #1d2742;        /* lighter than bg for clear separation */
  --ink: #f0f3fb;
  --muted: #b2bcdb;       /* brighter secondary text */
  --line: #41507f;        /* more visible borders */
  --green: #5cd39a;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
}

/* surfaces that hardcode white → use the dark card colour */
[data-theme="dark"] .daytab,
[data-theme="dark"] .daybar,
[data-theme="dark"] .viewbar,
[data-theme="dark"] .filterbar,
[data-theme="dark"] .undo-btn,
[data-theme="dark"] .btn-assign,
[data-theme="dark"] .people-menu,
[data-theme="dark"] .gchip,
[data-theme="dark"] .summary.empty,
[data-theme="dark"] .ftable.fill-empty,
[data-theme="dark"] .task .check { background: var(--card); }

/* form fields */
[data-theme="dark"] input:not([type=checkbox]):not([type=radio]),
[data-theme="dark"] select,
[data-theme="dark"] .bulk-area textarea {
  background: #11182b; color: var(--ink); border-color: var(--line);
}

/* chips & badges */
[data-theme="dark"] .assignee,
[data-theme="dark"] .badge { background: #2c3a63; color: #cdd8ff; }
[data-theme="dark"] .assignee.add.empty { background: #222a45; color: var(--muted); }
[data-theme="dark"] .assignee .chip-x { background: rgba(255, 255, 255, 0.16); color: #cdd8ff; }
[data-theme="dark"] .people-row.sel { background: #2c3a63; color: #cdd8ff; }

/* daily summary card */
[data-theme="dark"] .summary { background: linear-gradient(120deg, #1f2742, #232a44); border-color: var(--gold-soft); }

/* deadline + overdue */
[data-theme="dark"] .deadline-chip { background: #16332a; color: #7fe0ad; }
[data-theme="dark"] .deadline-chip.overdue { background: #3a1f24; color: #ff9d9d; }

/* adhan rows */
[data-theme="dark"] .timeline li.adhan { background: #23204a; }
[data-theme="dark"] .timeline li.adhan .time { color: #b3a6e6; }
[data-theme="dark"] .timeline li.adhan .what { color: #c9bdf0; }

/* seating: fixtures + table fill states */
[data-theme="dark"] .ftable { color: var(--ink); }
[data-theme="dark"] .ftable.fill-empty { color: var(--muted); border-color: #3a4566; }
[data-theme="dark"] .ftable.fill-some { background: #163328; border-color: var(--green); color: #d6ffe8; }
[data-theme="dark"] .ftable.fill-full { background: #3a3320; border-color: var(--gold); color: #f4e6c4; }
[data-theme="dark"] .ftable.fill-over { background: #3a1f24; border-color: #e06b6b; color: #ffc9c9; }
[data-theme="dark"] .fixture { background: #222c4a; border-color: #3a4566; color: #aeb8d8; }
[data-theme="dark"] .fixture.fx-stage { background: #26314f; }
[data-theme="dark"] .fixture.fx-cake { background: #2a2440; color: #c9b6e6; }
[data-theme="dark"] .fixture.fx-dj,
[data-theme="dark"] .fixture.fx-entrance { background: #1f2c3a; color: #9fc0d0; }

/* misc */
[data-theme="dark"] .guest-row.unseated { background: #2a2716; }
[data-theme="dark"] .danger-btn { background: #3a1f24; color: #ff9d9d; }
[data-theme="dark"] .danger-btn:hover { background: #48262c; }
[data-theme="dark"] .deadline-menu .dl-clear { background: #222a45; color: var(--muted); }
[data-theme="dark"] .conn.off { color: #ff9d9d; }

/* ---- Dark mode: high-contrast selection & highlight states ---- */
[data-theme="dark"] .ftable.sel { box-shadow: 0 0 0 4px var(--gold); }
/* Day selector: tabs are raised cards on a darker bar; selected = filled. */
[data-theme="dark"] .daybar { background: var(--bg); }
[data-theme="dark"] .daytab { background: var(--card); border-color: transparent; }
[data-theme="dark"] .daytab:hover { border-color: var(--gold); }
[data-theme="dark"] .daytab.deadline { border-color: var(--gold); }
[data-theme="dark"] .daytab.active {
  background: linear-gradient(120deg, var(--plum), var(--plum-dark));
  border-color: var(--plum); box-shadow: none; color: #fff;
}
[data-theme="dark"] .daytab.active .dt-dow,
[data-theme="dark"] .daytab.active .dt-meta { color: #dfe6ff; }
[data-theme="dark"] .daytab.active.deadline .dt-title::after { color: var(--gold); }
[data-theme="dark"] .daytab.today { box-shadow: 0 0 0 2px var(--gold); }
[data-theme="dark"] .ftable.multi-sel,
[data-theme="dark"] .fixture.multi-sel {
  outline-color: #9db4ff; box-shadow: 0 0 0 2px #9db4ff, 0 0 12px rgba(157, 180, 255, 0.7);
}
[data-theme="dark"] .ftable.hl { box-shadow: 0 0 0 4px #9db4ff, 0 0 18px #9db4ff; }
[data-theme="dark"] .ftable.fill-empty { border-color: #5566a0; }
[data-theme="dark"] .ftable .ft-occ { opacity: 1; }
[data-theme="dark"] .viewtab.active { color: #fff; }
[data-theme="dark"] .floor-hint { background: rgba(255, 255, 255, 0.14); color: var(--ink); opacity: 0.9; }
[data-theme="dark"] .people-row.sel { background: #3a4f86; color: #fff; }
[data-theme="dark"] .assignee.me { background: var(--gold); color: #20264a; }
[data-theme="dark"] .badge { background: var(--gold); color: #20264a; }
[data-theme="dark"] .sync-paused { color: var(--gold); }
