/*
 * Chassis widget stylesheet — everything shared across templates that
 * uses the Studio Gear vocabulary. Assumes tokens.css is loaded first
 * (all --chassis-*, --led-*, --text-*, --font-*, --radius* come from it).
 */

/* ── Reset + body ──────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--surface);
  color: var(--ink);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* iOS Safari auto-zooms into any input with font-size < 16px on focus.
 * Guarantee 16px on every editable so the recording flow stays smooth
 * on iPhone. */
input, select, textarea, button {
  font-size: 16px;
  font-family: inherit;
}

/* ── Sidebar ───────────────────────────────────────────────────
 *
 * Replaces the 52px horizontal topbar (which had grown to fifteen
 * elements). Four destinations, two glyph actions above them, a foot with
 * Einstellungen and the account. The old bar's fixed height and its
 * sticky rules are gone with it — nothing else depended on them.
 *
 * The look is poster: warm paper, a 2px near-black edge, hard offset
 * shadows with no blur.
 */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.6rem 1rem;
  background: var(--surface-raised);
  border: var(--edge-width) solid var(--edge);
  color: var(--ink);
  font-weight: 700;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 236px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1rem;
  background: var(--surface-raised);
  border-right: var(--edge-width) solid var(--edge);
  overflow-y: auto;
}

/* The drawer's state lives in a checkbox (U6). Kept off-screen rather
 * than `display:none` so it stays keyboard-reachable. */
.sidebar-drawer-state {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.sidebar-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-wordmark {
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}

/* ── The two glyph actions (R3, KD2) ── */

.sidebar-signs {
  display: flex;
  gap: 0.6rem;
}

.sidebar-sign {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* WCAG 2.5.8 asks for 24px; the platform recommendation is 44-48, and
   * these two carry no visible word to aim at, so they get the larger
   * one. */
  min-width: 44px;
  min-height: 44px;
  flex: 1;
  color: var(--ink);
  background: var(--surface);
  border: var(--edge-width) solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-offset-sm);
  text-decoration: none;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}

.sidebar-sign:hover { background: var(--surface-sunken); }
.sidebar-sign:active { transform: translate(2px, 2px); box-shadow: none; }
.sidebar-sign--record { color: var(--accent); }

/* ── Live state (R6 / KTD5) ──
 *
 * Present only while something is in flight, so it never becomes
 * furniture. Static by design: a permanent pulse in the chrome is ignored
 * within days, and it takes the real messages down with it. The failure
 * state differs from the running one by glyph and wording, not just by
 * colour. */

.sidebar-live {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.6rem;
  border: var(--edge-width) solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
}

.sidebar-live--running { color: var(--signal); }

.sidebar-live--failed {
  color: var(--danger);
  background: rgba(176, 32, 26, 0.08);
}

/* Seit Plan 2026-08-04-004 (U4) ist die Fehler-Plakette ein Link auf
 * /auftraege — die laufende Verarbeitung bleibt eine Meldung. Der Link braucht
 * deshalb, was ein `<div>` nicht brauchte: keine Unterstreichung im
 * Ruhezustand, aber eine sichtbare Reaktion auf Zeiger und Tastatur. Ohne die
 * Reaktion sieht er aus wie die Sackgasse, die er vorher war. */
a.sidebar-live { text-decoration: none; cursor: pointer; }
a.sidebar-live:hover { background: rgba(176, 32, 26, 0.16); }
a.sidebar-live:active { transform: translate(1px, 1px); }

/* ── Navigation ── */

.sidebar-collapsible {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1rem;
  min-height: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-group {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.35rem;
}

.sidebar-nav a,
.sidebar-settings {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.4rem 0.6rem;
  border: var(--edge-width) solid transparent;
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-settings:hover {
  background: var(--surface-sunken);
}

/* R7 + WCAG 1.4.1: the current page is a filled panel with a hard offset
 * shadow and heavier type. Colour is the last of the three signals here,
 * not the only one. */
.sidebar-nav a[aria-current="page"],
.sidebar-settings[aria-current="page"] {
  background: var(--surface);
  border-color: var(--edge);
  box-shadow: var(--shadow-offset-sm);
  font-weight: 800;
}

/* R11: the quieter tier is smaller and lighter, NOT greyed out. Dimming
 * reads as "disabled" and measurably hurts findability. */
.sidebar-tier-rule {
  border: none;
  border-top: var(--edge-width) solid var(--edge-soft);
  margin: 0.6rem 0;
}

.sidebar-tier-2 {
  font-size: 0.85rem !important;
  font-weight: 500 !important;
}

.sidebar-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
}

/* ── Foot: Einstellungen and the account ── */

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.75rem;
  border-top: var(--edge-width) solid var(--edge-soft);
}

.sidebar-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0 0.6rem;
}

.sidebar-account-name {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-signout {
  background: none;
  border: none;
  padding: 0.4rem 0;
  font-size: 0.75rem !important;
  color: var(--ink-muted);
  text-decoration: underline;
  cursor: pointer;
}

.sidebar-signout:hover { color: var(--ink); }

/* ── The drawer control (U6) ──
 *
 * Hidden while the bar is a column; the whole point of the bar is that it
 * has room for its four destinations at desktop widths. */

.sidebar-drawer-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: var(--edge-width) solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

/* A three-line glyph drawn in CSS — no icon font, no script. */
.sidebar-drawer-glyph,
.sidebar-drawer-glyph::before,
.sidebar-drawer-glyph::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
}

.sidebar-drawer-glyph::before,
.sidebar-drawer-glyph::after {
  content: "";
  position: relative;
}

.sidebar-drawer-glyph::before { top: -6px; }
.sidebar-drawer-glyph::after  { top: 4px; }

.sidebar-drawer-state:focus-visible ~ .sidebar-bar .sidebar-drawer-toggle {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Content beside the bar ── */
/* Padding on `body`, not a margin on `.content`: the content block keeps
 * its own `margin: 0 auto` centring, and it now centres inside what is
 * left over rather than inside the whole window. */

body { padding-left: 236px; }

/* R8: below this width the column would clip destinations off-screen, so
 * it lies down into a strip and the four destinations fold behind the
 * control above. The strip keeps the wordmark and BOTH glyph actions —
 * recording and uploading are why anyone opens this on a phone. */
@media (max-width: 800px) {
  .sidebar {
    position: sticky;
    width: auto;
    inset: 0 0 auto 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-right: none;
    border-bottom: var(--edge-width) solid var(--edge);
    overflow: visible;
  }

  .sidebar-bar { flex: 1; }
  .sidebar-signs { flex: 0 0 auto; }
  .sidebar-sign { flex: 0 0 auto; }
  .sidebar-drawer-toggle { display: inline-flex; }

  .sidebar-collapsible { display: none; }

  .sidebar-drawer-state:checked ~ .sidebar-collapsible {
    display: flex;
    flex: 1 0 100%;
  }

  .sidebar-foot { margin-top: 0; }

  body { padding-left: 0; }
}

/* ── Personen-Hub: section strip (U7/U8) ──────────────────────────
 *
 * Three navigation destinations became one page with the split inside it.
 * Server-rendered links, not a JavaScript switcher — the project had both
 * patterns and this is the one that survives a script that never loads.
 * The current section is a filled panel with a hard shadow and heavier
 * type, same three signals as the sidebar's own current item. */

.hub-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.hub-tab {
  display: inline-flex;
  align-items: center;
  /* Abstand kam mit den Zeichen dazu (Plan 2026-08-04-005) — vorher trug der
   * Reiter nur Text und brauchte keinen. */
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.45rem 0.9rem;
  border: var(--edge-width) solid var(--edge);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.hub-tab:hover { background: var(--surface-sunken); color: var(--ink); }

.hub-tab[aria-current="page"] {
  background: var(--surface-raised);
  color: var(--ink);
  font-weight: 800;
  box-shadow: var(--shadow-offset-sm);
}

/* R13: the quality area is a notice, not a permanent empty tab. It is in
 * the document only while there is something to review. */
.hub-notice {
  display: block;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1rem;
  border: var(--edge-width) solid var(--warn);
  border-radius: var(--radius);
  background: rgba(13, 79, 92, 0.08);
  color: var(--ink);
  font-size: 0.88rem;
  text-decoration: none;
}

.hub-notice:hover { background: rgba(13, 79, 92, 0.14); }
.hub-notice strong { color: var(--warn); }

/* ── Panels ────────────────────────────────────────────────────── */

.chassis-panel {
  background: var(--chassis-panel);
  border: 1px solid var(--chassis-border);
  border-radius: var(--radius);
  padding: 1rem;
}

.chassis-panel-raised {
  background: var(--chassis-panel-raised);
  border: 1px solid var(--chassis-border);
  border-radius: var(--radius);
  padding: 1rem;
}

/* ── Studio label — Mono-Caps section titles ───────────────────── */

.studio-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── LED dot ───────────────────────────────────────────────────── */

.led-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--led-color, var(--ink-faint));
  flex-shrink: 0;
}

.led-dot--off {
  background: transparent;
  border: 1px solid var(--edge-soft);
  box-shadow: none;
}

.led-dot--red    { --led-color: var(--led-red); }
.led-dot--amber  { --led-color: var(--led-amber); }
.led-dot--green  { --led-color: var(--led-green); }
.led-dot--white  { --led-color: var(--led-white-bright); }

.led-dot--pulse {
  animation: chassis-led-pulse 1s ease-in-out infinite;
}

@keyframes chassis-led-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* ── Raised chassis buttons — the primary CTA style ──────────── */

.chassis-btn-raised {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  min-width: 40px;
  padding: 0.55rem 1rem;
  background: var(--surface-raised);
  color: var(--ink);
  border: var(--edge-width) solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-offset-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}

.chassis-btn-raised:hover {
  background: var(--surface-sunken);
}

/* Pressing moves the button onto its own shadow — the poster equivalent
 * of a key travelling. Motion, not a hue change. */
.chassis-btn-raised:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.chassis-btn-raised:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.chassis-btn-raised--danger {
  background: var(--danger);
  color: #fff;
}

.chassis-btn-raised--danger:hover {
  background: rgb(148, 26, 21);
}

/* ── Small chip (metadata) ─────────────────────────────────────── */

.chassis-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--edge-soft);
  border-radius: var(--radius-sm);
}

/* ── Inputs ────────────────────────────────────────────────────── */

.chassis-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--surface-raised);
  border: var(--edge-width) solid var(--edge);
  border-radius: var(--radius);
  color: var(--ink);
  outline: none;
  min-height: 44px;
  transition: box-shadow 0.15s;
}

.chassis-input:focus {
  box-shadow: var(--shadow-offset-sm);
}

.chassis-input::placeholder {
  color: var(--ink-faint);
}

/* ── Layout containers ────────────────────────────────────────── */

.chassis-content {
  padding: 1.25rem 1rem;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 800px) {
  .chassis-content {
    max-width: 1100px;
    padding: 1.5rem 1.5rem;
  }
}

/* ── Chassis-Modal (used by Chassis.confirm / Chassis.alert) ──── */

.chassis-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(26, 24, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.chassis-modal {
  max-width: 480px;
  width: 100%;
  background: var(--surface-raised);
  border: var(--edge-width) solid var(--edge);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow-offset);
}

.chassis-modal-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--led-white-bright);
}

.chassis-modal-body {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.chassis-modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* ── Icons ─────────────────────────────────────────────────────── */

.chassis-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.chassis-icon.dim { opacity: 0.55; }

/* ── Accessibility ────────────────────────────────────────────── */

.chassis-btn-raised:focus-visible,
.chassis-chip:focus-visible,
.chassis-input:focus-visible,
.sidebar-nav a:focus-visible,
a.sidebar-live:focus-visible,
.sidebar-sign:focus-visible,
.sidebar-settings:focus-visible,
.sidebar-wordmark:focus-visible,
.sidebar-signout:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Reduced motion — kill all decorative animations. Overrides both CSS
 * @keyframes and JS-driven CSS-var-based bumps (Chassis.prefersReducedMotion
 * short-circuits the JS-side, this backstops the CSS side). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* List-row perf: isolates layout/paint/style per row so a status flip in
 * one row doesn't cascade re-layout across 40 archived meetings. Applied
 * to all row-shaped classes; individual templates opt in with the class. */
.activity-row,
.archive-row,
.meeting-row,
.pipeline-step-card,
.speaker-card {
  contain: layout paint style;
}

/* ── LIVE-Feed row layout ───────────────────────────────────────
 *
 * Structure: LED-Dot | Body (title, meta, error) | Timestamp.
 * The body flex-grows; the LED-dot and timestamp are fixed-width.
 * `contain` above already isolates the row's layout scope. */
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--edge-soft);
  border-radius: 0;
}

.activity-row:last-child { border-bottom: none; }

.activity-row > .led-dot {
  margin-top: 0.35rem;   /* align with the first text line */
}

.activity-row-body {
  flex: 1 1 auto;
  min-width: 0;   /* required so long titles ellipsize */
}

.activity-row-title {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-row-meta {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  margin-top: 0.15rem;
}

.activity-row-error {
  color: var(--led-red);
  font-size: 0.72rem;
  margin-top: 0.25rem;
}

.activity-row-ts {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.activity-row--fade-in {
  animation: chassis-fade-in 0.4s ease-out;
}

@keyframes chassis-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@supports (content-visibility: auto) {
  .archive-row-body { content-visibility: auto; contain-intrinsic-size: 400px; }
}

/* ── Divider ──────────────────────────────────────────────────── */

.chassis-divider {
  border: none;
  border-top: 1px solid var(--chassis-border);
  margin: 1rem 0;
}
