:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --ink: #1f2a37;
    --muted: #667085;
    --line: #d7dde4;
    --brand: #0f766e;
    --brand-ink: #ffffff;
    --danger: #b42318;
    --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% -10%, #d1fae5 0%, transparent 40%),
        radial-gradient(circle at 100% 0%, #dbeafe 0%, transparent 35%),
        var(--bg);
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 18px;
    justify-content: space-between;
    padding: 14px 22px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}

.topbar-brand {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.brand {
    font-weight: 700;
    letter-spacing: 0.3px;
    font-size: 20px;
}

.topbar-runtime-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    max-width: min(760px, 62vw);
}

.topbar-runtime-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #f8fafc;
    color: var(--ink);
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
}

.topbar-runtime-pill.is-ok {
    background: #ecfdf3;
    border-color: #a7f3d0;
}

.topbar-runtime-pill.is-warn {
    background: #fffbeb;
    border-color: #fde68a;
}

.topbar-runtime-pill.is-err {
    background: #fef2f2;
    border-color: #fecaca;
}

.topbar-runtime-pill .runtime-label {
    font-weight: 700;
    letter-spacing: 0.02em;
}

.topbar-runtime-pill .runtime-tag {
    font-size: 10px;
    opacity: 0.85;
}

.topnav {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.topnav a {
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
}

.topnav a.active,
.topnav a:hover {
    background: #e6f7f5;
    color: #0b5550;
}

.topnav-item {
    position: relative;
}

.topnav-dropdown::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 10px;
}

.topnav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.topnav-dropdown .topnav-link::after {
    content: "v";
    font-size: 11px;
    opacity: 0.75;
}

.topnav-menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    min-width: 190px;
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow);
    z-index: 30;
}

.topnav-dropdown:hover .topnav-menu,
.topnav-dropdown:focus-within .topnav-menu {
    display: flex;
}

.topnav-menu a {
    display: block;
    padding: 9px 10px;
    border-radius: 10px;
    white-space: nowrap;
}

.topnav-menu a.active,
.topnav-menu a:hover {
    background: #e6f7f5;
    color: #0b5550;
}

.userbar {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    flex-shrink: 0;
}

.content {
    width: min(1200px, 96vw);
    margin: 20px auto;
    display: grid;
    gap: 16px;
}

.content > * {
    min-width: 0;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    min-width: 0;
}

h1,
h2,
h3 {
    margin: 0 0 12px;
}

p,
label {
    color: var(--muted);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.stat {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: #f9fbfc;
}

.stat .v {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn,
button {
    border: none;
    border-radius: 10px;
    background: var(--brand);
    color: var(--brand-ink);
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    text-decoration: none;
}

.btn.secondary,
button.secondary {
    background: #e2e8f0;
    color: var(--ink);
}

.btn.danger,
button.danger {
    background: #dc2626;
    color: #ffffff;
}

.btn:hover,
button:hover {
    filter: brightness(0.96);
}

.btn:hover {
    text-decoration: none;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: none;
}

.form-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: end;
}

.field {
    min-width: 180px;
    flex: 1;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    font: inherit;
    color: var(--ink);
    background: #fff;
}

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
    border: 1px solid var(--line);
}

table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fafc;
    font-size: 13px;
    color: var(--muted);
}

.small {
    font-size: 12px;
    color: var(--muted);
}

.mono {
    font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
}

.text-break {
    overflow-wrap: anywhere;
    word-break: break-word;
}

pre.mono {
    white-space: pre-wrap;
}

pre.log {
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0b1220;
    color: #dbe7ff;
    padding: 12px;
    max-height: 70vh;
    overflow: auto;
}

.audio-player {
    width: 260px;
    max-width: 100%;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e6f7f5;
    color: #0b5550;
    font-size: 12px;
}

.badge-ok {
    background: #dcfce7;
    color: #166534;
}

.badge-warn {
    background: #fef3c7;
    color: #92400e;
}

.badge-err {
    background: #fee2e2;
    color: #991b1b;
}

.stage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
}

.stage-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: 20px 1fr;
    column-gap: 8px;
    row-gap: 2px;
    align-items: center;
}

.stage-item .small {
    grid-column: 2;
}

.stage-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.setting-option-wrap {
    display: grid;
    gap: 6px;
}

.setting-name {
    font-weight: 600;
}

.setting-desc {
    margin-top: 4px;
}

.setting-custom-input.is-hidden {
    display: none;
}

.column-controls summary {
    cursor: pointer;
    color: var(--ink);
    font-weight: 600;
}

.column-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.column-toggle-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}

.column-toggle-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.column-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.col-hidden {
    display: none !important;
}

.file-link-btn {
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    color: var(--brand);
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
}

.file-link-btn:hover {
    color: #0b5550;
}

.rejected-file-col {
    width: 230px;
    max-width: 230px;
}

.rejected-file-col .file-link-btn {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.class-lines {
    display: grid;
    gap: 4px;
}

.class-line {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: start;
    gap: 6px;
}

.class-line > .small.mono {
    white-space: nowrap;
    padding-top: 2px;
}

.class-line-value {
    display: grid;
    gap: 4px;
    min-width: 0;
    justify-items: start;
    align-content: start;
    grid-auto-flow: row;
}

.class-line-value > .badge {
    display: inline-flex;
    justify-self: start;
}

.qc-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.qc-actions-row form {
    margin: 0;
}

.transcript-text-col details,
.transcript-raw-col details {
    font-size: 12px;
    line-height: 1.35;
}

.transcript-text-col pre,
.transcript-raw-col pre {
    font-size: 11px;
}

.inline-media-block {
    display: grid;
    gap: 6px;
    max-width: 220px;
}

.inline-media-block .audio-player {
    width: 100%;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay[hidden] {
    display: none !important;
}

.modal-card {
    width: min(980px, 96vw);
    max-height: 92vh;
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 14px;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.file-card-section {
    margin-top: 12px;
}

.file-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
}

.file-card-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
    padding: 8px 10px;
}

.preprocess-compare-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.preprocess-compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.preprocess-summary-text {
    margin-top: 8px;
    color: #475569;
}

.preprocess-pipeline-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    padding: 10px;
    min-height: 132px;
}

.preprocess-pipeline-card.is-selected {
    border-color: #86efac;
    background: #f0fdf4;
}

.preprocess-pipeline-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.preprocess-pipeline-metrics {
    display: grid;
    gap: 6px;
}

.preprocess-pipeline-metrics > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.preprocess-pipeline-debug {
    margin-top: 8px;
    display: grid;
    gap: 4px;
}

.preprocess-pipeline-debug > div {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.preprocess-pipeline-debug .mono {
    font-size: 12px;
    text-align: right;
    word-break: break-word;
}

.preprocess-pipeline-empty {
    margin-top: 6px;
    color: #64748b;
}

.runtime-branch-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
    display: grid;
    gap: 10px;
}

.runtime-branch-section-head {
    display: grid;
    gap: 4px;
}

.runtime-branch-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.runtime-branch-summary > div,
.runtime-branch-metrics > div {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
    padding: 8px 10px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.runtime-branch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
}

.runtime-branch-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    padding: 10px;
    display: grid;
    gap: 8px;
}

.runtime-branch-card.is-selected {
    border-color: #86efac;
    background: #f0fdf4;
    box-shadow: 0 0 0 1px #bbf7d0 inset;
}

.runtime-branch-card.is-noise {
    background: #fffdf7;
}

.runtime-branch-card.is-error {
    background: #fef2f2;
    border-color: #fecaca;
}

.runtime-branch-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.runtime-branch-title-wrap {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.runtime-branch-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.runtime-branch-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.runtime-branch-details {
    margin-top: 2px;
}

.audio-rate-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.audio-rate-btn {
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
}

.audio-rate-btn.is-active {
    border-color: #0f766e;
    background: #ecfeff;
    color: #115e59;
    font-weight: 600;
}

.loudness-chart-wrap {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    padding: 8px;
    overflow: hidden;
}

.loudness-chart-wrap canvas {
    display: block;
    width: 100%;
    min-height: 180px;
    margin-bottom: 2px;
}

.file-card-section .loudness-chart-wrap canvas {
    min-height: 220px;
}

.loudness-inline {
    min-width: 220px;
    max-width: 280px;
}

.loudness-inline canvas {
    display: block;
    width: 100%;
    min-height: 64px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

body.modal-open {
    overflow: hidden;
}

.error {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: var(--danger);
    border-radius: 10px;
    padding: 10px;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.login-shell {
    max-width: 420px;
    margin: 8vh auto;
}

.footer {
    margin-top: auto;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    text-align: center;
}

.pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.chat-layout {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.chat-sidebar {
    display: grid;
    gap: 12px;
    align-self: start;
}

.chat-thread-list {
    display: grid;
    gap: 8px;
    max-height: 42vh;
    overflow: auto;
    padding-right: 2px;
}

.chat-thread-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 8px;
}

.chat-thread-item.active {
    border-color: #93c5fd;
    background: #eff6ff;
}

.chat-thread-link {
    display: grid;
    gap: 4px;
    text-decoration: none;
}

.chat-thread-title {
    color: var(--ink);
    font-weight: 600;
    line-height: 1.3;
}

.chat-thread-delete {
    display: flex;
    align-items: start;
}

.chat-thread-delete .btn {
    padding: 4px 9px;
    min-height: 30px;
}

.chat-memory-box {
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.chat-memory-form textarea {
    min-height: 140px;
}

.chat-main {
    display: grid;
    gap: 12px;
}

.chat-messages {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfdff;
    padding: 12px;
    max-height: 68vh;
    overflow: auto;
    display: grid;
    gap: 10px;
}

.chat-empty {
    color: var(--muted);
    text-align: center;
    padding: 30px 12px;
}

.chat-msg {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
}

.chat-msg.user {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.chat-msg.assistant {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.chat-msg.thinking {
    border-style: dashed;
}

.chat-msg.system {
    border-color: #fde68a;
    background: #fffbeb;
}

.chat-msg-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.chat-msg-body {
    white-space: pre-wrap;
    line-height: 1.45;
}

.chat-thinking-dots {
    display: inline-flex;
    gap: 3px;
    margin-left: 4px;
    vertical-align: middle;
}

.chat-thinking-dots span {
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: #166534;
    opacity: 0.25;
    animation: chat-dot-blink 1s infinite ease-in-out;
}

.chat-thinking-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-thinking-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chat-dot-blink {
    0%, 80%, 100% {
        opacity: 0.25;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-1px);
    }
}

.chat-input-form textarea {
    min-height: 90px;
}

.stream-player-wrap {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafc;
    padding: 10px;
}

.stream-player {
    width: 100%;
    min-height: 82px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0b1220;
}

.lab-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.lab-summary-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f9fbfc;
    padding: 12px;
}

.lab-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.lab-kpi,
.lab-matrix-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
    padding: 10px;
    display: grid;
    gap: 4px;
}

.lab-kpi strong,
.lab-matrix-item strong {
    font-size: 20px;
}

.lab-matrix-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.lab-delta-list {
    display: grid;
    gap: 8px;
}

.lab-param-section {
    margin-top: 12px;
}

.lab-param-section summary {
    cursor: pointer;
    font-weight: 600;
}

.lab-params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.lab-param-card {
    display: grid;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f9fbfc;
    padding: 12px;
}

.lab-param-label {
    font-weight: 600;
    color: var(--ink);
}

body.page-transcripts {
    overflow-x: hidden;
}

.page-transcripts .content {
    width: min(1520px, calc(100vw - 16px));
    margin: 12px auto 20px;
}

html[data-transcripts-preload-columns="1"] body.page-transcripts .transcripts-table-wrap,
html[data-transcripts-preload-columns="1"] body.page-transcripts .reject-transcripts-table-wrap {
    visibility: hidden;
}

.page-transcripts .transcripts-table-wrap,
.page-transcripts .reject-transcripts-table-wrap {
    max-width: 100%;
}

.page-transcripts .transcripts-table,
.page-transcripts .reject-transcripts-table {
    width: max-content;
    min-width: 100%;
}

.page-transcripts .transcripts-table th,
.page-transcripts .transcripts-table td,
.page-transcripts .reject-transcripts-table th,
.page-transcripts .reject-transcripts-table td {
    min-width: 0;
    font-size: 13px;
}

.page-transcripts .transcripts-table th,
.page-transcripts .reject-transcripts-table th {
    font-size: 11px;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.page-transcripts [data-col="filename"],
.page-transcripts [data-reject-col="filename"] {
    min-width: 180px;
    max-width: 220px;
    font-size: 11px;
}

.page-transcripts [data-col="classes"] {
    min-width: 190px;
    max-width: 220px;
}

.page-transcripts [data-col="diag"],
.page-transcripts [data-reject-col="status"] {
    min-width: 110px;
    max-width: 130px;
}

.page-transcripts [data-col="profile"],
.page-transcripts [data-reject-col="profile"] {
    min-width: 120px;
    max-width: 140px;
}

.profile-col {
    vertical-align: top;
}

.audio-gate-profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid #b7d8d3;
    background: linear-gradient(135deg, #effcf7 0%, #dff7ef 100%);
    color: #0f5f58;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0.02em;
    text-transform: none;
    white-space: normal;
    word-break: break-word;
}

.audio-gate-profile-badge-legacy {
    border-color: #d6dbe3;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
    color: #526071;
}

.audio-gate-profile-badge-empty {
    border-color: #e2e8f0;
    background: #f8fafc;
    color: #94a3b8;
}

.page-transcripts [data-col="qc"],
.page-transcripts [data-reject-col="qc"] {
    min-width: 196px;
    max-width: 220px;
}

.page-transcripts [data-col="text"],
.page-transcripts [data-col="raw"],
.page-transcripts [data-reject-col="reason"] {
    max-width: 250px;
}

.page-transcripts [data-col="audio"],
.page-transcripts [data-reject-col="audio_file"] {
    min-width: 130px;
    max-width: 160px;
}

.page-transcripts [data-col="processed"],
.page-transcripts [data-reject-col="created"] {
    min-width: 118px;
    max-width: 118px;
}

.compact-datetime {
    font-size: 10px;
    line-height: 1.3;
}

.page-transcripts td .btn,
.page-transcripts td button.btn {
    font-size: 11px;
    line-height: 1.2;
    padding: 6px 9px;
}

.loudness-inline-block {
    width: 280px;
    max-width: 100%;
}

.loudness-inline-meta {
    display: block;
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    margin-top: 6px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.control-stack {
    display: grid;
    gap: 6px;
}

.qc-status-row {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 6px;
}

.qc-status-row .js-qc-status {
    min-width: 0;
    flex: 1 1 auto;
    display: grid;
    gap: 3px;
}

.qc-status-expected {
    display: block;
}

.qc-status-result {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.qc-status-row .js-qc-clear-row form {
    margin: 0;
}

.qc-secondary-row {
    padding-top: 2px;
}

.qc-btn {
    min-width: 78px;
    justify-content: center;
}

.qc-btn-icon {
    min-width: 34px;
    width: 34px;
    padding-left: 0;
    padding-right: 0;
    font-size: 14px;
    font-weight: 700;
}

.qc-inline-clear {
    min-width: 24px;
    width: 24px;
    height: 24px;
    padding: 0;
    font-size: 13px;
    line-height: 1;
    border-radius: 999px;
}

.qc-btn-voice {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.qc-btn-noise {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.page-transcripts .column-controls {
    max-width: 100%;
}

.page-transcripts .column-toggle-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

@media (max-width: 1180px) {
    .topbar {
        flex-wrap: wrap;
        justify-content: center;
    }

    .topbar-brand {
        width: 100%;
        align-items: center;
    }

    .topbar-runtime-strip {
        justify-content: center;
        max-width: min(100%, 96vw);
    }

    .topnav {
        justify-content: center;
    }

    .topnav-item {
        position: static;
    }

    .topnav-menu {
        left: 50%;
        transform: translateX(-50%);
    }

    .userbar {
        width: 100%;
        justify-content: center;
    }

    .content {
        width: min(1200px, calc(100vw - 16px));
    }

    .page-transcripts .field {
        min-width: min(220px, 100%);
    }
}

@media (max-width: 900px) {
    .topbar {
        flex-wrap: wrap;
        justify-content: center;
    }

    .brand {
        font-size: 18px;
    }

    .topbar-runtime-pill {
        font-size: 10px;
        padding: 4px 7px;
    }

    .topbar-runtime-pill .runtime-tag {
        font-size: 9px;
    }

    .topnav {
        width: 100%;
    }

    .topnav-menu {
        min-width: min(220px, calc(100vw - 24px));
    }

    .content {
        width: min(1200px, 98vw);
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .chat-layout {
        grid-template-columns: 1fr;
    }

    .chat-thread-list {
        max-height: 30vh;
    }

    .chat-messages {
        max-height: 52vh;
    }

    .page-transcripts .content {
        width: calc(100vw - 12px);
        margin: 8px auto 16px;
    }

    .page-transcripts .card {
        padding: 12px;
    }

    .page-transcripts .field {
        min-width: 100%;
    }

    .page-transcripts .column-toggle-grid {
        grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    }
}
