:root {
    /* All interactive colors remapped to grayscale */
    --blue-700: #18181B;   /* near-black */
    --blue-600: #27272A;   /* zinc-800   */
    --blue-500: #52525B;   /* zinc-600   */
    --blue-100: #E4E4E7;   /* zinc-200   */
    --blue-50:  #FAFAFA;   /* zinc-50    */

    --slate-900: #0F172A;
    --slate-800: #1E293B;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748B;
    --slate-400: #94A3B8;
    --slate-300: #CBD5E1;
    --slate-200: #E2E8F0;
    --slate-100: #F1F5F9;
    --slate-50:  #F8FAFC;

    /* success → dark gray */
    --green-700: #18181B;
    --green-600: #27272A;
    --green-50:  #FAFAFA;
    --green-100: #E4E4E7;

    /* error → medium-dark gray */
    --red-700:  #3F3F46;
    --red-600:  #52525B;
    --red-100:  #F4F4F5;
    --red-50:   #FAFAFA;

    /* warning → medium gray */
    --amber-700: #3F3F46;
    --amber-600: #52525B;
    --amber-50:  #FAFAFA;
    --amber-100: #F4F4F5;

    /* accent → medium gray */
    --purple-700: #3F3F46;
    --purple-600: #52525B;
    --purple-50:  #FAFAFA;
    --purple-100: #F4F4F5;

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.12);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    background: #FFFFFF;
    min-height: 100vh;
    color: var(--slate-700);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 28px 120px;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 0 18px;
    margin-bottom: 28px;
}

.header-icon {
    width: 36px;
    height: 36px;
    background: var(--slate-900);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.header-text h1 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--slate-900);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.subtitle {
    font-size: 12px;
    color: var(--slate-400);
    margin-top: 2px;
}

/* ── Card / Section ──────────────────────────────────────────────────────── */
.jobs-section {
    background: #FFFFFF;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 16px;
}

/* ── Shared with me section ──────────────────────────────────────────────── */
.shared-with-me-section {
    margin-bottom: 80px;
}

.shared-with-me-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 0 10px;
    border-top: 2px solid var(--slate-200);
}

.shared-with-me-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.shared-with-me-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--slate-200);
    color: var(--slate-600);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.shared-owner-label {
    color: var(--slate-400);
    font-style: italic;
}

.role-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.role-badge-view {
    background: var(--slate-100);
    color: var(--slate-600);
    border: 1px solid var(--slate-200);
}

.role-badge-edit {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* ── Two-column main layout ──────────────────────────────────────────────── */
.main-layout {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.sidebar-panel {
    flex: 0 0 260px;
    width: 260px;
    position: sticky;
    top: 16px;
}

.jobs-panel {
    flex: 1;
    min-width: 0;
}

/* ── Calendar ────────────────────────────────────────────────────────────── */
.calendar-section {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 12px 12px 10px;
    margin-bottom: 10px;
}

.calendar-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.calendar-month-label {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--slate-800);
    text-align: center;
    white-space: nowrap;
}

.calendar-header-row2 {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.calendar-nav-btn {
    background: none;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    color: var(--slate-600);
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    transition: background .15s, border-color .15s;
}
.calendar-nav-btn:hover {
    background: var(--slate-100);
    border-color: var(--slate-300);
}

.calendar-grid-wrap {
    user-select: none;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 3px;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 9px;
    font-weight: 600;
    color: var(--slate-400);
    padding: 1px 0;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-day {
    border-radius: 3px;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: opacity .12s, transform .1s;
}

.cal-day-has-records {
    cursor: pointer;
    color: #fff;
}
.cal-day-has-records:hover {
    opacity: .80;
    transform: scale(1.1);
}

.cal-day-empty-count {
    background: var(--slate-100);
    color: var(--slate-400);
}

.cal-day-empty {
    background: transparent;
}

.cal-day-today .cal-day-num {
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 1px;
}

.cal-day-active {
    outline: 2px solid var(--slate-900);
    outline-offset: 1px;
}

.cal-day-num {
    font-size: 10px;
    line-height: 1;
}

.cal-day-count {
    font-size: 8px;
    line-height: 1;
    margin-top: 1px;
    opacity: .85;
}

/* ── Tag cloud (below calendar in sidebar) ───────────────────────────────── */
.tag-cloud-section {
    padding: 10px 12px;
    background: #fff;
    border-radius: var(--radius-lg);
    margin-bottom: 4px;
}

.tag-cloud-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

/* Stylish "show more" chevron — right-aligned, no line */
.tag-cloud-expand-btn {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    padding: 4px 0 2px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--slate-300);
    transition: color .2s;
}
.tag-cloud-expand-btn:hover {
    color: var(--slate-500);
}

/* ── Audio duration badge in job card ────────────────────────────────────── */
.job-audio-duration {
    display: inline-flex;
    align-items: center;
    background: var(--slate-100);
    color: var(--slate-500);
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: .01em;
}

/* ── Responsive: stack on narrow screens ─────────────────────────────────── */
@media (max-width: 700px) {
    .main-layout {
        flex-direction: column;
    }
    .sidebar-panel {
        width: 100%;
        flex: none;
        position: static;
    }
    /* Calendar grid visible by default; collapsed when user clicks the toggle */
    .calendar-grid-wrap.cal-collapsed {
        display: none;
    }
    /* Show the toggle button only on mobile */
    .calendar-grid-toggle {
        display: flex !important;
    }
}

/* Toggle button: hidden on desktop, shown on mobile via the rule above */
.calendar-grid-toggle {
    display: none;
    margin-left: auto;
    font-size: 13px;
    transition: transform .2s;
}
/* Rotate button when grid is collapsed (arrow points right = "expand") */
.calendar-grid-toggle.cal-collapsed {
    transform: rotate(-90deg);
}

h2 {
    color: var(--slate-900);
    margin-bottom: 16px;
    font-size: .9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--slate-500);
}

/* ── Section Tabs (Upload / Record) ─────────────────────────────────────── */
.section-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--slate-200);
}

.section-tab {
    padding: 9px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--slate-500);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s, border-color .15s;
    font-family: inherit;
}

.section-tab.active,
.section-tab:hover { color: var(--blue-600); border-bottom-color: var(--blue-600); }

.section-tab-content { display: none; }
.section-tab-content.active { display: block; }

/* ── Form ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 15px; }

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--slate-700);
    font-size: 13px;
}

input[type="text"],
input[type="email"],
textarea,
select.model-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13px;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
    color: var(--slate-900);
}

input[type="text"]:focus,
textarea:focus,
select.model-select:focus {
    outline: none;
    border-color: var(--slate-500);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

textarea { resize: vertical; }

.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--slate-600);
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--blue-600);
    flex-shrink: 0;
}

/* Collapsible */
.collapsible {
    margin-bottom: 15px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    background: var(--slate-50);
}

.collapsible summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--blue-600);
    font-weight: 500;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.collapsible summary::before {
    content: '›';
    font-size: 16px;
    transition: transform .15s;
    display: inline-block;
    line-height: 1;
}

details[open] .collapsible summary::before,
.collapsible[open] > summary::before { transform: rotate(90deg); }
.collapsible summary::-webkit-details-marker { display: none; }

/* ── File Drop Zone ──────────────────────────────────────────────────────── */
.file-input-wrapper {
    margin-bottom: 18px;
    border: 2px dashed var(--slate-300);
    border-radius: var(--radius-lg);
    background: var(--slate-50);
    transition: border-color .2s, background .2s;
    cursor: pointer;
}

.file-input-wrapper:hover,
.file-input-wrapper.dragover {
    border-color: var(--blue-500);
    background: var(--blue-50);
}

.file-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    text-align: left;
    gap: 12px;
    width: 100%;
}

.file-label-icon {
    font-size: 20px;
    opacity: .7;
    flex-shrink: 0;
}

.file-label-text { display: flex; flex-direction: column; gap: 2px; }

.file-label .file-label-text span:not(.file-label-hint) {
    font-size: 13px;
    font-weight: 500;
    color: var(--slate-700);
}

.file-label-hint {
    font-size: 12px;
    color: var(--slate-400);
}

.file-label input[type="file"] { display: none; }

.file-list { padding: 0 14px 12px; }

.file-item {
    background: #fff;
    border: 1px solid var(--slate-200);
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    gap: 12px;
}

.file-item-name {
    font-weight: 500;
    color: var(--slate-700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.file-item-remove {
    color: var(--slate-400);
    cursor: pointer;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    transition: color .15s, background .15s;
    flex-shrink: 0;
    font-size: 12px;
}

.file-item-remove:hover {
    color: var(--red-600);
    background: var(--red-50);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all .15s;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.4;
}

.btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.btn-primary {
    background: var(--blue-600);
    color: #fff;
    width: 100%;
    padding: 10px 18px;
    font-size: 14px;
}
.btn-primary:hover:not(:disabled) {
    background: var(--blue-700);
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--slate-100);
    color: var(--slate-700);
    border: 1px solid var(--slate-200);
}
.btn-secondary:hover { background: var(--slate-200); }

.btn-danger {
    background: var(--red-50);
    color: var(--red-600);
    border: 1px solid var(--red-100);
}
.btn-danger:hover { background: var(--red-100); }

.btn-success { background: var(--green-600); color: #fff; }
.btn-success:hover { background: var(--green-700); }

.btn-warning {
    background: var(--amber-50);
    color: var(--amber-700);
    border: 1px solid var(--amber-100);
}
.btn-warning:hover { background: var(--amber-100); }

.btn-record { background: var(--red-600); color: #fff; }
.btn-record:hover:not(:disabled) { background: var(--red-700); }

.btn-stop { background: var(--slate-700); color: #fff; }
.btn-stop:hover:not(:disabled) { background: var(--slate-900); }

.btn-small { padding: 5px 11px; font-size: 12px; width: auto; border-radius: var(--radius-sm); }

/* ── Recording UI ────────────────────────────────────────────────────────── */
.record-tab-warning {
    background: var(--amber-50);
    border: 1px solid var(--amber-100);
    color: #92400E;
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
    display: none;
}

.record-interface { display: flex; flex-direction: column; gap: 18px; }

.record-visualizer {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 110px;
}

.record-waveform { width: 100%; display: flex; align-items: center; justify-content: center; }

.waveform-idle, .waveform-done {
    font-size: 13px;
    color: var(--slate-400);
    text-align: center;
}

.waveform-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    height: 48px;
}

.waveform-bars span {
    display: inline-block;
    width: 3px;
    background: var(--blue-600);
    border-radius: 2px;
    min-height: 4px;
    transition: height .1s ease;
}

.record-timer {
    font-size: 2rem;
    font-weight: 700;
    color: var(--slate-900);
    letter-spacing: .08em;
    font-variant-numeric: tabular-nums;
}

.record-controls { display: flex; gap: 10px; flex-wrap: wrap; }
.record-controls .btn { flex: 1; }

.recorded-audio-preview { margin-bottom: 16px; }
.recorded-audio-preview audio { width: 100%; border-radius: var(--radius-md); }

/* ── Section Header ──────────────────────────────────────────────────────── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

/* ── Tag Cloud ───────────────────────────────────────────────────────────── */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 2px 0;
    transition: max-height 0.3s ease;
}

.cloud-tag {
    cursor: pointer;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,.08);
    background: var(--slate-50);
    transition: background .15s, opacity .15s;
    user-select: none;
    font-size: 12px;
    white-space: nowrap;
}

.cloud-tag:hover { opacity: .75; background: var(--slate-100); }
.cloud-tag.active { background: var(--slate-200); font-weight: 700; }

/* ── Job Table ───────────────────────────────────────────────────────────── */
.jobs-container { }

.no-jobs {
    text-align: center;
    color: var(--slate-400);
    padding: 48px 24px;
    font-size: 13px;
    background: var(--slate-50);
    border-radius: 0;
    border: none;
}

.no-jobs-project {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 64px 24px;
    background: var(--slate-50);
}
.no-jobs-text {
    font-size: 15px;
    color: var(--slate-500);
}
.no-jobs-record-btn {
    font-size: 48px;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    opacity: .7;
    transition: opacity .15s, transform .15s;
    padding: 0;
}
.no-jobs-record-btn:hover {
    opacity: 1;
    transform: scale(1.12);
}

.job-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.job-table thead th {
    padding: 6px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--slate-400);
    border-bottom: 1px solid var(--slate-200);
    white-space: nowrap;
}

.job-row {
    border-bottom: 1px solid var(--slate-100);
    transition: background .1s;
}

.job-row:last-child { border-bottom: none; }
.job-row:hover { background: var(--slate-50); }
.job-row-clickable { cursor: pointer; }
.job-row-clickable:hover { background: var(--slate-50); }

.job-row td {
    padding: 9px 12px;
    vertical-align: middle;
}

/* Left color bar per status */
.job-status-indicator { width: 3px; padding: 0 !important; }
.job-row.status-ind-active      .job-status-indicator { background: var(--blue-500); }
.job-row.status-ind-waiting     .job-status-indicator { background: var(--amber-600); }
.job-row.status-ind-summarizing .job-status-indicator { background: var(--slate-400); }
.job-row.status-ind-completed   .job-status-indicator { background: var(--green-600); }
.job-row.status-ind-failed      .job-status-indicator { background: var(--red-600); }
.job-row.status-ind-cancelled   .job-status-indicator { background: var(--slate-300); }

.job-row-name {
    font-weight: 600;
    color: var(--slate-900);
    font-size: 13px;
    margin-bottom: 2px;
    white-space: normal;
    overflow: visible;
    word-break: break-word;
}

.job-row-file {
    font-size: 11px;
    color: var(--slate-400);
    margin-bottom: 4px;
}

.job-row-error {
    font-size: 12px;
    color: var(--red-600);
    margin-top: 3px;
}

.job-duration-info {
    color: var(--slate-400);
    font-style: italic;
}

.modal-error-banner {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: 8px;
    color: var(--red-600);
    font-size: 13px;
    padding: 8px 14px;
    margin: 8px 16px 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.modal-error-banner::before {
    content: '⚠';
    flex-shrink: 0;
}

.job-row-model-cell { white-space: nowrap; }
.job-row-status-cell { white-space: nowrap; }
.job-row-actions-cell { white-space: nowrap; }

.job-processing-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 2px;
}

.job-processing-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--slate-500);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.job-progress-inline {
    flex: 1;
    max-width: 160px;
    margin: 0;
}

.job-progress-pct {
    font-size: 10px;
    font-weight: 600;
    color: var(--slate-400);
    white-space: nowrap;
    min-width: 28px;
    text-align: right;
}

/* legacy aliases kept for JS compatibility */
.status-border-active   {}
.status-border-waiting  {}
.status-border-completed {}
.status-border-failed   {}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 12px;
}

.job-info { flex: 1; min-width: 0; }
.job-info h3 { font-size: 14px; color: var(--slate-900); margin-bottom: 3px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-meta { font-size: 11px; color: var(--slate-400); margin-bottom: 6px; }
.job-tags { display: flex; flex-wrap: wrap; gap: 5px; }

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--blue-50);
    color: var(--blue-600);
    border: 1px solid var(--blue-100);
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}

.tag-chip:hover { background: var(--blue-100); }
.tag-chip.removable { padding-right: 5px; }
.tag-remove { cursor: pointer; color: var(--slate-400); font-size: 10px; margin-left: 2px; }
.tag-remove:hover { color: var(--red-600); }

.job-status {
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: .04em;
    flex-shrink: 0;
}

.status-waiting     { background: var(--amber-50);  color: var(--amber-700); }
.status-active      { background: var(--blue-50);   color: var(--blue-700); }
.status-summarizing { background: var(--slate-100); color: var(--slate-600); }
.status-completed   { background: var(--green-50);  color: var(--green-700); }
.status-failed      { background: var(--red-50);    color: var(--red-700); }

.summarizing-placeholder {
    color: var(--slate-400);
    font-style: italic;
    font-size: 13px;
    padding: 8px 0;
}

.badge { padding: 2px 7px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-audio { background: var(--purple-100); color: var(--purple-700); }

.progress-bar {
    width: 100%;
    height: 3px;
    background: var(--slate-100);
    border-radius: 10px;
    overflow: hidden;
    margin: 8px 0 3px;
}

.progress-fill {
    height: 100%;
    background: var(--blue-600);
    border-radius: 10px;
    transition: width .4s ease;
}

.progress-label { font-size: 11px; color: var(--slate-400); text-align: right; margin-bottom: 4px; }

/* ─── Toast notifications ────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 9000;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--slate-900);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,.22);
    pointer-events: all;
    animation: toast-in .25s ease, toast-out .3s ease 5.7s forwards;
    max-width: 420px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-btn {
    background: var(--blue-500);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.toast-btn:hover { background: var(--blue-600); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
    from { opacity: 1; }
    to   { opacity: 0; transform: translateY(8px); }
}

.error-message {
    background: var(--red-50);
    color: var(--red-700);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    margin-top: 8px;
    font-size: 12px;
    border: 1px solid var(--red-100);
}

.job-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.job-actions .btn { padding: 5px 11px; font-size: 12px; width: auto; }

.retranscribe-inline { display: flex; align-items: center; gap: 6px; }
.model-select-inline { width: auto; padding: 5px 10px; font-size: 12px; }

.model-badge {
    display: inline-block;
    background: var(--purple-100);
    color: var(--purple-700);
    border-radius: var(--radius-xs);
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 500;
}

/* ── Full-page Result View ───────────────────────────────────────────────── */
.modal {
    display: none; /* JS sets to flex */
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #fff;
    overflow: hidden;
    flex-direction: column;
    animation: pageIn .18s ease;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: none; }
}

/* keep for other places that may reference these */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn {
    from { transform: translateY(-16px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #fff;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--slate-200);
    background: #fff;
    flex-shrink: 0;
    box-shadow: 0 1px 0 var(--slate-100);
}

.modal-title-row {
    flex: 1;
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.modal-title-input {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    color: var(--slate-900);
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}

.modal-title-input:focus {
    outline: none;
    border-color: var(--slate-500);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.modal-close {
    background: var(--slate-100);
    border: none;
    font-size: 15px;
    color: var(--slate-500);
    cursor: pointer;
    line-height: 1;
    padding: 7px 10px;
    border-radius: var(--radius-md);
    transition: color .15s, background .15s;
    flex-shrink: 0;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 5px;
}

.modal-close:hover { background: var(--slate-200); color: var(--slate-900); }

/* Full-width video player bar (shown when source was a video) */
.result-video-bar {
    flex-shrink: 0;
    border-bottom: 1px solid var(--slate-200);
    background: #000;
    display: flex;
    justify-content: center;
    max-height: 340px;
}

.result-video-bar video {
    width: 100%;
    max-height: 340px;
    object-fit: contain;
    display: block;
}

/* Full-width player bar (between header and columns) */
.result-player-bar {
    display: none; /* shown by JS when audio exists */
    flex-shrink: 0;
    border-bottom: 1px solid var(--slate-200);
    background: #fff;
    padding: 10px 20px;
    align-items: center;
}

.result-player-bar > audio { display: none; }

.result-player-bar .custom-player { gap: 14px; flex: 1; min-width: 0; }

/* Two-column result layout */
.result-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

.result-sidebar {
    width: 288px;
    flex-shrink: 0;
    border-right: 1px solid var(--slate-200);
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--slate-50);
}

.result-main {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Sidebar resize handle */
.sidebar-resize-handle {
    width: 4px;
    flex-shrink: 0;
    cursor: col-resize;
    background: transparent;
    border-right: 1px solid var(--slate-200);
    transition: background .15s;
    position: relative;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.resizing {
    background: var(--slate-300);
}

/* Sidebar collapse button */
.sidebar-collapse-btn {
    position: absolute;
    top: 50%;
    right: -12px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--slate-200);
    color: var(--slate-400);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: var(--shadow-xs);
    transition: color .15s, background .15s, border-color .15s;
    opacity: 0;
    pointer-events: none;
}

.sidebar-resize-handle:hover .sidebar-collapse-btn,
.sidebar-collapse-btn:hover,
.result-layout.sidebar-collapsed .sidebar-collapse-btn {
    opacity: 1;
    pointer-events: all;
}

.sidebar-collapse-btn:hover {
    color: var(--slate-700);
    background: var(--slate-100);
    border-color: var(--slate-300);
}

/* Collapsed sidebar state */
.result-layout.sidebar-collapsed .result-sidebar {
    width: 0 !important;
    padding: 0;
    overflow: hidden;
    border-right: none;
    opacity: 0;
    pointer-events: none;
}

.result-layout.sidebar-collapsed .sidebar-resize-handle {
    cursor: pointer;
    width: 12px;
    border-right: none;
}

.result-layout.sidebar-collapsed .sidebar-collapse-btn {
    right: -6px;
}

.result-sidebar {
    transition: width .2s ease, padding .2s ease, opacity .15s ease;
}

.sidebar-section {}

.sidebar-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--slate-400);
    margin-bottom: 10px;
}

.sidebar-section-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--slate-400);
    padding: 0 2px;
    line-height: 1;
    transition: color .15s;
}
.sidebar-section-toggle:hover { color: var(--slate-700); }

.modal-body {
    padding: 0;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Tags editor */
.tags-editor {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 18px;
}

.modal-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 24px;
    margin-bottom: 10px;
}

.tag-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.tag-input-inline {
    flex: 1;
    min-width: 140px;
    padding: 6px 10px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: inherit;
    color: var(--slate-900);
    transition: border-color .15s, box-shadow .15s;
}

.tag-input-inline:focus {
    outline: none;
    border-color: var(--slate-500);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

/* ── Audio Player — light theme ─────────────────────────────────────────── */
.audio-player-section {
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}

.custom-player {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-btn {
    background: var(--blue-600);
    border: none;
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, box-shadow .15s;
    box-shadow: 0 2px 6px rgba(37,99,235,0.25);
}

.player-btn:hover { background: var(--blue-700); }

.player-btn-sm {
    width: 32px;
    height: 32px;
    font-size: 13px;
    background: var(--slate-200);
    color: var(--slate-600);
    box-shadow: none;
}

.player-btn-sm:hover { background: var(--slate-300); color: var(--slate-900); }

.player-time-text {
    color: var(--slate-500);
    font-size: 12px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    min-width: 36px;
}

.player-timeline-wrap { flex: 1; padding: 12px 0; cursor: pointer; }

.player-timeline {
    position: relative;
    height: 4px;
    background: var(--slate-200);
    border-radius: 4px;
    cursor: pointer;
    overflow: visible;
    transition: height .1s;
}

.player-timeline-wrap:hover .player-timeline { height: 6px; margin-top: -1px; }

.player-progress {
    height: 100%;
    background: var(--blue-600);
    border-radius: 4px;
    pointer-events: none;
    transition: width .1s linear;
}

.chapter-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: #F59E0B;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    transition: transform .15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.chapter-marker:hover { transform: translate(-50%, -50%) scale(1.5); }

.chapter-marker::after {
    content: attr(title);
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--slate-900);
    color: #fff;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
    max-width: 200px;
    text-overflow: ellipsis;
    overflow: hidden;
}

.chapter-marker:hover::after { opacity: 1; }

/* ── Result Tabs ─────────────────────────────────────────────────────────── */
.result-tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--slate-200);
    margin-bottom: 16px;
}

.result-tab-btn {
    padding: 8px 18px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--slate-500);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s, border-color .15s;
    font-family: inherit;
}

.result-tab-btn.active,
.result-tab-btn:hover { color: var(--blue-600); border-bottom-color: var(--blue-600); }

/* Custom view tab buttons */
.result-tab-btn[data-custom-view] {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-right: 6px;
}

.custom-view-tab-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-view-tab-rename,
.custom-view-tab-close {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 2px;
    font-size: 11px;
    line-height: 1;
    color: var(--slate-400);
    border-radius: 3px;
}
.result-tab-btn[data-custom-view]:hover .custom-view-tab-rename,
.result-tab-btn[data-custom-view]:hover .custom-view-tab-close { display: inline-flex; }
.custom-view-tab-rename:hover { color: var(--blue-600); }
.custom-view-tab-close:hover { color: var(--red-500, #ef4444); }

/* + add view button */
.result-tab-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px dashed var(--slate-300);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    font-weight: 400;
    color: var(--slate-400);
    margin: auto 4px;
    transition: color .15s, border-color .15s, background .15s;
    flex-shrink: 0;
}
.result-tab-add-btn:hover {
    color: var(--blue-600);
    border-color: var(--blue-600);
    background: var(--blue-50, #eff6ff);
}

/* Inline new-tab name input */
.custom-view-new-tab-input {
    height: 28px;
    padding: 2px 8px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--blue-400, #60a5fa);
    border-radius: 6px;
    outline: none;
    min-width: 120px;
    max-width: 200px;
    align-self: center;
    margin: auto 4px;
    color: var(--slate-700);
    background: var(--white, #fff);
}

/* Tab rename inline input */
.custom-view-tab-rename-input {
    width: 90px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--blue-400, #60a5fa);
    border-radius: 4px;
    padding: 1px 4px;
    outline: none;
    color: var(--slate-700);
    background: var(--white, #fff);
}

.result-pane { display: none; }
.result-pane.active { display: block; }

/* ── Custom View Pane ────────────────────────────────────────────────────── */
.custom-view-pane {
    display: none;
}
.custom-view-pane.active {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.custom-view-generate-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    padding: 14px 16px;
}

.custom-view-prompt-row textarea.custom-view-prompt-input {
    width: 100%;
    resize: vertical;
    min-height: 72px;
    border: 1px solid var(--slate-300);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--slate-700);
    background: var(--white, #fff);
    transition: border-color .15s;
    box-sizing: border-box;
}
.custom-view-prompt-input:focus {
    outline: none;
    border-color: var(--blue-500, #3b82f6);
}
.custom-view-prompt-input:disabled {
    background: var(--slate-100);
    color: var(--slate-400);
}

.custom-view-model-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-view-loader.loader {
    margin: 8px 0;
}

.custom-view-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 10px 14px;
    color: #b91c1c;
    font-size: 13px;
}

.custom-view-content.markdown-body {
    padding: 0;
    min-height: 40px;
}

/* ── Transcription Content ───────────────────────────────────────────────── */
.result-actions { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }

.transcription-content {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    padding: 16px;
    border-radius: var(--radius-md);
    word-wrap: break-word;
    color: var(--slate-700);
}

.transcription-edit-area {
    width: 100%;
    min-height: 320px;
    padding: 16px;
    border: 1.5px solid var(--slate-400);
    border-radius: var(--radius-md);
    font-family: 'SFMono-Regular', 'Consolas', 'Menlo', monospace;
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--slate-900);
    background: #fff;
    resize: vertical;
    display: none;
}

.transcription-edit-area:focus {
    outline: none;
    border-color: var(--slate-600);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.edit-unsaved-badge {
    font-size: 11px;
    color: var(--slate-500);
    font-style: italic;
    margin-left: 4px;
}

/* ── Chapters List ───────────────────────────────────────────────────────── */
.chapters-list { display: flex; flex-direction: column; gap: 6px; }

.no-chapters { color: var(--slate-400); font-style: italic; padding: 20px 0; font-size: 13px; }

.chapter-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.chapter-item:hover {
    background: var(--blue-50);
    border-color: var(--blue-100);
}

.chapter-time {
    font-variant-numeric: tabular-nums;
    font-size: 11px;
    font-weight: 700;
    color: var(--blue-600);
    min-width: 48px;
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    border-radius: var(--radius-xs);
    padding: 2px 6px;
    text-align: center;
}

.chapter-title { flex: 1; font-size: 13px; color: var(--slate-700); }
.chapter-duration { font-size: 11px; color: var(--slate-400); white-space: nowrap; }

/* ── Summary ─────────────────────────────────────────────────────────────── */
.summary-content {
    line-height: 1.75;
    font-size: 14px;
    color: var(--slate-700);
    min-height: 40px;
    padding: 4px 2px;
}

.summary-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 4px;
}

.metric-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--slate-100);
    color: var(--slate-600);
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 99px;
    border: 1px solid var(--slate-200);
}
.metric-chip strong { color: var(--slate-800); font-weight: 600; }

.summary-generate-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--slate-200);
}

.summary-model-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-model-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--slate-600);
    white-space: nowrap;
}

.summary-prompt-collapsible { margin-bottom: 0; }

/* ── Retranscribe ────────────────────────────────────────────────────────── */
.retranscribe-section {
    margin-top: 20px;
    border-top: 1px solid var(--slate-200);
    padding-top: 16px;
}

.retranscribe-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.retranscribe-section-title { font-weight: 600; font-size: 13px; color: var(--slate-700); }
.retranscribe-no-audio { font-size: 12px; color: var(--slate-400); }

.retranscribe-controls { display: flex; flex-direction: column; gap: 10px; }

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

.retranscribe-model-group { flex: 1; min-width: 220px; margin-bottom: 0; }
.retranscribe-model-group label { margin-bottom: 4px; }
.retranscribe-prompt-collapsible { margin-bottom: 0; }
.retranscribe-prompt-collapsible textarea { resize: vertical; min-height: 60px; }
.retranscribe-warning { font-size: 11px; color: var(--slate-400); margin: 0; }

/* ── Version History ─────────────────────────────────────────────────────── */
.versions-list { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }

.version-card {
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.version-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    background: var(--slate-50);
    border-bottom: 1px solid var(--slate-200);
    flex-wrap: wrap;
}

.version-card-label { font-weight: 600; font-size: 13px; color: var(--slate-700); }
.version-card-meta { font-size: 12px; color: var(--slate-400); flex: 1; }
.version-card-body { padding: 12px 14px; display: none; }
.version-card-body.open { display: block; }

.version-transcription {
    font-size: 12.5px;
    line-height: 1.65;
    white-space: pre-wrap;
    color: var(--slate-700);
    max-height: 280px;
    overflow-y: auto;
}

.version-prompt-note {
    font-size: 12px;
    color: var(--slate-400);
    font-style: italic;
    margin-bottom: 8px;
}

.summary-prompt-collapsible textarea { resize: vertical; min-height: 64px; }

.summary-version-preview {
    font-size: 13px;
    line-height: 1.6;
    color: var(--slate-600);
    white-space: pre-wrap;
    margin-bottom: 8px;
}

.summary-version-full { margin-top: 8px; }

/* ── Summary conversation history ───────────────────────────────────────── */
.summary-history {
    margin-top: 20px;
    border-top: 1px solid var(--slate-200);
    padding-top: 16px;
}

.summary-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.summary-history-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.summary-history-toggle {
    background: none;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    font-size: 12px;
    color: var(--blue-600);
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
}

.summary-history-toggle:hover { background: var(--blue-50); }

.summary-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Version history list has no height cap — full summary content must be readable */
.summary-version-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
}

.history-revision {
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.history-revision-label {
    background: var(--slate-50);
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--blue-600);
    border-bottom: 1px solid var(--slate-200);
}

.history-bubble {
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.6;
}

.history-bubble-user {
    background: var(--blue-50);
    border-bottom: 1px solid var(--blue-100);
}

.history-bubble-assistant { background: #fff; }

.history-bubble-role {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--slate-400);
    margin-bottom: 5px;
}

.history-bubble-user .history-bubble-role { color: var(--blue-600); }
.history-bubble-assistant .history-bubble-role { color: var(--purple-600); }

.history-bubble-user p { color: var(--slate-700); margin: 0 0 4px; }
.history-bubble-ts { font-size: 11px; color: var(--slate-400); }

.history-bubble-preview {
    color: var(--slate-600);
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.history-expand-btn {
    background: none;
    border: none;
    color: var(--blue-600);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 0 2px;
    display: block;
    font-family: inherit;
}

.history-expand-btn:hover { text-decoration: underline; }

.history-bubble-full {
    margin-top: 8px;
    border-top: 1px dashed var(--slate-200);
    padding-top: 8px;
    font-size: 13px;
}

/* ── EasyMDE (WYSIWYG markdown editor) ──────────────────────────────────── */
#summaryEditorContainer {
    margin-bottom: 4px;
}

#summaryEditArea {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    border: 1.5px solid var(--slate-400);
    border-radius: var(--radius-md);
    font-family: 'SFMono-Regular', 'Consolas', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.8;
    color: var(--slate-900);
    background: #fff;
    resize: vertical;
    box-sizing: border-box;
}

#summaryEditArea:focus {
    outline: none;
    border-color: var(--slate-600);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.summary-edit-preview {
    min-height: 200px;
    padding: 16px;
    border: 1.5px solid var(--slate-300);
    border-radius: var(--radius-md);
    background: var(--slate-50);
    box-sizing: border-box;
    overflow-y: auto;
}

.EasyMDEContainer {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1.5px solid var(--slate-400);
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}

.EasyMDEContainer:focus-within {
    border-color: var(--slate-600);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

/* Toolbar */
.editor-toolbar {
    background: var(--slate-50);
    border-bottom: 1px solid var(--slate-200);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 4px 6px;
    opacity: 1;
}

.editor-toolbar button {
    color: var(--slate-600) !important;
    border-radius: var(--radius-sm) !important;
    width: 28px;
    height: 28px;
    font-size: 13px;
    transition: background .12s, color .12s;
}

.editor-toolbar button:hover,
.editor-toolbar button.active {
    background: var(--slate-200) !important;
    color: var(--slate-900) !important;
    border-color: transparent !important;
}

.editor-toolbar i.separator {
    border-left: 1px solid var(--slate-200);
    margin: 0 3px;
}

.editor-toolbar.fullscreen {
    background: var(--slate-50);
    z-index: 9999;
}

/* CodeMirror (source editor) */
.CodeMirror {
    font-family: 'SFMono-Regular', 'Consolas', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.8;
    color: var(--slate-900);
    background: #fff;
    border: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.CodeMirror-scroll {
    padding: 8px 14px;
}

/* Preview pane */
.editor-preview,
.editor-preview-side {
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.75;
    color: var(--slate-700);
    padding: 16px 20px;
    border-left: 1px solid var(--slate-200);
}

/* Reuse markdown-body styles inside the preview */
.editor-preview h1,
.editor-preview-side h1 { font-size: 1.35rem; font-weight: 700; color: var(--slate-900); margin: 0 0 12px; border-bottom: 1px solid var(--slate-200); padding-bottom: 8px; }
.editor-preview h2,
.editor-preview-side h2 { font-size: 1.05rem; font-weight: 600; color: var(--slate-800); margin: 18px 0 8px; }
.editor-preview h3,
.editor-preview-side h3 { font-size: .9rem; font-weight: 600; color: var(--slate-700); margin: 14px 0 6px; }
.editor-preview p,
.editor-preview-side p { margin: 0 0 10px; }
.editor-preview ul,
.editor-preview ol,
.editor-preview-side ul,
.editor-preview-side ol { padding-left: 22px; margin: 0 0 12px; }
.editor-preview li,
.editor-preview-side li { margin-bottom: 4px; }
.editor-preview strong,
.editor-preview-side strong { font-weight: 700; color: var(--slate-900); }
.editor-preview code,
.editor-preview-side code { background: var(--slate-100); border-radius: var(--radius-xs); padding: 1px 5px; font-family: 'SFMono-Regular', 'Consolas', monospace; font-size: 12px; }
.editor-preview pre,
.editor-preview-side pre { background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius-md); padding: 14px; overflow-x: auto; margin: 0 0 14px; }
.editor-preview blockquote,
.editor-preview-side blockquote { border-left: 3px solid var(--blue-500); margin: 0 0 12px; padding: 6px 14px; color: var(--slate-600); background: var(--blue-50); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.editor-preview hr,
.editor-preview-side hr { border: none; border-top: 1px solid var(--slate-200); margin: 16px 0; }

/* Side-by-side layout separator */
.editor-preview-side { border-left: 1px solid var(--slate-200); }

/* Fullscreen */
.CodeMirror-fullscreen,
.editor-preview-active-side,
.editor-toolbar.fullscreen {
    z-index: 9999;
}

/* ── Markdown body ───────────────────────────────────────────────────────── */
.markdown-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
}

.markdown-body h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--slate-900);
    margin: 0 0 12px;
    border-bottom: 1px solid var(--slate-200);
    padding-bottom: 8px;
}

.markdown-body h2 { font-size: 1.05rem; font-weight: 600; color: var(--slate-800); margin: 18px 0 8px; }
.markdown-body h3 { font-size: .9rem; font-weight: 600; color: var(--slate-700); margin: 14px 0 6px; }

.markdown-body p { margin: 0 0 10px; }

.markdown-body ul,
.markdown-body ol { padding-left: 22px; margin: 0 0 12px; }
.markdown-body li { margin-bottom: 4px; }

.markdown-body strong { font-weight: 700; color: var(--slate-900); }
.markdown-body em { font-style: italic; }

.markdown-body code {
    background: var(--slate-100);
    border-radius: var(--radius-xs);
    padding: 1px 5px;
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    font-size: 12px;
    color: var(--purple-700);
}

.markdown-body pre {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 14px;
    overflow-x: auto;
    margin: 0 0 14px;
}

.markdown-body pre code { background: none; padding: 0; color: var(--slate-700); font-size: 13px; }

.markdown-body blockquote {
    border-left: 3px solid var(--blue-500);
    margin: 0 0 12px;
    padding: 6px 14px;
    color: var(--slate-600);
    background: var(--blue-50);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.markdown-body hr { border: none; border-top: 1px solid var(--slate-200); margin: 16px 0; }

.markdown-body table { border-collapse: collapse; width: 100%; margin: 0 0 14px; font-size: 13px; }

.markdown-body th,
.markdown-body td { border: 1px solid var(--slate-200); padding: 7px 12px; text-align: left; }

.markdown-body th { background: var(--slate-50); font-weight: 600; color: var(--slate-700); }

/* ── Loader ──────────────────────────────────────────────────────────────── */
.loader {
    width: 22px;
    height: 22px;
    border: 2px solid var(--slate-200);
    border-top-color: var(--blue-600);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 14px auto;
}

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

/* ── Q&A ─────────────────────────────────────────────────────────────────── */
.qa-pane {
    flex-direction: column;
    height: 100%;
    gap: 0;
}

.result-pane.qa-pane.active {
    display: flex;
}

.qa-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0 10px;
    border-bottom: 1px solid var(--slate-200);
    flex-shrink: 0;
}

.qa-hint {
    flex: 1;
    font-size: 12px;
    color: var(--slate-500);
    margin: 0;
    line-height: 1.5;
}

.qa-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 60%;
    max-width: 60%;
    align-self: center;
    min-height: 0;
}

.qa-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 120px;
}

.qa-empty {
    font-size: 13px;
    color: var(--slate-400);
    text-align: center;
    margin: 24px 0;
}

.qa-bubble {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 92%;
}

.qa-bubble-user {
    align-self: flex-end;
    align-items: flex-end;
}

.qa-bubble-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.qa-bubble-role {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--slate-400);
}

.qa-bubble-text {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    line-height: 1.55;
    margin: 0;
    word-break: break-word;
}

.qa-bubble-user .qa-bubble-text {
    background: var(--blue-600);
    color: #fff;
    border-bottom-right-radius: var(--radius-xs);
}

.qa-bubble-assistant .qa-bubble-text {
    background: var(--slate-100);
    color: var(--slate-800);
    border-bottom-left-radius: var(--radius-xs);
}

/* markdown inside answer bubble */
.qa-bubble-assistant .qa-bubble-text.markdown-body {
    font-size: 13.5px;
}

.qa-bubble-assistant .qa-bubble-text.markdown-body p:last-child { margin-bottom: 0; }

.qa-bubble-ts {
    font-size: 10px;
    color: var(--slate-400);
}

/* Loading dots animation */
.qa-bubble-loading .qa-bubble-text {
    background: var(--slate-100);
}

.qa-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
    background: var(--slate-100);
    border-radius: var(--radius-md) var(--radius-md) var(--radius-md) var(--radius-xs);
}

.qa-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--slate-400);
    animation: qa-bounce 1.2s infinite ease-in-out;
}

.qa-typing span:nth-child(2) { animation-delay: 0.2s; }
.qa-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes qa-bounce {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40%            { transform: scale(1.1); opacity: 1; }
}

.qa-bubble-error .qa-bubble-text {
    background: var(--red-100);
    color: var(--red-700);
}

.qa-input-row {
    display: flex;
    gap: 0;
    align-items: stretch;
    padding: 10px 0 4px;
    border-top: 1px solid var(--slate-200);
    flex-shrink: 0;
}

.qa-input {
    flex: 1;
    resize: none;
    border: 1px solid var(--slate-300);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    padding: 7px 11px;
    font-size: 13px;
    font-family: inherit;
    color: var(--slate-800);
    line-height: 1.45;
    background: #fff;
    transition: border-color .15s;
    max-height: 90px;
    min-height: 36px;
}

.qa-input:focus {
    outline: none;
    border-color: var(--blue-500);
    z-index: 1;
}

.qa-send-btn {
    flex: 0 0 auto;
    width: auto;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 7px 18px;
    font-size: 13px;
    align-self: stretch;
    height: auto;
    white-space: nowrap;
}

/* ── Tag cloud: rainbow, uniform small size ──────────────────────────────── */
.cloud-tag {
    font-size: 13px !important; /* override any old size-scaling */
    font-weight: 500;
}

/* ── Settings FAB ────────────────────────────────────────────────────────── */
.settings-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 1100;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--slate-800);
    color: #fff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: background .15s, transform .15s;
}
.settings-fab:hover { background: var(--slate-700); transform: rotate(30deg); }

/* ── Settings Modal ──────────────────────────────────────────────────────── */
.settings-modal {
    position: fixed;
    bottom: 84px;
    right: 28px;
    z-index: 1099;
    width: 320px;
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}
.settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--slate-200);
    background: var(--slate-50);
}
.settings-modal-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--slate-800);
}
.settings-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--slate-500);
    font-size: 16px;
    line-height: 1;
    padding: 2px 4px;
}
.settings-close-btn:hover { color: var(--slate-800); }
.settings-modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.form-hint {
    display: block;
    font-size: 11px;
    color: var(--slate-400);
    margin-top: 4px;
}

/* ── File list drag-to-reorder ───────────────────────────────────────────── */
.file-item-draggable {
    cursor: grab;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    background: #fff;
    transition: background .12s, box-shadow .12s;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.file-item-draggable:active { cursor: grabbing; }
.file-item-draggable.dragging { opacity: .5; box-shadow: var(--shadow-md); }
.file-item-draggable.drag-over { background: var(--slate-100); border-color: var(--slate-400); }
.drag-handle {
    color: var(--slate-400);
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    cursor: grab;
}
.file-list-hint {
    font-size: 11px;
    color: var(--slate-400);
    margin: 4px 0 0;
    text-align: center;
}

/* ── Record controls centered ────────────────────────────────────────────── */
.record-controls--centered {
    justify-content: center !important;
}

/* ── Multi-video player ──────────────────────────────────────────────────── */
.multi-video-section {
    padding: 0 0 4px;
    border-bottom: 1px solid var(--slate-200);
}
.multi-video-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px 8px;
}
.multi-video-item {
    flex: 1 1 280px;
    min-width: 200px;
    max-width: 480px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    position: relative;
}
.multi-video-item video {
    width: 100%;
    display: block;
    max-height: 200px;
    object-fit: contain;
}
.multi-video-label {
    position: absolute;
    top: 6px;
    left: 8px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,.85);
    background: rgba(0,0,0,.4);
    border-radius: 4px;
    padding: 2px 6px;
}
.multi-video-placeholder {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--slate-400);
    font-size: 12px;
    background: var(--slate-100);
    border-radius: var(--radius-md);
    padding: 8px;
    text-align: center;
}
.multi-video-timeline-wrap {
    padding: 0 16px 10px;
}
.multi-video-timeline {
    position: relative;
    height: 8px;
    background: var(--slate-200);
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
}
.multi-video-progress {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 0%;
    background: var(--slate-700);
    border-radius: 4px;
    transition: width .1s linear;
    pointer-events: none;
}
.multi-video-segments {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
}
.multi-video-segment {
    position: absolute;
    top: 0; bottom: 0;
    border-right: 2px solid rgba(255,255,255,.6);
}
.multi-video-segment:last-child { border-right: none; }
.multi-video-time-row {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
}

/* ── Auth Widget (header) ────────────────────────────────────────────────── */
.auth-widget {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.auth-user-name {
    font-size: 13px;
    color: var(--slate-600);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-yandex {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: #FFCC00;
    color: #000;
    font-weight: 600;
    font-size: 13px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}
.btn-yandex:hover { background: #F0BE00; }

.btn-yandex--large {
    padding: 12px 24px;
    font-size: 15px;
    border-radius: var(--radius-md);
}

.yandex-logo-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #000;
    color: #FFCC00;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    flex-shrink: 0;
}
.btn-yandex--large .yandex-logo-letter {
    width: 24px;
    height: 24px;
    font-size: 14px;
}

/* ── Google Login Button ─────────────────────────────────────────────────── */
.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: #fff;
    color: #3c4043;
    font-weight: 600;
    font-size: 13px;
    border: 1px solid #dadce0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(60,64,67,0.15);
}
.btn-google--large {
    padding: 12px 24px;
    font-size: 15px;
    border-radius: var(--radius-md);
}
.google-logo-icon {
    flex-shrink: 0;
    display: block;
}

/* ── Login Buttons Column (stacks buttons vertically in overlay) ─────────── */
.login-buttons-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    align-items: stretch;
}
.login-buttons-col .btn-google--large,
.login-buttons-col .btn-yandex--large {
    justify-content: center;
}

/* ── Login Required Overlay ──────────────────────────────────────────────── */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-overlay-card {
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 48px 40px;
    text-align: center;
    max-width: 360px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.login-overlay-icon { font-size: 40px; }

.login-overlay-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--slate-900);
    margin: 0;
}

.login-overlay-text {
    font-size: 14px;
    color: var(--slate-500);
    margin: 0;
    line-height: 1.5;
}

/* ── Floating Action Bar ─────────────────────────────────────────────────── */
.floating-action-bar {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none; /* children opt in */
    transition: opacity .2s, transform .2s;
}

.floating-action-bar.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(16px);
}

/* Panels (file queue / recording) */
.fab-panel {
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 16px 18px;
    width: 360px;
    max-width: calc(100vw - 32px);
    pointer-events: all;
    animation: fabPanelIn .18s ease;
}

@keyframes fabPanelIn {
    from { opacity: 0; transform: translateY(10px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.fab-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.fab-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--slate-700);
}

.fab-panel-action {
    width: 100%;
    margin-top: 12px;
}

/* File list inside FAB panel */
.fab-file-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.fab-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--slate-700);
    cursor: default;
}

.fab-file-item.file-item-draggable { cursor: grab; }
.fab-file-item.dragging { opacity: .5; }
.fab-file-item.drag-over { border-color: var(--slate-500); background: var(--slate-100); }

.fab-file-item .drag-handle {
    color: var(--slate-400);
    font-size: 14px;
    cursor: grab;
    flex-shrink: 0;
}

.fab-file-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fab-file-item-remove {
    cursor: pointer;
    color: var(--slate-400);
    font-size: 13px;
    flex-shrink: 0;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color .15s, background .15s;
}

.fab-file-item-remove:hover { color: var(--red-600); background: var(--red-100); }

.fab-file-list-hint {
    font-size: 11px;
    color: var(--slate-400);
    text-align: center;
    margin-top: 4px;
}

/* Recording panel internals */
.fab-record-visualizer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.fab-record-waveform {
    flex: 1;
    display: flex;
    align-items: center;
    min-height: 36px;
}

.fab-record-waveform .waveform-idle,
.fab-record-waveform .waveform-done {
    font-size: 12px;
    color: var(--slate-400);
}

.fab-record-waveform .waveform-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 36px;
}

.fab-record-waveform .waveform-bars span {
    display: inline-block;
    width: 3px;
    background: #ef4444;
    border-radius: 2px;
    min-height: 3px;
    transition: height .1s ease;
}

.fab-record-timer {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--slate-900);
    letter-spacing: .06em;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.fab-record-panel-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.fab-record-panel-controls .btn { flex: 1; }

.fab-recorded-audio-preview { margin-bottom: 0; }
.fab-recorded-audio-preview audio { width: 100%; border-radius: var(--radius-md); }

/* FAB buttons row */
.fab-buttons {
    display: flex;
    align-items: flex-end;
    gap: 18px;
    pointer-events: all;
}

.fab-btn-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.fab-btn-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--slate-500);
    letter-spacing: .01em;
    white-space: nowrap;
}

.fab-btn {
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: transform .15s, box-shadow .15s, background .15s;
    flex-shrink: 0;
}

/* Record button - primary, large red */
.fab-btn-record {
    width: 64px;
    height: 64px;
    background: #ef4444;
    box-shadow: 0 4px 16px rgba(239,68,68,.45), 0 2px 6px rgba(0,0,0,.12);
    order: 1;
}

.fab-btn-record:hover {
    transform: scale(1.07);
    box-shadow: 0 6px 20px rgba(239,68,68,.55), 0 3px 8px rgba(0,0,0,.14);
}

.fab-btn-record:active { transform: scale(.96); }

.fab-btn-record.recording {
    background: #dc2626;
    animation: recordPulse 1.4s ease-in-out infinite;
}

@keyframes recordPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(239,68,68,.45), 0 0 0 0 rgba(239,68,68,.4); }
    50%       { box-shadow: 0 4px 16px rgba(239,68,68,.45), 0 0 0 10px rgba(239,68,68,.0); }
}

.fab-record-dot {
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    display: block;
    transition: border-radius .2s;
}

.fab-btn-record.recording .fab-record-dot {
    border-radius: 4px;
    width: 18px;
    height: 18px;
}

/* Upload button - secondary, smaller */
.fab-btn-upload {
    width: 48px;
    height: 48px;
    background: #fff;
    border: 1.5px solid var(--slate-200);
    box-shadow: var(--shadow-md);
    color: var(--slate-600);
    order: 2;
}

.fab-btn-upload:hover {
    transform: scale(1.06);
    background: var(--slate-50);
    box-shadow: var(--shadow-lg);
}

.fab-btn-upload:active { transform: scale(.96); }

.fab-btn-upload.has-files {
    background: var(--slate-900);
    border-color: var(--slate-900);
    color: #fff;
}


/* ── Jobs lazy-load ──────────────────────────────────────────────────────── */
.jobs-loading-more {
    text-align: center;
    padding: 14px;
    font-size: 12px;
    color: var(--slate-400);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.jobs-loading-more .loader {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
}

/* ── Share Dialog ────────────────────────────────────────────────────────── */
.share-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn .15s ease;
}

.share-dialog {
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 480px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn .18s ease;
}

.share-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--slate-200);
    flex-shrink: 0;
}

.share-dialog-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--slate-900);
}

.share-dialog-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--slate-500);
    font-size: 18px;
    line-height: 1;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color .15s, background .15s;
}
.share-dialog-close:hover { background: var(--slate-100); color: var(--slate-900); }

.share-dialog-body {
    padding: 18px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.share-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.share-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--slate-400);
}

.share-public-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 10px 14px;
}

.share-public-link {
    flex: 1;
    font-size: 12px;
    color: var(--slate-600);
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.share-public-placeholder {
    flex: 1;
    font-size: 12px;
    color: var(--slate-400);
    font-style: italic;
}

.share-add-row {
    display: flex;
    gap: 8px;
    position: relative;
}

.share-email-input {
    flex: 1;
    padding: 7px 11px;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: inherit;
    color: var(--slate-900);
    transition: border-color .15s;
}
.share-email-input:focus {
    outline: none;
    border-color: var(--slate-500);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.share-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 60px;
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 10;
    max-height: 180px;
    overflow-y: auto;
    margin-top: 2px;
}

.share-autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--slate-700);
    border-bottom: 1px solid var(--slate-100);
    transition: background .1s;
}
.share-autocomplete-item:last-child { border-bottom: none; }
.share-autocomplete-item:hover { background: var(--slate-50); }
.share-autocomplete-email { font-size: 11px; color: var(--slate-400); }

.share-user-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.share-user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
}

.share-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--slate-600);
    flex-shrink: 0;
}

.share-user-info { flex: 1; min-width: 0; }
.share-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--slate-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.share-user-email {
    font-size: 11px;
    color: var(--slate-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-user-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--slate-400);
    font-size: 14px;
    padding: 2px 4px;
    border-radius: var(--radius-xs);
    transition: color .15s, background .15s;
    flex-shrink: 0;
}
.share-user-remove:hover { color: var(--red-600); background: var(--red-50); }

.share-role-select {
    font-size: 11px;
    padding: 3px 6px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--slate-700);
    cursor: pointer;
    flex-shrink: 0;
}
.share-role-select:focus { outline: none; border-color: var(--slate-400); }

/* Title save button is hidden — title auto-saves on blur */
#saveTitleBtn { display: none !important; }

/* Classic icon-only share button in modal header */
.btn-share-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: none;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    color: var(--slate-500);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s, border-color .15s;
}
.btn-share-icon:hover {
    background: var(--slate-100);
    color: var(--slate-800);
    border-color: var(--slate-300);
}

/* Legacy share button class kept for any remaining references */
.btn-share {
    background: var(--slate-100);
    color: var(--slate-700);
    border: 1px solid var(--slate-200);
    gap: 5px;
}
.btn-share:hover { background: var(--slate-200); }

/* Delete button at bottom of pane */
.pane-bottom-actions {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--slate-200);
    display: flex;
    justify-content: flex-end;
}

/* Retranscribe model info line */
.retranscribe-model-info {
    font-size: 11px;
    color: var(--slate-400);
    margin-bottom: 4px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .qa-body { width: 100%; max-width: 100%; }
}

@media (max-width: 680px) {
    .container { padding: 0 16px 110px; }

    header { flex-wrap: wrap; padding: 14px 0; }
    .subtitle { display: none; }

    .jobs-section { padding: 16px; }

    .custom-player { flex-wrap: wrap; }
    .player-timeline-wrap { order: 3; width: 100%; }

    /* Pull jobs panel edge-to-edge on mobile, cancelling container padding */
    .jobs-panel {
        margin-left: -16px;
        margin-right: -16px;
    }

    /* Job title cell: override the max-width:0 inline style so the cell */
    /* fills the full available table width, then let text wrap naturally */
    .job-row-title-cell {
        max-width: unset !important;
        width: auto !important;
    }

    /* Modal header: title row full-width, buttons below */
    .modal-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    .modal-title-row {
        flex: 0 0 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .modal-title-row .btn { align-self: flex-end; }
    #modalShareBtn, .modal-close {
        flex-shrink: 0;
    }

    .job-actions { flex-direction: column; }
    .job-actions .btn { width: 100%; }

    .section-tabs { flex-wrap: wrap; }
    .record-controls .btn { flex: 1 1 auto; }

    /* Full-page result: stack sidebar above main on mobile */
    .result-layout { flex-direction: column; overflow-y: auto; }
    .result-sidebar {
        width: 100% !important;
        border-right: none;
        border-bottom: 1px solid var(--slate-200);
        padding: 14px 16px;
        transition: none;
    }
    .result-main { padding: 14px 16px; overflow-y: visible; }
    .sidebar-resize-handle { display: none; }
    .result-layout.sidebar-collapsed .result-sidebar {
        width: 100% !important;
        padding: 14px 16px;
        opacity: 1;
        pointer-events: auto;
        overflow: visible;
    }

    /* Job table: compact actions on small screens */
    .job-row-actions-cell { vertical-align: top; padding-top: 10px; }
}

/* === Projects sidebar section === */
.projects-section {
    background: #fff;
}
.projects-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px 6px;
    user-select: none;
}
.projects-collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: var(--slate-400);
    padding: 0 2px;
    transition: transform .15s;
    line-height: 1;
}
.projects-collapse-btn.collapsed { transform: rotate(-90deg); }
.projects-header-title {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--slate-500);
}
.projects-new-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--slate-400);
    line-height: 1;
    padding: 0 2px;
    transition: color .15s;
}
.projects-new-btn:hover { color: var(--slate-700); }

.projects-tree { padding: 0 4px 6px; }
.project-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .12s;
    position: relative;
}
.project-row:hover { background: var(--slate-100); }
.project-row.active { background: var(--indigo-50, #eef2ff); }
.project-row.active .project-row-name { font-weight: 600; }

.project-row-chevron {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: var(--slate-400);
    width: 14px;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    transition: transform .15s;
}
.project-row-chevron.collapsed { transform: rotate(-90deg); }
.project-row-chevron.invisible { visibility: hidden; }

.project-row-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.project-row-emoji { font-size: 13px; flex-shrink: 0; }
.project-row-name {
    flex: 1;
    font-size: 13px;
    color: var(--slate-700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.project-row-count { font-size: 11px; color: var(--slate-400); flex-shrink: 0; }

.project-drag-handle {
    cursor: grab;
    font-size: 12px;
    color: var(--slate-300);
    padding: 0 3px;
    flex-shrink: 0;
    user-select: none;
    opacity: 0.35;
    transition: opacity .12s, color .12s;
    line-height: 1;
    letter-spacing: -2px;
    -webkit-user-drag: element;
}
.project-row:hover .project-drag-handle { opacity: 1; color: var(--slate-400); }
.project-drag-handle:hover { color: var(--slate-600) !important; }
.project-drag-handle:active { cursor: grabbing; }

.project-row-kebab {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--slate-400);
    padding: 0 2px;
    display: none;
    line-height: 1;
    border-radius: 4px;
    transition: background .12s, color .12s;
}
.project-row:hover .project-row-kebab { display: block; }
.project-row-kebab:hover { background: var(--slate-200); color: var(--slate-700); }

/* Drag-and-drop states — project reorder */
.project-row.dragging {
    opacity: .4;
}
.project-row.drag-nest-target {
    background: var(--indigo-50, #eef2ff);
    outline: 2px solid var(--indigo-400, #818cf8);
    outline-offset: -2px;
    border-radius: 6px;
}
.project-drop-line {
    height: 2px;
    background: var(--indigo-400, #818cf8);
    border-radius: 2px;
    margin: 1px 4px;
    pointer-events: none;
}

/* Job dragged onto project row */
.project-row.job-drop-hover {
    background: var(--emerald-50, #ecfdf5);
    outline: 2px solid var(--emerald-400, #34d399);
    outline-offset: -2px;
    border-radius: 6px;
}
/* While a job is being dragged, pulse the project sidebar label */
.projects-section.job-drag-active .projects-header-title {
    color: var(--emerald-600, #059669);
}

/* Job row being dragged */
.job-row.job-row-dragging {
    opacity: .4;
}

.job-row {
    -webkit-user-drag: element;
}

.project-children { padding-left: 20px; }

.projects-archived-wrap {
    padding: 4px 12px 8px;
    border-top: 1px dashed var(--slate-200);
}
.projects-archived-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: var(--slate-400);
    padding: 2px 0;
    text-align: left;
}
.projects-archived-toggle:hover { color: var(--slate-600); }
.projects-archived-list { margin-top: 4px; }
.project-row.archived { opacity: .55; }

/* Context menu */
.project-ctx-menu {
    position: fixed;
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    z-index: 9999;
    min-width: 160px;
    padding: 4px 0;
}
.project-ctx-menu-item {
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--slate-700);
    transition: background .1s;
}
.project-ctx-menu-item:hover { background: var(--slate-100); }
.project-ctx-menu-item.danger { color: #dc2626; }
.project-ctx-menu-sep { height: 1px; background: var(--slate-200); margin: 4px 0; }

/* === Project dialog form === */
.project-dialog { max-width: 420px; width: 100%; }
.project-form-row { margin-bottom: 14px; }
.project-form-row-inline { display: flex; gap: 16px; }
.project-form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--slate-500);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.project-color-input {
    width: 44px;
    height: 32px;
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
}
.project-emoji-input {
    width: 60px;
    font-size: 18px;
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    padding: 4px 8px;
    text-align: center;
}
.project-parent-select { width: 100%; }
.project-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

/* === Project badges on job rows === */
.job-project-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.project-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    padding: 1px 7px 1px 5px;
    border-radius: 10px;
    background: var(--slate-100);
    color: var(--slate-600);
    cursor: pointer;
    transition: background .12s;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.project-badge:hover { background: var(--slate-200); }
.project-badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.project-badge-more { font-size: 11px; color: var(--slate-400); cursor: default; }

/* === Add-to-project modal === */
.add-to-project-search-row { margin-bottom: 10px; }
.add-to-project-list { max-height: 320px; overflow-y: auto; }
.add-to-project-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .1s;
}
.add-to-project-item:hover { background: var(--slate-100); }
.add-to-project-item input[type=checkbox] { flex-shrink: 0; width: 15px; height: 15px; cursor: pointer; }
.add-to-project-item-name { flex: 1; font-size: 13px; color: var(--slate-700); }

/* === Result-modal projects list === */
.modal-projects-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.modal-add-to-project-btn { margin-top: 2px; font-size: 11px; }

.modal-project-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    padding: 2px 4px 2px 7px;
    border-radius: 10px;
    background: var(--slate-100);
    color: var(--slate-600);
    transition: background .12s;
}
.modal-project-chip:hover { background: var(--slate-200); }
.modal-project-chip-name {
    cursor: pointer;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.modal-project-chip-name:hover { text-decoration: underline; }
.modal-project-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    color: var(--slate-400);
    padding: 0 2px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity .12s, color .12s, background .12s;
    flex-shrink: 0;
}
.modal-project-chip:hover .modal-project-chip-remove { opacity: 1; }
.modal-project-chip-remove:hover { color: #dc2626; background: var(--slate-300); }

/* === Filter breadcrumb === */
.filter-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 7px 16px;
    background: var(--slate-50, #f8fafc);
    border-bottom: 1px solid var(--slate-200);
    font-size: 12px;
    color: var(--slate-500);
}
.breadcrumb-label {
    font-weight: 600;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 10px;
}
.breadcrumb-items {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1;
}
.breadcrumb-segment {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: var(--slate-600);
    padding: 2px 4px 2px 7px;
    border-radius: 4px;
    transition: background .1s;
}
.breadcrumb-segment:hover { background: var(--slate-200); }
.breadcrumb-segment-ancestor { cursor: pointer; }
.breadcrumb-sep { color: var(--slate-300); font-size: 12px; }

.breadcrumb-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: var(--slate-400);
    padding: 0 2px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity .12s, color .12s, background .12s;
    flex-shrink: 0;
}
.breadcrumb-segment:hover .breadcrumb-remove-btn { opacity: 1; }
.breadcrumb-remove-btn:hover { color: var(--slate-700); background: var(--slate-300); }
.breadcrumb-descendants-toggle {
    font-size: 12px;
    color: var(--slate-500);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.breadcrumb-ask-btn {
    background: none;
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    color: var(--slate-600);
    transition: background .12s, border-color .12s;
    white-space: nowrap;
}
.breadcrumb-ask-btn:hover { background: var(--slate-100); border-color: var(--slate-300); }
.breadcrumb-clear-all { flex-shrink: 0; }

/* === Screen-context Q&A panel === */
.screen-qa-panel {
    padding: 6px 16px 8px;
    background: var(--slate-50, #f8fafc);
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.screen-qa-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.screen-qa-context {
    font-size: 12px;
    color: var(--slate-500);
    font-style: italic;
    flex: 1;
}
.screen-qa-hide-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--slate-400);
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
    transition: color .12s;
}
.screen-qa-hide-btn:hover { color: var(--slate-700); }
.screen-qa-input-row {
    display: flex;
    gap: 6px;
    align-items: flex-end;
}
.screen-qa-input {
    flex: 1;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
    resize: vertical;
    min-height: 36px;
    max-height: 140px;
    line-height: 1.45;
}
.screen-qa-input:focus { border-color: var(--indigo-400, #818cf8); }
.screen-qa-input-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}
.screen-qa-messages {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
}
.screen-qa-msg {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    position: relative;
}
.screen-qa-msg.user {
    background: var(--indigo-50, #eef2ff);
    align-self: flex-end;
    max-width: 80%;
    color: var(--slate-700);
}
.screen-qa-msg.assistant {
    background: #fff;
    border: 1px solid var(--slate-200);
    align-self: flex-start;
    max-width: 95%;
    padding: 10px 25px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.screen-qa-msg-body { line-height: 1.5; }
.screen-qa-msg-body > *:first-child { margin-top: 0; }
.screen-qa-msg-body > *:last-child  { margin-bottom: 0; }
.screen-qa-msg-footer {
    display: flex;
    justify-content: flex-end;
}
.screen-qa-copy-btn {
    background: var(--slate-50, #f8fafc);
    border: 1px solid var(--slate-300);
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 3px 8px;
    color: var(--slate-500);
    transition: color .12s, background .12s, border-color .12s;
}
.screen-qa-copy-btn:hover { color: var(--slate-800); background: var(--slate-200); border-color: var(--slate-400); }
.screen-qa-sources {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.screen-qa-source-chip {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--slate-100);
    color: var(--slate-500);
    cursor: pointer;
    transition: background .1s;
}
.screen-qa-source-chip:hover { background: var(--slate-200); }

.projects-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px 6px;
    user-select: none;
}
.projects-collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: var(--slate-400);
    padding: 0 2px;
    transition: transform .15s;
    line-height: 1;
}
.projects-collapse-btn.collapsed { transform: rotate(-90deg); }
.projects-header-title {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--slate-500);
}
.projects-new-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--slate-400);
    line-height: 1;
    padding: 0 2px;
    transition: color .15s;
}
.projects-new-btn:hover { color: var(--slate-700); }

.projects-tree {
    padding: 0 4px 6px;
}
.project-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .12s;
    position: relative;
}
.project-row:hover { background: var(--slate-100); }
.project-row.active { background: var(--indigo-50, #eef2ff); }
.project-row.active .project-row-name { font-weight: 600; }

.project-row-chevron {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: var(--slate-400);
    width: 14px;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    transition: transform .15s;
}
.project-row-chevron.collapsed { transform: rotate(-90deg); }
.project-row-chevron.invisible { visibility: hidden; }

.project-row-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.project-row-emoji {
    font-size: 13px;
    flex-shrink: 0;
}
.project-row-name {
    flex: 1;
    font-size: 13px;
    color: var(--slate-700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.project-row-count {
    font-size: 11px;
    color: var(--slate-400);
    flex-shrink: 0;
}
.project-children {
    padding-left: 20px;
}

.projects-archived-wrap {
    padding: 4px 12px 8px;
    border-top: 1px dashed var(--slate-200);
}
.projects-archived-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: var(--slate-400);
    padding: 2px 0;
    text-align: left;
}
.projects-archived-toggle:hover { color: var(--slate-600); }
.projects-archived-list {
    margin-top: 4px;
}
.project-row.archived { opacity: .55; }

/* Context menu */
.project-ctx-menu {
    position: fixed;
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    z-index: 9999;
    min-width: 160px;
    padding: 4px 0;
}
.project-ctx-menu-item {
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--slate-700);
    transition: background .1s;
}
.project-ctx-menu-item:hover { background: var(--slate-100); }
.project-ctx-menu-item.danger { color: #dc2626; }
.project-ctx-menu-sep {
    height: 1px;
    background: var(--slate-200);
    margin: 4px 0;
}

/* ─── Project dialog form ──────────────────────────────────────────────────── */
.project-dialog {
    max-width: 420px;
    width: 100%;
}
.project-form-row {
    margin-bottom: 14px;
}
.project-form-row-inline {
    display: flex;
    gap: 16px;
}
.project-form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--slate-500);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.project-color-input {
    width: 44px;
    height: 32px;
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
}
.project-emoji-input {
    width: 60px;
    font-size: 18px;
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    padding: 4px 8px;
    text-align: center;
}
.project-parent-select {
    width: 100%;
}
.project-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

/* ─── Project badges on job rows ─────────────────────────────────────────────── */
.job-project-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.project-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    padding: 1px 7px 1px 5px;
    border-radius: 10px;
    background: var(--slate-100);
    color: var(--slate-600);
    cursor: pointer;
    transition: background .12s;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.project-badge:hover { background: var(--slate-200); }
.project-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.project-badge-more {
    font-size: 11px;
    color: var(--slate-400);
    cursor: default;
}

/* ─── Add-to-project modal ───────────────────────────────────────────────────── */
.add-to-project-search-row {
    margin-bottom: 10px;
}
.add-to-project-list {
    max-height: 320px;
    overflow-y: auto;
}
.add-to-project-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .1s;
}
.add-to-project-item:hover { background: var(--slate-100); }
.add-to-project-item input[type=checkbox] {
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    cursor: pointer;
}
.add-to-project-item-name {
    flex: 1;
    font-size: 13px;
    color: var(--slate-700);
}

/* ─── Result-modal projects list ─────────────────────────────────────────────── */
.modal-projects-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 6px;
}
.modal-add-to-project-btn {
    margin-top: 2px;
    font-size: 11px;
}

/* ─── Filter breadcrumb ─────────────────────────────────────────────────────── */
.filter-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 7px 16px;
    background: var(--slate-50, #f8fafc);
    border-bottom: 1px solid var(--slate-200);
    font-size: 12px;
    color: var(--slate-500);
}
.breadcrumb-label {
    font-weight: 600;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 10px;
}
.breadcrumb-items {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1;
}
.breadcrumb-segment {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: var(--slate-600);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background .1s;
}
.breadcrumb-segment:hover { background: var(--slate-200); }
.breadcrumb-sep {
    color: var(--slate-300);
    font-size: 12px;
}
.breadcrumb-descendants-toggle {
    font-size: 12px;
    color: var(--slate-500);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.breadcrumb-ask-btn {
    background: none;
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    color: var(--slate-600);
    transition: background .12s, border-color .12s;
    white-space: nowrap;
}
.breadcrumb-ask-btn:hover { background: var(--slate-100); border-color: var(--slate-300); }
.breadcrumb-clear-all {
    flex-shrink: 0;
}
