/* =====================================================================
   IRIS ODK–Asterisk QC Audit Portal
   Shared stylesheet: login, dashboard, admin wizards, tables, and the
   split-screen QC audit workspace. No frameworks, no CDN dependencies.
   ===================================================================== */

:root {
  --bg: #eef3f7;
  --bg-soft: #f7fafc;
  --surface: #ffffff;
  --surface-2: #f3f7fa;
  --ink: #0f2540;
  --ink-soft: #334f68;
  --muted: #6b8199;
  --line: #d9e3ec;
  --line-strong: #c3d2df;

  --brand: #0e7c86;
  --brand-dark: #0a5c63;
  --brand-soft: #e2f4f5;
  --accent: #1f5fd0;
  --accent-soft: #e8f0fe;

  --approved: #157f3d;
  --approved-soft: #e3f6ea;
  --rejected: #c02525;
  --rejected-soft: #fdeaea;
  --flagged: #a86300;
  --flagged-soft: #fdf1dc;
  --pending: #566c82;
  --pending-soft: #edf2f7;

  --danger: #c02525;
  --shadow-sm: 0 1px 2px rgba(15, 37, 64, 0.06), 0 1px 3px rgba(15, 37, 64, 0.08);
  --shadow-md: 0 6px 18px rgba(15, 37, 64, 0.08), 0 2px 6px rgba(15, 37, 64, 0.06);
  --shadow-lg: 0 24px 60px rgba(15, 37, 64, 0.18);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-size: 0.86em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.grow { flex: 1 1 auto; }
.right { text-align: right; }

/* ------------------------------ Buttons ----------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.06s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled) { filter: brightness(0.94); }
.btn-outline { background: transparent; border-color: var(--line-strong); color: var(--ink-soft); }
.btn-outline:hover:not(:disabled) { background: var(--surface-2); border-color: var(--brand); color: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover:not(:disabled) { background: rgba(15, 37, 64, 0.06); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }
.btn-danger-outline { background: transparent; border-color: #e7b4b4; color: var(--danger); }
.btn-danger-outline:hover:not(:disabled) { background: var(--rejected-soft); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; width: 34px; height: 34px; }
.btn .spinner { width: 14px; height: 14px; border-width: 2px; }

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(14, 124, 134, 0.25);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner.light { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------- Forms ------------------------------ */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label,
.label {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.field .hint { font-size: 12px; color: var(--muted); }
.field .req { color: var(--rejected); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 124, 134, 0.16);
}
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.checkbox { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.checkbox input[type="checkbox"] { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--brand); cursor: pointer; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

.alert {
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 13.5px;
  border: 1px solid transparent;
  margin-bottom: 14px;
}
.alert-error { background: var(--rejected-soft); border-color: #f2c6c6; color: #8f1d1d; }
.alert-info { background: var(--accent-soft); border-color: #c8daf8; color: #1b4b9e; }
.alert-success { background: var(--approved-soft); border-color: #bfe7cd; color: #126030; }
.alert-warn { background: var(--flagged-soft); border-color: #f0dcba; color: #7a4a00; }

/* ------------------------------ Badges ------------------------------ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge-approved { background: var(--approved-soft); color: var(--approved); border-color: #bfe7cd; }
.badge-rejected { background: var(--rejected-soft); color: var(--rejected); border-color: #f2c6c6; }
.badge-flagged { background: var(--flagged-soft); color: var(--flagged); border-color: #f0dcba; }
.badge-pending { background: var(--pending-soft); color: var(--pending); border-color: #d6e0e9; }
.badge-active { background: var(--approved-soft); color: var(--approved); border-color: #bfe7cd; }
.badge-archived { background: var(--pending-soft); color: var(--pending); border-color: #d6e0e9; }
.badge-admin { background: var(--accent-soft); color: var(--accent); border-color: #c8daf8; }
.badge-qc { background: var(--brand-soft); color: var(--brand-dark); border-color: #b9e3e5; }
.badge-count { background: var(--surface-2); color: var(--ink-soft); border-color: var(--line); }
.badge-count::before { display: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 650;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
}

/* ------------------------------ Login ------------------------------- */

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 12% -10%, #1a8f99 0%, transparent 60%),
    radial-gradient(900px 520px at 92% 0%, #1f5fd0 0%, transparent 55%),
    linear-gradient(160deg, #0b2338 0%, #103a52 48%, #0d4a52 100%);
}
.login-card {
  width: min(430px, 100%);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 34px 32px 28px;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--brand) 0%, #0f5f8f 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 15px;
  box-shadow: var(--shadow-sm);
  flex: 0 0 auto;
}
.login-card h1 { font-size: 20px; }
.login-card .sub { color: var(--muted); font-size: 13.5px; margin: 4px 0 22px; }
.login-footer { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.6; }
.login-demo {
  margin-top: 18px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  font-size: 12.5px;
  color: var(--ink-soft);
}
.login-demo code { font-family: var(--mono); background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

/* --------------------------- Boot / session ------------------------- */

/*
 * Neutral shell shown while GET /api/auth/me is in flight. It inherits the
 * portal background and only holds a centred spinner, so a refresh of an
 * authenticated route never flashes the login card.
 */
.boot-view {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.boot-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
}
.boot-mark { width: 38px; height: 38px; border-radius: 11px; font-size: 13px; }
.boot-text { font-size: 13px; letter-spacing: 0.01em; }
@media (prefers-reduced-motion: reduce) {
  .boot-view .spinner { animation-duration: 2.4s; }
}

/* ------------------------------ Shell ------------------------------- */

.app-view { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  padding: 0 20px;
  height: 62px;
  background: linear-gradient(100deg, #0c2a40 0%, #0d3f4f 55%, #0e5a63 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 10px rgba(9, 30, 47, 0.22);
}
.topbar .brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex-shrink: 0; }
.topbar .brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.topbar .brand-text strong { font-size: 14.5px; letter-spacing: 0.01em; }
.topbar .brand-text span { font-size: 11.5px; color: rgba(255, 255, 255, 0.66); }
.topbar .brand-mark { width: 34px; height: 34px; font-size: 12.5px; border-radius: 9px; background: rgba(255, 255, 255, 0.13); }

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  min-width: 0;
  flex: 0 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, 0.16); color: #fff; }
.nav .nav-icon { font-size: 14px; opacity: 0.9; }

.userbox {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-width: 0;
}
.userbox .who { text-align: right; line-height: 1.25; min-width: 0; max-width: 220px; }
.userbox .who strong,
.userbox .who span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox #logoutBtn { flex: 0 0 auto; white-space: nowrap; }
.userbox .who strong { display: block; font-size: 13px; }
.userbox .who span { font-size: 11.5px; color: rgba(255, 255, 255, 0.65); text-transform: capitalize; }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12.5px;
  color: #fff;
  flex: 0 0 auto;
}
.topbar .btn-ghost { color: rgba(255, 255, 255, 0.85); border-color: rgba(255, 255, 255, 0.24); }
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.main { flex: 1 1 auto; width: 100%; max-width: 1500px; margin: 0 auto; padding: 24px 22px 56px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 21px; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.page-head .actions { display: flex; gap: 9px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand); }

/* ------------------------------- Cards ------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; }
.card-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 18px 20px; }
.card + .card { margin-top: 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 17px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}
.stat::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--brand); opacity: 0.85; }
.stat.s-approved::after { background: var(--approved); }
.stat.s-rejected::after { background: var(--rejected); }
.stat.s-flagged::after { background: var(--flagged); }
.stat.s-pending::after { background: var(--pending); }
.stat .k { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.stat .v { font-size: 27px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; }
.stat .d { font-size: 12px; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1080px) { .grid-2 { grid-template-columns: 1fr; } }

/* ------------------------------ Tables ------------------------------ */

.table-wrap { width: 100%; overflow-x: auto; }
/* Long queue/reconciliation pages scroll inside the card while the filter
   bar above and the pagination bar below stay visible. */
.table-wrap.scroll-table {
  max-height: clamp(320px, calc(100vh - 350px), 680px);
  overflow-y: auto;
  overflow-x: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.table-wrap.scroll-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  box-shadow: inset 0 -1px 0 var(--line);
}
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr { transition: background 0.12s ease; }
table.data tbody tr:hover { background: #f6fafc; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tr.row-highlight { animation: rowFlash 1.6s ease; }
@keyframes rowFlash { 0% { background: #d9f2e2; } 100% { background: transparent; } }
table.data td.actions { text-align: right; white-space: nowrap; }
.cell-strong { font-weight: 650; color: var(--ink); }
.cell-sub { font-size: 12px; color: var(--muted); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}
.toolbar .search { flex: 1 1 240px; min-width: 180px; position: relative; }
.toolbar .search input { padding-left: 32px; }
.toolbar .search::before {
  content: "⌕";
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-52%);
  color: var(--muted);
  font-size: 16px;
  pointer-events: none;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.14s ease;
}
.chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { font-size: 11px; opacity: 0.75; font-weight: 700; }
.chip.active .n { opacity: 0.9; }
.chip.c-approved.active { background: var(--approved); border-color: var(--approved); }
.chip.c-rejected.active { background: var(--rejected); border-color: var(--rejected); }
.chip.c-flagged.active { background: var(--flagged); border-color: var(--flagged); }
.chip.c-pending.active { background: var(--pending); border-color: var(--pending); }

.empty {
  text-align: center;
  padding: 46px 22px;
  color: var(--muted);
}
.empty .big { font-size: 30px; margin-bottom: 8px; opacity: 0.55; }
.empty h4 { color: var(--ink-soft); margin-bottom: 5px; font-size: 15px; }
.empty p { font-size: 13.5px; max-width: 460px; margin: 0 auto 14px; }

/* --------------------------- Project cards -------------------------- */

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.project-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
  position: relative;
}
.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--line-strong); }
.project-card h3 { font-size: 16px; }
.project-card .desc { font-size: 13px; color: var(--muted); min-height: 20px; }
.project-meta { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-soft); }
.project-meta .row { display: flex; gap: 6px; align-items: center; }
.project-meta .k { color: var(--muted); min-width: 64px; }
.project-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.project-card .card-actions { display: flex; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.project-card .corner { position: absolute; top: 16px; right: 16px; }

/* ------------------------------ Modal ------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 26, 42, 0.52);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 18px;
  overflow-y: auto;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(760px, 100%);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: popIn 0.16s ease;
  margin: auto 0;
}
.modal.modal-wide { width: min(940px, 100%); }
.modal.modal-narrow { width: min(480px, 100%); }
@keyframes popIn { from { transform: translateY(8px) scale(0.99); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; }
.modal-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal-body { padding: 20px 22px; max-height: 66vh; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }
.modal-close { background: none; border: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.modal-close:hover { background: var(--surface-2); color: var(--ink); }

/* ------------------------------ Wizard ------------------------------ */

.wizard-steps { display: flex; align-items: center; gap: 0; padding: 16px 22px; background: var(--surface-2); border-bottom: 1px solid var(--line); overflow-x: auto; }
.wstep { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; color: var(--muted); white-space: nowrap; }
.wstep .num {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: #fff; border: 1.5px solid var(--line-strong); font-size: 12px;
}
.wstep.done { color: var(--brand-dark); }
.wstep.done .num { background: var(--brand); border-color: var(--brand); color: #fff; }
.wstep.current { color: var(--ink); }
.wstep.current .num { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 3px rgba(14, 124, 134, 0.14); }
.wline { flex: 1 1 24px; height: 1.5px; background: var(--line-strong); margin: 0 10px; min-width: 16px; }

.step-panel { display: none; }
.step-panel.active { display: block; }
.step-title { font-size: 16px; margin-bottom: 4px; }
.step-help { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

.connect-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-2);
  margin-bottom: 14px;
}
.connect-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.connect-row .field { flex: 1 1 180px; margin-bottom: 0; }

.status-line { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 10px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.status-dot.ok { background: var(--approved); box-shadow: 0 0 0 3px rgba(21, 127, 61, 0.15); }
.status-dot.err { background: var(--rejected); box-shadow: 0 0 0 3px rgba(192, 37, 37, 0.15); }
.status-dot.busy { background: var(--flagged); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.summary-list { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.summary-list .row { display: grid; grid-template-columns: 190px 1fr; gap: 12px; padding: 9px 13px; background: #fff; font-size: 13.5px; }
.summary-list .row .k { color: var(--muted); font-weight: 600; }
.summary-list .row .v { color: var(--ink); word-break: break-word; }
@media (max-width: 640px) { .summary-list .row { grid-template-columns: 1fr; gap: 2px; } }

.reviewer-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.picker-item {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 13.5px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.picker-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.picker-item input { accent-color: var(--brand); width: 16px; height: 16px; }

/* ------------------------------ Toasts ------------------------------ */

.toast-root { position: fixed; top: 74px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 11px 14px;
  font-size: 13.5px;
  color: var(--ink-soft);
  animation: slideIn 0.18s ease;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.toast.success { border-left-color: var(--approved); }
.toast.error { border-left-color: var(--rejected); }
.toast.warn { border-left-color: var(--flagged); }
.toast strong { display: block; color: var(--ink); font-size: 13.5px; margin-bottom: 1px; }
.toast.out { animation: slideOut 0.2s ease forwards; }
@keyframes slideIn { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideOut { to { transform: translateX(16px); opacity: 0; } }

/* --------------------------- Audit workspace ------------------------ */

.audit-body { background: var(--bg-soft); height: 100vh; overflow: hidden; display: flex; flex-direction: column; }

.audit-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  height: 58px;
  background: linear-gradient(100deg, #0c2a40 0%, #0d3f4f 60%, #0e5a63 100%);
  color: #fff;
  flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(9, 30, 47, 0.18);
  z-index: 20;
}
.audit-top .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.audit-top .meta { min-width: 0; }
.audit-top .meta strong { display: block; font-size: 14px; line-height: 1.2; }
.audit-top .meta span { font-size: 11.5px; color: rgba(255, 255, 255, 0.66); }
.audit-top .spacer { flex: 1 1 auto; }
.audit-top .top-actions { display: flex; align-items: center; gap: 8px; }
.audit-top .badge { background: rgba(255, 255, 255, 0.14); color: #fff; border-color: rgba(255, 255, 255, 0.28); }
.audit-top .badge.badge-approved { background: #1c9c50; border-color: #1c9c50; color: #fff; }
.audit-top .badge.badge-rejected { background: #d13b3b; border-color: #d13b3b; color: #fff; }
.audit-top .badge.badge-flagged { background: #c47c11; border-color: #c47c11; color: #fff; }
.audit-top .btn-outline { border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.audit-top .btn-outline:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.5); color: #fff; }

.audit-split { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 0; min-height: 0; }

.audit-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); overflow: hidden; }
.audit-pane.left { border-right: 1px solid var(--line); }
.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: 0 0 auto;
}
.pane-head h3 { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.pane-head .sub { font-size: 12px; color: var(--muted); }
.pane-scroll { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px 28px; }

.qa-list { display: flex; flex-direction: column; gap: 8px; }
.qa-item {
  display: grid;
  grid-template-columns: minmax(140px, 0.85fr) minmax(0, 1.15fr);
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13.5px;
}
.qa-item .q { color: var(--muted); font-weight: 600; font-size: 12.5px; line-height: 1.4; word-break: break-word; }
.qa-item .q .key { display: block; font-family: var(--mono); font-size: 10.5px; color: #90a4b8; font-weight: 400; margin-top: 2px; }
.qa-item .a { color: var(--ink); word-break: break-word; font-weight: 500; }
.qa-item .a.empty-answer { color: #9aabbc; font-style: italic; font-weight: 400; }
.qa-item.qa-key { background: var(--brand-soft); border-color: #bfe3e5; }
.qa-item.qa-key .a { font-family: var(--mono); font-weight: 650; font-size: 13.5px; color: var(--brand-dark); }
.qa-item.qa-structure .a { font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; color: var(--ink-soft); }

.meta-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.meta-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px; background: var(--surface-2); }
.meta-box .k { font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.meta-box .v { font-size: 13px; color: var(--ink); font-weight: 600; word-break: break-word; }

/* Audio player */
.player-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); padding: 13px; margin-bottom: 14px; }
.player-card .now { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 8px; display: flex; align-items: center; gap: 7px; min-width: 0; }
.player-card .now .file { font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-audio { width: 100%; height: 40px; display: block; }
.speed-row { display: flex; align-items: center; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.speed-row .lbl { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-right: 2px; }
.speed-btn {
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  min-width: 42px;
}
.speed-btn:hover { border-color: var(--brand); color: var(--brand-dark); }
.speed-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.rec-list { display: flex; flex-direction: column; gap: 6px; }
.rec-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  width: 100%;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.rec-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.rec-item.playing { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.rec-item .play-ico {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-size: 11px; flex: 0 0 auto;
}
.rec-item.playing .play-ico { background: var(--brand-dark); }
.rec-item .fname { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--ink); word-break: break-all; line-height: 1.35; }
.rec-item .fmeta { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.rec-item .check { margin-left: auto; color: var(--approved); font-weight: 800; font-size: 13px; }

.search-row { display: flex; gap: 8px; margin-top: 8px; }
.search-row input { font-size: 13px; padding: 7px 10px; }

.section-label {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.section-label:first-child { margin-top: 0; }

/* Verdict form */
.verdict-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--surface); margin-top: 14px; }
.verdict-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.verdict-opt {
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.14s ease;
  font-family: inherit;
}
.verdict-opt .ico { font-size: 16px; line-height: 1; }
.verdict-opt:hover { border-color: var(--brand); }
.verdict-opt.sel-approved { border-color: var(--approved); background: var(--approved-soft); color: var(--approved); }
.verdict-opt.sel-rejected { border-color: var(--rejected); background: var(--rejected-soft); color: var(--rejected); }
.verdict-opt.sel-flagged { border-color: var(--flagged); background: var(--flagged-soft); color: var(--flagged); }

.verdict-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.verdict-actions .grow { flex: 1 1 auto; }

.audit-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--ink-soft);
}

/* Skeleton + loading */
.loading-block { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 20px; color: var(--muted); font-size: 13.5px; }
.skeleton { background: linear-gradient(90deg, #eef3f7 25%, #e2eaf1 37%, #eef3f7 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Responsive */
.qc-activity-filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.qc-activity-filters .filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.filter-field select { min-width: 180px; }
.listen-cell { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.listen-bar { display: block; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.listen-fill { display: block; height: 100%; background: var(--brand); }
.listen-fill.low { background: #b91c1c; }

@media (max-width: 1100px) {
  .audit-split { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1.1fr); }
  .audit-pane.left { border-right: none; border-bottom: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .topbar { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 10px; }
  .userbox { margin-left: auto; }
  .table-pager { gap: 8px; }
  .pager-controls { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; }
  .userbox .who { display: none; }
  .main { padding: 16px 14px 44px; }
  .qa-item { grid-template-columns: 1fr; gap: 3px; }
  .verdict-options { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-grid { grid-template-columns: 1fr; }
  .modal { border-radius: var(--radius); }
  .modal-body { max-height: 72vh; }
  .audit-body { height: auto; min-height: 100vh; overflow: auto; }
  .audit-split { display: block; }
  .audit-pane { max-height: none; }
  .pane-scroll { overflow: visible; }
}

/* =====================================================================
   Hybrid CATI upgrade: tabs, recording badges, reconciliation,
   form-label/sample-sheet settings and grouped audit questions.
   ===================================================================== */

/* ---- tabs ---- */
.tabs {
  display: flex;
  gap: 6px;
  margin: 4px 0 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tab {
  appearance: none;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 14px;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  position: relative;
  top: 1px;
}
.tab:hover { background: var(--surface-2); }
.tab.active {
  background: var(--surface);
  border-color: var(--line);
  color: var(--brand-dark);
}
.tab .n {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--pending-soft);
  color: var(--pending);
  font-size: 11.5px;
  line-height: 18px;
  text-align: center;
}
.tab .n-ready { background: var(--approved-soft); color: var(--approved); }

/* ---- recording status badges ---- */
.rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 18px;
  white-space: nowrap;
  font-family: var(--font);
}
button.rec-badge { cursor: pointer; }
button.rec-badge:hover { filter: brightness(0.97); text-decoration: none; }
.rec-ok { background: var(--approved-soft); color: var(--approved); border-color: #bfe6cd; }
.rec-short { background: var(--flagged-soft); color: var(--flagged); border-color: #f0d9ac; }
.rec-missing { background: var(--rejected-soft); color: var(--rejected); border-color: #f3c9c9; }
.rec-unknown { background: var(--pending-soft); color: var(--pending); border-color: var(--line-strong); }

/* ---- reconciliation ---- */
.recon-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.recon-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.recon-card .k { font-size: 12px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.02em; }
.recon-card .n { font-size: 26px; font-weight: 750; line-height: 1.25; color: var(--ink); }
.recon-card .hint { font-size: 11.5px; color: var(--muted); }
.recon-card.ok { border-left-color: var(--approved); }
.recon-card.ok .n { color: var(--approved); }
.recon-card.bad { border-left-color: var(--rejected); }
.recon-card.bad .n { color: var(--rejected); }
.recon-card.warn { border-left-color: var(--flagged); }
.recon-card.warn .n { color: var(--flagged); }
.recon-card.muted { border-left-color: var(--pending); }
.recon-card.muted .n { color: var(--pending); }

.recon-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.recon-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.toolbar-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-top: 0;
  border-radius: 0;
}
.toolbar-sub .toolbar-hint { margin-left: 6px; }
.chips-soft .chip { font-size: 12px; padding: 4px 10px; background: var(--surface-2); }
.chips-soft .chip:hover { background: #fff; }
.chips-soft .chip.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}
.chips-soft .chip.active .n { color: #ffffff; opacity: 0.9; }

/* ---- server-side pagination ---- */
.table-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  border-radius: 0 0 var(--radius) var(--radius);
}
.pager-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-left: auto;
}
.pager-controls .btn { flex: 0 0 auto; white-space: nowrap; }
.pager-label { font-size: 12.5px; font-weight: 650; color: var(--ink-soft); white-space: nowrap; }
.pager-size {
  width: auto;
  min-width: 105px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm, 8px);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 9px;
  cursor: pointer;
}
.table-pager .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.recon-table td { vertical-align: top; }
.recon-row.bucket-fabrication { background: #fff7f7; }
.recon-row.bucket-unsubmitted { background: #fffaf1; }
.recon-row.bucket-ready { background: #f6fcf8; }

.bucket {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.bucket.ready { background: var(--approved-soft); color: var(--approved); }
.bucket.fabrication { background: var(--rejected-soft); color: var(--rejected); }
.bucket.unsubmitted { background: var(--flagged-soft); color: var(--flagged); }
.bucket.pending { background: var(--pending-soft); color: var(--pending); }

/* ---- form labels / sample sheet settings ---- */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.settings-tab {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-soft);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.settings-tab:hover { background: var(--surface); color: var(--ink); }
.settings-tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface-2);
}
.settings-card h4 { margin: 0 0 4px; font-size: 15px; color: var(--ink); }
.settings-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 8px 10px;
  margin: 10px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.settings-card .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
  flex: none;
}
.settings-card .dot.ok { background: var(--approved); }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-help { margin-top: 12px; }
.settings-help summary { cursor: pointer; font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.settings-help pre {
  margin: 8px 0;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  overflow-x: auto;
}

/* ---- grouped audit questions ---- */
.group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0 8px;
  padding: 7px 10px;
  background: var(--brand-soft);
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  font-weight: 700;
  color: var(--brand-dark);
  font-size: 13px;
}
.q-ur {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-left: 8px;
}

/* Custom statements configured per project (Fields & labels). */
.qa-item .q .q-label { display: block; color: var(--ink); font-weight: 700; font-size: 13px; }
.qa-item .q .q-ur {
  display: block;
  margin-left: 0;
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-soft);
}
.qa-item.qa-custom { border-left: 3px solid var(--accent, #2f6fd0); }
.ext-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

/* ---- ODK field visibility & statement editor ---- */
.fc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.fc-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.fc-toolbar input[type='search'] {
  flex: 1 1 200px;
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  background: #fff;
}
.fc-table { min-width: 820px; }
.fc-table td { vertical-align: top; }
.fc-table input[type='text'],
.fc-table input[type='number'] {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12.5px;
  background: #fff;
}
.fc-table input[type='number'] { max-width: 74px; }
.fc-table input[type='checkbox'] { width: 17px; height: 17px; margin-top: 8px; }
.fc-table tr.hidden { display: none; }
.fc-groups { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.fc-group-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.6fr) minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.fc-group-row input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12.5px;
  background: #fff;
}

/* ---- caller extension / PKT meta under recording badges ---- */
.rec-meta {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
}
.recon-table .rec-meta { margin-top: 2px; }

/* ------------------------------ Utilities --------------------------- */

/*
 * Kept last on purpose: several component rules set their own `display`, and
 * the utility must win in every engine (jsdom's cascade does not rank
 * `!important` above source order). The login/app boot shell relies on this.
 */
.hidden { display: none !important; }
