/* ══════════════════════════════════════════════════════════
   MODERATOR APP – Build with Vibe
   Styles for the internal moderator/trainer view.
   ══════════════════════════════════════════════════════════ */

/* ── Motion + radius tokens (moderator-scoped — shared.css already has --ease-fast/default and --radius-sm/md/lg) ── */
:root {
  --dur-fast: 120ms;     /* press/hover micro-feedback */
  --dur-base: 180ms;     /* default state changes */
  --dur-modal: 240ms;    /* sheets, panel transitions */
  --ease-enter: cubic-bezier(0.22, 1, 0.36, 1);  /* decelerate (enter) */
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);       /* accelerate (exit) */
  --radius-xs: 4px;      /* tighter chip/input radius for dense table contexts */
}

/* ── Focus rings (keyboard-only; mouse clicks stay clean) ──
   Global :focus-visible gives every interactive element a visible 2px ring.
   Existing :focus rules below only change border-color — that's ambient for
   both mouse and keyboard, but keyboard users need a high-contrast ring too. */
:where(button, [role="button"], [role="tab"], a, input, select, textarea,
       details > summary):focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Layout ── */
.page { height: auto; min-height: 100vh; overflow: visible; padding-bottom: 40px; }

/* ── Skip-to-content link (keyboard users jump past header + tab bar) ── */
.skip-link {
  position: absolute; top: 8px; left: 8px;
  padding: 8px 14px; background: var(--orange); color: var(--bg);
  font-family: var(--font-body); font-weight: 600; font-size: var(--ts-sm);
  border-radius: var(--radius-sm); text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-enter);
  z-index: 1000;
}
.skip-link:focus-visible { transform: translateY(0); outline-offset: 2px; }

/* sr-only for visually-hidden but screen-reader-accessible text */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ── Header ──
   All header right-side controls share a 32px height so presence dots,
   the agenda link, the run-select, and the wordmark sit on one optical line.
   The agenda link is a quiet ghost — secondary navigation, not a CTA. */
.mod-header .subtitle { font-weight: 700; letter-spacing: var(--track-caps); }
.header-agenda-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--ts-xs);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.header-agenda-link:hover {
  background: var(--glass-8);
  border-color: var(--border-strong);
  color: var(--text);
}
.run-select {
  height: 32px;
  max-width: 240px;
  background: var(--glass-8); border: 1px solid var(--border-strong);
  color: var(--text); padding: 0 10px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: var(--ts-sm);
  cursor: pointer;
  text-overflow: ellipsis;
}
.run-select:focus { border-color: var(--orange); outline: none; }
[data-theme="light"] .run-select { background: rgba(0,0,0,0.04); }

/* ── Tab Bar ── */
.tab-bar {
  display: flex; gap: 0; margin: 0;
  border-bottom: 1px solid var(--border-strong);
  padding: 0 var(--page-pad);
}
.tab {
  padding: 10px 20px; font-size: var(--ts-base); font-weight: 600;
  font-family: var(--font-heading);
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); cursor: pointer;
  transition: color var(--ease-fast), border-color var(--ease-fast);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--orange); border-bottom-color: var(--orange); }

/* ── Tab Panels ── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ═══════════════════════════════════
   TIMETABLE TAB (reused from timing-tool)
   ═══════════════════════════════════ */
.toolbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; margin: 12px 0 8px;
  background: var(--glass-5); border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
/* Groups give the toolbar a "settings | actions | status" rhythm instead
   of a flat row of controls. Status group is right-aligned so the clock
   stays in its familiar spot. */
.toolbar-group {
  display: flex; align-items: center; gap: 12px;
  margin: 0; padding: 0; border: none;
}
.toolbar-group + .toolbar-group {
  padding-left: 12px; border-left: 1px solid var(--border);
}
.toolbar-status { margin-left: auto; }
.toolbar label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--ts-sm); color: var(--text-muted);
}
/* Legends render specially in fieldsets (rendered into the border edge),
   so even inside a flex fieldset they break the row. Force inline display. */
.toolbar-legend {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0;
  font-size: var(--ts-xs); font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: var(--track-caps);
  float: none;
}
.toolbar input[type="time"] {
  height: 32px; box-sizing: border-box;
  background: var(--glass-8); border: 1px solid var(--border-strong);
  color: var(--text); padding: 0 8px; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: var(--ts-base);
  font-variant-numeric: tabular-nums;
}
.toolbar .clock {
  display: inline-flex; align-items: center; height: 32px;
  font-family: var(--font-mono); font-size: var(--ts-lg); font-weight: 600;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}
.toolbar .day-info {
  display: inline-flex; align-items: center; height: 32px;
  font-size: var(--ts-sm); color: var(--text-muted);
  padding: 0 10px; background: var(--glass-5); border-radius: var(--radius-sm);
}
.schedule-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: var(--ts-sm); margin-top: 4px;
}
.schedule-table th {
  text-align: left; padding: 8px 10px; font-weight: 600; font-size: var(--ts-xs);
  text-transform: uppercase; letter-spacing: var(--track-caps);
  color: var(--text-muted);
  position: sticky; top: 0; background: var(--bg); z-index: 2;
  box-shadow: 0 1px 0 var(--border-strong);
}
.schedule-table td {
  padding: 6px 10px; border-bottom: 1px solid var(--border);
  vertical-align: middle; white-space: nowrap;
}
.schedule-table td:nth-child(1) { width: 28px; text-align: center; }
.schedule-table td:nth-child(4),
.schedule-table td:nth-child(5),
.schedule-table td:nth-child(6) {
  font-family: var(--font-mono); font-size: var(--ts-sm); text-align: right;
  font-variant-numeric: tabular-nums;
}
.schedule-table td:nth-child(7) {
  text-align: center;
}
/* Duration cell holds the dur-input plus a planning chip (Online / Entfernen).
   Lay them out as a single right-aligned row so the chip sits immediately
   after the minutes input, where planning decisions live. */
.cell-dur {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}
.cell-dur > .btn-now.btn-secondary {
  margin: 0;
}
.cell-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
tr.row-slot td { color: var(--text); font-weight: 500; }
tr.row-slot td:nth-child(3) { cursor: pointer; }
tr.row-section td { color: var(--text-muted); font-weight: 400; font-size: var(--ts-xs); }
tr.row-section td:nth-child(3) { padding-left: 28px; }
tr.row-section.hidden { display: none; }
tr.row-break td { color: var(--text-faint); font-style: italic; background: var(--glass-3); }
tr.row-online-phase td {
  color: var(--orange);
  padding-top: 18px;
  border-top: 1px solid var(--orange-border);
}
tr.row-online-slot td {
  color: var(--text-muted);
  background: var(--glass-3);
}
tr.row-daybreak td {
  text-align: center; font-weight: 700; font-size: var(--ts-base);
  color: var(--orange); padding: 14px 10px;
  background: var(--orange-bg); border-top: 2px solid var(--orange-border);
  border-bottom: 2px solid var(--orange-border);
}
.btn-daybreak-move {
  background: var(--glass-10); border: 1px solid var(--orange-border);
  color: var(--orange); font-size: var(--ts-xs); padding: 6px 12px;
  border-radius: var(--radius-xs); cursor: pointer; font-family: var(--font-body);
  vertical-align: middle; margin: 0 6px; min-height: 44px; min-width: 44px;
}
.btn-daybreak-move:hover { background: var(--glass-20); }
tr.row-phase td {
  font-weight: 700; font-size: var(--ts-xs); letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--text-muted); padding: 10px 10px 4px; border-bottom: none;
}
tr.is-past td { opacity: 0.6; }
tr.is-current td { color: var(--text) !important; opacity: 1; }
tr.is-current { background: var(--orange-bg); }
tr.is-current td:first-child { color: var(--orange); font-weight: 700; }
tr.is-overtime td:nth-child(5),
tr.is-overtime td:nth-child(6) { color: var(--red); }
.dur-input {
  width: 56px; min-height: 28px; text-align: right; padding: 4px 6px;
  background: var(--glass-5); border: 1px solid transparent;
  color: inherit; font-family: var(--font-mono); font-size: var(--ts-sm);
  border-radius: var(--radius-xs); transition: border var(--ease-fast);
  font-variant-numeric: tabular-nums;
}
.dur-input:hover { border-color: var(--border-strong); }
.dur-input:focus { border-color: var(--orange); outline: none; background: var(--glass-10); }
.break-dur {
  width: 56px; min-height: 28px; text-align: right; padding: 4px 6px;
  background: transparent; border: 1px solid transparent;
  color: var(--text-faint); font-family: var(--font-mono); font-size: var(--ts-sm);
  font-style: italic; border-radius: var(--radius-xs);
  font-variant-numeric: tabular-nums;
}
.break-dur:hover { border-color: var(--border-strong); background: var(--glass-5); }
.break-dur:focus { border-color: var(--orange); outline: none; background: var(--glass-10); font-style: normal; color: var(--text); }
.toggle {
  cursor: pointer; user-select: none; font-size: var(--ts-xs);
  color: var(--text-faint); display: inline-flex;
  align-items: center; justify-content: center;
  background: none; border: none; padding: 0;
  min-width: 32px; min-height: 32px;
  font-family: inherit; line-height: 1;
}
@media (prefers-reduced-motion: no-preference) {
  .toggle { transition: transform var(--ease-fast); }
}
.toggle.open { transform: rotate(90deg); }
.btn-group { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.btn-now {
  padding: 6px 10px; font-size: var(--ts-xs); font-weight: 600;
  background: var(--orange); color: var(--bg); border: none;
  border-radius: var(--radius-xs); cursor: pointer; transition: opacity var(--ease-fast);
  font-family: var(--font-body); white-space: nowrap;
  min-height: 44px; min-width: 44px;
}
.btn-now:hover { opacity: 0.85; }
.btn-now.btn-end { background: var(--glass-12); color: var(--text-muted); }
.btn-now.btn-end:hover { background: var(--glass-20); color: var(--text); }
/* Secondary row action (Online / In Agenda / Entfernen): a small ghost chip
   that sits next to — not in line with — the primary Start/Ende pair.
   Override .btn-now's 44px min-height so the chip stays visually quiet. */
.btn-now.btn-secondary {
  min-height: 0; min-width: 0;
  height: 28px;
  padding: 0 10px;
  font-size: var(--ts-xs); font-weight: 500;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  margin-left: 6px;
}
.btn-now.btn-secondary:hover {
  background: var(--glass-8);
  border-color: var(--border-strong);
  color: var(--text);
  opacity: 1;
}
[data-theme="light"] .btn-now { color: #fff; }
[data-theme="light"] .btn-now.btn-secondary { color: var(--text-muted); }
.btn-break {
  height: 32px;
  padding: 0 12px; font-size: var(--ts-xs); font-weight: 500;
  background: var(--glass-8); color: var(--text-muted); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-body);
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.btn-break:hover { background: var(--glass-12); color: var(--text); border-color: var(--border-strong); }
/* Reset is destructive — wipes all overrides, breaks, anchors. Style it
   apart from the neutral toolbar chips so it can't be hit by mistake. */
.toolbar-actions {
  margin-left: auto;
  padding-left: 16px !important;
  border-left: 1px solid var(--border);
}
.btn-reset {
  height: 32px;
  padding: 0 14px; font-size: var(--ts-xs); font-weight: 600;
  background: transparent; color: var(--red); border: 1px solid var(--red);
  border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-body);
  letter-spacing: var(--track-caps);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.btn-reset:hover { background: var(--red); color: var(--bg); }
[data-theme="light"] .btn-reset:hover { color: #fff; }
.eod-marker {
  display: inline-block; font-size: var(--ts-xs); font-weight: 600;
  color: var(--red); margin-left: 8px;
}
/* Inline row badges: anchor marker (orange) + original-duration muted */
.tt-badge { font-size: var(--ts-xs); color: var(--orange); margin-left: 6px; }
.tt-badge--muted { color: var(--text-faint); font-size: var(--ts-xs); margin-left: 4px; }
.eod-ok { color: var(--p1); }
.summary {
  display: flex; gap: 20px; flex-wrap: wrap;
  padding: 10px 16px; margin-top: 8px;
  background: var(--glass-3); border: 1px solid var(--border);
  border-radius: var(--radius-md); font-size: var(--ts-sm); color: var(--text-muted);
}
.summary strong { color: var(--text); }

/* ── Light mode overrides ── */
[data-theme="light"] .toolbar { background: rgba(0,0,0,0.02); }
[data-theme="light"] .summary { background: rgba(0,0,0,0.02); }
[data-theme="light"] .dur-input { background: rgba(0,0,0,0.03); }
[data-theme="light"] .dur-input:focus { background: rgba(0,0,0,0.06); }
[data-theme="light"] .break-dur:hover { background: rgba(0,0,0,0.03); }
[data-theme="light"] .break-dur:focus { background: rgba(0,0,0,0.06); }
[data-theme="light"] tr.row-break td { background: rgba(0,0,0,0.02); }
[data-theme="light"] tr.row-daybreak td { background: rgba(255,85,0,0.06); }
[data-theme="light"] .btn-daybreak-move { background: rgba(0,0,0,0.04); }
[data-theme="light"] .btn-daybreak-move:hover { background: rgba(0,0,0,0.08); }

/* ═══════════════════════════════════
   MOBILE TIMETABLE (card list)
   ═══════════════════════════════════ */
.mobile-timetable { display: none; }
.mt-phase {
  font-family: var(--font-heading);
  font-size: var(--ts-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: var(--track-caps);
  color: var(--text-faint);
  margin: 20px 4px 8px;
}
.mt-phase:first-child { margin-top: 4px; }
.mt-phase-online { color: var(--orange); }
.mt-daybreak {
  text-align: center;
  font-family: var(--font-heading); font-weight: 700; font-size: var(--ts-sm);
  color: var(--orange);
  padding: 10px 12px;
  margin: 12px 0;
  background: var(--orange-bg);
  border-top: 2px solid var(--orange-border);
  border-bottom: 2px solid var(--orange-border);
  border-radius: var(--radius-sm);
}
.mt-card {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: baseline;
  padding: 12px 14px;
  margin-bottom: 6px;
  background: var(--glass-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: background var(--ease-fast);
}
.mt-card.is-break {
  background: var(--glass-3);
  border-style: dashed;
}
.mt-card.is-online {
  background: var(--glass-3);
  border-color: var(--border-strong);
}
.mt-card.is-past { opacity: 0.6; }
.mt-card.is-current {
  background: var(--orange-bg);
  border-color: var(--orange-border);
}
.mt-nr {
  grid-row: 1 / span 2;
  font-family: var(--font-mono); font-size: var(--ts-base); font-weight: 600;
  color: var(--text-muted); text-align: right;
  font-variant-numeric: tabular-nums;
}
.mt-card.is-current .mt-nr { color: var(--orange); }
.mt-title {
  font-family: var(--font-heading); font-size: var(--ts-base); font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.mt-card.is-break .mt-title {
  font-family: var(--font-body); font-weight: 400; font-style: italic;
  color: var(--text-muted);
}
.mt-card.is-online .mt-title { color: var(--text-secondary); }
.mt-dur {
  font-family: var(--font-mono); font-size: var(--ts-xs);
  color: var(--text-faint);
  justify-self: end;
  font-variant-numeric: tabular-nums;
}
.mt-times {
  grid-column: 2 / span 2;
  font-family: var(--font-mono); font-size: var(--ts-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.mt-card.is-current .mt-times { color: var(--orange); font-weight: 500; }
.mt-pill {
  display: inline-block;
  font-family: var(--font-body); font-size: var(--ts-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: var(--track-caps);
  color: var(--bg); background: var(--orange);
  padding: 2px 6px; border-radius: var(--radius-xs);
  margin-left: 6px; vertical-align: middle;
}
[data-theme="light"] .mt-pill { color: #fff; }

/* ═══════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════ */
/* Phone (≤ 640px): mobile-optimized layout */
@media (max-width: 640px) {
  /* Header: hide wordmark, expand run-select */
  .bwv-logo-wordmark { display: none; }
  .mod-header .subtitle { display: none; }
  .run-select { flex: 1; min-width: 0; max-width: 200px; }
  .bwv-header-right { flex: 1; gap: 8px; }

  /* Tab bar: bigger touch targets */
  .tab-bar { padding: 0 8px; }
  .tab { padding: 14px 16px; min-height: 48px; font-size: var(--ts-sm); flex: 1; text-align: center; }

  /* Timetable: swap table for cards */
  .toolbar {
    flex-direction: column; align-items: stretch;
    gap: 8px; padding: 12px 16px;
  }
  .toolbar-group { flex-direction: column; align-items: stretch; gap: 8px; }
  .toolbar-group + .toolbar-group {
    padding-left: 0; border-left: none;
    padding-top: 8px; border-top: 1px solid var(--border);
  }
  .toolbar-status { margin-left: 0; flex-direction: row; justify-content: space-between; }
  .toolbar .clock { font-size: var(--ts-lg); text-align: center; }
  .toolbar .day-info { text-align: center; }
  .toolbar label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .schedule-table { display: none; }
  .mobile-timetable { display: block; padding: 0 12px 32px; }
  .summary { font-size: var(--ts-xs); padding: 10px 12px; gap: 12px; }
}

/* ── Print ── */
@media print {
  .toolbar, .btn-group, .btn-reset, .bwv-header, .tab-bar { display: none; }
  .tab-panel { display: block !important; }
  tr.row-section.hidden { display: table-row; }
}

/* ═══════════════════════════════════
   MOTION POLISH — active states, tab fade, signature moments
   ═══════════════════════════════════ */

/* Press-down feedback: every clickable needs a visible "it registered" cue.
   90ms scale-down is the industry-standard touch response. */
.btn-now,
.tab,
.btn-daybreak-move,
.btn-reset,
.btn-break {
  transition: transform 90ms var(--ease-exit), opacity var(--dur-fast) var(--ease-exit), background var(--dur-fast) var(--ease-exit), color var(--dur-fast) var(--ease-exit), border-color var(--dur-fast) var(--ease-exit);
}
.btn-now:active,
.tab:active,
.btn-daybreak-move:active,
.btn-reset:active,
.btn-break:active {
  transform: scale(0.97);
}

/* Tab panel fade: currently tab switch snaps. 150ms opacity ease-in is enough
   to feel continuous without slowing the workflow. */
.tab-panel.active {
  animation: panel-fade var(--dur-base) var(--ease-enter);
}
@keyframes panel-fade {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* "jetzt" pill: signature moment — the single most-glanced element during
   a workshop. Deserves a pop-in so the trainer registers the transition. */
.mt-pill {
  animation: pill-pop 260ms var(--ease-enter);
}
@keyframes pill-pop {
  0%   { opacity: 0; transform: scale(0.72); }
  60%  { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}

/* Start/Stop fire flash: add .just-fired class for 220ms after button press.
   Critical on-stage feedback — confirms the action took effect. */
.btn-now.just-fired,
.btn-break.just-fired,
.btn-reset.just-fired {
  animation: btn-fire 260ms var(--ease-exit);
}
@keyframes btn-fire {
  0%   { box-shadow: 0 0 0 0 var(--orange-border); }
  40%  { box-shadow: 0 0 0 6px var(--orange-border); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Global reduced-motion honor: applies to every animation/transition in
   this app — not just the few that remembered to wrap in @media queries. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ═══════════════════════════════════
   REALTIME COLLAB — presence, toast, flash
   ═══════════════════════════════════ */

/* Presence: avatar pair next to run-select.
   Max 2 online per run per product decision. */
.presence {
  display: inline-flex;
  align-items: center;
}
.presence:empty { display: none; }
.presence-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-family: var(--font-heading);
  font-size: var(--ts-xs);
  font-weight: 700;
  letter-spacing: var(--track-caps);
  border: 2px solid var(--bg);
  background: var(--glass-15);
  color: var(--text);
  margin-left: -6px;
  cursor: default;
  user-select: none;
  position: relative;
}
.presence-dot:first-child { margin-left: 0; }
.presence-dot.is-self { background: var(--orange); color: var(--bg); }
[data-theme="light"] .presence-dot.is-self { color: #fff; }

/* Toast stack: stacked bottom-right, self-dismissing */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
  max-width: calc(100vw - 40px);
}
.toast {
  /* Solid-dark surface (not white-glass): lifts orange .toast-actor text to AA. */
  background: rgba(25, 25, 33, 0.95);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: var(--ts-sm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  pointer-events: auto;
  min-width: 200px;
  max-width: 360px;
  opacity: 0;
  transform: translateY(8px);
}
@media (prefers-reduced-motion: no-preference) {
  .toast { transition: opacity 180ms ease-out, transform 180ms ease-out; }
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-actor {
  color: var(--orange);
  font-weight: 600;
  margin-right: 4px;
}
/* Inline toast action (e.g. Rückgängig): small ghost button on the toast. */
.toast-action {
  margin-left: 10px;
  min-height: 24px;
  padding: 3px 10px;
  background: var(--glass-12);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--ts-xs);
  font-weight: 600;
  cursor: pointer;
  vertical-align: middle;
}
.toast-action:hover { background: var(--glass-20); }
[data-theme="light"] .toast { background: rgba(255, 255, 255, 0.95); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); }
[data-theme="light"] .toast-action { background: rgba(0,0,0,0.06); color: var(--text); }

/* Remote-change flash: orange ring + subtle bg pulse */
@keyframes remote-flash {
  0%   { box-shadow: inset 0 0 0 2px var(--orange); background-color: var(--glass-15); }
  100% { box-shadow: inset 0 0 0 0 transparent; background-color: transparent; }
}
.remote-change {
  animation: remote-flash 700ms ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .remote-change { animation: none; }
}

/* ═══════════════════════════════════
   OFFLINE BANNER — browser offline or Supabase channel closed
   ═══════════════════════════════════ */
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px;
  /* #c62828 (darker than --red #e53935): white text on it clears AA 4.5:1. */
  background: #c62828; color: #fff;
  font-family: var(--font-body); font-size: var(--ts-sm); font-weight: 500;
  border-bottom: 1px solid var(--border);
  transform: translateY(-100%);
}
.offline-banner:not([hidden]) { transform: translateY(0); }
@media (prefers-reduced-motion: no-preference) {
  .offline-banner { transition: transform var(--dur-base) var(--ease-enter); }
}
.offline-banner-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff; flex-shrink: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .offline-banner-dot { animation: offline-pulse 1.5s ease-in-out infinite; }
}
@keyframes offline-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ── Day badge (active workshop day + live/preview status) ── */
.day-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--ts-xs);
  font-weight: 600;
  font-family: var(--font-mono);
  margin-left: 8px;
  letter-spacing: 0.02em;
}
/* live = bright lime → dark text (white on lime is unreadable, ~1.2:1). */
.day-badge--live {
  background: var(--p1);
  color: var(--bg);
}
/* preview = darkened orange so white text clears AA (white on #ff5500 is 3.2:1). */
.day-badge--preview {
  background: var(--orange-deep);
  color: #fff;
}

/* ── Preview banner (shown on off-dates) ── */
.preview-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  background: var(--orange-deep);   /* white body text needs the darker orange for AA */
  color: #fff;
  font-size: var(--ts-sm);
  font-weight: 500;
}
.preview-banner[hidden] {
  display: none;
}
.preview-banner__btn {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.5);
  min-height: 24px;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: var(--ts-xs);
  margin-left: 4px;
  font-family: inherit;
}
.preview-banner__btn:hover {
  background: rgba(255,255,255,0.3);
}
.preview-banner__btn.is-active {
  background: #fff;
  color: var(--orange-deep);
  font-weight: 600;
}

/* ── Lunch banner: full-width movable row (like the day-break) ── */
tr.row-lunch-banner td {
  text-align: center;
  font-family: var(--font-body); font-size: var(--ts-sm); font-weight: 600;
  color: var(--text-secondary);
  padding: 10px 10px;
  background: var(--glass-3);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] tr.row-lunch-banner td { background: rgba(0,0,0,0.03); }

/* ══════════ SETUP TAB (gehosteter Run: wer nutzt was) ══════════ */
#panel-setup { padding: var(--page-pad); }
.setup-head { margin-bottom: var(--space-5); }
.setup-title { font-family: var(--font-heading); font-size: var(--ts-lg); margin: 0 0 var(--space-1); color: var(--text); }
.setup-sub { color: var(--text-secondary); margin: 0 0 var(--space-2); }
.setup-legend { font-size: var(--ts-sm); color: var(--text-muted); margin: 0 0 var(--space-1); }
.setup-note { font-size: var(--ts-sm); color: var(--text-faint); margin: 0; max-width: 70ch; }
.setup-table { width: 100%; border-collapse: collapse; font-size: var(--ts-sm); }
.setup-table th, .setup-table td { text-align: left; padding: var(--space-2); border-bottom: 1px solid var(--border); vertical-align: top; }
.setup-table th { font-size: var(--ts-xs); text-transform: uppercase; letter-spacing: var(--track-caps); color: var(--text-muted); font-weight: 600; }
.setup-nr { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.setup-name { font-weight: 600; color: var(--text); white-space: nowrap; }
.setup-app { color: var(--text-secondary); }
.setup-dev { white-space: nowrap; color: var(--text-secondary); }
.setup-grp { font-weight: 700; text-align: center; }
.setup-grp.grp-a { color: var(--p1); }
.setup-grp.grp-b { color: var(--p2); }
.setup-link { color: var(--orange); text-decoration: none; font-family: var(--font-mono); font-size: var(--ts-sm); }
.setup-link:hover { text-decoration: underline; }
.setup-sb-url { display: inline-block; margin-bottom: var(--space-1); }
.setup-sb-actions { display: flex; gap: var(--space-1); }
.setup-copy {
  font-size: var(--ts-xs); min-height: 24px; padding: 2px var(--space-2); border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--glass-8); color: var(--text-secondary);
  cursor: pointer; font-family: var(--font-mono); line-height: 1.4;
}
.setup-copy:hover { background: var(--glass-12); color: var(--text); }
@media (max-width: 760px) {
  .setup-table { font-size: var(--ts-xs); }
  .setup-table th, .setup-table td { padding: var(--space-1); }
}
.setup-acct { font-family: var(--font-mono); font-size: var(--ts-sm); white-space: nowrap; }
.setup-acct.grp-a { color: var(--p1); }
.setup-acct.grp-b { color: var(--p2); }
.setup-teardown { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.setup-teardown-title { font-family: var(--font-heading); font-size: var(--ts-md); margin: 0 0 var(--space-2); color: var(--text); }
.setup-teardown-list { margin: 0; padding-left: 1.3em; font-size: var(--ts-sm); color: var(--text-secondary); max-width: 80ch; }
.setup-teardown-list li { margin-bottom: var(--space-1); line-height: 1.5; }

/* ── App-Übersichten-Tab ── */
.appov-head { margin-bottom: var(--space-5); }
.appov-title { font-family: var(--font-heading); font-size: var(--ts-lg); margin: 0 0 var(--space-1); color: var(--text); }
.appov-sub { font-size: var(--ts-sm); color: var(--text-faint); margin: 0; max-width: 80ch; }
.appov-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
}
.appov-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--glass-2);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.appov-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.appov-app { font-family: var(--font-heading); font-size: var(--ts-md); margin: 0; color: var(--text); }
.appov-person { font-size: var(--ts-xs); color: var(--text-muted); white-space: nowrap; }
.appov-pitch { margin: 0; font-size: var(--ts-base); color: var(--text-secondary); line-height: 1.5; }
.appov-field { display: flex; flex-direction: column; gap: 2px; }
.appov-field-label { font-size: var(--ts-xs); text-transform: uppercase; letter-spacing: var(--track-caps); color: var(--text-muted); font-weight: 600; }
.appov-field-value { font-size: var(--ts-sm); color: var(--text-secondary); line-height: 1.45; }
.appov-crucial {
  border-left: 2px solid var(--orange);
  padding-left: var(--space-2);
  padding-top: var(--space-1);
  padding-bottom: var(--space-1);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.appov-crucial .appov-field-label { color: var(--orange); }
.appov-crucial .appov-field-value { color: var(--text); }
@media (max-width: 760px) {
  .appov-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════
   LIVE STATUS STRIP (now / next / time-left)
   ═══════════════════════════════════ */
.now-strip {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: 10px 16px;
  margin: 12px 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--glass-4);
}
.now-strip[hidden] { display: none; }
.now-strip.is-active {
  border-color: var(--orange-border);
  background: var(--orange-bg);
}
.now-strip-main { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }
.now-strip-tag {
  font-family: var(--font-body); font-size: var(--ts-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: var(--track-caps); color: var(--orange);
}
.now-strip-tag--idle { color: var(--text-faint); }
.now-strip-title { font-family: var(--font-heading); font-size: var(--ts-md); font-weight: 600; color: var(--text); }
.now-strip-time { font-family: var(--font-mono); font-size: var(--ts-base); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.now-strip-left { font-weight: 600; }
.now-strip-time.is-over { color: var(--red); }
.now-strip-next { font-size: var(--ts-sm); color: var(--text-muted); }
.now-strip-jump {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 32px; padding: 0 12px;
  background: transparent; border: 1px solid var(--orange-border);
  border-radius: var(--radius-sm); color: var(--orange);
  font-family: var(--font-body); font-size: var(--ts-xs); font-weight: 600; cursor: pointer;
}
.now-strip-jump:hover { background: var(--glass-8); }

/* ═══════════════════════════════════
   TIME-CONFIG DISCLOSURE (collapses the day-time inputs in the toolbar)
   ═══════════════════════════════════ */
.time-config { display: block; align-self: flex-start; }
.time-config > summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--glass-5); color: var(--text-muted); white-space: nowrap;
}
.time-config > summary::-webkit-details-marker { display: none; }
.time-config > summary::marker { content: ''; }
.time-config > summary:hover { color: var(--text); border-color: var(--border-strong); }
.time-config[open] > summary { color: var(--text); border-color: var(--orange-border); }
.time-config-caption {
  font-size: var(--ts-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: var(--track-caps); color: var(--text-faint);
}
.time-config-value { font-family: var(--font-mono); font-size: var(--ts-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.time-config-fields {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-top: 8px; padding: 0; border: 0;
}

/* ── Light-mode contrast fixes for the new tabs ── */
[data-theme="light"] .setup-acct.grp-a,
[data-theme="light"] .setup-grp.grp-a { color: #3d6010; }
[data-theme="light"] .setup-acct.grp-b,
[data-theme="light"] .setup-grp.grp-b { color: #015b8a; }
[data-theme="light"] .now-strip-jump:hover { background: var(--orange-bg); }
