/* ═══════════════════════════════════════════════════════════
   Church Meeting Assistant — app.css
   Small overrides on top of Pico.css

   NOTE: this file is also where the templates' former inline <style>
   blocks now live. Keeping them here (rather than in the HTML) is what
   lets the Content-Security-Policy in web/headers.py say
   style-src 'self' with no 'unsafe-inline' escape hatch.
   ═══════════════════════════════════════════════════════════ */

/* Pin the light scheme rather than following the OS: the palette below is
   hand-tuned for light, and Pico's automatic dark mode would half-apply. */
:root { color-scheme: light; }

/* ── Login page (login.html — standalone, does not extend base.html) ── */

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card { width: 100%; max-width: 24rem; }
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand h1 { margin-bottom: .25rem; font-size: 1.5rem; }
.login-brand p { margin: 0; color: var(--pico-muted-color); font-size: .875rem; }
.login-error { color: var(--pico-del-color); }

:root {
    --sidebar-width: 320px;
    --sidebar-bg: #f6f6f6;
    --sidebar-border: #e0e0e0;
    --meeting-hover: #ececec;
    --meeting-current-bg: #e8f4ff;
    --meeting-current-border: #4a90e2;

    --hit-green-bg: #d4edda;
    --hit-green-border: #28a745;
    --hit-yellow-bg: #fff3cd;
    --hit-yellow-border: #ffc107;
    --hit-dim-bg: #f0f0f0;
    --hit-dim-border: #999;
}


/* ─── Layout ─── */

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

body {
    padding: 0;
}

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

.app-layout {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;      /* let children (sidebar/main) own the scroll */
    overflow: hidden;
}


/* ─── Sidebar ─── */

.app-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    overflow-y: auto;
    padding: 1rem;
}

.sidebar-header {
    margin-bottom: 1rem;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.sidebar-title {
    text-decoration: none;
    color: inherit;
}

.sidebar-section-label {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.7rem;
    color: #666;
    margin: 0.5rem 0;
}


/* ─── Sidebar search bar ─── */

.sidebar-search {
    margin-bottom: 1rem;
}

.sidebar-search input[type="search"] {
    width: 100%;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
}

.search-output {
    margin-top: 0.5rem;
}

.search-hint {
    padding: 0.5rem;
    color: #888;
}

.search-results-count {
    padding: 0.25rem 0.5rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.search-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: white;
}

.search-result-item {
    border-bottom: 1px solid #eee;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-link {
    display: block;
    padding: 0.5rem;
    text-decoration: none;
    color: inherit;
    font-size: 0.8rem;
}

.search-result-link:hover {
    background: #f0f8ff;
}

.search-result-date {
    color: #666;
    font-size: 0.7rem;
    margin-bottom: 0.15rem;
}

.search-result-title {
    font-weight: 500;
    margin-bottom: 0.15rem;
}

.search-result-snippet {
    color: #666;
    font-size: 0.75rem;
    font-style: italic;
}


/* ─── Meetings list ─── */

.meetings-nav {
    margin-bottom: 1rem;
}

.meetings-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.meeting-item {
    margin-bottom: 0.25rem;
    border-radius: 6px;
    transition: background 0.1s ease;
}

.meeting-item:hover {
    background: var(--meeting-hover);
}

.meeting-item.is-current {
    background: var(--meeting-current-bg);
    border-left: 3px solid var(--meeting-current-border);
}

.meeting-link {
    display: block;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: inherit;
}

.meeting-date {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
}

.meeting-meta {
    font-size: 0.75rem;
    color: #666;
}

.meeting-meta span {
    margin-right: 0.5rem;
}

.meeting-meta .warn {
    color: #e67e22;
}


/* ─── Sidebar bottom nav ─── */

.sidebar-bottom-nav {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-nav-link {
    display: block;
    padding: 0.5rem;
    text-decoration: none;
    color: inherit;
    border-radius: 4px;
    font-size: 0.9rem;
}

.sidebar-nav-link:hover {
    background: var(--meeting-hover);
}


/* ─── Main panel ─── */

.app-main {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}


/* ─── Home page ─── */

.home-page {
    max-width: 900px;
    margin: 0 auto;
}

.home-header {
    text-align: center;
    margin-bottom: 2rem;
}

.home-header h1 {
    margin-bottom: 0.5rem;
}

.tagline {
    color: #666;
}

.home-footer {
    margin-top: 3rem;
    text-align: center;
    color: #999;
}

.stats-summary {
    margin: 0;
}


/* ─── Query form ─── */

.query-section {
    margin-bottom: 2rem;
}

#query-form textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid #ccc;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
}

#query-form textarea:focus {
    border-color: #4a90e2;
    outline: none;
}

.query-form-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.query-form-controls button {
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.query-form-controls button:hover {
    background: #3a7bc8;
}

.query-form-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* HTMX indicator: visible only when request in flight */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
    color: #666;
    font-size: 0.9rem;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-request.htmx-indicator {
    opacity: 1;
}


/* ─── Query output ─── */

.query-output {
    margin-top: 1.5rem;
}

.query-result {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.query-result-header h5 {
    margin: 0 0 0.25rem 0;
    color: #666;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.question-text {
    font-size: 1.05rem;
    margin: 0 0 1rem 0;
    font-style: italic;
}


/* ─── Hits list ─── */

.hits-block {
    margin-bottom: 1.5rem;
}

.hits-block h5 {
    margin-bottom: 0.5rem;
}

.hits-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: hit;
}

.hit-item {
    counter-increment: hit;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.35rem;
    border-radius: 4px;
    border-left: 3px solid transparent;
    background: #f0f0f0;
    position: relative;
}

.hit-item::before {
    content: "[" counter(hit) "]";
    position: absolute;
    left: -2.5rem;
    top: 0.5rem;
    color: #999;
    font-family: monospace;
    font-weight: bold;
}

.hits-list {
    padding-left: 2.5rem;
}

.hit-green {
    background: var(--hit-green-bg);
    border-left-color: var(--hit-green-border);
}

.hit-yellow {
    background: var(--hit-yellow-bg);
    border-left-color: var(--hit-yellow-border);
}

.hit-dim {
    background: var(--hit-dim-bg);
    border-left-color: var(--hit-dim-border);
    opacity: 0.75;
}

.hit-header {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    flex-wrap: wrap;
}

.hit-meeting-date {
    font-family: monospace;
    color: #4a90e2;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.hit-meeting-date:hover {
    text-decoration: underline;
}

.hit-title {
    font-size: 0.95rem;
}

.hit-score {
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.15rem;
    font-family: monospace;
}


/* ─── Synthesis ─── */

.synthesis-block {
    margin-bottom: 1.5rem;
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.synthesis-text {
    white-space: pre-wrap;
    line-height: 1.6;
}


/* ─── Sources ─── */

.sources-block {
    margin-bottom: 1rem;
}

.sources-block p {
    margin: 0;
}

.source-link {
    font-family: monospace;
    text-decoration: none;
    color: #4a90e2;
    padding: 0.15rem 0.35rem;
    background: #e8f4ff;
    border-radius: 3px;
    font-size: 0.85rem;
}

.source-link:hover {
    text-decoration: underline;
}


/* ─── Timings ─── */

.query-result-footer {
    padding-top: 0.75rem;
    border-top: 1px solid #e0e0e0;
    color: #999;
}

.timings {
    font-family: monospace;
}


/* ─── Query error ─── */

.query-pending .pending-block {
    margin-top: 0.5rem;
}

.pending-status {
    margin: 0;
    color: #444;
}

.pending-elapsed {
    color: #888;
    font-size: 0.85rem;
    margin-left: 0.4rem;
}

/* Shown only once waiting stops looking like a queue and starts looking like
   an absent worker — same palette as .query-error, since it is a caution. */
.pending-hint {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 0.75rem;
    margin: 0.75rem 0 0 0;
    color: #856404;
    font-size: 0.9rem;
}

.query-error {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.query-error h5 {
    margin: 0 0 0.5rem 0;
    color: #856404;
}

.query-error p {
    margin: 0;
}


/* ─── Meeting detail ─── */

.meeting-detail header {
    margin-bottom: 2rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 1rem;
}

.meeting-detail h1 {
    margin: 0;
    font-size: 1.8rem;
}

.meeting-quick-stats {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.meeting-quick-stats span {
    margin-right: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge.indexed {
    background: #d4edda;
    color: #155724;
}

.badge.warn {
    background: #fff3cd;
    color: #856404;
}


/* ─── Attendees ─── */

.attendees-block {
    margin-bottom: 2rem;
}

.attendees-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.attendees-list li {
    background: #f0f0f0;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
}


/* ─── Topics list ─── */

.topics-block {
    margin-bottom: 2rem;
}

.topics-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.topic-item {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

.topic-item summary {
    cursor: pointer;
    font-weight: 500;
    outline: none;
    padding: 0.15rem 0;
}

.topic-item summary:hover {
    color: #4a90e2;
}

.topic-number {
    display: inline-block;
    min-width: 2.5em;
    color: #999;
    font-weight: normal;
    font-family: monospace;
    font-size: 0.85rem;
    margin-right: 0.5rem;
}

.topic-title {
    font-size: 0.95rem;
}

.topic-body {
    padding: 0.75rem 0 0.25rem 0;
    margin-left: 2.5em;
    color: #333;
}

.topic-body-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.meeting-detail-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}


/* ─── History page ─── */

.history-page {
    max-width: 900px;
    margin: 0 auto;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.history-item {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.history-item.history-status-failed {
    background: #fff5f5;
    border-color: #ffcccc;
}

.history-item.history-status-pending,
.history-item.history-status-processing {
    background: #fffde7;
    border-color: #ffecb3;
}

.history-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    flex-wrap: wrap;
}

.history-source {
    font-family: monospace;
}

.history-date {
    font-family: monospace;
}

.history-question {
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
}

.history-sources,
.history-error {
    color: #666;
}

/* ─────────────────────────────────────────────────────────────
   Dashboard (MVP-B)
   ───────────────────────────────────────────────────────────── */

.dashboard-page {
    max-width: 900px;
}

.dashboard-header {
    margin-bottom: 1rem;
}

.dash-section {
    margin-bottom: 1.75rem;
}

.dash-section-label {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 0.6rem;
}

/* Health pills */
.health-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.health-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
    border: 1px solid #ddd;
}

.health-pill.is-up {
    background: #eafbea;
    border-color: #b7e4b7;
}

.health-pill.is-down {
    background: #fdeaea;
    border-color: #f0b7b7;
}

.health-pill small {
    color: #777;
}

.health-stamp {
    color: #999;
    margin-left: auto;
}

.health-notes {
    color: #777;
    margin-top: 0.4rem;
}

/* Stat tiles */
.stat-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.6rem;
}

.stat-tile {
    background: #f7f7f9;
    border: 1px solid #e6e6ea;
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
}

.stat-tile.is-warn {
    background: #fff8e6;
    border-color: #f0dfa8;
}

.stat-tile.is-active {
    background: #e9f2ff;
    border-color: #b7d2f0;
}

.stat-tile.is-error {
    background: #fdeaea;
    border-color: #f0b7b7;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.75rem;
    color: #777;
    margin-top: 0.2rem;
}

.stat-breakdown {
    color: #777;
    margin-top: 0.5rem;
}

/* Tables */
.dash-table {
    width: 100%;
    font-size: 0.9rem;
    border-collapse: collapse;
}

.dash-table th {
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #999;
    border-bottom: 1px solid #e6e6ea;
    padding: 0.3rem 0.5rem;
}

.dash-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #f0f0f2;
    vertical-align: middle;
}

.dash-question {
    color: #444;
}

.dash-row-failed td {
    background: #fdf4f4;
}

.dash-actions {
    text-align: right;
    white-space: nowrap;
}

/* Action buttons */
.dash-btn {
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    border-radius: 5px;
    border: 1px solid #ccc;
    background: #fff;
    /* Pico's default button colour is white-on-primary; on this white pill it
       would be invisible. Every existing .dash-btn happened to carry a modifier
       with its own colour, so a plain one was the first to show the hole. */
    color: #333;
    cursor: pointer;
    margin: 0 0 0 0.3rem;
    width: auto;
    line-height: 1.4;
}

.dash-btn:hover {
    filter: brightness(0.96);
}

.dash-btn.is-cancel {
    border-color: #e0a0a0;
    color: #b03030;
}

.dash-btn.is-requeue {
    border-color: #a0b8e0;
    color: #2050b0;
}

.dash-btn.is-resolve {
    border-color: #a0d0a0;
    color: #208030;
}

/* Open errors */
.dash-error-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dash-error-item {
    border: 1px solid #f0d0d0;
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    margin-bottom: 0.5rem;
    background: #fdf6f6;
}

.dash-error-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.dash-error-type {
    font-family: monospace;
    font-weight: 600;
    color: #b03030;
}

.dash-error-proc,
.dash-error-time {
    color: #999;
}

.dash-error-head .dash-btn {
    margin-left: auto;
}

.dash-error-msg {
    color: #666;
    margin-top: 0.3rem;
    font-family: monospace;
}

/* ─────────────────────────────────────────────
   Ingestion page (MVP-C): flash messages + form
   ───────────────────────────────────────────── */

.flash {
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.flash-error {
    background: #fdecea;
    border: 1px solid #f5c6c2;
    color: #a02622;
}

.flash-ok {
    background: #eafaf0;
    border: 1px solid #b7e4c7;
    color: #1b7a3d;
}

.ingest-form button[type="submit"] {
    margin-top: 0.5rem;
}

/* awaiting-review link styled like a button chip inside the table */
a.dash-btn {
    text-decoration: none;
    display: inline-block;
}

/* ─────────────────────────────────────────────
   Speakers review editor (MVP-C, Phase 4)
   ───────────────────────────────────────────── */

.speakers-help {
    margin: 0 0 0.75rem 0;
    color: #555;
}

.speakers-legend {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.sp-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    white-space: nowrap;
}

.sp-badge.sp-review   { background: #fff3cd; color: #7a5c00; }
.sp-badge.sp-no_match { background: #e7e0ff; color: #4b2fa0; }
.sp-badge.sp-invalid  { background: #fdecea; color: #a02622; }
.sp-badge.sp-manual   { background: #dff3e4; color: #1d6b3a; }

.speakers-table td { vertical-align: middle; }

.speakers-table .sp-label code { font-weight: 600; }
.speakers-table .sp-time strong { font-variant-numeric: tabular-nums; }
.speakers-table .sp-samples small { color: #888; font-variant-numeric: tabular-nums; }

.speakers-table .sp-name input {
    margin: 0;
    width: 100%;
}

/* highlight the rows needing attention */
tr.sp-flag-review   { background: rgba(255, 243, 205, 0.35); }
tr.sp-flag-no_match { background: rgba(231, 224, 255, 0.40); }
tr.sp-flag-invalid  { background: rgba(253, 236, 234, 0.45); }
tr.sp-flag-manual   { background: rgba(223, 243, 228, 0.45); }

/* Manually added speakers: a typed timestamp instead of a diarized cluster */

.speakers-table .sp-time-input {
    margin: 0.25rem 0 0 0;
    width: 100%;
    min-width: 7rem;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.speakers-table .sp-remove {
    display: block;
    margin: 0.25rem 0 0 0;
    font-size: 0.75rem;
    color: #a02622;
    cursor: pointer;
}

.speakers-table .sp-remove input {
    margin: 0 0.2rem 0 0;
    vertical-align: middle;
}

/* The add-row is a form, not a record — dashed to say "nothing here yet". */
tr.sp-add-row td { border-top: 2px dashed #b9d9c4; }

.speakers-manual-help {
    margin: 0.75rem 0 0 0;
    color: #555;
}

.speakers-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin: 1rem 0 0.5rem 0;
}

.speakers-actions button[type="submit"] { margin: 0; }
.speakers-actions a[role="button"] { margin: 0; }

/* ─────────────────────────────────────────────
   Ingestion job detail (MVP-C, Phase 5)
   ───────────────────────────────────────────── */

.detail-timeline td:first-child {
    color: #666;
    width: 12rem;
    white-space: nowrap;
}

.detail-timeline td { font-variant-numeric: tabular-nums; }

.detail-traceback {
    max-height: 320px;
    overflow: auto;
    background: #2b2b2b;
    color: #eee;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-size: 0.78rem;
}

.detail-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.detail-actions form { margin: 0; }
.detail-actions button { margin: 0; }
.detail-actions a[role="button"] { margin: 0; }

.flash a[role="button"] { margin-left: 0.5rem; }

/* ─────────────────────────────────────────────
   Meeting transcript / стенограма (annotated.md)
   ───────────────────────────────────────────── */

.transcript-block { margin-top: 1.5rem; }

.transcript-details > summary {
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    background: #f2f4f7;
    border-radius: 6px;
    font-size: 0.9rem;
    user-select: none;
}

.transcript-details[open] > summary {
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.transcript-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e3e6ea;
    border-radius: 6px;
    background: #fff;
    line-height: 1.5;
}

/* extra top gap whenever the speaker changes — visually groups turns */
.transcript-turn.is-new-speaker { margin-top: 0.75rem; }
.transcript-turn:first-child { margin-top: 0; }

.turn-meta.is-hidden { display: none; }

.turn-speaker {
    font-weight: 600;
    color: #2b3a55;
    font-size: 0.9rem;
}

.turn-line {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}

.turn-ts {
    flex: 0 0 auto;
    color: #9aa2ad;
    font-family: monospace;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.turn-text { flex: 1 1 auto; }

/* ─────────────────────────────────────────────
   Meeting audio player + clickable timestamps
   ───────────────────────────────────────────── */

.audio-player-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    background: #f7f9fb;
    border: 1px solid #e3e6ea;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.audio-player-bar audio {
    width: 100%;
    height: 38px;
}

.audio-hint { color: #8a919c; }

/* clickable timestamp — used in both topics and стенограма */
.ts-link {
    cursor: pointer;
    color: #2563c9;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}

.ts-link:hover,
.ts-link:focus {
    color: #17408b;
    border-bottom-style: solid;
    outline: none;
}

/* in the стенограма the timestamp span is the link */
.turn-ts.ts-link {
    background: none;
    border-bottom: 1px dotted currentColor;
}

/* ─────────────────────────────────────────────
   Top navigation bar (always visible)
   ───────────────────────────────────────────── */

.top-nav {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.5rem 1rem;
    background: #1f2a44;
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.top-nav-brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    white-space: nowrap;
}

.top-nav-links {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.top-nav-links a {
    color: #cdd5e6;
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}

.top-nav-links a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.top-nav-links a.is-active {
    background: #3b82f6;
    color: #fff;
}

/* Section heading with an action on the right (Теми + PDF download). */
.topics-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.topics-head h4 {
    margin-bottom: 0;
}

/* ── Web account management (/admin/users) ───────────────────────────── */

.admin-msg {
    margin: 0 0 1rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.admin-msg.is-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.admin-msg.is-ok {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* A disabled account stays listed (deactivation is a soft delete and must be
   reversible), but should not read as an account that can currently sign in. */
.dash-table tr.is-disabled td {
    opacity: 0.55;
}

.admin-create-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.admin-create-form input,
.admin-create-form select,
.admin-create-form button {
    margin: 0;
    width: auto;
    flex: 1 1 10rem;
    font-size: 0.9rem;
    padding: 0.35rem 0.6rem;
    height: auto;
}

.admin-create-form button {
    flex: 0 0 auto;
}

/* Password reset folds away so the row stays scannable until it's needed.
   <details> is display:block by default, which would drop it onto its own line
   below the other row actions. */
.admin-inline-form {
    display: inline-block;
    vertical-align: middle;
}

.admin-inline-form summary {
    display: inline-block;
    cursor: pointer;
    list-style: none;
}

/* Pico decorates every <summary> with an accordion chevron (::after) and the
   native marker; neither belongs on a button-shaped control. */
.admin-inline-form summary::after,
.admin-inline-form summary::marker,
.admin-inline-form summary::-webkit-details-marker {
    display: none;
    content: none;
}

.admin-inline-form form {
    display: flex;
    gap: 0.35rem;
    margin: 0.35rem 0 0;
}

.admin-inline-form input {
    margin: 0;
    width: 11rem;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    height: auto;
}

.admin-session-count {
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Keep the row's controls on one line and vertically centred — the lock badge
   is a <small>, the rest are buttons, so they need a common baseline. */
.dash-actions {
    white-space: nowrap;
}

.dash-actions > * {
    vertical-align: middle;
}

.dash-admin-lock {
    display: inline-block;
    margin-left: 0.3rem;
}

/* Right-hand identity block: which church you're in and who you are. Pushed
   to the far edge so the tenant is always visible — on a shared server that's
   the one thing a user must never be confused about. */
.top-nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

.top-nav-tenant {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-weight: 600;
}

.top-nav-who {
    color: #cdd5e6;
    text-decoration: none;
}

.top-nav-who:hover {
    color: #fff;
    text-decoration: underline;
}

.top-nav-user form {
    margin: 0;
}

.top-nav-logout {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #cdd5e6;
    padding: 0.25rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
    width: auto;
    margin: 0;
    line-height: 1.3;
}

.top-nav-logout:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

/* When there's no sidebar (dashboard / ingest / history), keep the main
   content readable instead of stretching edge-to-edge on wide screens. */
.app-layout.no-sidebar .app-main > * {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* ─────────────────────────────────────────────
   Учасники section — "edit voices" entry point
   ───────────────────────────────────────────── */

.attendees-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

.attendees-head h4 { margin: 0; }

.attendees-edit-voices {
    font-size: 0.85rem;
    text-decoration: none;
    padding: 0.2rem 0.6rem;
    border: 1px solid #cdd5e6;
    border-radius: 6px;
    color: #2563c9;
    white-space: nowrap;
}

.attendees-edit-voices:hover {
    background: #eaf1fd;
    border-color: #2563c9;
}

.attendees-edit-voices.is-reprocessing {
    color: #7a5c00;
    border-color: #ffe08a;
    background: #fff8e6;
}

/* ─────────────────────────────────────────────
   Transcript speaker reassignment (change speaker)
   ───────────────────────────────────────────── */

.transcript-help { color: #888; margin: 0.25rem 0 0.5rem; }

.turn-speaker-link {
    color: #2b3a55;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    border-bottom: 1px dashed #9aa7bd;
    cursor: pointer;
    white-space: nowrap;
}
.turn-speaker-link:hover,
.turn-speaker-link:focus { color: #17408b; background: #eef3fb; border-bottom-style: solid; outline: none; }

.turn-speaker-plain { color: #6b7280; font-weight: 600; font-size: 0.9rem; white-space: nowrap; }

/* pending changes bar */
.review-bar {
    border: 1px solid #ffe08a;
    background: #fff8e6;
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.75rem;
}
.review-bar-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem;
}
.review-run-form { margin: 0; }
.review-run-btn { margin: 0; background: #d97706; border-color: #d97706; }
.review-run-btn:hover { background: #b45309; border-color: #b45309; }

.review-list { list-style: none; padding: 0; margin: 0 0 0.4rem; }
.review-item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.2rem 0; font-size: 0.9rem;
}
.review-badge-new {
    font-size: 0.72rem; padding: 0.1rem 0.4rem; border-radius: 4px;
    background: #e7e0ff; color: #4b2fa0;
}
.review-remove {
    margin-left: auto; background: none; border: none; color: #a02622;
    cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0.3rem; width: auto;
}
.review-hint { color: #7a5c00; margin: 0; }

/* change-speaker dialog */
.speaker-dialog {
    border: none; border-radius: 10px; padding: 1.25rem 1.4rem;
    max-width: 420px; box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}
.speaker-dialog::backdrop { background: rgba(0,0,0,0.4); }
.speaker-dialog h5 { margin: 0 0 0.4rem; }
.speaker-dialog-form input[type="text"] { width: 100%; }
.dlg-newhint { color: #666; margin: 0.25rem 0 0.75rem; }
.speaker-dialog-actions { display: flex; gap: 0.6rem; }
.speaker-dialog-actions button { margin: 0; }
