/* ==========================================================================
   SOTIKS Speech AI: SaaS shell
   Everything is local: no web-font CDN, no icon CDN, no JS CDN. Icons are
   inline SVG macros; HTMX is served from /static/htmx.min.js.
   ========================================================================== */

:root {
  /* Shell */
  --sidebar-bg: #0f172a;
  --sidebar-soft: #1e293b;
  --sidebar-line: #27354a;
  --indigo: #3b82f6;
  --indigo-strong: #2563eb;

  /* Workspace */
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;

  /* States */
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fef3c7;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.16);
  --sidebar-width: 250px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--indigo-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.015em; }
h2 { font-size: 18px; margin: 0; letter-spacing: -0.01em; }
h3 { font-size: 15px; margin: 20px 0 8px; }
p { margin: 0 0 10px; }

.icon { flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--muted); }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; }

/* ==========================================================================
   App shell
   ========================================================================== */

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  color: #cbd5e1;
  border-right: 1px solid var(--sidebar-line);
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--sidebar-line);
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--indigo), #6366f1);
  color: #fff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title { color: #f8fafc; font-weight: 700; font-size: 15.5px; letter-spacing: -0.01em; }
.brand-title em { font-style: normal; color: #93c5fd; }
.brand-sub { color: #94a3b8; font-size: 11.5px; margin-top: 2px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; padding: 16px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item:hover { background: var(--sidebar-soft); color: #f8fafc; text-decoration: none; }
.nav-item.active { background: var(--sidebar-soft); color: #fff; box-shadow: inset 3px 0 0 var(--indigo); }
.nav-icon { color: #93a4bd; display: inline-flex; }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { color: #93c5fd; }
.nav-label { flex: 1; min-width: 0; }
.nav-badge {
  min-width: 26px;
  text-align: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: #24334a;
  color: #dbeafe;
  font-size: 11.5px;
  font-weight: 700;
}
.nav-badge-warn { background: #7c2d12; color: #fed7aa; }
.nav-badge-ok { background: #14532d; color: #bbf7d0; }
.nav-badge-dim { background: #27354a; color: #94a3b8; }

/* Menu groups: a small caption per section, first one sits closer to the brand. */
.nav-section { display: flex; flex-direction: column; gap: 3px; }
.nav-section + .nav-section { margin-top: 10px; }
.nav-section-title {
  padding: 10px 12px 2px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 18px;
  border-top: 1px solid var(--sidebar-line);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--sidebar-soft);
  color: #bfdbfe;
  font-weight: 700;
  font-size: 12.5px;
  flex: none;
}
.sidebar-user-text { flex: 1; min-width: 0; }
.sidebar-user-name { color: #f8fafc; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: #94a3b8; font-size: 11.5px; }
.sidebar-logout { color: #94a3b8 !important; padding: 6px 8px !important; }
.sidebar-logout:hover { background: var(--sidebar-soft) !important; color: #fff !important; }

.main-content { margin-left: var(--sidebar-width); min-height: 100vh; }
.page { max-width: 1360px; margin: 0 auto; padding: 28px 32px 48px; }

.mobile-bar { display: none; }
.sidebar-scrim { display: none; }
.sidebar-collapse {
  position: absolute;
  top: 22px;
  right: -14px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--sidebar-soft);
  border: 1px solid var(--sidebar-line);
  color: #cbd5e1;
  font-size: 12px;
  cursor: pointer;
  z-index: 31;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.sidebar:hover .sidebar-collapse { opacity: 1; }

/* Collapsed sidebar on wide screens */
.sidebar-toggle:checked ~ .sidebar { width: 76px; }
.sidebar-toggle:checked ~ .sidebar .brand-text,
.sidebar-toggle:checked ~ .sidebar .nav-label,
.sidebar-toggle:checked ~ .sidebar .nav-badge,
.sidebar-toggle:checked ~ .sidebar .sidebar-user-text,
.sidebar-toggle:checked ~ .sidebar .logout-text { display: none; }
.sidebar-toggle:checked ~ .sidebar .nav-item { justify-content: center; }
.sidebar-toggle:checked ~ .sidebar .sidebar-brand { justify-content: center; }
.sidebar-toggle:checked ~ .main-content { margin-left: 76px; }

/* ==========================================================================
   Page headers, actions, cards
   ========================================================================== */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-header .eyebrow {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 6px;
}
.page-header h1 { font-size: 28px; }
.page-header .lead { color: var(--muted); max-width: 720px; margin: 6px 0 0; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* Right-hand cluster of a page header: export menu, audio switch, delete. */
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.delete-dialogue-form { display: inline-flex; }
.section-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dropdown { position: relative; }
.dropdown-toggle { white-space: nowrap; }
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 5px);
  z-index: 30;
  min-width: 250px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
  white-space: nowrap;
}
.dropdown-menu a:hover { background: var(--surface-soft); text-decoration: none; }
.select-all-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.select-all-label input { width: auto; }
.export-links { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.export-links .btn { white-space: nowrap; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.back-link { font-size: 13px; display: inline-block; margin-bottom: 6px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.card-soft { background: var(--surface-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.empty-card { padding: 34px 20px; text-align: center; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
/* The menu captions vanish with the labels in the collapsed rail. */
.sidebar-toggle:checked ~ .sidebar .nav-section-title { display: none; }
.section-head h2 { display: flex; align-items: center; gap: 8px; }
.block-title { font-size: 16px; font-weight: 650; margin: 0 0 4px; }
.block-hint { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }

/* ==========================================================================
   KPI cards (dashboard)
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card {
  display: flex;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  color: inherit;
  min-height: 118px;
}
a.kpi-card:hover { text-decoration: none; border-color: #c7d6ea; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08); }
.kpi-card.kpi-alert { border-color: #fecaca; background: linear-gradient(180deg, #fff, #fff7f7); }
.kpi-card.kpi-warn { border-color: #fde68a; }
.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
}
.kpi-icon-blue { background: #dbeafe; color: #1d4ed8; }
.kpi-icon-indigo { background: #e0e7ff; color: #4338ca; }
.kpi-icon-green { background: #dcfce7; color: #15803d; }
.kpi-icon-red { background: #fee2e2; color: #b91c1c; }
.kpi-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 30px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; }
.kpi-unit { font-size: 16px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.kpi-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.kpi-link { font-size: 12.5px; font-weight: 600; color: var(--indigo-strong); }

/* ==========================================================================
   Store tiles (dashboard)
   ========================================================================== */

.store-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.store-tile {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
}
.store-tile:hover { border-color: #c7d6ea; box-shadow: 0 4px 16px rgba(15, 23, 42, 0.07); }
.store-tile-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.store-tile-name { font-weight: 650; font-size: 15px; }
.store-tile-addr { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.store-tile-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); padding: 10px 0; }
.tile-metric { display: flex; flex-direction: column; gap: 2px; }
.tile-metric-label { font-size: 11.5px; color: var(--muted); }
.tile-metric-value { font-weight: 650; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.store-tile-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Live status dot */
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #94a3b8; flex: none; }
.status-dot.live { background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); animation: pulse 1.8s infinite; }
.status-dot.waiting { background: #f59e0b; }
.status-dot.dead { background: #ef4444; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.badge-live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: 5px; animation: pulse 1.8s infinite; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.3;
}
.btn:hover { background: var(--surface-soft); text-decoration: none; border-color: #cbd5e1; }
.btn-primary { background: var(--indigo-strong); border-color: var(--indigo-strong); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.btn-danger { background: var(--bad-soft); border-color: #fecaca; color: var(--bad); }
.btn-danger:hover { background: #fecaca; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #eef2f7; color: var(--text); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-small { padding: 4px 8px; font-size: 12.5px; }

/* ==========================================================================
   Forms
   ========================================================================== */

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 8px 10px;
  width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}
label { display: block; font-size: 13px; font-weight: 550; color: #334155; }
label > input, label > select, label > textarea { margin-top: 5px; font-weight: 400; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-label { display: block; }
.stack-label textarea { margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; font-size: 13px; }
.check input { width: auto; }
.check-inline { align-self: end; padding-bottom: 9px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; font-size: 13px; cursor: pointer; }
.switch input { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.form-actions .btn-danger { margin-left: auto; }
.inline-form { margin: 0; }
.inline-form-inline { display: inline-flex; margin: 0; gap: 4px; align-items: center; }
.inline-form-inline select { width: auto; padding: 4px 8px; font-size: 13px; }

/* ==========================================================================
   Callouts
   ========================================================================== */

.callout {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  margin-bottom: 16px;
  font-size: 13.5px;
  color: #334155;
}
.callout-title { display: flex; align-items: center; gap: 6px; font-weight: 650; font-size: 13.5px; }
.callout-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.callout-ok { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.callout-warn { background: var(--warn-soft); border-color: #fde68a; color: #78350f; }
.callout-muted { background: var(--surface-soft); }
.callout code { background: rgba(15, 23, 42, 0.06); padding: 1px 5px; border-radius: 5px; }

/* Alerts and notices */
.alert { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: #7c3f06; font-size: 13.5px; margin: 10px 0; }
.alert-error { background: var(--bad-soft); color: var(--bad); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.notice { padding: 10px 12px; border-radius: var(--radius-sm); background: #eff6ff; color: #1e40af; font-size: 13.5px; margin-top: 8px; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.inline-result:empty { display: none; }

/* ==========================================================================
   Badges, chips, pills, scores
   ========================================================================== */

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.muted { background: #f1f5f9; color: var(--muted); }
.badge.tech { background: #dcfce7; color: #166534; }
.badge.bonus { background: #e0f2fe; color: #075985; }
.badge.zone.zone-max { background: #bbf7d0; color: #14532d; }
.badge.zone.zone-plan { background: var(--ok-soft); color: var(--ok); }
.badge.zone.zone-min { background: #fef9c3; color: #854d0e; }
.badge.zone.zone-low { background: #ffedd5; color: #9a3412; }
.badge.zone.zone-critical { background: var(--bad-soft); color: var(--bad); }
.chip { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #f1f5f9; color: #334155; font-size: 12.5px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.pill-soft { background: #eff6ff; color: var(--indigo-strong); }
.score { font-size: 18px; font-weight: 700; }
.score-bad { color: var(--bad); }
.pattern-panel, .weight-balance { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }

/* ==========================================================================
   Tables and filters
   ========================================================================== */

.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  white-space: nowrap;
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }
.check-col { width: 34px; }
.check-col input { width: auto; }
.row-link { font-weight: 600; }
.batch-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}
.filters-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }

/* ==========================================================================
   Dialogues list: filters, bulk panel, stable table columns
   ========================================================================== */

/* Two clean rows of four: Point, Employee, Call type, Speaker, then Max score,
   From, To and one cell with the exclusion toggle and the two buttons. */
.filters-grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.filters-grid4 .filters-cell {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  min-height: 100%;
}
.filters-grid4 .filters-cell .check { margin: 0; }
.filters-grid4 .filters-buttons { display: flex; gap: 8px; }
.filters-grid4 .filters-buttons .btn { flex: 0 0 auto; }
@media (max-width: 900px) {
  .filters-grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .filters-grid4 { grid-template-columns: minmax(0, 1fr); }
}

/* Manual upload: file, point and the button share one row aligned on the
   bottom edge, so the button never stretches to the height of the fields. */
.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px) auto;
  gap: 12px;
  align-items: end;
}
.upload-row .btn { height: 38px; white-space: nowrap; }
@media (max-width: 760px) {
  .upload-row { grid-template-columns: minmax(0, 1fr); }
}

/* One bulk panel: the counter on the left, the actions on the right. */
.batch-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.batch-count { font-size: 13.5px; font-weight: 600; color: #334155; }
.batch-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.batch-actions .inline-form { margin: 0; }
.list-hint { color: var(--muted); font-size: 13px; margin: 0 0 10px; }

/* Column widths stay the same on every page, so nothing jumps while filtering. */
.dialogues-table { table-layout: fixed; }
.dialogues-table .col-id { width: 78px; }
.dialogues-table .col-store { width: 92px; }
.dialogues-table .col-started { width: 132px; }
.dialogues-table .col-employee { width: 168px; }
.dialogues-table .col-type { width: 116px; }
.dialogues-table .col-status { width: 168px; }
.dialogues-table .col-speaker { width: 112px; }
.dialogues-table .col-duration { width: 76px; }
.dialogues-table .col-score { width: 96px; }
.dialogues-table td { overflow: hidden; text-overflow: ellipsis; }
/* The score is a badge of the same scale as the other columns' badges. */
.score-badge { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Stores page
   ========================================================================== */

.store-card .section-head { margin-bottom: 12px; }
.store-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: #334155; font-weight: 600; }
.channels { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 6px 0 16px; }
.channel { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-soft); }
.channel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.channel-name { font-weight: 700; font-size: 13px; letter-spacing: 0.04em; color: #334155; }
.channel-rows { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.channel-rows > div { display: flex; justify-content: space-between; gap: 12px; }
.channel-rows span { color: var(--muted); }
.channel-rows strong { font-weight: 600; }

.store-grid { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr); gap: 18px; margin-bottom: 8px; }

.model-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.model-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
.model-option:hover { border-color: #c9d2e0; }
.model-option.selected { border-color: var(--indigo); background: #f5f9ff; box-shadow: 0 0 0 1px var(--indigo) inset; }
.model-option input { width: auto; margin-top: 3px; }
.model-option .model-label { font-weight: 600; font-size: 14px; color: var(--text); }
.model-option .model-hint { font-size: 12.5px; color: var(--muted); }
.key-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; margin-top: 4px; }
.key-state.present { color: var(--ok); }
.key-state.absent { color: var(--muted); }
.key-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* Connection wizard */
.wizard, .wizard-result { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.wizard-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.code-block { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}
.code-pre {
  margin: 0;
  padding: 14px 16px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  overflow-x: auto;
  max-height: 420px;
}
.token {
  display: block;
  padding: 12px 16px;
  background: #0f172a;
  color: #fde68a;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  word-break: break-all;
}
.token-box { margin-top: 10px; }

/* Users block */
.users-create { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border); }
.users-create .block-title { margin: 0 0 10px; font-size: 15px; }
/* Login and password: exactly two equal columns, aligned on the input line. */
.users-create-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin-top: 16px; }
/* The submit closes the form, after every field, with its own breathing room. */
.users-create-submit { display: flex; justify-content: flex-start; margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); }
.users-create-submit .btn { height: 38px; }
@media (max-width: 640px) {
  .users-create-grid { grid-template-columns: minmax(0, 1fr); }
}
.users-table td { vertical-align: middle; }
.store-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* Role cards: a compact 2x2 grid. The radio sits on the role's title line and
   the explanation takes one or two lines, so the four choices fit on screen
   without a wall of boxes. */
.role-cards {
  border: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.role-cards legend { grid-column: 1 / -1; padding: 0; margin-bottom: 2px; }
.role-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.role-card:hover { border-color: #c7d6ea; }
.role-card-head { display: flex; align-items: center; gap: 8px; }
.role-card input[type="radio"] {
  margin: 0;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  accent-color: var(--indigo-strong);
}
.role-card-title { font-weight: 650; font-size: 13.5px; line-height: 1.2; }
.role-card-hint { color: var(--muted); font-size: 12px; line-height: 1.4; }
/* Fallback for browsers without :has(): the card still shows the focus ring. */
.role-card:focus-within { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); }
@supports selector(:has(*)) {
  .role-card:has(input:checked) {
    border-color: var(--indigo-strong);
    box-shadow: inset 3px 0 0 var(--indigo-strong);
    background: #f8fafc;
  }
}
@media (max-width: 640px) {
  .role-cards { grid-template-columns: minmax(0, 1fr); }
}

/* Seller settings: an inner panel with a soft background instead of a browser
   fieldset, so its frame never cuts through the card around it. */
.seller-panel {
  display: block;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: #f6f9fd;
  border: 1px solid #e6eef8;
}
.seller-panel[hidden] { display: none; }
.seller-panel-title { font-weight: 650; font-size: 13.5px; margin-bottom: 10px; }
.seller-panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.seller-panel .block-hint { margin: 10px 0 0; }
@media (max-width: 640px) {
  .seller-panel-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Row actions of the accounts table: one line of small buttons per account. */
.row-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-actions .btn, .row-actions select { height: 30px; }
.row-actions select { padding: 2px 8px; font-size: 12.5px; }
.row-action { display: inline-flex; }

/* One-line hint under an h1: replaces a paragraph of marketing copy. */
.page-intro { color: var(--muted); font-size: 14px; margin: 6px 0 0; max-width: 760px; }

/* ==========================================================================
   Dialogs
   ========================================================================== */

.tabbar { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; background: #e8eef6; border-radius: 12px; margin: 4px 0 20px; }
.tabbar button, .tabbar a {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.tabbar button:hover, .tabbar a:hover { background: rgba(255, 255, 255, 0.7); color: var(--text); text-decoration: none; }
.tabbar button.active, .tabbar a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabpanel { display: none; }
.tabpanel.active { display: block; }

.upload-card { position: relative; }
.upload-card summary { list-style: none; }
.upload-card summary::-webkit-details-marker { display: none; }
.upload-card[open] summary { margin-bottom: 14px; }
.upload-form {
  position: absolute;
  right: 0;
  top: 46px;
  z-index: 10;
  width: 380px;
  max-width: calc(100vw - 48px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.upload-inline .filters { align-items: end; }

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.stat { min-width: 148px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.stat .stat-label { font-size: 12px; color: var(--muted); }
.stat .stat-value { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.stat.ok { border-color: #bfe6cc; background: #f2fbf5; }
.stat.warn { border-color: #f3d9b1; background: #fffaf0; }

/* ==========================================================================
   Dialogs: detail, transcript, evaluations
   ========================================================================== */

.keep-audio { font-size: 13px; }
.speaker-card .speaker-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-items: end; }
.speaker-card .speaker-form .switch { grid-column: 1 / -1; }
.player { width: 100%; margin: 6px 0 18px; }

.transcript { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 78%; border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; background: #f6f8fb; }
.bubble-seller { margin-left: auto; background: #eff6ff; border-color: #d3ddff; }
.bubble-customer { margin-right: auto; }
.bubble-unknown { margin: 0 auto; background: #f6f8fb; }
.bubble-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.role-name { font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; font-size: 11px; }
.bubble-seller .role-name { color: var(--indigo-strong); }
.bubble-text { font-size: 14.5px; }
.text-raw { display: none; }
body.show-raw .text-raw { display: inline; }
body.show-raw .text-masked { display: none; }
.ts { border: none; background: none; padding: 0; color: var(--indigo-strong); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; cursor: pointer; }
.ts:hover { text-decoration: underline; }
.rms { padding: 1px 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.05); font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.evaluate-form { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.model-list { display: flex; gap: 12px; flex-wrap: wrap; flex: 1; }
.model-name { font-weight: 600; }
.quote { margin: 6px 0; font-size: 13px; color: #334155; }
.suggest { margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--indigo); background: #f5f9ff; border-radius: 0 8px 8px 0; font-size: 13px; }
.suggest-label { display: block; font-weight: 600; color: var(--indigo-strong); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; }
.gold-panel { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.gold-row { display: grid; grid-template-columns: 1fr 220px; gap: 12px; align-items: center; padding: 6px 0; font-size: 13.5px; }
.gold-panel .btn { margin-top: 12px; }

.score-block { display: flex; align-items: baseline; gap: 6px; }
.score-block .score-value { font-size: 34px; font-weight: 750; letter-spacing: -0.02em; }
.score-block .score-scale { font-size: 15px; color: var(--muted); }
.quote-card { margin: 6px 0; padding: 8px 10px; border-radius: 10px; background: #f7f9fc; border: 1px solid #e8edf5; font-size: 13.5px; color: #334155; }
.quote-card .listen { margin-left: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 1px 8px; font-size: 12px; cursor: pointer; color: var(--indigo-strong); }
.model-column-title { font-size: 15px; font-weight: 700; }
.suggest-block { margin-top: 22px; }
.suggest-block .suggest { font-size: 14px; }

.pipeline-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 500; margin-bottom: 16px; }
.pipeline-banner.queued, .pipeline-banner.processing { background: #eff6ff; color: #1e40af; }
.pipeline-banner.done { background: var(--ok-soft); color: var(--ok); }
.pipeline-banner.failed, .pipeline-banner.skipped_short { background: var(--bad-soft); color: var(--bad); }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Checklists
   ========================================================================== */

details.disclosure { border: 1px solid var(--border); border-radius: var(--radius); padding: 0 16px; background: var(--surface); margin-bottom: 16px; box-shadow: var(--shadow); }
details.disclosure > summary { cursor: pointer; list-style: none; padding: 14px 0; font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::after { content: "▾"; color: var(--muted); font-size: 12px; font-weight: 400; }
details.disclosure[open] > summary::after { content: "▴"; }
details.disclosure > .disclosure-body { padding-bottom: 16px; }

.item-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.item-card.is-bonus { border-left: 3px solid #0ea5e9; }
.item-card.is-penalty { border-left: 3px solid var(--warn); }
.item-card.is-critical { border-left: 3px solid var(--bad); }
.item-row-top { display: grid; grid-template-columns: minmax(240px, 1fr) 96px 240px 210px 40px; gap: 12px; align-items: end; }
.item-row-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.item-row-top label, .item-row-bottom label { font-size: 12px; color: var(--muted); font-weight: 600; }
.label-like { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.item-scenarios { display: flex; gap: 10px; flex-wrap: wrap; padding-bottom: 8px; }
.item-card .remove-item { align-self: end; }
.item-card textarea { min-height: 64px; }
.hidden-code { display: none; }
.kind-preview { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.items-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 980px; }
.items-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--border); background: var(--surface-soft); }
.items-table td { padding: 8px; border-bottom: 1px solid #eef2f7; vertical-align: top; }
.items-table input[type="checkbox"] { width: auto; }
.types-cell { min-width: 180px; }
.types-cell .check { display: flex; margin-bottom: 2px; }
.history-entry { border-top: 1px solid #eef2f7; padding: 10px 0; }
.history-entry summary { cursor: pointer; display: flex; gap: 12px; align-items: center; }
.rules { white-space: pre-wrap; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 12.5px; color: #334155; margin: 12px 0; }
.history-items { margin: 0; padding-left: 20px; font-size: 13px; }

/* Per-model calibration rules */
.model-rule { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); text-align: left; min-width: 190px; }
.model-rule-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.model-rule-form textarea { width: 100%; font-size: 12.5px; resize: vertical; }
.model-rule-form .btn-small { margin-top: 4px; }
.model-rule-list { list-style: none; margin: 6px 0 0; padding: 0; }
.model-rule-list li { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px; padding: 4px 0; border-top: 1px solid #eef0f3; font-size: 12px; text-align: left; }
.model-rule-list .rule-text { flex: 1 1 120px; }
.model-rule-list form { margin: 0; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.rule-column h3 { font-size: 14px; margin: 0 0 6px; }
.rule-form textarea { width: 100%; resize: vertical; }
.rule-form .btn-small { margin-top: 4px; }
.rule-list { margin-top: 8px; }
.rule-item { display: flex; gap: 6px; align-items: flex-start; padding: 6px 0; border-top: 1px solid #eef0f3; font-size: 13px; }
.rule-item .rule-text { flex: 1; }
.rule-item .btn-ghost { padding: 0 6px; }
.rules-summary td form { display: inline; margin-left: 6px; }

/* Recorder */
.recorder { display: flex; flex-direction: column; gap: 12px; }
.recorder-level { width: 100%; height: 56px; border-radius: 10px; background: #0f172a; display: block; }
.recorder-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.recorder-timer { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); margin-right: 6px; }
.rec-dot.live { animation: recpulse 1s infinite; }
@keyframes recpulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.recorder-status { font-size: 13.5px; color: var(--muted); }

/* ==========================================================================
   Modal dialog (stores page)
   ========================================================================== */

dialog.modal {
  border: none;
  border-radius: 18px;
  padding: 0;
  width: 720px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
dialog.modal::backdrop { background: rgba(15, 23, 42, 0.55); }
.modal-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ==========================================================================
   Login
   ========================================================================== */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(59, 130, 246, 0.28), transparent 60%),
    radial-gradient(700px 420px at 100% 110%, rgba(99, 102, 241, 0.22), transparent 60%),
    #0f172a;
}
.login-card {
  width: 380px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 30px;
}
.login-card .brand-mark { margin-bottom: 14px; }
.login-card .brand { margin-bottom: 4px; }
.login-card .stack { margin-top: 18px; }
.brand { font-weight: 700; font-size: 22px; color: var(--text); letter-spacing: -0.02em; }
.brand span { color: var(--indigo-strong); }
.brand-lg { font-size: 24px; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .store-grid { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .sidebar-toggle:checked ~ .sidebar { width: var(--sidebar-width); }
  .sidebar-toggle:checked ~ .sidebar .brand-text,
  .sidebar-toggle:checked ~ .sidebar .nav-label,
  .sidebar-toggle:checked ~ .sidebar .nav-badge,
  .sidebar-toggle:checked ~ .sidebar .sidebar-user-text,
  .sidebar-toggle:checked ~ .sidebar .logout-text { display: revert; }
  .sidebar-toggle:checked ~ .sidebar .nav-item { justify-content: flex-start; }
  .sidebar-toggle:checked ~ .sidebar .sidebar-brand { justify-content: flex-start; }
  .sidebar-toggle:checked ~ .main-content { margin-left: 0; }
  .sidebar-collapse { display: none; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
    width: var(--sidebar-width);
  }
  .sidebar-toggle:checked ~ .sidebar { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--sidebar-bg);
    color: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .mobile-bar .brand-title { font-size: 15px; }
  .mobile-toggle { color: #e2e8f0 !important; font-size: 18px; }
  .page { padding: 18px 16px 40px; }
  .sidebar-toggle:checked ~ .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 25;
  }
  .sidebar-toggle:checked ~ .sidebar { z-index: 30; }
}

@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .bubble { max-width: 92%; }
  .store-grid { grid-template-columns: 1fr; }
  .upload-form { width: calc(100vw - 28px); right: -6px; }
  .item-row-top { grid-template-columns: 1fr 92px; }
  .item-row-bottom { grid-template-columns: 1fr; }
  .model-picker { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 23px; }
}

/* --- Staff registry and voice samples (Stage I) --------------------------- */
.label-inline { color: var(--muted); font-weight: 600; }
.staff-block { margin-top: 4px; }
.staff-table td { vertical-align: top; }
.staff-table tr.sample-row td { padding-top: 0; background: #f8fafc; }
.staff-table tr.sample-row:hover td { background: #f8fafc; }
.staff-add { margin-top: 14px; align-items: end; }
.disclosure-inline { border: none; padding: 0; margin: 0; }
.disclosure-inline > summary { font-size: 13px; padding: 4px 0; }
.samples-block { padding: 6px 0 4px; }
.samples-head {
  display: flex; align-items: center; gap: 12px;
  justify-content: space-between; flex-wrap: wrap;
}
.sample-list { list-style: none; margin: 6px 0 0; padding: 0; }
.sample-item {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 6px 0; border-top: 1px dashed #e2e8f0; font-size: 13.5px;
}
.sample-item:first-child { border-top: none; }
.role-hint { font-style: normal; color: #b45309; font-weight: 600; }

/* ==========================================================================
   Stage J: costs, per-model metrics, store registry, models tab
   Everything below is additive: existing selectors keep their look.
   ========================================================================== */

.mono, .metric-badge.mono { font-variant-numeric: tabular-nums; }
.alert-info-soft { background: #eff6ff; color: #1e3a8a; }
.source-tag { font-weight: 600; color: var(--indigo-strong); text-transform: none; letter-spacing: 0; margin-left: 6px; }

/* --- score / time / money strip under the dialogue header ---------------- */
.cost-strip {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 18px;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.cost-total { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--border); padding-right: 18px; }
.cost-total-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; display: inline-flex; align-items: center; gap: 6px; }
.cost-total-value { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cost-models { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 14px; }
.cost-model {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft);
  font-size: 13px;
}
.cost-model-name { font-weight: 600; }
.cost-score { font-weight: 750; font-size: 16px; font-variant-numeric: tabular-nums; }
.cost-scale { font-size: 11.5px; font-weight: 500; color: var(--muted); margin-left: 1px; }
.cost-empty { margin: 0; align-self: center; }
.metric-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px; background: #eef2f7; color: #334155;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.column-metrics { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 4px; }
.column-score { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* --- comparison table: scenario rows, conflicts, quotes, advice ---------- */
.status-badge { font-weight: 700; }
.quote-card {
  margin: 6px 0 4px; padding: 8px 10px; border-left: 3px solid #cbd5e1;
  background: #f8fafc; border-radius: 0 8px 8px 0; font-size: 13px; color: #334155;
}
.quote-card .listen { margin-left: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 1px 8px; font-size: 12px; cursor: pointer; color: var(--indigo-strong); }
.reason { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.conflict-note { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--warn); }
.conflict-note::before { content: "⚖ "; }
.suggest { margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--indigo); background: #f5f9ff; border-radius: 0 8px 8px 0; font-size: 13px; }
.suggest-label { display: block; font-weight: 700; color: var(--indigo-strong); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }

/* --- spoiler of the other scenarios ------------------------------------- */
.spoiler { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
.spoiler-toggle {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border: 1px solid var(--border); background: var(--surface-soft); border-radius: 10px;
  padding: 7px 12px; font: inherit; font-size: 13.5px; font-weight: 600; color: #334155; cursor: pointer;
}
.spoiler-toggle:hover { border-color: #c7d6ea; background: #f1f5f9; }
.spoiler-toggle::before { content: "▸"; color: var(--muted); font-size: 12px; }
.spoiler-toggle[aria-expanded="true"]::before { content: "▾"; }
.spoiler-hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.spoiler-body { margin-top: 10px; }

/* --- approve-as-reference block ----------------------------------------- */
.calibration-panel .disclosure-inline { margin-top: 10px; }
.gold-table { display: flex; flex-direction: column; gap: 2px; }
.gold-head, .gold-row { display: grid; grid-template-columns: minmax(220px, 1.4fr) 190px minmax(220px, 2fr); gap: 12px; align-items: center; }
.gold-head { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.gold-row { padding: 5px 0; font-size: 13.5px; border-bottom: 1px solid #f1f5f9; }
.gold-row.compact { grid-template-columns: 1fr 220px; }
.gold-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gold-row select, .gold-row input[type="text"] { padding: 5px 8px; font-size: 13px; }
.calibration-extra { display: grid; grid-template-columns: 220px 1fr; gap: 12px; margin-top: 14px; }
.calibration-extra .span-2 { grid-column: 1 / -1; }
.calibration-models { margin-top: 12px; }

/* --- store registry (/admin/stores) ------------------------------------- */
.registry-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.store-registry { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-bottom: 22px; }
.registry-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 14px;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
}
.registry-card:hover { border-color: #c7d6ea; box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08); }
.registry-card.is-offline { border-left: 3px solid var(--bad); }
.registry-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.registry-title h2 { font-size: 16.5px; }
.registry-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.registry-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 12px 0; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); }
.registry-facts dt { font-size: 11.5px; color: var(--muted); }
.registry-facts dd { margin: 2px 0 0; font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.registry-models { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.registry-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

/* --- one point page: tabs, hardware, steps ------------------------------ */
.store-tabs a { text-decoration: none; }
.store-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.hardware-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 14px; }
.fact { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-soft); }
.fact-label { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.fact-value { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-top: 4px; flex-wrap: wrap; }
.steps { margin: 14px 0; padding-left: 20px; font-size: 13.5px; color: #334155; display: flex; flex-direction: column; gap: 4px; }

/* --- «Нейросети» page ---------------------------------------------------- */
.models-kpi { margin-bottom: 20px; }
.models-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin-bottom: 22px; }
.model-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.model-card.is-unconfigured { background: #fcfcfd; }
.model-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.model-card-head h2 { font-size: 16px; }
.model-card-purpose { margin: 0; color: #334155; font-size: 13.5px; }
.model-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 0; padding: 12px 0; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); }
.model-facts dt { font-size: 11.5px; color: var(--muted); }
.model-facts dd { margin: 1px 0 0; font-weight: 650; font-size: 13.5px; }
.model-assigned { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.assign-form { display: flex; flex-direction: column; gap: 12px; }
.assign-targets { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); }
.assign-stores { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 14px; padding-left: 22px; }

/* --- text dialogue upload ----------------------------------------------- */
.text-upload textarea { min-height: 150px; font-family: inherit; }
#text-preview:not(:empty) { margin-top: 8px; }

@media (max-width: 960px) {
  .cost-strip { grid-template-columns: 1fr; }
  .cost-total { border-right: none; border-bottom: 1px solid var(--border); padding: 0 0 10px; }
  .gold-head, .gold-row, .gold-row.compact { grid-template-columns: 1fr; gap: 6px; }
  .gold-head { display: none; }
  .calibration-extra { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Stage K - two audio tracks and one full-width block per model
   ========================================================================== */

/* --- two labelled players ------------------------------------------------ */
.audio-tracks { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 18px; }
.audio-track {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 10px 12px;
}
.audio-track-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.audio-track-title { font-weight: 650; font-size: 13.5px; }
.audio-track-hint { color: var(--muted); font-size: 12.5px; }
.audio-track .player { margin: 0; }

/* --- per-model review block --------------------------------------------- */
.model-review {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.model-review.is-primary { border-left: 3px solid var(--indigo); }
.model-review-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.model-review-title h3 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.model-review-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.model-review-score { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.model-review-score .score-value { font-size: 32px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; }
.model-review-score .score-scale { font-size: 13px; color: var(--muted); margin-left: 2px; }
.score-none { font-size: 15px; font-weight: 650; color: var(--muted); }
.model-review-metrics { display: flex; gap: 6px; flex-wrap: wrap; }
.model-review-counts { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.pattern-panel-compact { margin: 8px 0 4px; }

.review-items { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.review-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: var(--surface);
}
.review-item.status-fail { border-left: 3px solid var(--bad); background: #fffbfb; }
.review-item.status-pass, .review-item.status-no_objection { border-left: 3px solid var(--ok); }
.review-item.status-unknown { border-left: 3px solid var(--warn); }
.review-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.review-item-title { font-weight: 650; font-size: 14px; }
.review-item .quote-card { margin: 8px 0 4px; max-width: 900px; }
.review-item .reason { margin: 4px 0 0; }
.review-items-muted .review-item { background: var(--surface-soft); }
.conflict-chip {
  font-size: 11.5px; font-weight: 650; color: var(--warn);
  background: var(--warn-soft); border-radius: 999px; padding: 1px 8px;
}
.model-tools { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 10px; }
.model-tools > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: 13.5px; color: var(--indigo-strong);
}
.model-tools > summary::-webkit-details-marker { display: none; }
.model-tools > summary::after { content: "▾"; color: var(--muted); font-size: 12px; }
.model-tools[open] > summary::after { content: "▴"; }
.model-tools-body { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.model-tools-body .model-rule-form textarea { min-height: 54px; }
.model-rule-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.approve-form {
  display: grid;
  grid-template-columns: 200px minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.saved-rules { margin-top: 6px; }
.saved-rules .model-rule-list { margin-top: 4px; }
.saved-rules .model-rule-list li { display: flex; align-items: flex-start; gap: 6px; padding: 4px 0; font-size: 13px; }
.saved-rules .model-rule-list .rule-text { flex: 1; }
.score-hint {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px;
  background: #eef2f7; color: var(--muted); font-size: 11.5px; font-weight: 600;
}
.evaluate-form-compact { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.evaluate-form-compact .model-list { flex: 1 1 320px; }

@media (max-width: 860px) {
  .approve-form { grid-template-columns: 1fr; }
  .model-review-score { align-items: flex-start; }
}

/* ==========================================================================
   Remote audio check of a point: live meter, calibration, voice enrolment
   ========================================================================== */

.live-panel .section-head { flex-wrap: wrap; gap: 12px; }
.live-start-form { display: flex; align-items: flex-end; gap: 10px; }
.live-start-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.live-body {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 24px;
  margin-top: 14px;
}
.live-meter-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.live-db { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.live-meter {
  position: relative;
  height: 18px;
  margin: 8px 0 6px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  overflow: hidden;
}
.live-meter-fill { height: 100%; width: 0; transition: width 0.25s ease; background: var(--muted); }
.live-meter-fill.ok { background: var(--ok); }
.live-meter-fill.warn { background: var(--warn); }
.live-meter-fill.bad { background: var(--bad); }
.live-meter-fill.muted { background: var(--border); }
.live-meter-norm {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 60%;
  width: 20%;
  border-left: 1px dashed rgba(15, 23, 42, 0.25);
  border-right: 1px dashed rgba(15, 23, 42, 0.25);
  pointer-events: none;
}
.live-zone { margin: 4px 0 0; font-size: 14px; font-weight: 600; }
.live-zone.ok { color: var(--ok); }
.live-zone.warn { color: var(--warn); }
.live-zone.bad { color: var(--bad); }
.live-zone.muted { color: var(--muted); }
.live-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.live-fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 14px; }
.live-fieldset legend { padding: 0 6px; font-weight: 600; font-size: 14px; }
.live-mode { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }
.live-settings output { font-weight: 600; margin-left: 8px; }
.live-player { display: none; }

.enrollment-dialog { width: 780px; }
.enroll-text {
  margin: 14px 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  font-size: 18px;
  line-height: 1.6;
}
.enroll-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.enroll-way { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.enroll-way h3 { margin: 0 0 6px; font-size: 15px; }
.enroll-browser { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.enroll-timer { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 42px; }
.inline-result:empty { display: none; }
.inline-result { margin-top: 10px; }

@media (max-width: 860px) {
  .live-body, .enroll-columns { grid-template-columns: 1fr; }
}

/* --- seller workspace: assistant cards and network badges ------------------ */
.assist-form { display: flex; flex-direction: column; gap: 10px; }
.assist-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.assist-actions .btn.is-recording { background: var(--bad-soft); color: var(--bad); border-color: #fecaca; }
.assist-summary { margin: 8px 0 14px; }
.assist-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.assist-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.assist-card.is-addon { background: var(--surface-soft); }
.assist-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.assist-price { font-weight: 700; white-space: nowrap; color: var(--indigo-strong); }
.assist-why { margin: 4px 0 0; }
.assist-benefits { margin: 4px 0 0; padding-left: 18px; font-size: 14px; color: var(--muted); }
.assist-addons-title { margin: 16px 0 8px; font-weight: 600; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.network-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  white-space: nowrap;
}
.network-badge.is-all { background: #f1f5f9; color: var(--muted); border-color: var(--border); }

/* Network pills: one colour per retail chain, used through macros/networks.html. */
.badge.net-megafon { background: #ecfdf5; color: #047857; }
.badge.net-beeline { background: #fefce8; color: #a16207; }
.badge.net-tele2_mono { background: #1e293b; color: #e2e8f0; }
.badge.net-tele2_alt { background: #f5f3ff; color: #6d28d9; }
.badge.net-miranda { background: #fff1f2; color: #be123c; }
.badge.net-rustore { background: #eff6ff; color: #1d4ed8; }
.badge.net-sotiks { background: #f0fdfa; color: #0f766e; }
.badge.net-all { background: #f1f5f9; color: var(--muted); }
.network-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.network-tabs a {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}
.network-tabs a.active { background: var(--indigo); border-color: var(--indigo); color: #fff; font-weight: 600; }
.network-tabs a .muted { color: inherit; opacity: .7; }
.stock-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.stock-file { flex: 1 1 280px; }

/* Inventory actions: two equal columns, each a self-contained card, so the
   row never leaves an empty half behind the shorter button. */
.inventory-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: stretch;
}
.inventory-action {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfdff;
}
.inventory-action h3 { margin: 0; font-size: 15px; }
.inventory-action .block-hint { margin: 0; }
.inventory-action .btn { align-self: flex-start; margin-top: auto; }
.inventory-upload { grid-template-columns: minmax(0, 1fr) auto; }
.inventory-upload .stock-file { flex: none; }
.inventory-upload .btn { margin-top: auto; }
/* A KPI whose source has no data: the label stays, the value says why. */
.stat.muted-stat .stat-value { color: var(--muted); font-weight: 600; }
@media (max-width: 860px) {
  .inventory-actions { grid-template-columns: 1fr; }
}
.violation-list { display: flex; flex-direction: column; gap: 12px; }
.violation { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface); }
.violation-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.violation .quote { margin: 8px 0; padding-left: 12px; border-left: 3px solid var(--border); color: var(--muted); }
.violation .suggested { margin: 0; }
