:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --panel-border: #2a2e38;
  --text: #eef0f3;
  --dim: #8a90a0;
  --accent: #4f8dfd;
  --warn: #f5a623;
  --bad: #ff5c5c;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100%;
}
.app { max-width: 760px; margin: 0 auto; padding: 20px 16px 80px; }

h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.subtitle { color: var(--dim); font-size: 13px; margin-bottom: 20px; }

/* ---- Setup ---- */
.setup-row {
  display: flex; gap: 8px; margin-bottom: 10px; align-items: center; flex-wrap: wrap;
}
.call-time-field { display: flex; align-items: center; gap: 4px; }
.call-time-field span { color: var(--dim); font-size: 13px; }
.setup-row input[type="text"] {
  flex: 1; min-width: 0;
}
input, select {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px;
}
input[type="number"] { width: 70px; }
.time-inputs { display: flex; align-items: center; gap: 4px; }
.time-inputs span { color: var(--dim); font-size: 13px; }

.type-toggle { display: flex; gap: 4px; }
.type-btn {
  padding: 10px 12px; font-size: 13px; color: var(--dim);
}
.type-btn.active { border-color: var(--accent); color: var(--text); background: #16233a; }

button {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: #2f6fe8; border-color: #2f6fe8; color: #fff; font-weight: 600; }
button.ghost { background: transparent; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.icon { padding: 8px 10px; }

.concept-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.concept-item .name-block { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.concept-item {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
}
.concept-item .name { flex: 1; font-weight: 500; }
.call-time { color: var(--dim); font-size: 12px; }

.badge-break {
  display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em; padding: 2px 6px; border-radius: 4px;
  background: #3a2e57; color: #c9b6ff; vertical-align: middle;
}

.start-bar { margin-top: 22px; display: flex; gap: 10px; }

/* ---- Live view ---- */
.top-bar {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 18px; flex-wrap: wrap; gap: 8px;
}

.progress-track {
  margin-top: 20px; height: 8px; background: #2a2e38; border-radius: 4px; overflow: hidden;
}
.progress-fill { height: 100%; background: var(--accent); transition: width 0.3s linear; }
.progress-fill.warn { background: var(--warn); }
.progress-fill.over { background: var(--bad); width: 100% !important; }

.upcoming { margin-top: 26px; }
.upcoming h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--dim); margin-bottom: 10px; }

.bottom-actions { margin-top: 30px; display: flex; justify-content: space-between; }
.bottom-actions button { font-size: 13px; color: var(--dim); }

.waiting-screen { text-align: center; padding: 80px 20px; color: var(--dim); }

/* ---- Runsheet ---- */
.slot-block { margin-bottom: 10px; scroll-margin-top: calc(var(--head-h, 52px) + 8px); }
.slot-time { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.slot-grid { display: grid; gap: 8px; grid-template-columns: repeat(var(--cols, 1), 1fr); }
.room-card {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px;
  padding: 10px 12px; display: flex; align-items: flex-start; gap: 8px;
}
.room-card.current { border-color: var(--accent); background: #14202f; }
.room-card.past { opacity: 0.35; filter: grayscale(1); }
.room-label { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.item-title { font-weight: 500; }
.item-speaker { color: var(--dim); font-size: 13px; margin-top: 2px; }
.item-duration { font-variant-numeric: tabular-nums; }
.item-countdown { font-size: 15px; font-weight: 600; color: var(--text); margin-top: 8px; font-variant-numeric: tabular-nums; }
.item-countdown.warn { color: var(--warn); }
.item-countdown.over { color: var(--bad); }

.room-card.warn { border-color: var(--warn); }
.room-card.over { border-color: var(--bad); background: #241417; }
.room-card.current.warn { background: #2a2312; }
.room-card.current.over { background: #241417; }

.sticky-bar {
  position: sticky; top: 0; z-index: 8; margin: 8px -16px 0; padding: 10px 16px;
  background: #10151f; border-bottom: 1px solid var(--accent);
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  backdrop-filter: blur(6px);
}
.sticky-bar.warn { border-bottom-color: var(--warn); }
.sticky-bar.over { border-bottom-color: var(--bad); background: #1f1215; }
.sticky-bar-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(79,141,253,0.2);
}
.sticky-bar.warn .sticky-bar-dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(245,166,35,0.2); }
.sticky-bar.over .sticky-bar-dot { background: var(--bad); box-shadow: 0 0 0 4px rgba(255,92,92,0.2); }
.sticky-bar-label { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sticky-bar-countdown { font-size: 13px; font-weight: 600; color: var(--dim); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.sticky-bar-countdown.warn { color: var(--warn); }
.sticky-bar-countdown.over { color: var(--bad); }

.room-card.is-break { border-color: #7c5cff; background: #1c1730; }
.room-card.is-break.current { border-color: #7c5cff; background: #241c3a; }
.item-title .badge-break { margin-left: 6px; }

.day-divider {
  margin: 26px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--panel-border);
  font-size: 15px; font-weight: 600; color: var(--text);
}
.day-divider .day-tag { font-size: 12px; font-weight: 600; color: var(--accent); margin-left: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.slot-block.future-day { opacity: 0.8; }

.jump-now-btn {
  position: fixed; bottom: 20px; right: 20px; z-index: 10;
  background: #2f6fe8; border-color: #2f6fe8; color: #fff; font-weight: 600;
  border-radius: 999px; padding: 12px 18px; box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.concurrent-label { display: none; }

@media (max-width: 700px) {
  /* On mobile the room cards stack into one column, so a connecting line down
     the left plus a label is the only cue that they're simultaneous, not sequential. */
  .concurrent-group {
    border-left: 3px solid var(--accent); padding-left: 12px; margin-left: 2px;
  }
  .concurrent-label {
    display: block; font-size: 11px; color: var(--accent); text-transform: uppercase;
    letter-spacing: 0.04em; font-weight: 600; margin-bottom: 6px;
  }
}

@media (max-width: 700px) {
  .slot-grid { grid-template-columns: 1fr !important; }
  }

.site-nav {
  display: flex; flex-wrap: wrap; gap: 6px 16px; max-width: 760px; margin: 16px auto 0; padding: 0 16px;
  font-size: 13px;
}
.site-nav a { color: var(--dim); text-decoration: none; padding: 4px 0; }
.site-nav a:hover { color: var(--text); }
.site-nav a:first-child { margin-right: auto; }


.item-form {
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px;
  padding: 12px 12px 2px; margin-bottom: 10px;
}
.item-form input { background: var(--bg); }
.concept-list .item-form { border-color: var(--accent); }
.concept-list .day-divider { margin: 14px 0 4px; }

/* ---- Crew ---- */
.crew-filter { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 0; }
.filter-btn { padding: 10px 9px; font-size: 13px; min-height: 44px; color: var(--dim); }
.filter-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--text); background: #16233a; font-weight: 600; }
.crew-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.crew-chip {
  font-size: 12px; font-weight: 600; line-height: 1.5; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 30%, transparent); color: var(--text);
}
/* A person is picked: sessions they aren't on stay visible but fade to grey */
.room-card.not-mine { opacity: 0.4; filter: grayscale(1); }
.crew-note {
  display: flex; gap: 10px; align-items: baseline; margin: 4px 0 14px; padding: 7px 4px;
  border-top: 1px dashed #3a3524; border-bottom: 1px dashed #3a3524; color: #d9c48a; font-size: 14px;
}
.crew-note-time { font-size: 12px; color: #a8976a; text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
.crew-note.past { opacity: 0.35; filter: grayscale(1); }
.crew-note.not-mine { opacity: 0.4; filter: grayscale(1); }
.badge-note { background: #3a3524; color: #d9c48a; }
.sticky-bar.idle { border-bottom-color: var(--panel-border); }
.sticky-bar.idle .sticky-bar-dot { background: var(--dim); box-shadow: none; }
/* Live bar: hidden while the live card is on screen, slides in at the top or bottom once it's scrolled off */
.sticky-bar.live-float {
  position: fixed; left: 0; right: 0; top: var(--head-h, 0px); margin: 0; padding: 10px max(16px, calc(50% - 364px));
  opacity: 0; pointer-events: none; transform: translateY(-100%); transition: transform 0.2s, opacity 0.2s;
}
.sticky-bar.live-float[data-pos="top"] { transform: none; opacity: 1; pointer-events: auto; }
.sticky-bar.live-float[data-pos="bottom"] {
  top: auto; bottom: 0; transform: none; opacity: 1; pointer-events: auto;
  border-bottom: 0; border-top: 1px solid var(--accent);
}
.sticky-bar.live-float.warn[data-pos="bottom"] { border-top-color: var(--warn); }
.sticky-bar.live-float.over[data-pos="bottom"] { border-top-color: var(--bad); }

/* Name buttons (and the status line when nothing is live) stay pinned to the top */
.sticky-head { position: sticky; top: 0; z-index: 9; background: var(--bg); margin: 0 -16px; padding: 0 16px; }
.sticky-head .sticky-bar { position: static; margin: 0 -16px; }

/* Red line between what has started and what hasn't */
.now-line { position: relative; margin: 6px 0 14px; border-top: 2px solid var(--bad); scroll-margin-top: calc(var(--head-h, 52px) + 24px); }
.now-line span {
  position: absolute; left: 0; top: -11px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
}
