/* =========================================================
   CAISE-ASR — shared stylesheet
   Light theme with CAISE branding
   ========================================================= */

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

:root {
  --bg:           #f0f4f8;
  --surface:      #ffffff;
  --surface2:     #e8eef5;
  --border:       #c8d6e4;
  --accent:       #2a8fa0;
  --accent-dark:  #1c6a7a;
  --accent-light: #d6eff3;
  --caise-blue:   #2353a5;
  --text:         #1a2c3d;
  --text-dim:     #5a6e82;
  --green:        #e8f5e9;
  --green-border: #4caf50;
  --green-text:   #1b5e20;
  --red:          #fde8e8;
  --red-text:     #c0392b;
  --red-border:   #e57373;
  --blue-sel:     #e3eff8;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =========================================================
   Language switching
   ========================================================= */

.lang-en { display: none; }
html[data-lang="en"] .lang-en { display: inline; }
html[data-lang="en"] .lang-pl { display: none; }

/* =========================================================
   Site Header
   ========================================================= */

.site-header {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.header-brand {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  flex-shrink: 0;
}
.header-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--caise-blue);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.header-subtitle {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.3;
}
.lang-switcher {
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-top: 0.1rem;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.lang-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.1s;
}
.lang-link:hover { color: var(--accent-dark); text-decoration: underline; }
.lang-link.lang-active { font-weight: 700; color: var(--accent-dark); }
.lang-sep { color: var(--text-dim); }

.header-middle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}
.admin-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.admin-nav > :not(:first-child) {
  border-left: 1px solid var(--text-dim);
  padding-left: 0.9rem;
}
.admin-nav form { display: inline; margin: 0; }
.stats-bar     { font-size: 0.78rem; color: var(--text-dim); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.annotator-tag { font-size: 0.83rem; color: var(--text-dim); white-space: nowrap; }

.header-logos {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}
.logo-caise      { height: 38px; width: auto; }
.logo-admedvoice { height: 22px; width: auto; }

/* ---- Main layout ---- */
main {
  max-width: 960px;
  margin: 1.5rem auto;
  padding: 0 1rem 2rem;
  flex: 1;
  width: 100%;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

/* ---- Audio ---- */
.audio-card audio { width: 100%; margin: 0.5rem 0; accent-color: var(--accent); }
.audio-btns { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.25rem; }
.btn-ctrl {
  padding: 0.3rem 0.9rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-ctrl:hover { background: var(--accent-light); border-color: var(--accent); }
.audio-error { font-size: 0.8rem; color: var(--red-text); margin-left: 0.5rem; }

/* ---- Reference ---- */
.ref-card { border-color: var(--green-border); background: var(--green); }
.ref-box  { background: rgba(255,255,255,0.6); }
.ref-toggle { cursor: pointer; user-select: none; }
.ref-hint   { font-size: 0.75rem; font-weight: normal; opacity: 0.65; margin-left: 0.5rem; }

/* ---- Transcript boxes ---- */
.transcript-box {
  padding: 0.75rem;
  border-radius: 6px;
  background: var(--surface2);
  font-size: 0.95rem;
  line-height: 1.65;
  white-space: pre-wrap;
  user-select: text;
  cursor: text;
  min-height: 2.5rem;
  margin-bottom: 0.5rem;
  word-break: break-word;
  color: var(--text);
}

/* ---- Copy buttons ---- */
.btn-copy {
  padding: 0.25rem 0.65rem;
  background: var(--accent-light);
  border: 1px solid var(--border);
  color: var(--accent-dark);
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8rem;
}
.btn-copy:hover { background: var(--accent); color: #fff; }

/* ---- Hypotheses row ---- */
.hyp-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.hyp-card { transition: border-color 0.15s; cursor: pointer; user-select: none; }
.hyp-card:hover { border-color: var(--accent); }
.hyp-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light), 0 0 0 3px var(--accent); }
.wer-badge { font-size: 0.72rem; font-weight: 600; padding: 0.15rem 0.45rem; border-radius: 4px; margin-left: 0.5rem; background: var(--surface2); color: var(--text-dim); vertical-align: middle; }
.wer-badge.wer-better { background: var(--green); color: var(--green-text); border: 1px solid var(--green-border); }
.wer-badge.wer-worse  { background: var(--red);   color: var(--red-text);   border: 1px solid var(--red-border); }

/* ---- Preference ---- */
.pref-card { }
.pref-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.pref-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-size: 0.9rem;
  transition: background 0.12s, border-color 0.12s;
}
.pref-label:hover { border-color: var(--accent); background: var(--accent-light); }
.pref-label input[type=radio] { accent-color: var(--accent); }

/* ---- Correction ---- */
.correction-card .card-title .optional { font-weight: 400; text-transform: none; letter-spacing: 0; }
.correction-card textarea {
  width: 100%;
  padding: 0.75rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}
.correction-card textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }

/* ---- Action bar ---- */
.action-bar {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0 1rem;
  align-items: center;
}
.btn-skip {
  padding: 0.65rem 1.4rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn-exclude {
  padding: 0.65rem 1.4rem;
  background: var(--red);
  border: 1px solid var(--red-border);
  color: var(--red-text);
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn-submit {
  padding: 0.65rem 2.5rem;
  background: var(--accent);
  border: 1px solid var(--accent-dark);
  color: #fff;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  margin-left: auto;
}
.btn-skip:hover    { border-color: var(--text-dim); color: var(--text); }
.btn-exclude:hover { background: #fcc; }
.btn-submit:hover  { background: var(--accent-dark); }

/* ---- State panels ---- */
.state-panel {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--text-dim);
}
.state-panel h2 { margin-bottom: 0.75rem; color: var(--text); }
.state-panel p  { margin-bottom: 1.5rem; }

/* ---- File info ---- */
.file-info {
  font-family: monospace;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  word-break: break-all;
}

/* ---- Setup page ---- */
.setup-card {
  max-width: 420px;
  margin: 4rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
.setup-card h1    { margin-bottom: 0.4rem; font-size: 1.4rem; color: var(--caise-blue); }
.setup-card .subtitle { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 1.75rem; }
.setup-card label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
  margin-top: 1rem;
}
.setup-card label:first-of-type { margin-top: 0; }
.setup-card input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}
.setup-card input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.btn-primary {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.8rem;
  background: var(--accent);
  border: 1px solid var(--accent-dark);
  color: #fff;
  border-radius: 7px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  padding: 0.65rem 1.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-dark); }
.error-msg { color: var(--red-text); font-size: 0.9rem; margin-bottom: 1rem; }
.optional  { font-weight: 400; color: var(--text-dim); }

/* =========================================================
   Admin panel
   ========================================================= */

.admin-main { max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem 4rem; }

.admin-badge {
  background: #e8edf8;
  border: 1px solid #b0c0e0;
  color: var(--caise-blue);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 0.4rem;
}

.admin-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.admin-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}
.section-note {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-dim);
}

/* Stats grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}
.stat-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  text-align: center;
}
.stat-value { font-size: 1.9rem; font-weight: 700; color: var(--accent); line-height: 1.2; }
.stat-label { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.25rem; }
.stat-hint  { font-size: 0.7rem; margin-top: 0.2rem; font-weight: 600; }
.stat-hint--active { color: var(--green-text); }
.stat-hint--warn   { color: var(--red-text); }
.stat-box--active  { border-color: var(--green-border); }
.stat-box--warn    { border-color: var(--red-border); }
.queue-threshold-chip {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: var(--surface3, var(--surface2));
  border: 1px solid var(--border);
  font-size: 0.68rem;
  vertical-align: middle;
}

/* Training status badge */
.training-badge {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: var(--surface2);
}
.training-badge--idle    { color: var(--text-dim); }
.training-badge--queued  { background: var(--yellow, #fef9c3); border-color: var(--yellow-border, #ca8a04); color: var(--yellow-text, #92400e); }
.training-badge--running { background: var(--green); border-color: var(--green-border); color: var(--green-text); }
.training-badge--guarded { background: var(--yellow, #fef9c3); border-color: var(--yellow-border, #ca8a04); color: var(--yellow-text, #92400e); }
.training-badge--failed  { background: var(--red);   border-color: var(--red-border);   color: var(--red-text);   }

/* Trigger button */
.btn-trigger {
  padding: 0.65rem 1.6rem;
  background: var(--caise-blue);
  border: 1px solid #1a3d80;
  color: #fff;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}
.btn-trigger:hover { background: #1a3d80; }

/* Save button */
.btn-save {
  padding: 0.65rem 1.8rem;
  background: var(--accent);
  border: 1px solid var(--accent-dark);
  color: #fff;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0.5rem;
}
.btn-save:hover { background: var(--accent-dark); }

/* Link-style button (header logout) */
.btn-link {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}
.btn-link:hover { color: var(--text); }

/* Header link */
.header-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
}
.header-link:hover { color: var(--accent-dark); text-decoration: underline; }
.header-link--active { color: var(--accent-dark); font-weight: 700; }

/* Settings form */
.admin-form { display: flex; flex-direction: column; gap: 0.75rem; }
.form-field  { display: flex; flex-direction: column; gap: 0.3rem; }
.form-field label {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 500;
}
.form-field input[type=number] {
  width: 180px;
  padding: 0.55rem 0.8rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}
.form-field input[type=number]:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.field-hint { font-size: 0.78rem; color: var(--text-dim); }
.tuning-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 0.6rem;
}
.tuning-grid .form-field input[type=number] { width: 100%; }
.form-fieldset {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  gap: 0.2rem;
}
.form-fieldset legend {
  padding: 0 0.4rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 500;
}
.training-diagnostics-wrap { overflow-x: auto; }
.training-diagnostics { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.training-diagnostics th, .training-diagnostics td { padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.training-diagnostics th { color: var(--text-dim); font-weight: 600; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.checkbox-label input[type=checkbox] { width: 1rem; height: 1rem; cursor: pointer; }

/* Sessions table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.admin-table th { color: var(--text-dim); font-weight: 600; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.05em; background: var(--surface2); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--blue-sel); }

.muted     { color: var(--text-dim); font-size: 0.9rem; }
.info-note { font-size: 0.83rem; color: var(--text-dim); line-height: 1.55; }

/* ---- Pipeline progress (Training section) ---- */
.pipeline-progress {
  margin: 1rem 0 0.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

/* Progress bar track */
.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.7rem;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
  background: var(--accent);
}
.progress-fill--failed { background: var(--red-text); }

/* Step list */
.step-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  padding: 0.2rem 0;
}
.step-icon {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
}
.step-item--done .step-icon   { background: var(--green); border-color: var(--green-border); color: var(--green-text); }
.step-item--done .step-label  { color: var(--text-dim); text-decoration: line-through; }
.step-item--active .step-icon { background: var(--accent-light); border-color: var(--accent); color: var(--accent-dark); }
.step-item--active .step-label{ color: var(--text); font-weight: 600; }
.step-item--guarded .step-icon { background: var(--yellow, #fef9c3); border-color: var(--yellow-border, #ca8a04); color: var(--yellow-text, #92400e); }
.step-item--guarded .step-label{ color: var(--yellow-text, #92400e); font-weight: 600; }
.step-item--failed .step-icon { background: var(--red); border-color: var(--red-border); color: var(--red-text); }
.step-item--failed .step-label{ color: var(--red-text); font-weight: 600; }
.step-item--pending .step-label{ color: var(--text-dim); }

/* Spinner for active step */
@keyframes spin { to { transform: rotate(360deg); } }
.step-spinner { display: inline-block; animation: spin 1.1s linear infinite; }

.step-current-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  font-family: monospace;
}

/* Error details box shown when a pipeline step fails */
.error-details {
  margin-top: 0.9rem;
  border: 1px solid var(--red-border, #f5c2c7);
  border-radius: 6px;
  background: #fff5f5;
  overflow: hidden;
}
.error-summary {
  cursor: pointer;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--red-text, #842029);
  background: var(--red, #f8d7da);
  user-select: none;
}
.error-pre {
  margin: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.78rem;
  font-family: "Consolas", "Menlo", monospace;
  white-space: pre-wrap;
  word-break: break-all;
  color: #400;
  max-height: 14rem;
  overflow-y: auto;
}

/* Per-step indeterminate bar (active step only) */
.step-bar-track {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: 0.25rem 0 0.3rem;
  position: relative;
}
.step-bar-indeterminate {
  position: absolute;
  height: 100%;
  width: 35%;
  background: var(--accent);
  border-radius: 2px;
  animation: step-slide 1.6s ease-in-out infinite;
}
@keyframes step-slide {
  0%   { left: -35%; }
  100% { left: 100%; }
}

/* Last captured log line from subprocess */
.step-log-line {
  font-family: monospace;
  font-size: 0.73rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding-right: 0.5rem;
}

/* ---- Canary acquisition ---- */
.canary-main { max-width: 1180px; }
.canary-intro,
.canary-overview,
.canary-ready {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}
.canary-intro h1,
.canary-overview h1 { font-size: 1.45rem; margin-bottom: 0.35rem; }
.canary-create-form {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 130px auto;
  align-items: end;
  gap: 0.75rem;
}
.canary-create-form label { font-size: 0.78rem; color: var(--text-dim); }
.canary-create-form input {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.58rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
}
.canary-eyebrow {
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.canary-progress-block { width: min(440px, 48%); }
.canary-progress-value { font-size: 1.45rem; font-weight: 700; margin-bottom: 0.35rem; }
.canary-provenance { display: flex; flex-wrap: wrap; gap: 0.7rem; font-size: 0.72rem; color: var(--text-dim); }
.canary-workbench audio { width: 100%; margin: 1rem 0; }
.canary-item-head { display: flex; align-items: center; gap: 0.65rem; color: var(--text-dim); font-size: 0.78rem; }
.health-chip { padding: 0.16rem 0.45rem; border: 1px solid var(--border); border-radius: 4px; }
.health-chip--available { color: var(--green-text); border-color: var(--green-border); background: var(--green); }
.canary-transcript-label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.canary-workbench textarea {
  width: 100%;
  resize: vertical;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  line-height: 1.55;
}
.canary-workbench textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.canary-gt { margin-top: 1rem; padding: 0.8rem; border: 1px solid var(--border); border-radius: 6px; background: #f7fafc; }
.canary-gt summary { cursor: pointer; font-weight: 600; color: var(--text-dim); }
.canary-gt .info-note { margin: 0.55rem 0; }
.canary-gt-result { margin-top: 0.65rem; }
.canary-gt-result > div { padding: 0.75rem; margin-bottom: 0.55rem; background: var(--green); border-left: 3px solid var(--green-border); }
.canary-actions { display: flex; justify-content: flex-end; margin-top: 1rem; }
.canary-item-grid { display: grid; grid-template-columns: repeat(20, minmax(28px, 1fr)); gap: 0.35rem; }
.canary-item-dot { height: 28px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 4px; color: var(--text-dim); font-size: 0.7rem; background: var(--surface2); }
.canary-item-dot--done { border-color: var(--green-border); color: var(--green-text); background: var(--green); }
.canary-bulk-action { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.canary-bulk-action h2 { font-size: 1rem; margin-bottom: 0.25rem; }
.canary-bulk-result { padding: 0.75rem 0.9rem; margin-bottom: 1rem; color: var(--green-text); background: var(--green); border-left: 4px solid var(--green-border); }
.canary-transcript-table-wrap { margin-top: 1rem; overflow-x: auto; }
.canary-transcript-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.canary-transcript-table th,
.canary-transcript-table td { padding: 0.6rem; border-top: 1px solid var(--border); text-align: left; vertical-align: top; }
.canary-transcript-table th { color: var(--text-dim); font-size: 0.7rem; text-transform: uppercase; }
.canary-transcript-table audio { width: 190px; height: 32px; }
.canary-identifiers { display: grid; gap: 0.2rem; min-width: 78px; }
.canary-identifiers code { color: var(--text); font-size: 0.74rem; }
.canary-identifiers small { color: var(--text-dim); font-size: 0.65rem; white-space: nowrap; }
.canary-stored-transcript { min-width: 280px; white-space: pre-wrap; }
.canary-inline-edit { display: grid; grid-template-columns: minmax(280px, 1fr) auto; gap: 0.5rem; align-items: end; }
.canary-inline-edit textarea { width: 100%; padding: 0.55rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface2); color: var(--text); font: inherit; resize: vertical; }
.canary-frozen-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.canary-set-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1rem; }
.canary-set-picker { display: flex; align-items: end; gap: 0.75rem; }
.canary-archive-toggle { padding-bottom: 0.55rem; color: var(--text-dim); font-size: 0.75rem; }
.canary-remove-row { display: flex; justify-content: flex-end; margin: -0.4rem 0 1rem; }
.gate-protection-note { color: var(--text-dim); font-size: 0.75rem; }
.btn-destructive { padding: 0.45rem 0.7rem; border: 1px solid #c53030; border-radius: 4px; background: transparent; color: #9b2c2c; cursor: pointer; font: inherit; font-weight: 600; }
.btn-destructive:hover { background: #fff5f5; }
.canary-set-toolbar label,
.health-monitor-picker label { display: grid; gap: 0.3rem; color: var(--text-dim); font-size: 0.75rem; }
.canary-set-toolbar select,
.health-monitor-picker select { min-width: 260px; padding: 0.55rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); }
.canary-set-toolbar details { text-align: right; }
.canary-set-toolbar summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.canary-set-toolbar .canary-create-form { margin-top: 0.65rem; }

/* ---- Model health ---- */
.health-main { max-width: 1180px; }
.health-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.health-monitor-picker { display: flex; justify-content: flex-end; margin-bottom: 0.75rem; }
.health-heading h1 { font-size: 1.55rem; }
.health-heading p { margin-top: 0.25rem; color: var(--text-dim); font-size: 0.82rem; }
.health-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-bottom: 1rem; }
.active-policy-banner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; padding: 0.9rem 1rem; border: 1px solid var(--green-border); border-left: 5px solid var(--green-border); background: var(--green); }
.active-policy-banner > div { display: grid; gap: 0.25rem; }
.active-policy-banner strong { overflow-wrap: anywhere; }
.active-policy-banner code { color: var(--text-dim); font-size: 0.7rem; overflow-wrap: anywhere; }
.active-policy-label { color: var(--green-text); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
.active-policy-metrics { justify-items: end; text-align: right; }
.active-policy-metrics small { color: var(--text-dim); }
.publication-band { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; margin-bottom: 1.5rem; padding: 1rem; border-block: 1px solid var(--border); background: var(--surface); }
.publication-copy, .publication-action { display: grid; gap: 0.35rem; }
.publication-copy code { color: var(--text-dim); font-size: 0.75rem; overflow-wrap: anywhere; }
.publication-action { justify-items: end; max-width: 24rem; text-align: right; }
.publication-action small { color: var(--text-dim); }
.publication-current, .publication-success { color: var(--green-text); font-weight: 700; }
.publication-success { margin: 0; }
.health-kpi { min-height: 92px; padding: 1rem; border: 1px solid var(--border); border-left: 4px solid var(--caise-blue); background: var(--surface); }
.health-kpi strong { display: block; font-size: 1.35rem; overflow-wrap: anywhere; }
.health-kpi span { color: var(--text-dim); font-size: 0.75rem; }
.health-kpi--healthy { border-left-color: var(--green-border); }
.health-kpi--warning { border-left-color: #d69e2e; }
.health-empty,
.health-chart-band,
.health-table-section { padding: 1rem; margin-bottom: 1rem; border: 1px solid var(--border); background: var(--surface); }
.health-empty { text-align: center; padding: 3rem 1rem; }
.health-empty p { margin-top: 0.65rem; color: var(--text-dim); }
.health-chart-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.health-chart-heading h2,
.health-table-section h2 { font-size: 1rem; margin-bottom: 0.7rem; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.8rem; font-size: 0.72rem; color: var(--text-dim); }
.chart-legend span::before { content: ""; display: inline-block; width: 16px; height: 3px; margin-right: 0.3rem; vertical-align: middle; background: currentColor; }
.legend-wer { color: #2353a5; }
.legend-cer { color: #2a8fa0; }
.health-chart { display: block; width: 100%; height: 205px; }
.chart-axis { stroke: #7890a6; stroke-width: 1; }
.chart-grid { stroke: #dce4ec; stroke-width: 1; stroke-dasharray: 4 5; }
.chart-axis-label { fill: var(--text-dim); font-size: 10px; }
.chart-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-line--wer { stroke: #2353a5; }
.chart-line--cer { stroke: #2a8fa0; }
.chart-point { stroke: var(--surface); stroke-width: 1.5; }
.chart-point--wer { fill: #2353a5; }
.chart-point--cer { fill: #2a8fa0; }
.chart-value { font-size: 9px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.chart-value--wer { fill: #2353a5; }
.chart-value--cer { fill: #287e8c; }
.health-table-wrap { overflow-x: auto; }
.health-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.health-table th,
.health-table td { padding: 0.65rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.health-table th { color: var(--text-dim); font-size: 0.7rem; text-transform: uppercase; }
.health-table tr.is-selected { background: var(--blue-sel); }
.health-table tr.is-active-policy { box-shadow: inset 4px 0 var(--green-border); }
.active-policy-chip { display: inline-block; margin-left: 0.45rem; padding: 0.12rem 0.36rem; border: 1px solid var(--green-border); border-radius: 4px; color: var(--green-text); background: var(--green); font-size: 0.65rem; font-weight: 700; vertical-align: middle; }
.active-policy-current { color: var(--green-text); font-size: 0.72rem; }
.stat-value--checkpoint { font-size: 0.9rem; overflow-wrap: anywhere; }
.health-table td:first-child { max-width: 330px; overflow-wrap: anywhere; }
.diagnostics-start-form { display: grid; grid-template-columns: minmax(180px, 1fr) auto; align-items: center; gap: 0.55rem; }
.diagnostics-start-form input { min-width: 0; min-height: 38px; padding: 0.45rem 0.55rem; border: 1px solid var(--border); border-radius: 4px; color: var(--text); background: var(--surface); }
.diagnostics-notice { margin-bottom: 1rem; padding: 0.65rem 0.8rem; border-left: 3px solid var(--caise-blue); background: var(--surface2); color: var(--text); }
.diagnostics-notice--accepted { border-left-color: var(--green-border); background: var(--green); color: var(--green-text); }
.diagnostics-command-form button:disabled { cursor: wait; opacity: 0.65; }
.diagnostics-table { min-width: 960px; table-layout: fixed; }
.diagnostics-table .diagnostics-col-run { width: 250px; }
.diagnostics-table .diagnostics-col-status { width: 110px; }
.diagnostics-table .diagnostics-col-samples { width: 80px; }
.diagnostics-table .diagnostics-col-actions { width: 155px; }
.diagnostics-table td:first-child { max-width: none; overflow-wrap: normal; }
.diagnostics-run strong { display: block; margin-bottom: 0.25rem; }
.diagnostics-run small { display: grid; gap: 0.15rem; color: var(--text-dim); }
.diagnostics-run code,
.diagnostics-run span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diagnostics-bundles { display: grid; gap: 0.55rem; }
.diagnostics-bundle { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 0.55rem; }
.diagnostics-bundle .btn-secondary { padding: 0.45rem 0.65rem; white-space: nowrap; text-align: center; }
.diagnostics-bundle small { min-width: 0; color: var(--text-dim); }
.diagnostics-hash { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diagnostics-actions { display: grid; gap: 0.4rem; }
.diagnostics-actions form { margin: 0; }
.diagnostics-actions button { width: 100%; min-height: 36px; white-space: nowrap; }
.health-table--transcripts audio { display: block; width: 190px; height: 32px; margin-bottom: 0.25rem; }
.health-table--transcripts td:nth-child(2),
.health-table--transcripts td:nth-child(3),
.health-table--transcripts td:nth-child(4) { min-width: 260px; }
.health-transcript-changed { background: #fff7df; }
.health-status { display: inline-block; padding: 0.16rem 0.42rem; border: 1px solid var(--border); border-radius: 4px; }
.health-status--healthy { color: var(--green-text); background: var(--green); border-color: var(--green-border); }
.health-status--warning { color: #7c4a03; background: #fff7df; border-color: #d69e2e; }
.health-warning { padding: 0.55rem 0.7rem; margin-bottom: 0.7rem; color: #7c4a03; background: #fff7df; border-left: 3px solid #d69e2e; }
.ci-bar { position: relative; width: 130px; height: 18px; background: var(--surface2); border: 1px solid var(--border); }
.ci-zero { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: #7890a6; }
.ci-range { position: absolute; top: 7px; height: 3px; background: var(--accent); }
.ci-marker { position: absolute; top: 3px; width: 2px; height: 11px; background: var(--text); transform: translateX(-1px); }
.ci-bar + small { color: var(--text-dim); font-size: 0.67rem; }

.reward-audit-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1rem; }
.reward-audit-heading h1 { margin-bottom: 0.25rem; font-size: 1.4rem; }
.reward-audit-form { display: grid; grid-template-columns: minmax(190px, 1.4fr) minmax(135px, 0.7fr) 100px minmax(220px, 1fr) auto; gap: 0.75rem; align-items: end; }
.reward-audit-form label,
.reward-audit-heading label { display: grid; gap: 0.3rem; color: var(--text-dim); font-size: 0.72rem; font-weight: 600; }
.reward-audit-form select,
.reward-audit-form input,
.reward-audit-heading select { min-height: 38px; }
.reward-audit-status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; margin-bottom: 0.8rem; }
.reward-audit-table audio { display: block; width: 175px; height: 30px; margin-bottom: 0.3rem; }
.reward-audit-table td:nth-child(2),
.reward-audit-table td:nth-child(3) { min-width: 240px; }
.reward-audit-table td small { display: block; margin-top: 0.3rem; color: var(--text-dim); }
.reward-audit-disagreement { background: #fff7df; }

/* ---- Annotation audit ---- */
.annotation-audit-main { max-width: 1540px; }
.audit-view-tabs { display: flex; gap: 0.35rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.audit-view-tab { padding: 0.65rem 0.85rem; color: var(--text-dim); text-decoration: none; border-bottom: 3px solid transparent; }
.audit-view-tab--active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.excluded-audio-table audio { width: 260px; max-width: 100%; display: block; margin-bottom: 0.4rem; }
.excluded-audio-table td:first-child { min-width: 300px; }
.excluded-transcript { min-width: 260px; max-width: 480px; white-space: normal; }
.annotation-audit-heading,
.annotation-section-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; }
.annotation-audit-heading { margin-bottom: 1rem; }
.annotation-audit-heading h1 { margin-bottom: 0.25rem; font-size: 1.5rem; }
.annotation-section-head { margin-bottom: 0.75rem; }
.annotation-section-head h2 { font-size: 1rem; }
.annotation-filter-form { display: flex; align-items: end; gap: 0.6rem; }
.annotation-filter-form label { display: grid; gap: 0.25rem; color: var(--text-dim); font-size: 0.7rem; }
.annotation-filter-form select { min-width: 135px; min-height: 36px; }
.annotator-audit-table td:first-child { min-width: 160px; }
.annotation-audit-table audio { display: block; width: 165px; height: 30px; margin-bottom: 0.35rem; }
.annotation-audit-table td { vertical-align: top; }
.annotation-audit-table td:first-child { min-width: 185px; }
.annotation-audit-table td small { display: block; margin-top: 0.25rem; color: var(--text-dim); }
.annotation-pair-text { min-width: 340px; }
.annotation-pair-text > div + div { margin-top: 0.65rem; padding-top: 0.65rem; border-top: 1px solid var(--border); }
.annotation-audit-table blockquote { margin: 0.55rem 0 0; padding-left: 0.55rem; border-left: 3px solid var(--accent); font-size: 0.78rem; }
.annotation-row--muted { background: #f2f4f7; color: var(--text-dim); }
.moderation-form { display: grid; grid-template-columns: minmax(105px, 1fr) auto; gap: 0.4rem; margin-top: 0.45rem; min-width: 210px; }
.moderation-form input { min-width: 0; padding: 0.42rem 0.5rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); }
.moderation-form button { white-space: nowrap; }
.annotation-pagination { display: flex; justify-content: center; align-items: center; gap: 0.75rem; margin-top: 0.8rem; }
.reward-agreement { display: inline-block; padding: 0.16rem 0.42rem; border: 1px solid; border-radius: 4px; font-weight: 700; }
.reward-agreement--yes { color: var(--green-text); background: var(--green); border-color: var(--green-border); }
.reward-agreement--no { color: #7c4a03; background: #fff7df; border-color: #d69e2e; }

@media (max-width: 760px) {
  .site-header { position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.7rem 1rem; padding: 0.75rem 1rem; }
  .header-brand { grid-column: 1; }
  .header-logos { grid-column: 2; flex-direction: row; align-items: center; gap: 0.55rem; }
  .logo-caise { height: 28px; }
  .logo-admedvoice { height: 17px; }
  .header-middle { grid-column: 1 / -1; width: 100%; overflow-x: auto; justify-content: flex-start; padding-bottom: 0.2rem; }
  .header-middle { scrollbar-width: none; }
  .header-middle::-webkit-scrollbar { display: none; }
  .admin-nav { width: max-content; flex-wrap: nowrap; justify-content: flex-start; gap: 0.65rem; }
  .admin-nav > :not(:first-child) { border-left: 0; padding-left: 0; }
  .admin-nav .header-link,
  .admin-nav .btn-link { white-space: nowrap; }
  .diagnostics-main { padding-inline: 0.75rem; }
  .diagnostics-main .admin-section { padding: 1rem; }
  .diagnostics-capture h1 { font-size: 1.55rem; line-height: 1.2; }
  .diagnostics-start-form { grid-template-columns: 1fr; }
  .diagnostics-start-form .btn-secondary { width: 100%; }
  .diagnostics-main .health-table-wrap { overflow: visible; }
  .diagnostics-table { display: block; min-width: 0; }
  .diagnostics-table colgroup,
  .diagnostics-table thead { display: none; }
  .diagnostics-table tbody,
  .diagnostics-table tr { display: block; }
  .diagnostics-table tr { padding-block: 0.35rem; border-bottom: 1px solid var(--border); }
  .diagnostics-table td,
  .diagnostics-table td:first-child { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 0.7rem; width: 100%; max-width: none; padding: 0.6rem 0; border-bottom: 0; }
  .diagnostics-table td::before { content: attr(data-label); color: var(--text-dim); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
  .diagnostics-table .diagnostics-run strong { margin: 0; }
  .diagnostics-table .diagnostics-run small { grid-column: 2; }
  .diagnostics-bundle { grid-template-columns: 1fr; }
  .diagnostics-bundle .btn-secondary { width: 100%; }
  .diagnostics-actions form { grid-column: 2; }
  .canary-intro,
  .canary-overview,
  .canary-ready { align-items: stretch; flex-direction: column; gap: 1rem; }
  .canary-bulk-action { align-items: stretch; flex-direction: column; }
  .canary-set-toolbar { align-items: stretch; flex-direction: column; }
  .canary-set-picker { align-items: stretch; flex-direction: column; }
  .canary-set-toolbar details { text-align: left; }
  .canary-progress-block { width: 100%; }
  .canary-create-form { grid-template-columns: 1fr; width: 100%; }
  .canary-item-grid { grid-template-columns: repeat(10, minmax(26px, 1fr)); }
  .health-heading { align-items: stretch; flex-direction: column; }
  .health-summary { grid-template-columns: 1fr; }
  .active-policy-banner { align-items: stretch; flex-direction: column; }
  .active-policy-metrics { justify-items: start; text-align: left; }
  .publication-band { align-items: stretch; flex-direction: column; }
  .publication-action { justify-items: start; max-width: none; text-align: left; }
  .reward-audit-heading { align-items: stretch; flex-direction: column; }
  .reward-audit-form { grid-template-columns: 1fr; }
  .annotation-audit-heading,
  .annotation-section-head { align-items: stretch; flex-direction: column; }
  .annotation-filter-form { align-items: stretch; flex-direction: column; }
  .annotation-filter-form select { width: 100%; }
}

/* =========================================================
   Site Footer
   ========================================================= */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.4rem 1.5rem;
  margin-top: auto;
  font-size: 0.79rem;
  color: var(--text-dim);
  line-height: 1.65;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.footer-copy {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.footer-disclaimer { margin-bottom: 0.7rem; }
.footer-projects-title {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.footer-project { margin-bottom: 0.25rem; }
.footer-project a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.footer-project a:hover { text-decoration: underline; }
