/*
 * Dark, RTL. No web fonts: font-src is 'self' and there is nothing worth a round trip here.
 * Every rule lives in this file because the CSP forbids inline style.
 */

:root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-raised: #1e222b;
    --border: #2a2f3a;
    --text: #e6e8ec;
    --muted: #8b93a3;
    --accent: #5b9dd9;
    --accent-dim: #2c4a66;
    --danger: #e06c75;
    --ok: #7fb069;
    --warn: #d9a55b;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "Noto Sans Hebrew", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

.muted {
    color: var(--muted);
}

.error {
    color: var(--danger);
    margin: 8px 0;
}

.empty,
.loading {
    padding: 24px 4px;
}

/* ------------------------------------------------------------------ chrome */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 2;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    color: var(--muted);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius);
}

.nav-link:hover {
    color: var(--text);
    background: var(--surface-raised);
}

.nav-link.active {
    color: var(--text);
    background: var(--accent-dim);
}

.content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

/* ------------------------------------------------------------------ inputs */

button,
input,
select {
    font: inherit;
    color: var(--text);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 12px;
}

button {
    background: var(--accent-dim);
    border-color: var(--accent-dim);
    cursor: pointer;
}

button:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--accent);
}

button:disabled {
    opacity: 0.45;
    cursor: default;
}

button.ghost,
a.ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    display: inline-block;
}

button.ghost:hover:not(:disabled),
a.ghost:hover {
    background: var(--surface-raised);
    border-color: var(--accent);
}

input:focus,
select:focus,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 20px;
}

.filters input[type="search"] {
    flex: 1 1 260px;
}

.field {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ------------------------------------------------------------------- login */

.login-card {
    max-width: 380px;
    margin: 12vh auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}

.card h1,
.card h2 {
    margin: 0;
}

/* Styled as a button, but it is an <a>: a plain top-level navigation to /v1/auth/google/start,
   which no CSP directive in our policy restricts. */
.button-link {
    display: block;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    background: var(--accent-dim);
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius);
    padding: 9px 12px;
    font-weight: 600;
}

.button-link:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.token-login summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
    padding: 4px 0;
}

.token-login summary:hover {
    color: var(--text);
}

.token-login form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
}

/* The six-digit code reads as digits, not as prose: LTR, spaced, tabular. */
.code-input {
    font-size: 22px;
    letter-spacing: 0.35em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.hint {
    font-size: 13px;
    margin: 4px 0 0;
}

/* -------------------------------------------------------------------- rows */

.rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: inherit;
    text-decoration: none;
}

.row:hover {
    border-color: var(--accent);
}

.row-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.row-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.row-sub {
    font-size: 13px;
}

.row-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 13px;
}

.hit {
    flex-direction: column;
    align-items: stretch;
}

.hit-text {
    margin: 0 0 6px;
    overflow-wrap: anywhere;
}

.timecode {
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

.pill {
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
}

.pill-completed {
    color: var(--ok);
    border-color: var(--ok);
}

.pill-failed {
    color: var(--danger);
    border-color: var(--danger);
}

.pill-processing,
.pill-pending {
    color: var(--warn);
    border-color: var(--warn);
}

/* ------------------------------------------------------------------ detail */

.detail-head {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.detail-head h2 {
    margin: 0;
    overflow-wrap: anywhere;
}

.detail-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin: 8px 0 16px;
    font-size: 13px;
}

.player {
    width: 100%;
    margin-bottom: 16px;
}

.downloads {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.transcript {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.segment {
    display: flex;
    gap: 12px;
    align-items: baseline;
    text-align: start;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 6px 10px;
    width: 100%;
}

.segment:hover:not(:disabled) {
    background: var(--surface);
    border-color: var(--border);
}

.segment-active {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.segment-time {
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    flex: 0 0 auto;
}

.segment-text {
    overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- telegram */

.telegram {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 800px) {
    .telegram {
        grid-template-columns: 1fr;
    }
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 75vh;
    overflow-y: auto;
}

.chat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-align: start;
    background: var(--surface);
    border: 1px solid var(--border);
}

.chat-active {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.chat-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.chat-sub {
    font-size: 12px;
}

.message-pane {
    min-width: 0;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 65vh;
    overflow-y: auto;
    padding: 4px;
}

.message {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    max-width: 80%;
}

.message.outgoing {
    align-self: flex-start;
    background: var(--surface-raised);
    border-color: var(--accent-dim);
}

.message.incoming {
    align-self: flex-end;
}

.message.deleted {
    border-style: dashed;
    border-color: var(--danger);
    opacity: 0.75;
}

.message-head {
    display: flex;
    gap: 10px;
    align-items: baseline;
    flex-wrap: wrap;
    font-size: 12px;
    margin-bottom: 2px;
}

.sender {
    font-weight: 600;
}

.message-text {
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.tombstone {
    color: var(--danger);
}

.chip {
    display: inline-block;
    font-size: 12px;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--muted);
}

.older-slot {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
    min-height: 8px;
}

.error-slot:empty {
    display: none;
}
