/* ===== Global Materialize Theme ===== */
:root {
    --mat-primary: #00897B;
    --mat-primary-dark: #00695C;
    --mat-primary-light: #4DB6AC;
    --mat-primary-bg: #E0F2F1;
    --mat-accent: #1565C0;
    --mat-accent-light: #42A5F5;
    --mat-accent-bg: #E3F2FD;
    --mat-dark: #263238;
    --mat-dark-secondary: #37474F;
    --mat-grey: #546E7A;
    --mat-grey-light: #78909C;
    --mat-grey-border: #B0BEC5;
    --mat-grey-bg: #ECEFF1;
    --mat-success: #2E7D32;
    --mat-success-bg: #E8F5E9;
    --mat-warning: #E65100;
    --mat-warning-bg: #FFF3E0;
    --mat-danger: #C62828;
    --mat-danger-bg: #FFEBEE;
    --mat-body-bg: #FAFAFA;
    --mat-card-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --mat-card-shadow-hover: 0 3px 10px rgba(0,0,0,0.12);
    --mat-radius: 8px;
    --mat-radius-lg: 12px;
}

body {
    background-color: var(--mat-body-bg);
    color: var(--mat-dark);
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ===== Navbar ===== */
.mat-navbar {
    background: linear-gradient(135deg, var(--mat-dark) 0%, var(--mat-dark-secondary) 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 0.6rem 0;
}
.mat-navbar .navbar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    color: #fff !important;
    letter-spacing: 0.3px;
}
.mat-navbar .navbar-brand i {
    color: var(--mat-primary-light);
}
.mat-navbar .nav-link {
    color: rgba(255,255,255,0.85) !important;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.mat-navbar .nav-link:hover {
    color: #fff !important;
}
.mat-navbar .dropdown-menu {
    background: var(--mat-dark-secondary);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--mat-radius);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    margin-top: 8px;
}
.mat-navbar .dropdown-item {
    color: rgba(255,255,255,0.85);
    font-size: 0.88rem;
    padding: 0.5rem 1rem;
    transition: all 0.15s;
}
.mat-navbar .dropdown-item:hover,
.mat-navbar .dropdown-item:focus {
    background: var(--mat-primary-dark);
    color: #fff;
}
.mat-navbar .dropdown-item i {
    color: var(--mat-primary-light);
}
.mat-navbar .dropdown-divider {
    border-color: rgba(255,255,255,0.1);
}

/* ===== Footer ===== */
.mat-footer {
    background: var(--mat-dark);
    color: rgba(255,255,255,0.6);
    border: none;
    padding: 1rem 0;
}
.mat-footer small {
    font-size: 0.8rem;
    letter-spacing: 0.3px;
}

/* ===== Page Headers ===== */
.mat-page-header {
    margin-bottom: 1.5rem;
}
.mat-page-header h2,
.mat-page-header h3 {
    font-weight: 700;
    color: var(--mat-dark);
}
.mat-page-header h2 i,
.mat-page-header h3 i {
    color: var(--mat-primary);
}

/* ===== Cards (Global) ===== */
.mat-card {
    border: 1px solid #E0E0E0;
    border-radius: var(--mat-radius);
    overflow: hidden;
    background: #fff;
    box-shadow: var(--mat-card-shadow);
    transition: box-shadow 0.2s ease;
}
.mat-card:hover {
    box-shadow: var(--mat-card-shadow-hover);
}
.mat-card-header {
    padding: 10px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #fff;
    background: var(--mat-dark-secondary);
    letter-spacing: 0.3px;
}
.mat-card-body {
    padding: 16px;
}

/* ===== Tables (Global) ===== */
.mat-table-card {
    border: 1px solid #E0E0E0;
    border-radius: var(--mat-radius);
    overflow: hidden;
    box-shadow: var(--mat-card-shadow);
}
.mat-table thead {
    background: var(--mat-dark-secondary);
}
/* Override Bootstrap .table > :not(caption) > * > * which has high specificity */
.mat-table.table > thead > tr > th {
    color: #fff;
    background-color: var(--mat-dark-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.7rem 0.75rem;
    border-bottom: none;
    white-space: nowrap;
    box-shadow: none;
}
.mat-table thead th a {
    color: #fff !important;
    text-decoration: none;
}
.mat-table thead th a:hover {
    text-decoration: underline !important;
}
.mat-table tbody tr {
    transition: background-color 0.15s;
}
.mat-table tbody tr:hover {
    background-color: var(--mat-primary-bg);
}
.mat-table tbody td {
    vertical-align: middle;
    font-size: 0.88rem;
    color: var(--mat-dark);
    padding: 0.6rem 0.75rem;
}

/* ===== Buttons (Global) ===== */
.mat-btn-primary {
    background: var(--mat-primary);
    color: #fff;
    border: none;
    border-radius: var(--mat-radius);
    font-weight: 600;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0,137,123,0.3);
    transition: all 0.2s ease;
}
.mat-btn-primary:hover {
    background: var(--mat-primary-dark);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,137,123,0.4);
    transform: translateY(-1px);
}

.mat-btn-success {
    background: var(--mat-success);
    color: #fff;
    border: none;
    border-radius: var(--mat-radius);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(46,125,50,0.3);
    transition: all 0.2s ease;
}
.mat-btn-success:hover {
    background: #1B5E20;
    color: #fff;
    box-shadow: 0 4px 12px rgba(46,125,50,0.4);
    transform: translateY(-1px);
}

.mat-btn-accent {
    background: var(--mat-accent);
    color: #fff;
    border: none;
    border-radius: var(--mat-radius);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(21,101,192,0.3);
    transition: all 0.2s ease;
}
.mat-btn-accent:hover {
    background: #0D47A1;
    color: #fff;
    box-shadow: 0 4px 12px rgba(21,101,192,0.4);
    transform: translateY(-1px);
}

.mat-btn-outline {
    background: #fff;
    color: var(--mat-grey);
    border: 1px solid var(--mat-grey-border);
    border-radius: var(--mat-radius);
    font-weight: 500;
    transition: all 0.2s ease;
}
.mat-btn-outline:hover {
    background: var(--mat-grey-bg);
    color: var(--mat-dark-secondary);
    border-color: #90A4AE;
}

/* Outline button that sits on a DARK panel header (e.g. transcript Reset/Redo) — the plain
   .mat-btn-outline is white-on-white here and disappears. Translucent chip + white text/border. */
.mat-btn-on-dark {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--mat-radius);
    font-weight: 500;
    transition: all 0.2s ease;
}
.mat-btn-on-dark:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    border-color: #fff;
}
.mat-btn-on-dark:active {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.mat-btn-danger {
    background: #fff;
    color: var(--mat-danger);
    border: 1px solid #EF9A9A;
    border-radius: var(--mat-radius);
    font-weight: 500;
    transition: all 0.2s ease;
}
.mat-btn-danger:hover {
    background: var(--mat-danger-bg);
    color: #B71C1C;
    border-color: #E57373;
}

.mat-btn-warning {
    background: #fff;
    color: #E65100;
    border: 1px solid #FFCC80;
    border-radius: var(--mat-radius);
    font-weight: 500;
    transition: all 0.2s ease;
}
.mat-btn-warning:hover {
    background: var(--mat-warning-bg);
    color: #BF360C;
    border-color: #FFB74D;
}

.mat-btn-info {
    background: #fff;
    color: var(--mat-accent);
    border: 1px solid #90CAF9;
    border-radius: var(--mat-radius);
    font-weight: 500;
    transition: all 0.2s ease;
}
.mat-btn-info:hover {
    background: var(--mat-accent-bg);
    color: #0D47A1;
    border-color: #64B5F6;
}

/* Small action buttons for tables */
.mat-btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
    border-radius: 6px;
}

/* ===== Forms (Global) ===== */
.mat-form-control {
    border: 1px solid #CFD8DC;
    border-radius: 6px;
    font-size: 0.88rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--mat-dark);
}
.mat-form-control:focus {
    border-color: var(--mat-primary);
    box-shadow: 0 0 0 3px rgba(0,137,123,0.15);
}
.mat-form-select {
    border: 1px solid #CFD8DC;
    border-radius: 6px;
    font-size: 0.88rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.mat-form-select:focus {
    border-color: var(--mat-primary);
    box-shadow: 0 0 0 3px rgba(0,137,123,0.15);
}
.mat-form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--mat-dark-secondary);
    margin-bottom: 0.3rem;
}

/* ===== Badges ===== */
.mat-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.mat-badge-active {
    background: var(--mat-success-bg);
    color: var(--mat-success);
}
.mat-badge-inactive {
    background: var(--mat-grey-bg);
    color: var(--mat-grey-light);
}
/* Evaluation task statuses (tracking / inbox) */
.mat-badge-status-assigned {
    background: var(--mat-grey-bg);
    color: var(--mat-grey);
}
.mat-badge-status-inprogress {
    background: var(--mat-accent-bg);
    color: var(--mat-accent);
}
.mat-badge-status-returned {
    background: var(--mat-warning-bg);
    color: var(--mat-warning);
}
.mat-badge-status-reopened {
    background: #F3E5F5;
    color: #6A1B9A;
}
.mat-badge-status-closed {
    background: var(--mat-success-bg);
    color: var(--mat-success);
}

/* ===== Alerts ===== */
.mat-alert {
    border-radius: var(--mat-radius);
    border: none;
    font-size: 0.88rem;
}
.mat-alert-success {
    background: var(--mat-success-bg);
    color: var(--mat-success);
    border-left: 4px solid var(--mat-success);
}
.mat-alert-danger {
    background: var(--mat-danger-bg);
    color: var(--mat-danger);
    border-left: 4px solid var(--mat-danger);
}
.mat-alert-info {
    background: var(--mat-accent-bg);
    color: var(--mat-accent);
    border-left: 4px solid var(--mat-accent);
}
.mat-alert-warning {
    background: var(--mat-warning-bg);
    color: var(--mat-warning);
    border-left: 4px solid var(--mat-warning);
}

/* ===== Filter Bar ===== */
.mat-filter-bar {
    background: #fff;
    border: 1px solid #E0E0E0;
    border-radius: var(--mat-radius);
    padding: 12px 16px;
    box-shadow: var(--mat-card-shadow);
}

/* ===== Set Groups (tracking page: one collapsible card per assignment set) ===== */
.mat-set-group {
    background: #fff;
    border: 1px solid #E0E0E0;
    border-radius: var(--mat-radius);
    box-shadow: var(--mat-card-shadow);
    overflow: hidden;
}
.mat-set-group-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    background: linear-gradient(135deg, var(--mat-grey-bg) 0%, #fff 70%);
    user-select: none;
}
/* Only the name area is the collapse toggle; action links/buttons live outside it. */
.mat-set-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 0 1 auto;
    min-width: 0;
    padding: 0;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
    color: inherit;
}
.mat-set-toggle:hover .mat-set-name {
    color: var(--mat-primary);
}
.mat-set-group-header .mat-set-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--mat-dark);
}
.mat-set-toggle > .bi-chevron-down {
    color: var(--mat-grey);
    transition: transform 0.2s ease;
}
.mat-set-toggle.collapsed > .bi-chevron-down {
    transform: rotate(-90deg);
}
.mat-set-open-link {
    color: var(--mat-grey-light);
    font-size: 0.85rem;
    text-decoration: none;
}
.mat-set-open-link:hover {
    color: var(--mat-primary);
}
.mat-set-progress {
    display: inline-block;
    width: 110px;
    height: 6px;
    border-radius: 3px;
    background: #E0E0E0;
    overflow: hidden;
}
.mat-set-progress > span {
    display: block;
    height: 100%;
    background: var(--mat-success);
}
/* Assignments list: give rows room for the per-set status/progress cell. */
.mat-assignments-table td {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    vertical-align: middle;
}
/* Tracking: clickable sortable column headers */
.mat-set-group th.js-sort {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.mat-set-group th.js-sort:hover {
    color: var(--mat-primary);
}

/* ===== Shared server-side grid: toolbar · sortable headers · pager ===== */
/* Sortable header link — inherits the header's colour so it reads on light or dark headers. */
th.js-sort { white-space: nowrap; }
.mat-sort-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    white-space: nowrap;
}
.mat-sort-link:hover { color: inherit; opacity: .8; }
.mat-sort-link .bi { font-size: .78em; }

/* Toolbar: search + filters in a wrap-friendly row (sits inside a .mat-filter-bar). */
.mat-grid-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .5rem .75rem;
    margin: 0;
}
.mat-grid-toolbar .mat-grid-field { display: flex; flex-direction: column; gap: .15rem; }
.mat-grid-toolbar .mat-grid-search { min-width: 15rem; flex: 1 1 15rem; max-width: 24rem; }
.mat-grid-toolbar .mat-grid-spacer { flex: 1 1 auto; }
.mat-grid-count { color: var(--mat-grey, #546E7A); font-size: .82rem; white-space: nowrap; }

/* Pager row below a grid: count + rows-per-page on the left, page controls on the right. */
.mat-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    padding: .6rem .9rem;
    border-top: 1px solid #ECEFF1;
    background: #FCFDFD;
}
.mat-pager-info { display: flex; align-items: center; gap: 1rem; color: var(--mat-grey, #546E7A); font-size: .84rem; }
.mat-pager-size { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.mat-pager-size select { width: auto; padding-top: .15rem; padding-bottom: .15rem; }
.mat-pager-list .page-link {
    color: var(--mat-primary-dark, #00695C);
    border-color: #E0E0E0;
    padding: .2rem .55rem;
}
.mat-pager-list .page-link:hover { background: var(--mat-primary-bg, #E0F2F1); color: var(--mat-primary-dark, #00695C); }
.mat-pager-list .page-item.active .page-link {
    background: var(--mat-primary, #00897B);
    border-color: var(--mat-primary, #00897B);
    color: #fff;
}
.mat-pager-list .page-item.disabled .page-link { color: #B0BEC5; }
.mat-pager-list .page-link:focus { box-shadow: 0 0 0 .2rem rgba(0,137,123,.2); }
.mat-pager-list .mat-pager-gap { border: none; background: transparent; }
.mat-set-group .collapse > .table-responsive,
.mat-set-group .collapsing > .table-responsive {
    border-top: 1px solid #EEEEEE;
}

/* ===== Modals ===== */
.mat-modal-header {
    background: var(--mat-dark-secondary);
    color: #fff;
    padding: 12px 20px;
}
.mat-modal-header .modal-title {
    font-weight: 600;
    font-size: 1rem;
}
/* Close ('x') pinned top-right, after the title, on every popup */
.mat-modal-header,
.modal-header {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.mat-modal-header .btn-close,
.modal-header .btn-close {
    margin-left: auto;   /* push the 'x' to the right (Bootstrap default) */
    flex-shrink: 0;
}
.mat-modal-header .modal-title,
.modal-header .modal-title {
    min-width: 0;     /* let .text-truncate keep working inside the flex row */
}
.mat-modal-header-warning {
    background: #E65100;
}
.mat-modal-header-info {
    background: var(--mat-accent);
}
.mat-modal-header-danger {
    background: var(--mat-danger);
}
.mat-modal-content {
    border: none;
    border-radius: var(--mat-radius-lg);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.mat-modal-footer {
    border-top: 1px solid #E0E0E0;
    padding: 12px 20px;
}

/* ===== Detail Pages ===== */
.mat-detail-card {
    border: 1px solid #E0E0E0;
    border-radius: var(--mat-radius);
    background: #fff;
    box-shadow: var(--mat-card-shadow);
    overflow: hidden;
}
.mat-detail-header {
    background: var(--mat-dark-secondary);
    color: #fff;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 0.9rem;
}
.mat-detail-body {
    padding: 20px;
}
.mat-detail-body dt {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--mat-grey-light);
    font-weight: 600;
}
.mat-detail-body dd {
    font-size: 0.9rem;
    color: var(--mat-dark);
    margin-bottom: 1rem;
}
.mat-pre-block {
    background: var(--mat-grey-bg);
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 0.83rem;
    color: var(--mat-dark-secondary);
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* ===== Error Page ===== */
.mat-error-page {
    text-align: center;
    padding: 3rem 1rem;
}
.mat-error-icon {
    font-size: 5rem;
    color: var(--mat-danger);
    margin-bottom: 1rem;
}

/* ===== Upload area ===== */
.upload-area {
    border: 2px dashed #B0BEC5;
    border-radius: var(--mat-radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    transition: border-color 0.3s, background-color 0.3s;
    cursor: pointer;
    background: #fff;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--mat-primary);
    background-color: var(--mat-primary-bg);
}

.upload-area i {
    font-size: 3rem;
    color: var(--mat-primary-light);
}

/* Metric cards */
.metric-card {
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.metric-label {
    font-size: 0.85rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* Confidence colors */
.confidence-high { color: #198754; }
.confidence-medium { color: #ffc107; }
.confidence-low { color: #dc3545; }

.bg-confidence-high { background-color: #d1e7dd; }
.bg-confidence-medium { background-color: #fff3cd; }
.bg-confidence-low { background-color: #f8d7da; }

/* Model radio cards */
.model-radio-label {
    padding: 0.75rem 0.5rem;
    border-radius: 10px;
    text-align: center;
    transition: all 0.2s;
    line-height: 1.3;
}

.btn-check:checked + .model-radio-label {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.35);
}

.btn-check:checked + .model-radio-label small {
    color: rgba(255,255,255,0.8) !important;
}

/* Engine badge */
.engine-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--mat-primary) 0%, var(--mat-primary-dark) 100%);
    color: white;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Loading overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

/* Results section */
.results-section {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Feedback score cards */
.feedback-overall-score {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.feedback-score-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.feedback-score-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6c757d;
}

.feedback-score-card {
    border-radius: 12px;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.feedback-score-card:hover {
    transform: translateY(-3px);
}

.feedback-circle-wrapper {
    width: 80px;
    height: 80px;
    position: relative;
}

.feedback-circle-svg {
    width: 100%;
    height: 100%;
}

.feedback-circle-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
}

/* Table styling */
.page-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

/* Master page styling */
.prompt-preview {
    display: inline-block;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* Row styling: prompts present vs empty */
.row-has-prompts {
    border-left: 3px solid var(--mat-success);
}

.row-no-prompts {
    border-left: 3px solid #FFA726;
    background-color: #FFF8E1;
}

/* ===== Generate Page — Materialize Theme ===== */

/* Chips / tags */
.gen-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
}
.gen-chip-genre   { background: #E0F2F1; color: #00695C; }
.gen-chip-subgenre{ background: #E8EAF6; color: #283593; }
.gen-chip-marks   { background: #FFF3E0; color: #E65100; }
.gen-chip-params  { background: #F3E5F5; color: #6A1B9A; }

.gen-chip-sm {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(255,255,255,0.25);
    color: #fff;
}

/* Stepper */
.gen-stepper {
    display: flex;
    align-items: center;
    gap: 0;
}
.gen-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 24px;
    background: #ECEFF1;
    color: #78909C;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}
.gen-step.active {
    background: #00897B;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,137,123,0.3);
}
.gen-step.completed {
    background: #4DB6AC;
    color: #fff;
}
.gen-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    background: rgba(0,0,0,0.1);
}
.gen-step.active .gen-step-num,
.gen-step.completed .gen-step-num {
    background: rgba(255,255,255,0.3);
}
.gen-step-label { letter-spacing: 0.3px; }
.gen-step-line {
    flex: 0 0 40px;
    height: 2px;
    background: #CFD8DC;
    margin: 0 4px;
    transition: background 0.3s ease;
}
.gen-step-line.completed {
    background: #4DB6AC;
}

/* Cards */
.gen-card {
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s ease;
}
.gen-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.gen-card-header {
    padding: 10px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #fff;
    background: #37474F;
    letter-spacing: 0.3px;
}
.gen-card-body {
    padding: 12px 16px;
}

/* Readonly cards */
.gen-card-readonly {
    border-color: #B0BEC5;
}
.gen-card-header-readonly {
    background: #78909C;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.gen-card-hint {
    color: rgba(255,255,255,0.7);
    font-weight: 400;
    font-size: 0.75rem;
}
.gen-badge-readonly {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* Parameter card */
.gen-card-header-params {
    background: #00695C;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Preview card header */
.gen-card-header-preview {
    background: #1565C0;
}

/* Form inputs */
.gen-textarea {
    font-size: 0.83rem;
    border: 1px solid #CFD8DC;
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.gen-textarea:focus {
    border-color: #00897B;
    box-shadow: 0 0 0 3px rgba(0,137,123,0.15);
}
.gen-textarea-readonly {
    background-color: #FAFAFA !important;
    color: #546E7A;
    border-color: #E0E0E0;
}
.gen-input {
    font-size: 0.83rem;
    border: 1px solid #CFD8DC;
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.gen-input:focus {
    border-color: #00897B;
    box-shadow: 0 0 0 3px rgba(0,137,123,0.15);
}

/* Pre blocks */
.gen-pre {
    background: #FAFAFA;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 0;
    font-size: 0.8rem;
    max-height: 300px;
    overflow-y: auto;
    color: #37474F;
}

/* Parameter group header */
.gen-group-header {
    font-weight: 700;
    font-size: 0.82rem;
    color: #00695C;
    padding: 6px 12px;
    background: #E0F2F1;
    border-radius: 6px;
    border-left: 3px solid #00897B;
}

/* Parameter row */
.gen-param-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #F5F5F5;
}
.gen-param-row:last-child {
    border-bottom: none;
}
.gen-param-label {
    flex: 0 0 320px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.gen-param-name {
    font-weight: 600;
    font-size: 0.8rem;
    color: #37474F;
}
.gen-param-marks {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #E0F2F1;
    color: #00695C;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}
.gen-param-input {
    flex: 1;
}

/* Buttons */
.gen-btn-preview {
    background: #00897B;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0,137,123,0.3);
    transition: all 0.2s ease;
}
.gen-btn-preview:hover {
    background: #00796B;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,137,123,0.4);
    transform: translateY(-1px);
}

.gen-btn-save {
    background: #2E7D32;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(46,125,50,0.3);
    transition: all 0.2s ease;
}
.gen-btn-save:hover {
    background: #1B5E20;
    color: #fff;
    box-shadow: 0 4px 12px rgba(46,125,50,0.4);
    transform: translateY(-1px);
}

.gen-btn-back {
    background: #fff;
    color: #546E7A;
    border: 1px solid #B0BEC5;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.gen-btn-back:hover {
    background: #ECEFF1;
    color: #37474F;
    border-color: #90A4AE;
}

.gen-btn-cancel {
    background: #fff;
    color: #C62828;
    border: 1px solid #EF9A9A;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.gen-btn-cancel:hover {
    background: #FFEBEE;
    color: #B71C1C;
    border-color: #E57373;
}

/* ===== Split View Layout (Index Results) ===== */
.split-view-container {
    height: 100vh;
    height: 100dvh; /* full viewport for a comfortable editing workspace; dvh avoids mobile URL-bar overflow */
    border: 1px solid #E0E0E0;
    border-radius: var(--mat-radius);
    overflow: hidden;
    box-shadow: var(--mat-card-shadow);
    background: #fff;
}

.split-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
}

.split-panel-left {
    border-right: 2px solid #E0E0E0;
    position: relative; /* anchors the floating PDF control pill */
}

.split-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #fff;
    background: var(--mat-dark-secondary);
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.split-panel-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.split-panel-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 10px 16px;
    border-top: 1px solid #E0E0E0;
    background: var(--mat-grey-bg);
    flex-shrink: 0;
}

.pdf-panel-body {
    background: #F5F5F5;
    padding: 0 0 68px; /* bottom room so the floating pill never permanently hides the page */
    overflow: auto;
    cursor: grab;
}

.pdf-panel-body:active {
    cursor: grabbing;
}

/* ===== Floating PDF control pill (page nav · zoom · rotate) ===== */
.pdf-float-toolbar {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px 8px;
    background: rgba(38, 43, 54, 0.92);
    border-radius: 999px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
    z-index: 20;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.pdf-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #EAECEF;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.pdf-tb-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.pdf-tb-btn:active {
    background: rgba(255, 255, 255, 0.24);
}

.pdf-tb-btn:disabled {
    opacity: 0.35;
    cursor: default;
    background: transparent;
    color: #EAECEF;
}

/* Zoom level, styled as an inner pill (click to reset to 100%) */
.pdf-tb-zoom {
    border: none;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 5px 12px;
    margin: 0 2px;
    min-width: 54px;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s;
}

.pdf-tb-zoom:hover {
    background: rgba(255, 255, 255, 0.24);
}

.pdf-tb-page {
    color: #EAECEF;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0 6px;
    min-width: 46px;
    text-align: center;
    user-select: none;
    white-space: nowrap;
}

.pdf-tb-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.22);
    margin: 0 5px;
    flex-shrink: 0;
}

.pdf-page-image {
    width: 100%;
    height: auto;
    display: block;
    transition: width 0.15s ease, transform 0.15s ease;
    transform-origin: center center;
}

/* ===== Transcript Page Tabs (jump + drag-reorder) ===== */
.transcript-tabs-footer {
    justify-content: flex-start;
    gap: 0;
    overflow: hidden;
}

.page-tabs-list {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 2px;
}

.page-tab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    border: 1px solid #CFD8DC;
    background: #fff;
    color: #455A64;
    border-radius: 16px;
    padding: 3px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.page-tab:hover {
    background: var(--mat-grey-bg);
    border-color: var(--mat-primary, #1565C0);
}

.page-tab.active {
    background: var(--mat-primary, #1565C0);
    border-color: var(--mat-primary, #1565C0);
    color: #fff;
}

.page-tab.active .page-tab-grip {
    color: rgba(255, 255, 255, 0.7);
}

.page-tab-grip {
    font-size: 0.7rem;
    color: #B0BEC5;
    cursor: grab;
}

.page-tab.dragging {
    opacity: 0.4;
}

.page-tab-placeholder {
    flex: 0 0 auto;
    border: 2px dashed var(--mat-primary, #1565C0);
    border-radius: 16px;
    min-width: 70px;
    height: 26px;
    background: rgba(21, 101, 192, 0.06);
}

/* ===== Page discard (WYSIWYG: discarded pages are excluded from the analysis) ===== */
.page-tab-discard {
    display: inline-flex;
    align-items: center;
    margin-left: 2px;
    color: #90A4AE;
    cursor: pointer;
}

.page-tab-discard:hover {
    color: var(--mat-danger, #c62828);
}

.page-tab.active .page-tab-discard {
    color: rgba(255, 255, 255, 0.75);
}

.page-tab.discarded {
    background: #ECEFF1;
    border-style: dashed;
    color: #90A4AE;
    text-decoration: line-through;
}

.page-tab.discarded .page-tab-discard {
    color: var(--mat-success, #2e7d32);
    text-decoration: none;
}

.page-tab.discarded.active {
    background: #CFD8DC;
    border-color: #90A4AE;
    color: #546E7A;
}

.page-discard-banner {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--mat-warning-bg, #FFF8E1);
    color: #8D6E63;
    border: 1px dashed var(--mat-warning, #F9A825);
    border-radius: 6px;
    padding: 6px 10px;
    margin: 8px 8px 4px 8px;
    font-size: 0.8rem;
}

/* ===== PDF Zoom Controls ===== */
.pdf-zoom-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
    padding: 2px 4px;
}

.pdf-zoom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: rgba(255,255,255,0.8);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.pdf-zoom-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.pdf-zoom-btn:active {
    background: rgba(255,255,255,0.3);
    transform: scale(0.92);
}

.pdf-zoom-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pdf-zoom-btn:disabled:hover {
    background: transparent;
}

.pdf-zoom-level {
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    min-width: 38px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    user-select: none;
}

.transcript-panel-body {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.transcript-text {
    white-space: pre-wrap;
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--mat-dark);
}

.transcript-textarea {
    width: 100%;
    height: 100%;
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    padding: 20px 24px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--mat-dark);
    background: #fff;
    white-space: pre-wrap;
    overflow-y: auto;
}

.transcript-textarea:focus {
    outline: none;
    box-shadow: none;
    background: #FAFFFE;
}

.page-indicator {
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.8;
}

/* ===== Detailed Feedback / Score Input Panel ===== */
.score-input-panel {
    border: 1px solid #E0E0E0;
    border-radius: var(--mat-radius-lg);
    overflow: hidden;
    background: #fff;
    box-shadow: var(--mat-card-shadow);
    margin-top: 1rem;
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

/* Header */
.score-panel-header {
    display: flex;
    flex-direction: column;
    padding: 14px 24px;
    font-weight: 600;
    font-size: 1rem;
    color: #fff;
    background: var(--mat-primary-dark);
    letter-spacing: 0.3px;
    gap: 5px;
}

.score-panel-col-labels {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-shrink: 0;
}

.score-col-label-ai {
    font-size: 0.78rem;
    font-weight: 500;
    opacity: 0.9;
    min-width: 80px;
    text-align: right;
}

.score-col-label-you {
    font-size: 0.78rem;
    font-weight: 500;
    opacity: 0.9;
    min-width: 100px;
    text-align: center;
}

.score-panel-subtitle {
    font-size: 0.78rem;
    font-weight: 400;
    opacity: 0.78;
    letter-spacing: 0;
}

/* Body */
.score-panel-body {
    padding: 12px 24px 20px;
}

/* Group header row */
.score-group-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--mat-primary-dark);
    background: var(--mat-primary-bg);
    padding: 7px 14px;
    border-radius: 6px;
    margin: 16px 0 6px;
}

.score-group-range {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--mat-primary-dark);
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.75;
}

/* Each parameter row */
.score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 10px;
    border-bottom: 1px solid #EEF2F2;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    border-radius: 4px;
    margin-bottom: 2px;
}

.score-row:hover {
    background: #F5FFFE;
    border-left-color: var(--mat-primary);
}

.score-row:last-child {
    border-bottom: none;
}

/* Left side: icon + name + description */
.score-row-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.score-row-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.score-row-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.score-row-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--mat-dark-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.score-row-desc {
    font-size: 0.78rem;
    color: var(--mat-grey);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Right side: model score + feedback btn + user input */
.score-row-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.score-model-badge {
    font-size: 0.95rem;
    font-weight: 700;
    min-width: 52px;
    text-align: right;
    line-height: 1;
}

.score-outof {
    font-weight: 400;
    font-size: 0.78rem;
    color: var(--mat-grey-light);
}

/* Feedback detail icon button */
.score-feedback-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: var(--mat-primary-bg);
    color: var(--mat-primary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.15s;
    flex-shrink: 0;
    padding: 0;
}

.score-feedback-btn:hover {
    background: var(--mat-primary);
    color: #fff;
    transform: scale(1.12);
}

.score-feedback-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,137,123,0.25);
}

/* Senior-evaluator instructions button — sits on the dark green Detailed Feedback header */
.score-instructions-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255,255,255,0.55);
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.score-instructions-btn:hover {
    background: #fff;
    color: var(--mat-primary-dark);
    transform: scale(1.1);
}

.score-instructions-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.35);
}

.score-feedback-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    font-size: 0.82rem;
    color: #ccc;
    flex-shrink: 0;
}

/* User score input */
.score-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.score-user-input {
    width: 58px;
    padding: 6px 6px;
    font-size: 0.92rem;
    font-weight: 700;
    text-align: center;
    border: 2px solid #CFD8DC;
    border-radius: 8px;
    color: var(--mat-accent);
    background: #F8FBFF;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    -moz-appearance: textfield;
}

.score-user-input::-webkit-outer-spin-button,
.score-user-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.score-user-input:focus {
    outline: none;
    border-color: var(--mat-accent);
    box-shadow: 0 0 0 3px rgba(21,101,192,0.15);
    background: #fff;
}

.score-user-input:not(:placeholder-shown) {
    border-color: var(--mat-accent);
    background: #EFF6FF;
}

.score-user-input.over-max {
    border-color: var(--mat-danger);
    color: var(--mat-danger);
    background: var(--mat-danger-bg);
}

.score-input-max {
    font-size: 0.78rem;
    color: var(--mat-grey-light);
    white-space: nowrap;
}

/* Evaluator score as a typeable dropdown (combobox): the input keeps the chip look, a caret hints at
   the menu, and the menu opens on focus/click and filters as you type. The input stays an <input>, so
   the existing :placeholder-shown "filled" rule above handles the empty/filled chip styling. */
.score-combo {
    position: relative;
    display: inline-block;
}

/* Down-caret drawn as a CSS triangle; clicks pass through to the input. */
.score-combo::after {
    content: "";
    position: absolute;
    right: 8px;
    top: 50%;
    margin-top: -2px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #90A4AE;
    pointer-events: none;
}

.score-combo .score-user-input {
    width: 74px;
    padding-right: 18px;   /* room for the caret */
    cursor: pointer;
}

.score-combo-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 30;
    min-width: 100%;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: #fff;
    border: 1px solid #CFD8DC;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
    max-height: 180px;
    overflow-y: auto;
}

/* Author display rules below would otherwise beat the UA [hidden] default — keep them hidden. */
.score-combo-menu[hidden],
.score-combo-opt[hidden] {
    display: none;
}

.score-combo-opt {
    padding: 5px 10px;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    color: var(--mat-accent);
    border-radius: 6px;
    cursor: pointer;
}

.score-combo-opt:hover,
.score-combo-opt.active {
    background: var(--mat-accent);
    color: #fff;
}

/* Review/Finalize page: score is a plain editable text input (0.25 fine-tuning, no dropdown menu). */
.eval-score-input {
    padding: 5px 8px;
    border: 1px solid #CFD8DC;
    border-radius: 6px;
    background: #fff;
    -moz-appearance: textfield;
}

.eval-score-input:focus {
    outline: none;
    border-color: var(--mat-accent);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

/* ===== Bottom-right app toasts (delete/restore confirmations) ===== */
.app-toast {
    background: #263238;
    color: #fff;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-width: 340px;
}

.app-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Deleted feedback points (restorable bin under each list) ===== */
.deleted-points-list .list-group-item {
    opacity: 0.75;
    background: var(--mat-grey-bg, #f5f5f5) !important;
    border-style: dashed !important;
    cursor: default !important;
}

.deleted-points-list .positive-check,
.deleted-points-list .improvement-check,
.deleted-points-list .drag-handle,
.deleted-points-list .delete-positive-btn,
.deleted-points-list .delete-improvement-btn {
    display: none;
}

.restore-point-btn {
    display: none;
    white-space: nowrap;
}

.deleted-points-list .restore-point-btn {
    display: inline-block;
}

/* Totals row */
.score-totals-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--mat-grey-bg);
    border-radius: 8px;
    border: 1px solid #E0E0E0;
}

.score-totals-label {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--mat-dark-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-totals-values {
    display: flex;
    gap: 12px;
    align-items: center;
}

.score-totals-model {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--mat-grey);
    background: #fff;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    padding: 5px 14px;
}

.score-totals-user {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--mat-accent);
    background: var(--mat-accent-bg);
    border: 1px solid #BBDEFB;
    border-radius: 6px;
    padding: 5px 14px;
}

/* Bootstrap Popover override for feedback detail */
.feedback-popover {
    max-width: 380px;
    font-size: 0.88rem;
}

.feedback-popover .popover-header {
    background: var(--mat-primary-dark);
    color: #fff;
    font-weight: 600;
    font-size: 0.88rem;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    padding: 10px 14px;
}

.feedback-popover .popover-body {
    color: var(--mat-dark);
    line-height: 1.7;
    padding: 12px 16px;
    font-size: 0.85rem;
}

/* ===== Unified Transcript View ===== */
.transcript-unified-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 0;
}

.confidence-legend {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 8px 14px;
    margin: 0;
    background: #F5F7F7;
    border-bottom: 1px solid #E0E0E0;
    font-size: 0.73rem;
    font-weight: 500;
    color: var(--mat-grey);
    flex-shrink: 0;
}

.confidence-legend-label {
    font-weight: 600;
    color: var(--mat-dark-secondary);
    font-size: 0.74rem;
}

.confidence-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Legend dots */
.conf-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.conf-dot-high {
    background: var(--mat-success);
}

.conf-dot-medium {
    background: #F57C00;
}

.conf-dot-low {
    background: var(--mat-danger);
}

/* Lines container — the single contenteditable host for the whole page's transcript, so native
   arrow-key navigation and writing-aid underlines span every line at once. */
.unified-lines-container {
    flex: 1;
    padding: 8px 0 8px 12px;
    overflow-y: auto;
    cursor: text;
}

/* Each line row (block, not flex, so vertical caret movement across lines is reliable) */
.unified-line {
    display: block;
    border-left: 4px solid transparent;
    margin: 0 0 2px 0;
    transition: background 0.15s;
    position: relative;
    min-height: 1.8em;
    background: transparent;
}

/* Paragraph spacer (empty line) */
.unified-line-spacer {
    height: 12px;
    border: none;
    background: transparent;
}

/* Confidence indicators — thick left border only, no background */
.conf-indicator-high {
    border-left-color: var(--mat-success);
}

.conf-indicator-medium {
    border-left-color: #F57C00;
}

.conf-indicator-low {
    border-left-color: var(--mat-danger);
}

/* Editable text per line (block child of the contenteditable container; editability inherited) */
.unified-line-text {
    padding: 3px 16px 3px 12px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--mat-dark);
    outline: none;
    border: none;
    background: transparent;
    word-break: break-word;
    white-space: pre-wrap;
    min-height: 1.8em;
    cursor: text;
}

/* Subtle cue that the transcript is being edited (focus lives on the container now, not per line) */
.unified-lines-container:focus {
    outline: none;
}

/* OCR strikeout markers (~struck out~): rendered struck-through; the literal tildes stay in the
   element so the contenteditable save path (textContent) round-trips the stored text unchanged. */
.transcript-strike {
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
    opacity: 0.55;
}

/* Modified line indicator (small blue dot) */
.unified-line.modified::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--mat-accent);
    opacity: 0.7;
}

/* Fallback textarea inside unified view */
.transcript-fallback {
    width: 100%;
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    padding: 20px 24px;
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--mat-dark);
    background: #fff;
    white-space: pre-wrap;
    overflow-y: auto;
}

.transcript-fallback:focus {
    outline: none;
    box-shadow: none;
    background: #FAFFFE;
}

/* ===================================================================== */
/* ===== Redesign (Phase 1): stages, inheritance, clients, test bench === */
/* ===================================================================== */

/* ----- Inheritance badges (used on Central Library, genre editor, clients) ----- */
.inherit-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    line-height: 1.4;
    white-space: nowrap;
}
.inherit-badge i { font-size: 0.72rem; }
/* Overridden at this level (a real local value exists) */
.inherit-badge-overridden {
    background: var(--mat-success-bg);
    color: var(--mat-success);
    border: 1px solid #A5D6A7;
}
/* Inheriting the default from up the chain */
.inherit-badge-inherited {
    background: var(--mat-grey-bg);
    color: var(--mat-grey);
    border: 1px solid #CFD8DC;
}
/* Inherited specifically from Central Library (read-only at this level) */
.inherit-badge-central {
    background: #EDE7F6;
    color: #4527A0;
    border: 1px solid #D1C4E9;
}

/* ----- Stage tags (which pipeline stage a block feeds) ----- */
.stage-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.stage-tag-1   { background: #E0F2F1; color: #00695C; }   /* Transcribe */
.stage-tag-2   { background: #FFF3E0; color: #E65100; }   /* Proofread */
.stage-tag-3   { background: #EDE7F6; color: #4527A0; }   /* Genre evaluation */
.stage-tag-all { background: #ECEFF1; color: #37474F; }   /* Persona — all stages */

/* ----- Stage sections (genre editor grouped by pipeline stage) ----- */
.stage-section {
    border: 1px solid #E0E0E0;
    border-radius: var(--mat-radius);
    background: #fff;
    box-shadow: var(--mat-card-shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.stage-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    color: #fff;
    cursor: pointer;
    user-select: none;
}
.stage-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}
.stage-section-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}
.stage-section-sub {
    font-size: 0.74rem;
    font-weight: 400;
    opacity: 0.85;
}
.stage-section-body { padding: 16px 18px; }
.stage-section-chevron { transition: transform 0.2s ease; }
.stage-section.collapsed .stage-section-chevron { transform: rotate(-90deg); }
.stage-section.collapsed .stage-section-body { display: none; }

/* Per-stage header colours */
.stage-section-header-1 { background: linear-gradient(135deg, #00897B, #00695C); }   /* Transcribe */
.stage-section-header-2 { background: linear-gradient(135deg, #F57C00, #E65100); }   /* Proofread */
.stage-section-header-3 { background: linear-gradient(135deg, #5E35B1, #4527A0); }   /* Genre evaluation */

/* A read-only "inherited from Central Library" block inside a stage */
.inherited-block {
    border: 1px dashed #C5CAE9;
    border-radius: 6px;
    background: #FAFAFE;
    padding: 12px 14px;
}
.inherited-block .inherited-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.inherited-block pre {
    background: #fff;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    padding: 10px 12px;
    margin: 0;
    font-size: 0.78rem;
    max-height: 180px;
    overflow-y: auto;
    color: #455A64;
    white-space: pre-wrap;
}

/* ----- Test Bench steps (Home reframe) ----- */
.tb-step {
    border: 1px solid #E0E0E0;
    border-radius: var(--mat-radius);
    background: #fff;
    box-shadow: var(--mat-card-shadow);
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.tb-step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: var(--mat-dark-secondary);
    color: #fff;
}
.tb-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--mat-primary);
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}
.tb-step-title { font-weight: 600; font-size: 0.95rem; letter-spacing: 0.3px; }
.tb-step-sub { font-size: 0.74rem; font-weight: 400; opacity: 0.8; margin-left: auto; }
.tb-step-body { padding: 16px 18px; }
.tb-resolved {
    font-size: 0.82rem;
    color: var(--mat-grey);
    background: var(--mat-primary-bg);
    border-radius: 6px;
    padding: 8px 12px;
    border-left: 3px solid var(--mat-primary);
}

/* Assembled-prompt preview tabs */
.tb-prompt-area {
    width: 100%;
    border: 1px solid #CFD8DC;
    border-radius: 6px;
    padding: 12px 14px;
    font-family: var(--bs-font-monospace, monospace);
    font-size: 0.8rem;
    line-height: 1.55;
    color: #37474F;
    background: #FAFAFA;
    min-height: 320px;
    white-space: pre-wrap;
    resize: vertical;
}

/* ----- Client cards ----- */
.client-card {
    display: block;
    border: 1px solid #E0E0E0;
    border-radius: var(--mat-radius);
    background: #fff;
    box-shadow: var(--mat-card-shadow);
    padding: 18px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
    height: 100%;
}
.client-card:hover {
    box-shadow: var(--mat-card-shadow-hover);
    transform: translateY(-2px);
    border-color: var(--mat-primary-light);
    color: inherit;
}
.client-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--mat-primary-bg);
    color: var(--mat-primary-dark);
    font-size: 1.3rem;
    margin-bottom: 10px;
}
.client-card-name { font-weight: 700; font-size: 1rem; color: var(--mat-dark); }
.client-card-central {
    background: #EDE7F6;
    color: #4527A0;
}

/* Small note line shared by relabeled admin pages */
.ia-note {
    font-size: 0.85rem;
    color: var(--mat-grey);
    background: #fff;
    border: 1px solid #E0E0E0;
    border-left: 3px solid var(--mat-primary);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 1rem;
}
.ia-note .ia-chain {
    font-family: var(--bs-font-monospace, monospace);
    font-size: 0.8rem;
    color: var(--mat-dark-secondary);
    background: var(--mat-grey-bg);
    border-radius: 4px;
    padding: 1px 6px;
}

/* ===== Writing-check inline highlights (transcript review) =====
   Underline + faint background only, so they coexist with the confidence left borders
   and the .modified line markers. Colour-coded per SPaG error type. */
.spag-err {
    border-bottom: 2px solid;
    border-radius: 1px;
    cursor: pointer;
}
.spag-err-spelling             { border-color: var(--mat-danger);  background: var(--mat-danger-bg); }
.spag-err-grammar              { border-color: var(--mat-accent);  background: var(--mat-accent-bg); }
.spag-err-punctuation          { border-color: var(--mat-warning); background: var(--mat-warning-bg); }
.spag-err-capitalisation       { border-color: #6A1B9A;            background: #F3E5F5; }
.spag-err-sentenceConstruction { border-color: var(--mat-primary); background: var(--mat-primary-bg); }

/* Status chip in the transcript panel header (dark background) */
.spag-status {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
}
.spag-status .spinner-border-sm { width: 0.7rem; height: 0.7rem; border-width: 2px; }
.spag-status-ok     { background: rgba(255,255,255,0.15); }
.spag-status-issues { background: var(--mat-warning); }
.spag-status-stale  { background: var(--mat-grey-light); }
.spag-status-error  { background: var(--mat-danger); }

/* Shared read-only popover (Grammarly-style card) */
.spag-popover {
    position: fixed;
    z-index: 1080;
    max-width: 320px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    padding: 0.75rem 0.9rem;
    font-size: 0.85rem;
    color: var(--mat-dark);
}
.spag-popover-header { margin-bottom: 0.4rem; }
.spag-type-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    color: #fff;
}
.spag-badge-spelling             { background: var(--mat-danger); }
.spag-badge-grammar              { background: var(--mat-accent); }
.spag-badge-punctuation         { background: var(--mat-warning); }
.spag-badge-capitalisation      { background: #6A1B9A; }
.spag-badge-sentenceConstruction { background: var(--mat-primary); }
.spag-popover-mistake {
    color: var(--mat-grey);
    text-decoration: line-through;
    margin-bottom: 0.25rem;
    overflow-wrap: anywhere;
}
.spag-popover-correction {
    color: var(--mat-dark-secondary);
    font-weight: 500;
    overflow-wrap: anywhere;
}

/* Issue list panel (opens from the status chip) */
.spag-issue-list {
    position: fixed;
    z-index: 1080;
    width: 360px;
    max-width: 90vw;
    max-height: 50vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    padding: 0.5rem;
    font-size: 0.82rem;
    color: var(--mat-dark);
}
.spag-issue-row {
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--mat-grey-bg);
}
.spag-issue-row:last-child { border-bottom: none; }
.spag-issue-ref {
    margin-left: 0.4rem;
    font-size: 0.72rem;
    color: var(--mat-grey);
}
.spag-issue-body { display: block; margin-top: 0.2rem; }
.spag-issue-mistake {
    color: var(--mat-grey);
    text-decoration: line-through;
    margin-right: 0.4rem;
    overflow-wrap: anywhere;
}
.spag-issue-correction {
    color: var(--mat-dark-secondary);
    font-weight: 500;
    overflow-wrap: anywhere;
}

/* ===== Evaluator dashboard (client sidebar + inbox/outbox) ===== */
.mat-fixed-table { table-layout: fixed; width: 100%; }
.mat-fixed-table td, .mat-fixed-table th { overflow: hidden; }
.mat-file-actions { display: flex; gap: .25rem; flex-wrap: nowrap; }
.mat-client-item {
    display: flex;
    align-items: center;
    gap: .25rem;
    border: 0;
    border-radius: .375rem;
}
.mat-client-item.active {
    background: var(--mat-primary);
    border-color: var(--mat-primary);
    color: #fff;
}
.mat-client-item.active .mat-badge { background: #fff; color: var(--mat-primary); }
/* Drag-to-reorder affordance: grip handle + dragging state (order saved per evaluator in localStorage) */
.mat-client-grip { cursor: grab; opacity: .4; flex-shrink: 0; }
.mat-client-item:hover .mat-client-grip { opacity: .75; }
.mat-client-item.active .mat-client-grip { opacity: .85; }

/* Paper-type badges in the inbox/outbox Name column: solid green "C" = comprehension-only
   (direct marks entry, no AI), outlined "C+W" = mixed (comprehension part + creative writing). */
.mat-paper-badge {
    display: inline-block;
    min-width: 1.35rem;
    padding: 0 .3rem;
    margin-right: .35rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.25rem;
    text-align: center;
    vertical-align: text-bottom;
}
.mat-paper-badge-comp { background: var(--mat-success); color: #fff; }
.mat-paper-badge-mixed { background: var(--mat-success-bg); color: var(--mat-success); border: 1px solid var(--mat-success); }
/* Reopened-for-revision pill (evaluator inbox Type column) — amber, reads as "needs attention". */
.mat-paper-badge-reopened { background: var(--mat-warning-bg, #FFF3E0); color: var(--mat-warning, #F57C00); border: 1px solid var(--mat-warning, #F57C00); }

/* Fixed, wrap-capable "Type" column: the paper-type pill + any status pill (R) sit here and wrap. */
.mat-pill-col { display: flex; flex-wrap: wrap; gap: .2rem; }
.mat-pill-col .mat-paper-badge { margin-right: 0; }

/* (+) expander in the Name cell that reveals a row's reference-document sub-row. */
.mat-doc-toggle {
    flex-shrink: 0;
    width: 1.15rem; height: 1.15rem;
    margin: .1rem .4rem 0 0;
    padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--mat-success, #0F6E56);
    border-radius: 50%;
    background: var(--mat-success-bg, #E6F2EE);
    color: var(--mat-success, #0F6E56);
    font-size: .62rem; line-height: 1;
    cursor: pointer;
}
.mat-doc-toggle:hover,
.mat-doc-toggle[aria-expanded="true"] { background: var(--mat-success, #0F6E56); color: #fff; }

/* Reference-documents sub-row: graceful height/opacity reveal below the main row. */
.mat-doc-subrow > td { background: var(--mat-success-bg, #f3f8f6); }
.mat-doc-subrow-inner {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 1rem;
    transition: max-height .2s ease, opacity .2s ease, padding .2s ease;
}
.mat-doc-subrow.open .mat-doc-subrow-inner { max-height: 12rem; opacity: 1; padding: .5rem 1rem; }
.mat-doc-items { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center; }
.mat-doc-item { display: inline-flex; align-items: center; gap: .4rem; }
.mat-doc-label { font-weight: 600; color: var(--mat-dark, #263238); }
.mat-client-item.dragging { opacity: .5; }

/* ===== Assigned-task breadcrumb bar (Run Analysis / Stage screens + Evaluate popup) ===== */
.eval-crumb-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid var(--mat-border, #e0e0e0);
    border-radius: 8px;
    padding: 8px 14px;
}
.eval-crumb-task { font-weight: 600; color: var(--mat-dark); max-width: 40%; }
.eval-crumb { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.eval-crumb-item { color: var(--mat-dark-secondary); font-size: 0.88rem; }
.eval-crumb-sep { color: var(--mat-grey); font-size: 0.7rem; }

/* ===== SLA countdown sub-line (evaluator inbox + admin tracking) ===== */
.js-sla-countdown { color: var(--mat-grey-light, #90A4AE); white-space: nowrap; }
.js-sla-countdown.sla-warn { color: #F57C00; font-weight: 600; }              /* amber — ≤ 6h left */
.js-sla-countdown.sla-overdue { color: var(--mat-danger, #dc3545); font-weight: 700; } /* red — past due */

/* ===== Basic rich-text editor (rubric evaluator instructions) ===== */
.rich-text-editor {
    min-height: 92px;
    max-height: 320px;
    height: auto;
    overflow-y: auto;
    line-height: 1.5;
}
.rich-text-editor:focus {
    outline: none;
}
.rich-text-editor ul,
.rich-text-editor ol { padding-left: 1.4rem; margin-bottom: 0.4rem; }
.rich-text-editor p { margin-bottom: 0.4rem; }
.rich-text-toolbar .btn { line-height: 1; }

/* Rendered instructions (Detailed Feedback modal) — lists need their indentation back. */
.rubric-instructions-display ul,
.rubric-instructions-display ol { padding-left: 1.4rem; margin-bottom: 0.5rem; }
.rubric-instructions-display p { margin-bottom: 0.5rem; }
.rubric-instructions-display :last-child { margin-bottom: 0; }

/* ===== Evaluator inbox page picker (pre-OCR page exclusion) ===== */
.picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.5rem;
    max-height: 62vh;
    overflow-y: auto;
}
.picker-thumb {
    position: relative;
    border: 2px solid var(--mat-border, #dee2e6);
    border-radius: 6px;
    background: #fff;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease;
}
.picker-thumb:hover { border-color: var(--mat-primary, #1976D2); }
.picker-thumb img { display: block; width: 100%; height: auto; }
.picker-thumb .picker-page-num {
    display: block;
    font-size: 0.75rem;
    color: var(--mat-grey, #6c757d);
    padding: 2px 0 4px;
    text-align: center;
    background: #fff;
}
.picker-thumb .picker-x {
    display: none;
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--mat-danger, #d32f2f);
    color: #fff;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}
.picker-thumb.excluded { border-color: var(--mat-danger, #d32f2f); }
.picker-thumb.excluded img { filter: grayscale(1); opacity: 0.35; }
.picker-thumb.excluded .picker-x { display: inline-block; }

/* Page-picker magnify lightbox (fixed overlay above the Bootstrap modal) */
.picker-zoom {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--mat-border, #dee2e6);
    border-radius: 50%;
    color: var(--mat-primary, #1976D2);
    font-size: 0.95rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.picker-zoom:hover { background: var(--mat-primary, #1976D2); color: #fff; }
.picker-thumb.excluded .picker-zoom { filter: none; opacity: 1; }

.picker-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1080; /* above the Bootstrap modal (1055) + its backdrop */
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    flex-direction: column;
}
.picker-lightbox-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    color: #fff;
}
.picker-lightbox-btn { background: rgba(255,255,255,0.92); }
.picker-lightbox-btn-danger { color: var(--mat-danger, #d32f2f); }
.picker-lightbox-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 0;
    padding: 0 0.5rem 1rem;
}
.picker-lightbox-stage {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}
.picker-lightbox-img {
    max-width: 100%;
    max-height: calc(100vh - 90px);
    background: #fff;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    border-radius: 4px;
}
.picker-lightbox-nav {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 0;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.picker-lightbox-nav:hover { background: rgba(255,255,255,0.35); }

/* ── Notification bell / feed ─────────────────────────────────────────── */
.mat-notif .mat-notif-badge {
    position: absolute;
    top: 2px;
    right: 0;
    font-size: 0.6rem;
    padding: 0.15em 0.4em;
    line-height: 1;
}
.mat-notif-menu {
    width: 360px;
    max-width: 92vw;
    padding: 0;
    overflow: hidden;
}
/* The navbar styles ALL its dropdowns dark (.mat-navbar .dropdown-menu). The notification feed is a
   light panel, so override the dark background here — same specificity (0,2,0) but defined later, so it
   wins — without touching the shared navbar rule (the user/Sign-out menu stays dark on purpose). */
.mat-navbar .mat-notif-menu {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    color: #212529;
}
.mat-notif-head {
    background: #f8f9fa;
    color: #212529;
}
.mat-notif-markall { text-decoration: none; }
.mat-notif-list {
    max-height: 60vh;
    overflow-y: auto;
}
.mat-notif-item {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    white-space: normal;
}
.mat-notif-item:last-child { border-bottom: 0; }
.mat-notif-item:hover { background: #f5f7fa; }
.mat-notif-item.mat-notif-unread { background: #eef4ff; }
.mat-notif-item.mat-notif-unread:hover { background: #e3edff; }
.mat-notif-title { font-weight: 600; color: #1f2937; }
.mat-notif-msg { white-space: normal; color: #6c757d; }
.mat-notif-time { font-size: 0.72rem; margin-top: 2px; color: #6c757d; }
.mat-notif-empty { color: #6c757d; }
