:root {
  --bg: #f6f7f9; --surface: #ffffff; --line: #e4e7ec; --text: #101828; --muted: #667085;
  --accent: #3b5bdb; --accent-ink: #ffffff; --danger: #d92d20;
  --green: #067647; --green-bg: #ecfdf3; --blue: #175cd3; --blue-bg: #eff8ff;
  --amber: #b54708; --amber-bg: #fffaeb; --red: #b42318; --red-bg: #fef3f2; --grey-bg: #f2f4f7;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c111d; --surface: #161b26; --line: #293040; --text: #f5f5f6; --muted: #94969c;
    --accent: #6e8bff; --accent-ink: #0c111d; --danger: #f97066;
    --green: #47cd89; --green-bg: #053321; --blue: #84caff; --blue-bg: #102a56;
    --amber: #fdb022; --amber-bg: #4e1d09; --red: #fda29b; --red-bg: #55160c; --grey-bg: #1f242f;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.sub, .hint, .note { color: var(--muted); font-size: 12px; }
.hint { margin: 4px 0 0; }
.note { background: var(--amber-bg); color: var(--amber); padding: 8px 12px; border-radius: 8px; }
.empty { color: var(--muted); text-align: center; padding: 24px; }

/* Layout */
body.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.nav { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
.nav nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav nav a { color: var(--text); padding: 8px 10px; border-radius: 8px; }
.nav nav a:hover { background: var(--grey-bg); text-decoration: none; }
.nav nav a.on { background: var(--grey-bg); font-weight: 600; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 15px; }
.brand.big { font-size: 18px; justify-content: center; margin-bottom: 20px; }
.mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.me { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.me .who { font-weight: 600; }
.role { color: var(--muted); font-weight: 400; font-size: 12px; }
.main { padding: 28px 32px; min-width: 0; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.back { font-size: 13px; display: inline-block; margin-bottom: 6px; }
.card-page { max-width: 400px; margin: 10vh auto; padding: 0 16px; }

/* Controls */
input, select, button, .button { font: inherit; color: var(--text); }
input, select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; white-space: nowrap; }
.button:hover, button:hover { text-decoration: none; filter: brightness(0.97); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.danger { color: var(--danger); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 13px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px;
  display: flex; flex-direction: column; gap: 14px; }
.card.narrow { max-width: 440px; }
.alert { background: var(--red-bg); color: var(--red); padding: 10px 12px; border-radius: 8px; margin: 0; }
.ok { background: var(--green-bg); color: var(--green); padding: 10px 12px; border-radius: 8px; margin: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.filters input[type=search] { flex: 1 1 220px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Tables */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); background: var(--grey-bg);
  padding: 9px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 11px 12px; font-size: 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: var(--grey-bg); }
td.title { font-weight: 600; min-width: 200px; max-width: 320px; }
td.nowrap { white-space: nowrap; }
td .sub { font-weight: 400; }
td.title a { color: var(--text); }
td.time { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.time .sub { white-space: normal; min-width: 140px; max-width: 200px; }
td.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
td.actions form { margin: 0; }
td.actions .button { padding: 4px 9px; font-size: 12px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--grey-bg); color: var(--muted); white-space: nowrap; }
.pill.big { font-size: 13px; padding: 4px 12px; }
.pill.active { background: var(--blue-bg); color: var(--blue); }
.pill.planned { background: var(--amber-bg); color: var(--amber); }
.pill.completed { background: var(--green-bg); color: var(--green); }
.pill.failed { background: var(--red-bg); color: var(--red); }
.stats { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); }
.dot { white-space: nowrap; }
.dot::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--line); }
.dot.ready::before { background: var(--green); }
.dot.pending::before { background: var(--blue); }
.dot.failed::before, .dot.none::before { background: var(--red); }
.dot.expired::before, .dot.empty::before { background: var(--amber); }
.platform { white-space: nowrap; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 16px; color: var(--muted); }

/* Detail */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 20px; }
.facts > div { background: var(--surface); padding: 12px 14px; }
.facts .wide { grid-column: span 2; }
dt { font-size: 12px; color: var(--muted); }
dd { margin: 2px 0 0; font-weight: 500; }
.columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 20px; }
.count { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.transcript { max-height: 70vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.seg { display: grid; grid-template-columns: 64px 1fr; column-gap: 10px; }
.seg .t { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; grid-row: span 2; padding-top: 1px; }
.seg .who { font-weight: 600; font-size: 13px; }
.seg p { margin: 0; }
.rec { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 12px; }
.rec:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.rec video, .rec audio { width: 100%; margin: 8px 0 4px; border-radius: 8px; }
.people { margin: 0; padding-left: 18px; }
.timeline { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.timeline .time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.bad { color: var(--red); }
.issued { background: var(--blue-bg); border: 1px solid var(--blue); color: var(--text); border-radius: 12px; padding: 16px 18px; margin-bottom: 20px; }
.issued p { margin: 0 0 10px; }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 12px; }
  .nav nav { flex-direction: row; flex: 1; }
  .me { border-top: 0; padding-top: 0; flex-direction: row; gap: 12px; align-items: center; }
  .main { padding: 20px 16px; }
  .columns { grid-template-columns: 1fr; }
  .facts .wide { grid-column: auto; }
}
@keyframes pulse { 50% { opacity: .35; } }
.dot.loading { color: var(--muted); }
.dot.loading::before { background: var(--muted); animation: pulse 1.2s ease-in-out infinite; }
