/* ============================================================
   LexScribe — Workspace shell design system
   Shared workspace shell: sidebar + topbar + panels/tables/badges.
   Namespaced under .ws-* so it never collides with Bootstrap
   (which still loads on the public/landing pages).
   ============================================================ */

/* ── Design tokens (guide §2) ─────────────────────────────────
   Institutional palette: ink navy on warm archive paper, with
   aged brass reserved for the dark chrome (sidebar mark + active
   nav) so it never competes with the amber status chips on paper.
   Every text/background pair below is WCAG AA (≥4.5:1) at the
   sizes it is actually used.
   ------------------------------------------------------------ */
:root {
  --ws-bg: #f2f0ea;             /* warm archive paper */
  --ws-surface: #ffffff;
  --ws-surface-subtle: #faf8f3;
  --ws-border: #ddd8cd;
  --ws-border-strong: #bdb6a7;
  --ws-text: #161d29;           /* ink              16.2:1 on surface */
  --ws-muted: #6a6459;          /*                   5.9:1 on surface */
  --ws-soft: #7d7466;           /*                   4.6:1 on surface */
  --ws-primary: #1d3f66;        /* ink navy          9.8:1 white-on   */
  --ws-primary-dark: #142c48;   /* hover            14.2:1 white-on   */
  --ws-accent: #c5a253;         /* aged brass — dark chrome only      */
  --ws-accent-deep: #8a6a12;    /* brass on paper    5.1:1 on surface */
  --ws-green: #10704f;          /*                   5.4:1 on soft    */
  --ws-amber: #96540a;          /*                   5.4:1 on soft    */
  --ws-red: #b42318;            /*                   6.1:1 on soft    */
  --ws-blue-soft: #eaeef5;      /* pale navy wash (legacy token name) */
  --ws-green-soft: #eaf5ee;
  --ws-amber-soft: #fdf4e6;
  --ws-red-soft: #fdf0ee;
  --ws-gray-soft: #e7e3da;
  --ws-gray-ink: #4e4a41;       /*                   6.9:1 on gray-soft */
  --ws-sidebar: #16273d;        /* deep navy chrome */
  --ws-sidebar-ink: #0f1520;    /* text on a brass pill  6.2:1        */
  --ws-shadow: 0 4px 12px rgba(26, 22, 14, 0.10);
  --ws-shadow-soft: 0 1px 2px rgba(26, 22, 14, 0.07);
  --ws-radius: 6px;
  --ws-radius-sm: 4px;
}

body {
  margin: 0;
  background: var(--ws-bg);
  color: var(--ws-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--ws-primary); }

/* ── Shell grid (guide §4) ────────────────────────────────── */
.ws-shell {
  --ws-sidebar-w: 248px;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  transition: grid-template-columns 0.18s ease;
}
.ws-shell.is-sidebar-collapsed {
  --ws-sidebar-w: 80px;
  grid-template-columns: 80px minmax(0, 1fr);
}

/* ── Sidebar (dark) ───────────────────────────────────────── */
.ws-sidebar {
  box-sizing: border-box;
  min-height: 100vh;
  padding: 1rem;
  background: var(--ws-sidebar);
  color: #e4e0d6;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ws-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.ws-brand {
  display: flex; align-items: center; gap: 0.75rem;
  min-width: 0; padding: 0.2rem 0.1rem;
  color: #fff; font-weight: 800; text-decoration: none;
}
.ws-brand:hover { color: #fff; text-decoration: none; }
.ws-brand .material-symbols-outlined {
  font-size: 1.7rem; flex: 0 0 auto; color: var(--ws-accent);
}
.ws-brand-name { font-size: 1.05rem; letter-spacing: 0.005em; }

.ws-sidebar-toggle {
  width: 2rem; height: 2rem; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--ws-radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: #d5d0c4; cursor: pointer;
}
.ws-sidebar-toggle:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.ws-sidebar-toggle .material-symbols-outlined { font-size: 1.05rem; }

/* ── Nav (grouped links) ──────────────────────────────────── */
.ws-nav {
  display: flex; flex-direction: column; gap: 1rem;
  margin-top: 1rem; flex: 1;
}
.ws-nav-section { min-width: 0; }
.ws-nav-title {
  padding: 0 0.5rem 0.35rem;
  color: #9d9584; font-size: 0.68rem; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.ws-nav-list { display: grid; gap: 0.18rem; }

.ws-nav a {
  display: flex; align-items: center; gap: 0.65rem; min-width: 0;
  padding: 0.65rem 0.7rem; border-radius: var(--ws-radius-sm);
  color: #d5d0c4; text-decoration: none; font-size: 0.92rem; font-weight: 600;
}
.ws-nav a:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
/* Active item is a brass nameplate — the one loud note in the shell. */
.ws-nav a.is-active { background: var(--ws-accent); color: var(--ws-sidebar-ink); font-weight: 700; }
.ws-nav a.is-active:hover { background: #d3b268; color: var(--ws-sidebar-ink); }
.ws-nav a.ws-nav-cta { background: rgba(197, 162, 83, 0.18); color: #f3ead8; }
.ws-nav a.ws-nav-cta:hover { background: rgba(197, 162, 83, 0.28); color: #fff; }
.ws-nav .material-symbols-outlined { font-size: 1.15rem; flex: 0 0 1.15rem; }
.ws-nav-label {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Collapsed rail: icon stacked over a micro-label ──────── */
.ws-shell.is-sidebar-collapsed .ws-sidebar { padding: 1rem 0.5rem; }
.ws-shell.is-sidebar-collapsed .ws-sidebar-head {
  justify-content: center; padding-bottom: 0.75rem;
}
.ws-shell.is-sidebar-collapsed .ws-brand { display: none; }
.ws-shell.is-sidebar-collapsed .ws-sidebar-toggle { width: 2.2rem; }
.ws-shell.is-sidebar-collapsed .ws-nav { align-items: stretch; gap: 0.5rem; }
.ws-shell.is-sidebar-collapsed .ws-nav-section { width: 100%; }

.ws-shell.is-sidebar-collapsed .ws-nav-title {
  height: 1px; margin: 0.2rem 0.5rem; padding: 0; overflow: hidden;
  color: transparent; background: rgba(255, 255, 255, 0.12);
}
.ws-shell.is-sidebar-collapsed .ws-nav a {
  width: 100%; height: auto; flex-direction: column;
  justify-content: center; align-items: center; gap: 0.2rem;
  padding: 0.55rem 0.25rem; border-radius: var(--ws-radius-sm);
}
.ws-shell.is-sidebar-collapsed .ws-nav .material-symbols-outlined {
  flex-basis: auto; font-size: 1.5rem;
}
.ws-shell.is-sidebar-collapsed .ws-nav-label {
  display: block; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.01em;
  text-align: center; width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #9d9584;
}
.ws-shell.is-sidebar-collapsed .ws-nav a:hover .ws-nav-label { color: #e4e0d6; }
.ws-shell.is-sidebar-collapsed .ws-nav a.is-active .ws-nav-label { color: var(--ws-sidebar-ink); }

.ws-main { min-width: 0; }

/* ── Topbar (guide §5) ────────────────────────────────────── */
.ws-topbar {
  box-sizing: border-box; height: 60px; padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--ws-surface); border-bottom: 1px solid var(--ws-border);
}
.ws-org { color: var(--ws-muted); font-size: 0.9rem; font-weight: 650; }

.ws-tbar-actions { display: flex; align-items: center; gap: 0.15rem; }

.ws-tbar-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  height: 2.1rem; padding: 0 0.55rem;
  border: none; border-radius: var(--ws-radius-sm);
  background: transparent; color: var(--ws-muted); cursor: pointer;
  font-size: 0.87rem; font-weight: 600; white-space: nowrap; list-style: none;
  transition: background 0.12s, color 0.12s;
}
.ws-tbar-btn::-webkit-details-marker { display: none; }
.ws-tbar-btn:hover { background: var(--ws-border); color: var(--ws-text); }
.ws-tbar-btn .material-symbols-outlined { font-size: 1.2rem; line-height: 1; }
.ws-tbar-btn.is-soon { color: #b9b2a4; cursor: default; opacity: 0.55; }
.ws-tbar-btn.is-soon:hover { background: transparent; color: #b9b2a4; }

.ws-tbar-user { padding-right: 0.4rem; }
.ws-tbar-username {
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ws-text);
}
.ws-tbar-chevron { font-size: 1rem !important; color: var(--ws-muted); transition: transform 0.15s; }
details[open] .ws-tbar-chevron { transform: rotate(180deg); }

.ws-tbar-dropdown { position: relative; }
.ws-tbar-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 170px;
  background: var(--ws-surface); border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 200; padding: 0.3rem; animation: ws-menu-in 0.12s ease;
}
.ws-tbar-menu--right { left: auto; right: 0; min-width: 220px; }
@keyframes ws-menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ws-tbar-menu-item {
  display: flex; align-items: center; gap: 0.55rem; width: 100%;
  padding: 0.5rem 0.65rem; border: none; border-radius: calc(var(--ws-radius) - 2px);
  background: transparent; color: var(--ws-text);
  font-size: 0.88rem; font-weight: 500; text-decoration: none;
  cursor: pointer; text-align: left; transition: background 0.1s;
}
.ws-tbar-menu-item:hover { background: var(--ws-border); color: var(--ws-text); text-decoration: none; }
.ws-tbar-menu-item.is-danger { color: var(--ws-red); }
.ws-tbar-menu-item.is-danger:hover { background: var(--ws-red-soft); }
.ws-tbar-menu-item .material-symbols-outlined { font-size: 1rem; line-height: 1; }
.ws-tbar-menu-head { padding: 0.5rem 0.65rem 0.4rem; }
.ws-tbar-menu-name {
  font-size: 0.88rem; font-weight: 700; color: var(--ws-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-tbar-menu-org {
  font-size: 0.78rem; color: var(--ws-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-tbar-menu-sep { height: 1px; background: var(--ws-border); margin: 0.3rem 0; }

/* ── Content column (centered, capped width) ──────────────── */
.ws-content {
  box-sizing: border-box; width: min(100%, 1480px);
  margin: 0 auto; padding: 1.5rem;
}

/* ── Page primitives ──────────────────────────────────────── */
.ws-pagehead {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.25rem;
}
.ws-title {
  margin: 0; font-size: 1.35rem; line-height: 1.2; font-weight: 700;
  letter-spacing: -0.012em;
  display: flex; align-items: center; gap: 0.5rem;
}
.ws-title .material-symbols-outlined { color: var(--ws-primary); font-size: 1.5rem; }
.ws-subtitle { margin: 0.3rem 0 0; color: var(--ws-muted); font-size: 0.9rem; }

.ws-panel {
  background: var(--ws-surface); border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius); padding: 1rem; box-shadow: var(--ws-shadow-soft);
  margin-bottom: 1.25rem;
}
.ws-panel:last-child { margin-bottom: 0; }
.ws-panel.is-flush { padding: 0; overflow: hidden; }
.ws-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  margin: -1rem -1rem 1rem; padding: 0.7rem 1rem;
  background: var(--ws-surface-subtle);
  border-left: 3px solid var(--ws-primary);
  border-bottom: 1px solid var(--ws-border);
  border-top-left-radius: calc(var(--ws-radius) - 1px);
  border-top-right-radius: calc(var(--ws-radius) - 1px);
}
.ws-panel.is-flush .ws-panel-head { margin: 0 0 0 0; }
.ws-panel-title {
  margin: 0; font-size: 0.95rem; font-weight: 700; letter-spacing: -0.005em; color: var(--ws-text);
  display: flex; align-items: center; gap: 0.45rem;
}
.ws-panel-title .material-symbols-outlined { font-size: 1.15rem; color: var(--ws-primary); }
.ws-panel-meta { color: var(--ws-muted); font-size: 0.8rem; }

/* ── Buttons ──────────────────────────────────────────────── */
.ws-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.ws-pagehead .ws-actions { margin-bottom: 0; }
.ws-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.25rem; border: 1px solid var(--ws-border); border-radius: var(--ws-radius-sm);
  background: #fff; color: var(--ws-text); padding: 0.45rem 0.78rem;
  text-decoration: none; font-weight: 700; font-size: 0.86rem; cursor: pointer;
}
.ws-btn:hover { border-color: var(--ws-border-strong); text-decoration: none; color: var(--ws-text); }
.ws-btn.primary { background: var(--ws-primary); border-color: var(--ws-primary); color: #fff; }
.ws-btn.primary:hover { background: var(--ws-primary-dark); border-color: var(--ws-primary-dark); color: #fff; }
.ws-btn.danger { color: var(--ws-red); }
.ws-btn.sm { min-height: 1.9rem; padding: 0.3rem 0.55rem; font-size: 0.8rem; }
.ws-btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.ws-btn .material-symbols-outlined { font-size: 1.05rem; }
.ws-btn-group { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; }

/* ── Stat tiles ───────────────────────────────────────────── */
.ws-stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 1.25rem; }
.ws-stat {
  background: var(--ws-surface); border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius); padding: 1.1rem 1.2rem; box-shadow: var(--ws-shadow-soft);
  display: flex; align-items: center; gap: 0.9rem;
}
.ws-stat-icon {
  flex: 0 0 auto; width: 2.8rem; height: 2.8rem; border-radius: var(--ws-radius);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ws-blue-soft); color: var(--ws-primary);
}
.ws-stat-icon .material-symbols-outlined { font-size: 1.5rem; }
.ws-stat.is-green .ws-stat-icon { background: var(--ws-green-soft); color: var(--ws-green); }
.ws-stat.is-amber .ws-stat-icon { background: var(--ws-amber-soft); color: var(--ws-amber); }
.ws-stat-body { min-width: 0; }
.ws-stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; color: var(--ws-text); }
.ws-stat-label { color: var(--ws-muted); font-size: 0.82rem; margin-top: 0.15rem; }

/* ── Tables ───────────────────────────────────────────────── */
.ws-table-wrap { width: 100%; overflow-x: auto; }
.ws-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.ws-table th, .ws-table td {
  padding: 0.7rem 0.85rem; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--ws-border);
}
.ws-table thead th {
  background: var(--ws-surface-subtle); color: var(--ws-muted);
  font-weight: 700; font-size: 0.74rem; letter-spacing: 0.07em; text-transform: uppercase;
}
.ws-table tbody tr:last-child td { border-bottom: none; }
.ws-table tbody tr:hover { background: var(--ws-surface-subtle); }
.ws-table .ws-num { text-align: center; }
.ws-table .ws-end { text-align: right; }
.ws-table a { font-weight: 650; text-decoration: none; }
.ws-table a:hover { text-decoration: underline; }
.ws-cell-muted { color: var(--ws-muted); }

/* ── Badges / status pills ────────────────────────────────── */
.ws-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.55rem; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; line-height: 1.4;
  background: var(--ws-border); color: var(--ws-text);
}
.ws-badge .material-symbols-outlined { font-size: 0.95rem; }
.ws-badge.is-green { background: var(--ws-green-soft); color: var(--ws-green); }
.ws-badge.is-amber { background: var(--ws-amber-soft); color: var(--ws-amber); }
.ws-badge.is-red   { background: var(--ws-red-soft); color: var(--ws-red); }
.ws-badge.is-blue  { background: var(--ws-blue-soft); color: var(--ws-primary); }
.ws-badge.is-gray  { background: var(--ws-gray-soft); color: var(--ws-gray-ink); }

/* ── Forms ────────────────────────────────────────────────── */
.ws-form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.85rem; }
.ws-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.ws-field.grow { flex: 1 1 220px; }
.ws-label { font-size: 0.8rem; font-weight: 650; color: var(--ws-muted); }
.ws-input, .ws-select, .ws-textarea {
  box-sizing: border-box; width: 100%;
  border: 1px solid var(--ws-border); border-radius: var(--ws-radius-sm);
  background: #fff; color: var(--ws-text);
  padding: 0.5rem 0.65rem; font: inherit; font-size: 0.88rem;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ws-input:focus, .ws-select:focus, .ws-textarea:focus {
  outline: none; border-color: var(--ws-primary);
  box-shadow: 0 0 0 3px rgba(29, 63, 102, 0.18);
}
.ws-input:disabled, .ws-select:disabled, .ws-textarea:disabled {
  background: var(--ws-surface-subtle); color: var(--ws-soft); cursor: not-allowed;
}
.ws-input-group { position: relative; display: flex; align-items: center; }
.ws-input-group .material-symbols-outlined {
  position: absolute; left: 0.6rem; color: var(--ws-soft); font-size: 1.2rem; pointer-events: none;
}
.ws-input-group .ws-input { padding-left: 2.2rem; }
.ws-hint { font-size: 0.76rem; color: var(--ws-soft); margin-top: 0.15rem; }

/* ── Toggle switch ────────────────────────────────────────── */
.ws-switch { position: relative; display: inline-flex; align-items: center; }
.ws-switch input { position: absolute; opacity: 0; width: 2.4rem; height: 1.35rem; margin: 0; cursor: pointer; }
.ws-switch .ws-switch-track {
  width: 2.4rem; height: 1.35rem; border-radius: 999px;
  background: var(--ws-border-strong); transition: background 0.15s; flex: 0 0 auto;
}
.ws-switch .ws-switch-track::after {
  content: ""; position: absolute; top: 0.18rem; left: 0.2rem;
  width: 1rem; height: 1rem; border-radius: 50%; background: #fff;
  box-shadow: var(--ws-shadow-soft); transition: transform 0.15s;
}
.ws-switch input:checked + .ws-switch-track { background: var(--ws-primary); }
.ws-switch input:checked + .ws-switch-track::after { transform: translateX(1.05rem); }
.ws-switch input:disabled { cursor: not-allowed; }
.ws-switch input:disabled + .ws-switch-track { opacity: 0.5; }
.ws-switch-row { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.85rem; }
.ws-switch-row:last-child { margin-bottom: 0; }
.ws-switch-row .ws-switch-label { font-size: 0.9rem; font-weight: 600; }

/* ── Definition list (account info) ───────────────────────── */
.ws-dl { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 0.55rem 1rem; margin: 0; }
.ws-dl dt { color: var(--ws-muted); font-size: 0.85rem; font-weight: 650; }
.ws-dl dd { margin: 0; font-size: 0.9rem; }
.ws-dl code {
  background: var(--ws-surface-subtle); border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-sm); padding: 0.1rem 0.4rem; font-size: 0.82rem;
}

/* ── List group (recent transcripts) ──────────────────────── */
.ws-list { display: flex; flex-direction: column; }
.ws-list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 0.25rem; border-bottom: 1px solid var(--ws-border);
  text-decoration: none; color: var(--ws-text);
}
.ws-list-item:last-child { border-bottom: none; }
.ws-list-item:hover { background: var(--ws-surface-subtle); color: var(--ws-text); text-decoration: none; }
.ws-list-item-title { font-weight: 650; margin: 0 0 0.15rem; }
.ws-list-item-meta { color: var(--ws-muted); font-size: 0.82rem; }

/* ── Pagination ───────────────────────────────────────────── */
.ws-pagination { display: flex; justify-content: center; gap: 0.3rem; margin-top: 1.25rem; }
.ws-pagination a, .ws-pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.1rem; height: 2.1rem; padding: 0 0.5rem;
  border: 1px solid var(--ws-border); border-radius: var(--ws-radius-sm);
  background: #fff; color: var(--ws-text); text-decoration: none;
  font-size: 0.85rem; font-weight: 650; cursor: pointer;
}
.ws-pagination a:hover { border-color: var(--ws-border-strong); }
.ws-pagination .is-active { background: var(--ws-primary); border-color: var(--ws-primary); color: #fff; }
.ws-pagination .is-disabled { opacity: 0.45; pointer-events: none; }
.ws-pagination .material-symbols-outlined { font-size: 1.1rem; }

/* ── Empty / placeholder state ────────────────────────────── */
.ws-empty { text-align: center; padding: 2.5rem 1rem; color: var(--ws-muted); }
.ws-empty .material-symbols-outlined { font-size: 2.6rem; opacity: 0.6; }
.ws-empty p { margin: 0.6rem 0 0; }

/* ── Breadcrumb ───────────────────────────────────────────── */
.ws-breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
  font-size: 0.82rem; color: var(--ws-muted); margin-bottom: 0.85rem;
}
.ws-breadcrumb a { text-decoration: none; }
.ws-breadcrumb a:hover { text-decoration: underline; }
.ws-breadcrumb .sep { color: var(--ws-soft); }
.ws-breadcrumb .current { color: var(--ws-text); font-weight: 600; }

/* ── Alerts (Django messages) ─────────────────────────────── */
.ws-alerts { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; }
.ws-alert {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 0.9rem; border-radius: var(--ws-radius);
  border: 1px solid var(--ws-border); background: var(--ws-surface);
  font-size: 0.9rem;
}
.ws-alert .material-symbols-outlined { font-size: 1.2rem; }
.ws-alert.is-success { background: var(--ws-green-soft); border-color: #b7ddc6; color: var(--ws-green); }
.ws-alert.is-error   { background: var(--ws-red-soft); border-color: #f0c4bd; color: var(--ws-red); }
.ws-alert.is-warning { background: var(--ws-amber-soft); border-color: #ecd6ab; color: var(--ws-amber); }
.ws-alert.is-info    { background: var(--ws-blue-soft); border-color: #c2cfe0; color: var(--ws-primary); }
.ws-alert-close {
  margin-left: auto; border: none; background: transparent; cursor: pointer;
  color: inherit; opacity: 0.7; display: inline-flex; padding: 0.1rem;
}
.ws-alert-close:hover { opacity: 1; }

/* ── Transcript segments & speaker colors ─────────────────── */
/* (Moved from the inline <style> in transcript_detail.html so the
   HTMX-swapped _speaker_row.html keeps its colors too.) */
.speaker-segment {
  border-left: 4px solid;
  padding-left: 1rem;
  margin-bottom: 1rem;
}
.speaker-segment:last-child { margin-bottom: 0; }
.speaker-segment p { margin: 0; line-height: 1.55; }
.speaker-segment.is-review { border-color: var(--ws-amber); }
.ws-badge.sm { font-size: 0.7rem; padding: 0.1em 0.5em; }

/* Говорник palette — must stay index-for-index identical to
   SPEAKER_COLORS in apps/dashboard/views.py. Eight archival inks,
   all ≥5:1 on white so a speaker name is readable as text, ordered
   most-separated-first (a 4-speaker hearing gets navy/crimson/green/
   ochre). */
.speaker-0 { border-color: #1d3f66; }
.speaker-1 { border-color: #a32724; }
.speaker-2 { border-color: #10704f; }
.speaker-3 { border-color: #8a6a12; }
.speaker-4 { border-color: #5b3d8f; }
.speaker-5 { border-color: #0f6b74; }
.speaker-6 { border-color: #9c3268; }
.speaker-7 { border-color: #4f6118; }

.speaker-name-0 { color: #1d3f66; }
.speaker-name-1 { color: #a32724; }
.speaker-name-2 { color: #10704f; }
.speaker-name-3 { color: #8a6a12; }
.speaker-name-4 { color: #5b3d8f; }
.speaker-name-5 { color: #0f6b74; }
.speaker-name-6 { color: #9c3268; }
.speaker-name-7 { color: #4f6118; }

.timestamp { font-family: ui-monospace, "SF Mono", "Courier New", monospace; font-size: 0.82em; }

/* Speaker row (left-color card) */
.ws-speaker-row {
  border: 1px solid var(--ws-border); border-left-width: 4px;
  border-radius: var(--ws-radius); padding: 0.6rem 0.85rem; margin-bottom: 0.75rem;
  background: var(--ws-surface);
}
.ws-speaker-row:last-child { margin-bottom: 0; }
.ws-speaker-row-inner { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.ws-speaker-chip {
  border: 1px solid currentColor; border-radius: 999px;
  padding: 0.1rem 0.55rem; font-size: 0.78rem; font-weight: 700;
}
.ws-speaker-assign { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ws-speaker-assign .ws-select, .ws-speaker-assign .ws-input { width: auto; min-width: 150px; }
.ws-audio { height: 2rem; max-width: 230px; vertical-align: middle; }

/* ── Responsive ≤860px (guide §7) ─────────────────────────── */
@media (max-width: 860px) {
  .ws-shell,
  .ws-shell.is-sidebar-collapsed { display: block; }
  .ws-sidebar { min-height: 0; }
  .ws-nav { flex-direction: row; flex-wrap: wrap; }
  .ws-nav-section { min-width: 11rem; }

  .ws-shell.is-sidebar-collapsed .ws-brand,
  .ws-shell.is-sidebar-collapsed .ws-nav-label { display: inline; }
  .ws-shell.is-sidebar-collapsed .ws-nav { align-items: stretch; }
  .ws-shell.is-sidebar-collapsed .ws-nav-title {
    width: auto; height: auto; margin: 0; padding: 0 0.5rem 0.35rem;
    overflow: visible; color: #9d9584; background: transparent;
  }
  .ws-shell.is-sidebar-collapsed .ws-nav a {
    width: auto; height: auto; flex-direction: row;
    justify-content: flex-start; gap: 0.65rem; padding: 0.65rem 0.7rem;
  }

  .ws-topbar { padding: 0 1rem; }
  .ws-content { padding: 1rem; }
  .ws-pagehead { display: block; }
  .ws-org { max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ── Tabs ─────────────────────────────────────────────────────── */
.ws-tabs {
  display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--ws-border);
}
.ws-tab {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.7rem 1.1rem; border: none; border-bottom: 2px solid transparent;
  background: transparent; color: var(--ws-muted);
  font: inherit; font-size: 0.9rem; font-weight: 650; cursor: pointer;
  margin-bottom: -2px; transition: color 0.12s, border-color 0.12s;
}
.ws-tab:hover { color: var(--ws-text); }
.ws-tab.is-active { color: var(--ws-primary); border-bottom-color: var(--ws-primary); }
.ws-tab .material-symbols-outlined { font-size: 1.1rem; }

.ws-tabpanel { display: none; }
.ws-tabpanel.is-active { display: block; }

/* „Копирај цитат" feedback (see _tabs_clips_js.html) */
.ws-copy-citation.is-copied {
  color: var(--ws-green); border-color: var(--ws-green); background: var(--ws-green-soft);
}
.ws-copy-citation.is-copy-failed {
  color: var(--ws-red); border-color: var(--ws-red); background: var(--ws-red-soft);
}

/* ── Timeline / Activity tab ──────────────────────────────────── */
.ws-timeline { display: flex; flex-direction: column; gap: 0.6rem; }
.ws-tl-lane { display: flex; align-items: center; gap: 0.75rem; }
.ws-tl-label {
  flex: 0 0 130px; font-size: 0.82rem; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right;
}
.ws-tl-track {
  flex: 1; position: relative; height: 22px;
  background: var(--ws-surface-subtle); border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-sm); overflow: hidden;
}
.ws-tl-bar {
  position: absolute; top: 0; height: 100%;
  border-radius: 0; opacity: 0.85;
  transition: opacity 0.1s;
}
.ws-tl-bar:hover { opacity: 1; }
.ws-tl-bar.speaker-0 { background: #1d3f66; }
.ws-tl-bar.speaker-1 { background: #a32724; }
.ws-tl-bar.speaker-2 { background: #10704f; }
.ws-tl-bar.speaker-3 { background: #8a6a12; }
.ws-tl-bar.speaker-4 { background: #5b3d8f; }
.ws-tl-bar.speaker-5 { background: #0f6b74; }
.ws-tl-bar.speaker-6 { background: #9c3268; }
.ws-tl-bar.speaker-7 { background: #4f6118; }

/* ── Talk-time donut ──────────────────────────────────────────── */
.ws-donut-wrap { position: relative; flex: 0 0 auto; }
.ws-donut {
  width: 160px; height: 160px; border-radius: 50%;
  background: var(--ws-border);
  /* White center hole via pseudo element */
  position: relative;
}
.ws-donut::after {
  content: ''; position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 90px; height: 90px; border-radius: 50%;
  background: var(--ws-surface);
}
.ws-donut-legend {
  display: flex; flex-direction: column; gap: 0.5rem; justify-content: center;
}
.ws-donut-legend-row {
  display: flex; align-items: center; gap: 0.55rem; font-size: 0.88rem;
}
.ws-swatch {
  width: 12px; height: 12px; border-radius: 3px; flex: 0 0 12px;
}
.ws-swatch.speaker-0 { background: #1d3f66; }
.ws-swatch.speaker-1 { background: #a32724; }
.ws-swatch.speaker-2 { background: #10704f; }
.ws-swatch.speaker-3 { background: #8a6a12; }
.ws-swatch.speaker-4 { background: #5b3d8f; }
.ws-swatch.speaker-5 { background: #0f6b74; }
.ws-swatch.speaker-6 { background: #9c3268; }
.ws-swatch.speaker-7 { background: #4f6118; }
.ws-donut-name { font-weight: 650; min-width: 80px; }

/* ── Key Moments cards ────────────────────────────────────────── */
.ws-moment {
  background: var(--ws-surface); border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius); padding: 1rem 1.1rem; margin-bottom: 1rem;
  box-shadow: var(--ws-shadow-soft);
}
.ws-moment:last-child { margin-bottom: 0; }
.ws-moment-header {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.ws-moment-quote {
  margin: 0 0 0.5rem; padding: 0.5rem 0.9rem;
  border-left: 3px solid var(--ws-primary);
  font-style: italic; color: var(--ws-text); line-height: 1.55;
}
.ws-moment-why { margin: 0; font-size: 0.85rem; }

/* ── People analytics ──────────────────────────────────────────── */
.ws-people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.ws-people-card {
  background: var(--ws-surface); border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius); padding: 1.1rem 1rem;
  display: flex; align-items: flex-start; gap: 0.85rem;
  text-decoration: none; color: inherit;
  box-shadow: var(--ws-shadow-soft);
  transition: box-shadow 0.15s, border-color 0.15s;
  cursor: pointer;
}
.ws-people-card:hover {
  box-shadow: var(--ws-shadow); border-color: var(--ws-border-strong);
}
.ws-people-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ws-people-avatar.is-large {
  width: 64px; height: 64px;
}
.ws-people-body { flex: 1; min-width: 0; }
.ws-people-name {
  font-weight: 600; font-size: 0.95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 0.2rem;
}
.ws-people-stats {
  display: flex; gap: 1rem; margin-top: 0.55rem;
}
.ws-people-stat { text-align: center; }
.ws-people-stat-value { font-weight: 700; font-size: 1rem; color: var(--ws-text); }
.ws-people-stat-label { font-size: 0.72rem; color: var(--ws-muted); }
.ws-people-bar-bg {
  height: 4px; background: var(--ws-border); border-radius: 2px;
  margin-top: 0.6rem; overflow: hidden;
}
.ws-people-bar-fill { height: 100%; border-radius: 2px; }
.ws-people-arrow { color: var(--ws-soft); margin-left: auto; align-self: center; }

/* Profile page header */
.ws-people-profile-head {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.ws-people-id {
  display: flex; align-items: center; gap: 1rem; min-width: 220px;
}
.ws-people-metrics {
  margin-left: auto; flex: 1 1 480px;
  display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 0.75rem;
}
.ws-people-metric {
  background: var(--ws-surface-subtle); border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-sm); padding: 0.85rem 1rem; text-align: center;
}
.ws-people-metric-value { font-weight: 700; font-size: 1.5rem; color: var(--ws-text); line-height: 1.1; }
.ws-people-metric-label { font-size: 0.72rem; color: var(--ws-muted); margin-top: 0.25rem; }

/* Mini bar (inline in tables) */
.ws-mini-bar-bg {
  height: 6px; background: var(--ws-border); border-radius: 3px;
  overflow: hidden; width: 80px; display: inline-block; vertical-align: middle;
}
.ws-mini-bar-fill { height: 100%; border-radius: 3px; background: var(--ws-primary); }

/* Chart containers */
.ws-chart-wrap { padding: 0.5rem 0; position: relative; }
.ws-chart-wrap.is-short canvas { max-height: 200px; }
.ws-chart-wrap canvas { max-height: 260px; }

/* Role / mood badge variants */
.ws-role-badge, .ws-mood-badge { font-size: 0.75rem; padding: 0.2em 0.55em; }

/* Attendance legend */
.ws-attend-legend {
  display: flex; gap: 1.25rem; margin-bottom: 0.75rem;
  font-size: 0.82rem; color: var(--ws-muted);
}
.ws-attend-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.ws-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Stats small variant (used in profile header) */
.ws-stat.is-small { padding: 0.6rem 0.9rem; }
.ws-stat.is-small .ws-stat-value { font-size: 1.25rem; }
.ws-stat.is-small .ws-stat-label { font-size: 0.72rem; }

/* ── Предмети (case intelligence) ─────────────────────────── */
.ws-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ws-clip { display: inline-flex; align-items: center; }
.ws-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }
.ws-disclaimer {
  display: flex; align-items: center; gap: 0.45rem;
  margin: 0 0 1rem; padding: 0.5rem 0.8rem;
  border-left: 3px solid var(--ws-amber); border-radius: var(--ws-radius-sm);
  background: var(--ws-amber-soft); color: var(--ws-muted); font-size: 0.82rem;
}
.ws-disclaimer .material-symbols-outlined { font-size: 1.05rem; color: var(--ws-amber); }
.ws-claim-grid {
  display: grid; gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.ws-claim-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 0.35rem; font-size: 0.8rem;
}
.ws-entity-grid {
  display: grid; gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.ws-entity-card {
  background: var(--ws-surface-subtle); border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-sm); padding: 0.85rem 1rem;
}
.ws-entity-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 0.6rem;
}
.ws-entity-value { font-weight: 650; }
.ws-entity-citations { display: flex; flex-direction: column; gap: 0.6rem; }
.ws-entity-citation:not(:last-child) {
  padding-bottom: 0.6rem; border-bottom: 1px dashed var(--ws-border);
}
.ws-case-timeline {
  display: flex; flex-direction: column; gap: 0; padding-left: 0.25rem;
}
.ws-case-timeline-item {
  display: flex; gap: 0.85rem; position: relative; padding-bottom: 1.25rem;
}
.ws-case-timeline-item:last-child { padding-bottom: 0; }
.ws-case-timeline-item::before {
  content: ''; position: absolute; left: 5px; top: 16px; bottom: 0;
  width: 2px; background: var(--ws-border);
}
.ws-case-timeline-item:last-child::before { display: none; }
.ws-case-timeline-dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--ws-primary);
  flex-shrink: 0; margin-top: 4px; z-index: 1;
}
.ws-case-timeline-body { flex: 1; min-width: 0; }
.ws-case-timeline-date { font-weight: 650; font-size: 0.85rem; color: var(--ws-muted); }
.ws-case-timeline-label { margin: 0.15rem 0 0.15rem; }
.ws-search-form {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 1rem; padding: 0.6rem 0.9rem;
  background: var(--ws-surface); border: 1px solid var(--ws-border);
  border-radius: var(--ws-radius-sm); color: var(--ws-muted);
}
.ws-search-input {
  flex: 1; border: none; background: transparent; color: var(--ws-text);
  font-size: 0.95rem; outline: none;
}
