/* === Captly · Manjgura tenant === */
/* Editorial broadcast: dark, warm, confident. Newsroom-as-software. */

:root {
    /* Warm dark palette — paper-black, not screen-grey */
    --bg: #0c0b0d;
    --bg-2: #121113;
    --surface: #16151a;
    --surface-2: #1c1b21;
    --surface-3: #25232a;
    --border: #2a2830;
    --border-strong: #3d3a44;
    --text: #f1ece2;
    --text-dim: #aba59b;
    --text-muted: #928c81;
    /* Manjgura crimson kept as tenant accent — overridable per-tenant */
    --accent: #E84049;
    --accent-hover: #ff5661;
    --accent-soft: rgba(232, 64, 73, 0.10);
    --accent-line: rgba(232, 64, 73, 0.35);
    --green: #7bc97b;
    --green-line: rgba(123, 201, 123, 0.30);
    --green-soft: rgba(123, 201, 123, 0.08);
    /* Warning amber — reviewer "good-enough" score state */
    --amber: #e8a030;
    --amber-line: rgba(232, 160, 48, 0.30);
    --amber-soft: rgba(232, 160, 48, 0.08);

    /* Editorial typography — Fraunces (display serif, variable opsz/wght)
       + Geist (refined body sans) + JetBrains Mono (utility / tickers) */
    --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
    --display: "Fraunces", "Iowan Old Style", Georgia, serif;
    --mono: "JetBrains Mono", "SF Mono", Consolas, "Liberation Mono", Courier, monospace;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --fast: 180ms;
    --slow: 420ms;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-weight: 400;
    font-feature-settings: "ss01", "ss02", "cv11";
    position: relative;
}

/* Subtle grain overlay — adds warmth, mostly invisible but felt */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.025;
    z-index: 100;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
    background: var(--accent);
    color: #fff;
}

/* === Universal focus ring — keyboard nav visibility (WCAG 2.4.7) === */
:focus { outline: none; }
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 1px;
    transition: outline-offset var(--fast) var(--ease);
}
/* Inputs already have border — use inset ring instead */
input:focus-visible,
textarea:focus-visible {
    outline-offset: 0;
    box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 1px var(--accent) inset;
}
/* Custom-styled radio/checkbox: ring on the visual proxy */
input[type="radio"]:focus-visible + .option-check,
input[type="checkbox"]:focus-visible + .option-check {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

a {
    color: var(--text-dim);
    text-decoration: none;
    transition: color var(--fast) var(--ease);
}
a:hover { color: var(--accent); }

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* === Top Bar === */

.topbar {
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    background: rgba(15, 15, 16, 0.85);
}

.topbar-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-brand {
    display: flex;
    align-items: center;
    opacity: 0.85;
    transition: opacity var(--fast) var(--ease);
}
.topbar-brand:hover { opacity: 1; }

.topbar-logo {
    height: 28px;
    width: auto;
    display: block;
    filter: invert(1) hue-rotate(180deg);
}

.topbar-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    letter-spacing: 0.02em;
}

.topbar-tool {
    color: var(--text);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.topbar-tenant {
    color: var(--text-dim);
    font-weight: 500;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
}

.topbar-sep {
    color: var(--border-strong);
    font-weight: 300;
}

/* On-air dot — pulses while a job is processing (body.processing) */
.onair-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border-strong);
    transition: background var(--fast) var(--ease);
    flex-shrink: 0;
}
body.processing .onair-dot {
    background: var(--accent);
    box-shadow: 0 0 0 0 var(--accent);
    animation: onairPulse 1.6s cubic-bezier(0.66, 0, 0, 1) infinite;
}
@keyframes onairPulse {
    0%   { box-shadow: 0 0 0 0   rgba(232, 64, 73, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(232, 64, 73, 0); }
    100% { box-shadow: 0 0 0 0   rgba(232, 64, 73, 0); }
}

/* === Container === */

.container {
    flex: 1;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 72px 28px 56px;
    animation: fadeUp 0.6s var(--ease);
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Header === */

.header {
    margin-bottom: 56px;
    position: relative;
}

.header::before {
    content: "";
    position: absolute;
    left: -28px;
    top: 28px;
    width: 3px;
    height: 56px;
    background: var(--accent);
}

.header-eyebrow {
    font-family: var(--mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.header h1 {
    font-family: var(--display);
    font-size: 4.2rem;
    font-weight: 500;
    font-variation-settings: "opsz" 96, "SOFT" 30;
    letter-spacing: -0.035em;
    color: var(--text);
    line-height: 0.92;
    margin-bottom: 18px;
}

.header h1 .brand-dot {
    color: var(--accent);
    font-style: italic;
    font-variation-settings: "opsz" 144;
    margin-left: -2px;
}

.header-sub {
    font-family: var(--display);
    font-size: 1.15rem;
    color: var(--text-dim);
    font-weight: 400;
    font-variation-settings: "opsz" 14;
    max-width: 520px;
    line-height: 1.5;
    letter-spacing: -0.005em;
}

/* === Busy Banner === */

.busy-banner {
    padding: 14px 18px;
    background: var(--accent-soft);
    border-left: 2px solid var(--accent);
    margin-bottom: 32px;
    font-size: 0.86rem;
    color: var(--text-dim);
    animation: slideIn 0.3s var(--ease);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

/* === Source Tabs === */

.source-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 36px;
    position: relative;
}

.tab {
    padding: 14px 22px 16px;
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: color var(--fast) var(--ease);
    letter-spacing: 0.01em;
    position: relative;
}

.tab:first-child { padding-left: 0; }

.tab:hover { color: var(--text); }

.tab.active {
    color: var(--text);
    font-weight: 600;
}

.tab.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--accent);
    animation: slideWidth 0.3s var(--ease);
}

.tab:first-child.active::after {
    left: 0;
}

@keyframes slideWidth {
    from { transform: scaleX(0); transform-origin: left; }
    to { transform: scaleX(1); }
}

/* === Panels === */

.panel {
    animation: fadeUp 0.3s var(--ease);
}

/* === Drop Zone === */

.drop-zone {
    border: 1px dashed var(--border-strong);
    padding: 64px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--fast) var(--ease);
    background: var(--surface);
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, var(--accent-soft), transparent 60%);
    opacity: 0;
    transition: opacity var(--slow) var(--ease);
}

.drop-zone:hover::before, .drop-zone.dragover::before { opacity: 1; }

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent);
    border-style: solid;
}

.drop-icon {
    color: var(--text-muted);
    margin-bottom: 14px;
    transition: color var(--fast) var(--ease), transform var(--slow) var(--ease);
    display: flex;
    justify-content: center;
    position: relative;
}
.drop-zone:hover .drop-icon,
.drop-zone.dragover .drop-icon {
    color: var(--accent);
    transform: translateY(-2px);
}

.drop-main {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    position: relative;
}

.drop-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 400;
    position: relative;
}

/* === File Info === */

.file-info {
    display: none;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--surface-2);
    border-left: 2px solid var(--accent);
    margin-top: 12px;
    animation: slideIn 0.25s var(--ease);
}

.file-info.visible { display: flex; }

.file-name {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color var(--fast) var(--ease);
}
.file-remove:hover { color: var(--accent); }

/* === YouTube Input === */

.yt-input-wrap {
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color var(--fast) var(--ease);
}
.yt-input-wrap:focus-within {
    border-color: var(--accent);
    background: var(--surface-2);
}

.yt-input {
    width: 100%;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.86rem;
    outline: none;
    letter-spacing: -0.01em;
}
.yt-input::placeholder { color: var(--text-muted); }
/* The wrapper already shows focus via its accent border — suppress the input's
   own inset focus ring so it doesn't render as a doubled red outline. */
.yt-input:focus-visible { box-shadow: none; }

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 12px;
    line-height: 1.5;
}

/* === Batch === */

.batch-textarea {
    width: 100%;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.83rem;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    transition: border-color var(--fast) var(--ease);
    letter-spacing: -0.01em;
}
.batch-textarea:focus {
    border-color: var(--accent);
    background: var(--surface-2);
}
/* Border-color change above is the focus indicator — drop the global inset ring
   so focus isn't a doubled outline (matches .yt-input). */
.batch-textarea:focus-visible { box-shadow: none; }
.batch-textarea::placeholder { color: var(--text-muted); }

/* === Options === */

.options { margin: 40px 0 32px; }

.section-label {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
}

.lang-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
}

.option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: var(--surface);
    cursor: pointer;
    transition: background var(--fast) var(--ease);
}

.option:hover { background: var(--surface-2); }

/* Full-width row — keeps the grid even when there's an odd number of options
   (Transkript spans the top, the 4 language toggles fill a clean 2×2 below). */
.option-wide { grid-column: 1 / -1; }

/* Keep input focusable for keyboard nav (display:none would break Tab) */
.option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    margin: 0;
}

.option-check {
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-strong);
    flex-shrink: 0;
    transition: all var(--fast) var(--ease);
    position: relative;
    background: transparent;
}

.option input:checked + .option-check {
    background: var(--accent);
    border-color: var(--accent);
}

.option input:checked + .option-check::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 4px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    animation: popIn 0.2s var(--ease);
}

@keyframes popIn {
    from { transform: rotate(45deg) scale(0); }
    to { transform: rotate(45deg) scale(1); }
}

.option-text {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 400;
}

/* === Buttons === */

.btn-go {
    width: 100%;
    padding: 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-family: var(--sans);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all var(--fast) var(--ease);
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.btn-go::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform var(--slow) var(--ease);
}

.btn-go:hover:not(:disabled)::before { transform: translateX(100%); }
.btn-go:hover:not(:disabled) { background: var(--accent-hover); }

.btn-go:disabled {
    background: var(--surface-3);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-secondary {
    display: block;
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border-strong);
    font-family: var(--sans);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 10px;
    transition: all var(--fast) var(--ease);
}
.btn-secondary:hover {
    color: var(--text);
    border-color: var(--text-dim);
    background: var(--surface);
}

.btn-zip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--fast) var(--ease);
    margin-top: 6px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.btn-zip:hover { background: var(--accent-hover); }

/* === Pipeline Step Tracker === */

.pipeline-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 40px;
    padding: 0 8px;
}

.pipe-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
}

.pipe-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    background: var(--bg);
    transition: all var(--slow) var(--ease);
    position: relative;
}

.pipe-step.done .pipe-dot {
    background: var(--accent);
    border-color: var(--accent);
}

.pipe-step.done .pipe-dot::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fff;
}

.pipe-step.active .pipe-dot {
    background: transparent;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    animation: stepPulse 1.5s ease-in-out infinite;
}

@keyframes stepPulse {
    0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft); }
    50% { box-shadow: 0 0 0 6px rgba(232, 64, 73, 0.06); }
}

.pipe-label {
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    transition: color var(--fast) var(--ease);
}

.pipe-step.done .pipe-label { color: var(--text-dim); }
.pipe-step.active .pipe-label { color: var(--accent); }

.pipe-line {
    flex: 1;
    height: 1px;
    background: var(--border);
    margin: 0 6px;
    min-width: 16px;
    transition: background var(--slow) var(--ease);
    /* Align with center of dot (dot is 10px, label is ~22px below, total step height ~32px) */
    align-self: flex-start;
    margin-top: 5px;  /* (10px dot height / 2) - (1px line height / 2) */
}

.pipe-line.done { background: var(--accent-line); }

/* === Progress === */

.progress-phase {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    text-align: center;
    margin-bottom: 32px;
}

.waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 56px;
    margin-bottom: 32px;
}

.waveform .bar {
    width: 2px;
    background: var(--accent);
    animation: wave 1.4s ease-in-out infinite;
    border-radius: 1px;
}

@keyframes wave {
    0%, 100% { height: 6px; opacity: 0.25; }
    50% { height: 42px; opacity: 1; }
}

.progress-track {
    height: 1px;
    background: var(--border);
    overflow: hidden;
    margin-bottom: 16px;
    position: relative;
}

.progress-fill {
    position: relative;
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.5s var(--ease);
    box-shadow: 0 0 12px var(--accent);
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.progress-detail { color: var(--text-dim); }

/* === Results === */

.result-header {
    margin-bottom: 36px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    animation: fadeUp 0.4s var(--ease);
}

.result-badge {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    color: var(--green);
    text-transform: uppercase;
    margin-bottom: 8px;
    padding: 3px 10px;
    border: 1px solid var(--green-line);
    background: var(--green-soft);
}

.result-sub {
    font-size: 0.95rem;
    color: var(--text-dim);
    margin-top: 8px;
}

.previews { margin-bottom: 24px; }

.preview-box {
    margin-bottom: 18px;
    animation: fadeUp 0.3s var(--ease);
}

.preview-label {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.preview-content {
    max-height: 180px;
    overflow-y: auto;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 0.76rem;
    line-height: 1.75;
    color: var(--text-dim);
    white-space: pre-wrap;
    word-wrap: break-word;
    letter-spacing: -0.01em;
}

.result-actions { margin-bottom: 16px; }

.btn-dl {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    font-family: var(--sans);
    font-size: 0.88rem;
    font-weight: 400;
    text-decoration: none;
    transition: all var(--fast) var(--ease);
    width: 100%;
}
.btn-dl:hover {
    border-color: var(--accent);
    color: var(--text);
    background: var(--surface-2);
}
.btn-dl:hover .dl-arrow { color: var(--accent); }

.dl-icon {
    color: var(--text-muted);
    flex-shrink: 0;
    display: flex;
}

.dl-name {
    flex: 1;
    font-weight: 500;
}

.dl-ext {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 2px 6px;
    border: 1px solid var(--border);
    text-transform: uppercase;
    flex-shrink: 0;
}

.dl-arrow {
    color: var(--border-strong);
    flex-shrink: 0;
    transition: color var(--fast) var(--ease);
    display: flex;
}

.downloads {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    margin-bottom: 10px;
}

/* === QA Score Card === */

.qa-card {
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 20px 22px;
    margin-bottom: 28px;
    animation: fadeUp 0.4s var(--ease);
}

.qa-card-header {
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.qa-score-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.qa-score-badge {
    font-family: var(--display);
    font-size: 1.9rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--green);
    flex-shrink: 0;
    min-width: 52px;
}

.qa-score-badge.score-good { color: var(--amber); }
.qa-score-badge.score-poor { color: var(--accent); }

.qa-score-denom {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0;
}

.qa-score-bar-wrap {
    flex: 1;
    height: 3px;
    background: var(--border);
    overflow: hidden;
}

.qa-score-bar {
    height: 100%;
    background: var(--green);
    transition: width 0.8s var(--ease);
}

.qa-score-label {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-transform: uppercase;
    flex-shrink: 0;
}

.qa-summary-text {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    line-height: 1.6;
    padding-top: 4px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.qa-errors {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(232, 64, 73, 0.06);
    border-left: 2px solid var(--accent);
}

.qa-error-item {
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--accent);
    line-height: 1.7;
}

/* result header score inline */
.result-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.result-reviewer-score {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--green);
    padding: 3px 9px;
    border: 1px solid var(--green-line);
    background: var(--green-soft);
}

.result-reviewer-score.score-good {
    color: var(--amber);
    border-color: var(--amber-line);
    background: var(--amber-soft);
}

.result-reviewer-score.score-poor {
    color: var(--accent);
    border-color: var(--accent-line);
    background: var(--accent-soft);
}

/* === Processing Indicator === */

.processing-indicator {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--surface);
    border-left: 2px solid var(--accent);
    margin-bottom: 12px;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-dim);
    animation: slideIn 0.3s var(--ease);
}

.processing-spinner {
    width: 12px;
    height: 12px;
    border: 1.5px solid rgba(232, 64, 73, 0.25);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.processing-error { color: var(--accent); }

/* === Error === */

.error-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent);
    border: 1px solid var(--accent);
    background: var(--accent-soft);
}

.error-title {
    text-align: center;
    font-family: var(--display);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 18px;
}

.error-detail {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--accent);
    background: var(--surface);
    border-left: 2px solid var(--accent);
    padding: 16px 18px;
    margin-bottom: 20px;
    word-break: break-word;
    line-height: 1.6;
}

/* === Footer === */

.footer {
    border-top: 1px solid var(--border);
    padding: 24px 28px;
    background: var(--bg);
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    letter-spacing: 0.02em;
}

.footer .sep {
    color: var(--border-strong);
    font-weight: 300;
}

.footer-mark {
    color: var(--text-dim);
}
.footer-mark-name {
    font-family: var(--display);
    font-style: italic;
    font-variation-settings: "opsz" 36;
    font-weight: 500;
    font-size: 0.86rem;
    color: var(--text);
    letter-spacing: -0.01em;
    text-transform: none;
}
.footer-mark-sep {
    color: var(--accent);
    margin: 0 4px;
}

/* === Utility === */

[hidden] { display: none !important; }

.screen { animation: fadeUp 0.35s var(--ease); }

/* === Responsive === */

@media (max-width: 640px) {
    .container { padding: 48px 20px 40px; }
    .header h1 { font-size: 3rem; }
    .header-sub { font-size: 1.02rem; }
    .header-eyebrow { font-size: 0.65rem; letter-spacing: 0.14em; }
    .header::before { display: none; }
    .options-grid { grid-template-columns: 1fr; }
    .topbar-inner { padding: 14px 20px; }
    .topbar-meta { font-size: 0.7rem; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
    .topbar-tenant { font-size: 0.7rem; }
    .tab { padding: 11px 14px 13px; font-size: 0.82rem; }
    .footer { padding: 20px; }
    .footer-mark-name { font-size: 0.82rem; }
    .intro-card { padding: 24px 20px; }
    .intro-title { font-size: 1.4rem; }
    .live-transcript { max-height: 160px; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* === Heartbeat indicator on progress fill (poll feedback) === */
.progress-fill.heartbeat::after {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 4px;
    background: rgba(255,255,255,0.6);
    box-shadow: 0 0 6px rgba(255,255,255,0.45);
    animation: heartbeat-pulse 0.25s ease-out;
}
@keyframes heartbeat-pulse {
    from { opacity: 0.9; }
    to   { opacity: 0; }
}

/* === Batch progress info row === */
.batch-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 8px 0 4px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* === Source URL list shown after batch completes === */
.batch-sources {
    margin: 16px 0;
    padding: 12px 14px;
    border-left: 2px solid var(--accent-line);
    background: var(--accent-soft);
}
.batch-sources-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.batch-sources-list {
    margin: 0;
    padding-left: 18px;
    font-size: 0.8rem;
    word-break: break-all;
}
.batch-sources-list li {
    margin: 2px 0;
}

/* === Cancel button row inside progress screen === */
.progress-actions {
    margin-top: 18px;
    display: flex;
    justify-content: center;
}
.btn-cancel {
    font-size: 0.85rem;
    padding: 6px 16px;
    opacity: 0.75;
}
.btn-cancel:hover {
    opacity: 1;
}
/* Armed inline-confirm state (replaces blocking confirm()) */
.btn-cancel.confirm {
    opacity: 1;
    color: var(--accent);
    border-color: var(--accent-line);
}

/* === How-to-use intro modal === */
.intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.62);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.intro-overlay[hidden] { display: none; }
.intro-card {
    position: relative;
    width: 100%;
    max-width: 520px;
    box-sizing: border-box;
    overflow: hidden;
    background: var(--bg-2);
    border: 1px solid var(--accent-line);
    padding: 32px 28px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
    animation: fadeUp 0.3s var(--ease);
}
.intro-close {
    position: absolute;
    top: 10px;
    right: 12px;
    padding: 4px 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: color var(--fast) var(--ease);
}
.intro-close:hover { color: var(--text); }
.intro-eyebrow {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 6px;
}
.intro-title {
    font-family: var(--display);
    font-size: 1.7rem;
    font-weight: 500;
    margin: 0 0 18px;
    color: var(--text);
}
.intro-steps {
    margin: 0 0 18px;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.intro-steps li {
    color: var(--text-dim);
    line-height: 1.5;
    font-size: 0.94rem;
}
.intro-steps strong { color: var(--text); font-weight: 600; }
.intro-foot {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 18px;
}
.intro-cta { width: 100%; }
.help-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.help-btn:hover { color: var(--text); border-color: var(--accent); }

/* === Live transcription pane === */
.live-pane {
    width: 100%;
    box-sizing: border-box;
    margin: 16px auto 0;
    padding: 14px 16px;
    border: 1px solid var(--accent-line);
    background: var(--accent-soft);
    text-align: left;
}
.live-pane-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 var(--accent);
    animation: live-pulse 1.4s ease-out infinite;
}
@keyframes live-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(232, 64, 73, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(232, 64, 73, 0); }
    100% { box-shadow: 0 0 0 0 rgba(232, 64, 73, 0); }
}
.live-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--accent);
}
.live-stop-btn {
    margin-left: auto;
    font-size: 0.82rem;
    padding: 6px 14px;
    border: 1px solid var(--accent-line);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.live-stop-btn:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.live-stop-btn:disabled {
    opacity: 0.55;
    cursor: default;
}
.live-transcript {
    max-height: 220px;
    overflow-y: auto;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-dim);
    white-space: pre-wrap;
    word-break: break-word;
}
