/* ─── Reset & Base ────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    color: #333;
    display: flex;
    min-height: 100vh;
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 8px;
    background: #fff;
    color: #334155;
}

.language-switcher-label {
    padding: 0 4px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    line-height: 1;
}

.language-switcher button {
    min-width: 32px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.language-switcher button.active {
    background: #e0f2fe;
    color: #075985;
}

.language-switcher button:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 2px;
}

.public-language-switcher {
    background: #f8fafc;
    border-color: var(--public-line);
}

.public-nav-actions .language-switcher {
    min-height: 42px;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
    width: 220px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.22s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    font-size: 22px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.logo-mark {
    flex: 0 0 auto;
}

.logo-text {
    white-space: nowrap;
}

.sidebar-toggle {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(255,255,255,0.08);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.14);
}

.nav-tabs {
    list-style: none;
    margin-top: 20px;
    flex: 1 1 auto;
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px 16px 18px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
}

.sidebar-footer-title {
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
}

.sidebar-footer-subtitle {
    margin-top: 4px;
    font-size: 11px;
    color: rgba(226, 232, 240, 0.78);
    line-height: 1.4;
}

.sidebar-footer-controls {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-tabs li {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    white-space: normal;
}

.nav-icon {
    flex: 0 0 20px;
    text-align: center;
}

.nav-label {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.28;
    font-size: 15px;
}

.lang-en .nav-label {
    font-size: 12px;
    line-height: 1.18;
}

.nav-tabs li:hover { background: rgba(255,255,255,0.05); }
.nav-tabs li.active {
    background: rgba(255,255,255,0.1);
    border-left-color: #4fc3f7;
}

/* ─── Content ────────────────────────────────────────────── */
.content {
    margin-left: 220px;
    padding: 30px;
    width: calc(100% - 220px);
    overflow-x: hidden;
    transition: margin-left 0.22s ease, width 0.22s ease;
}

.app-shell.sidebar-collapsed .sidebar {
    width: 72px;
}

.app-shell.sidebar-collapsed .content {
    margin-left: 72px;
    width: calc(100% - 72px);
}

.app-shell.sidebar-collapsed .logo-text,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .sidebar-footer-subtitle,
.app-shell.sidebar-collapsed .sidebar-footer-controls {
    display: none;
}

.app-shell.sidebar-collapsed .sidebar-header {
    padding-left: 12px;
    padding-right: 12px;
}

.app-shell.sidebar-collapsed .logo {
    justify-content: center;
    font-size: 18px;
}

.app-shell.sidebar-collapsed .sidebar-footer {
    padding-left: 10px;
    padding-right: 10px;
    text-align: center;
}

.app-shell.sidebar-collapsed .sidebar-footer-title {
    font-size: 11px;
}

.app-shell.sidebar-collapsed .nav-tabs li {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

.tab-content { display: none; overflow-x: hidden; }
.tab-content.active { display: block; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 { font-size: 24px; color: #1a1a2e; }
.section-header {
    gap: 10px;
    flex-wrap: wrap;
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn:hover { border-color: #4fc3f7; color: #4fc3f7; }

.btn-primary {
    background: #4fc3f7;
    color: #fff;
    border-color: #4fc3f7;
}

.btn-primary:hover { background: #29b6f6; }

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-success { background: #66bb6a; color: #fff; border-color: #66bb6a; }
.btn-danger { background: #ef5350; color: #fff; border-color: #ef5350; }
.btn-secondary { background: #78909c; color: #fff; border-color: #78909c; }

.export-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.question-meta-card {
    margin: 10px 0 14px;
    padding: 12px;
    border: 1px solid #e5edf5;
    border-radius: 10px;
    background: #f8fbff;
}

.question-meta-row,
.question-meta-admin-row,
.question-meta-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.question-meta-admin-row {
    margin-top: 10px;
}

.difficulty-badge,
.meta-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.difficulty-badge {
    background: #e8f3ff;
    color: #1d4ed8;
}

.q-difficulty-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    background: #fff2cc;
    color: #8a5a00;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.q-difficulty-empty {
    background: #eef2f7;
    color: #64748b;
}

.question-title-row,
.parent-flow-heading,
.detail-question-heading-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.question-title-row {
    margin: 0 0 12px 0;
    padding: 16px 16px 0 16px;
    color: #0f172a;
    font-size: 16px;
    font-weight: 800;
}

.question-title-row.standalone {
    padding: 0;
    margin-bottom: 10px;
}

.parent-flow-heading {
    margin-bottom: 8px;
}

.detail-question-heading-row {
    margin-bottom: 6px;
}

.difficulty-stars-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 3px 7px;
    border: 1px solid rgba(180, 83, 9, 0.16);
    border-radius: 999px;
    background: rgba(255, 251, 235, 0.86);
    color: #7c2d12;
    font-size: 12px;
    font-weight: 800;
}

.difficulty-stars-control.compact {
    font-size: 11px;
}

.difficulty-star-average,
.difficulty-star-count {
    white-space: nowrap;
}

.difficulty-star-count {
    color: #8a5a00;
    font-size: 11px;
    font-weight: 700;
}

.difficulty-star-buttons {
    display: inline-flex;
    align-items: center;
    gap: 1px;
}

.difficulty-star-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: #d1d5db;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    padding: 0 1px;
    transition: color 0.16s ease, transform 0.16s ease;
}

.difficulty-star-btn:hover,
.difficulty-star-btn.filled {
    color: #f59e0b;
}

.difficulty-star-btn.average-filled {
    color: #fbbf24;
}

.difficulty-star-btn.selected {
    color: #ea580c;
    transform: scale(1.12);
}

.difficulty-overview-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(180, 83, 9, 0.16);
    border-radius: 14px;
    background: rgba(254, 243, 199, 0.72);
    color: #7c2d12;
}

.difficulty-overview-card span,
.difficulty-overview-card em {
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}

.difficulty-overview-card strong {
    font-size: 14px;
    font-weight: 900;
}

.meta-status-pill {
    background: #eef2f7;
    color: #475569;
}

.question-meta-inline-label {
    font-size: 12px;
    color: #475569;
    font-weight: 700;
}

.question-meta-input {
    width: 82px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
}

.question-meta-ocr {
    margin-top: 10px;
}

.question-meta-textarea {
    width: 100%;
    min-height: 110px;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    resize: vertical;
    font-size: 13px;
    line-height: 1.5;
}

/* ─── Filters ────────────────────────────────────────────── */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters select, .filters input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.filters input[type="text"] { width: 200px; }

/* ─── Papers Grid ────────────────────────────────────────── */
.papers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.paper-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.paper-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.paper-card .paper-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a1a2e;
}

.paper-card .paper-info {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.paper-card .paper-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin-top: 10px;
}

.paper-card .status-processed { background: #e8f5e9; color: #2e7d32; }
.paper-card .status-pending { background: #fff3e0; color: #e65100; }

.paper-card .card-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

/* ─── Questions Grid ─────────────────────────────────────── */
.questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.question-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.question-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.question-card .q-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: top;
    border-bottom: 1px solid #eee;
}

.question-card .q-info {
    padding: 14px;
}

.question-card .q-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 6px;
}

.question-card .q-source {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

.question-card .q-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #e3f2fd;
    color: #1565c0;
    border-radius: 10px;
    font-size: 11px;
}

.question-card .q-actions {
    padding: 0 14px 14px;
    display: flex;
    gap: 8px;
}

/* ─── Pagination ─────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.pagination button.active {
    background: #4fc3f7;
    color: #fff;
    border-color: #4fc3f7;
}

/* ─── Export Layout ──────────────────────────────────────── */
.export-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    min-height: 600px;
}

.export-sidebar {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.export-sidebar h3 { margin-bottom: 12px; font-size: 16px; }

.export-sidebar input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 12px;
}

.export-edit-status {
    margin: -4px 0 10px;
    padding: 7px 9px;
    border: 1px solid #dbe4f0;
    border-radius: 6px;
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.export-edit-status.is-editing {
    border-color: rgba(14, 165, 233, 0.32);
    background: #eff6ff;
    color: #0369a1;
}

.export-paper-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.auto-compose-panel {
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid #dbe4f0;
    border-radius: 8px;
    background: #f8fafc;
}

.auto-compose-panel h3 {
    margin-bottom: 10px;
}

.compose-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.compose-grid label,
.compose-kp-rule label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.compose-grid label:first-child {
    grid-column: span 2;
}

.compose-grid select,
.compose-grid input,
.compose-kp-rule select,
.compose-kp-rule input {
    width: 100%;
    border: 1px solid #d8e2ee;
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff;
}

.compose-ratio-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 8px 0;
    font-size: 12px;
    font-weight: 800;
    color: #334155;
}

.compose-kp-rules {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.compose-kp-rule {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px 28px;
    gap: 8px;
    align-items: end;
}

.compose-kp-remove {
    height: 34px;
    border: 1px solid #fecaca;
    border-radius: 6px;
    background: #fff1f2;
    color: #b91c1c;
    cursor: pointer;
    font-weight: 900;
}

.compose-generate-btn {
    width: 100%;
    margin-top: 10px;
}

.compose-summary {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.4;
    color: #64748b;
}

.export-template-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.selected-list {
    max-height: 500px;
    overflow-y: auto;
}

.selected-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.selected-item-main {
    flex: 1;
    min-width: 0;
}

.selected-item-order {
    display: inline-flex;
    gap: 4px;
    flex: 0 0 auto;
}

.selected-order-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #d8e2ee;
    border-radius: 6px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    line-height: 1;
}

.selected-order-btn:disabled {
    color: #cbd5e1;
    cursor: not-allowed;
    background: #f8fafc;
}

.selected-item small {
    display: block;
    margin-top: 2px;
    color: #66736d;
    font-size: 11px;
}

.selected-item .remove-btn {
    border: none;
    background: transparent;
    color: #ef5350;
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    line-height: 1;
    padding: 2px 4px;
}

.export-used-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    vertical-align: middle;
}

.export-template-panel {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #e7edf4;
}

.export-template-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.export-template-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e4ebf5;
    border-radius: 8px;
    background: #f8fafc;
}

.export-paper-item.active {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.16);
}

.export-template-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
    color: #64748b;
}

.export-template-main strong {
    color: #0f172a;
    font-size: 13px;
}

.export-template-main em {
    font-style: normal;
}

.export-template-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.export-preview {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.export-preview h3 { margin-bottom: 12px; font-size: 16px; }

#preview-area {
    min-height: 400px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    color: #999;
    text-align: center;
}

.export-selection-bar {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 14px;
    background: rgba(15, 118, 110, 0.08);
}

.export-scope-label,
.detail-export-label,
.subq-inline-export-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.export-scope-count {
    flex: 0 0 auto;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: #0f5f58;
    font-size: 11px;
    font-weight: 800;
}

.subq-header-export {
    margin-left: auto;
    padding: 4px 8px;
    border: 1px solid rgba(31, 41, 35, 0.1);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
}

.export-preview-note,
.export-answer-hint {
    margin-bottom: 12px;
    padding: 9px 10px;
    border-radius: 12px;
    background: rgba(15, 118, 110, 0.08);
    color: #0f5f58;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
}

.export-preview-source {
    margin-bottom: 16px;
    text-align: left;
}

.export-preview-source-title {
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(31, 41, 35, 0.08);
    color: #18211f;
    font-size: 13px;
    font-weight: 800;
}

.export-preview-question {
    padding: 14px 0;
    border-bottom: 1px solid rgba(31, 41, 35, 0.1);
}

/* ─── Modal ──────────────────────────────────────────────── */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden { display: none; }

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover { color: #333; }

.modal-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 10px 0;
}

/* ─── Tag Tree ───────────────────────────────────────────── */
.tag-tree {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 12px;
    margin: 16px 0;
}

.tag-tree label {
    display: block;
    padding: 4px 0;
    cursor: pointer;
    font-size: 14px;
}

.tag-tree label.level-2 { padding-left: 0; font-weight: 600; }
.tag-tree label.level-3 { padding-left: 20px; font-weight: normal; }
.tag-tree label.level-4 { padding-left: 40px; font-size: 13px; color: #555; }

/* ─── Toast ──────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 12px 24px;
    background: #333;
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    animation: fadeIn 0.3s;
}

.toast.hidden { display: none; }

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

/* ─── Loading ────────────────────────────────────────────── */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #eee;
    border-top-color: #4fc3f7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

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

/* ─── Question Detail in Modal ───────────────────────────── */
.detail-section {
    margin: 20px 0;
}

.detail-section h4 {
    font-size: 16px;
    color: #1a1a2e;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #4fc3f7;
    display: inline-block;
}

.detail-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #666;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0;
}

.detail-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}

/* ─── General ─────────────────────────────────────────────── */
.hidden { display: none; }

/* ─── Import Progress ──────────────────────────────────── */
.import-progress {
    margin: 10px 0;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 13px;
}

.import-progress.hidden {
    display: none;
}

.process-progress {
    margin: 10px 0;
    padding: 12px;
    background: #f0f7ff;
    border-radius: 6px;
    font-size: 13px;
}

.process-progress.hidden {
    display: none;
}

.progress-bar {
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #66bb6a);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    color: #555;
    font-size: 12px;
}

.import-result {
    margin: 0;
}

/* ─── Question Browser (Split View) ─────────────────────── */
.question-browser {
    display: grid;
    grid-template-columns: 180px 220px minmax(0, 1fr);
    gap: 0;
    height: calc(100vh - 180px);
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.question-browser.no-kp-panel {
    grid-template-columns: 280px minmax(0, 1fr);
}

.question-list-panel {
    border-right: 1px solid #ddd;
    overflow-y: auto;
    background: #fafafa;
    display: flex;
    flex-direction: column;
}

.question-list-panel .filters {
    padding: 8px 10px;
    background: #fff;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.question-list-panel .filters select,
.question-list-panel .filters input {
    width: auto;
    margin-bottom: 0;
    flex: 1;
    min-width: 60px;
}

.question-list-panel .filters #q-search {
    flex: 2;
    min-width: 80px;
}

/* ─── Knowledge Point Tree Panel ─────────────────────────── */
.kp-tree-panel {
    border-right: 1px solid #ddd;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.kp-tree-header {
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.kp-tree {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.kp-tree-node {
    user-select: none;
}

.kp-tree-item {
    display: flex;
    align-items: center;
    padding: 4px 8px 4px 0;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s;
}

.kp-tree-item:hover {
    background: #e8f0ff;
}

.kp-tree-item.selected {
    background: #d0e0ff;
    color: #1a56db;
}

.kp-tree-toggle {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #888;
    flex-shrink: 0;
}

.kp-tree-toggle.open::after {
    content: '▼';
}

.kp-tree-toggle.closed::after {
    content: '▶';
}

.kp-tree-label {
    flex: 1;
    margin-left: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kp-tree-children {
    margin-left: 16px;
}

.kp-tree-count {
    font-size: 10px;
    color: #888;
    margin-left: 4px;
}

/* ─── Question Detail Tags ─────────────────────────────── */
.question-tags {
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #dbe7f5;
}

.question-tag-drop-target,
.question-stream-tag-drop-target {
    transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, outline-color 0.16s ease;
}

.question-tag-drop-target.drag-over,
.question-stream-tag-drop-target.drag-over {
    border-color: #1a56db;
    box-shadow: inset 0 0 0 1px rgba(26, 86, 219, 0.2), 0 0 0 3px rgba(26, 86, 219, 0.12);
}

.question-tags-label {
    font-size: 12px;
    color: #5b6b81;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.1px;
}

.kp-tag-row {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    gap: 6px;
    flex-wrap: wrap;
}

.kp-tag {
    display: inline-block;
    background: #edf4ff;
    color: #1f4aa8;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.4;
    white-space: normal;
    box-shadow: inset 0 0 0 1px #d4e3ff;
}

.kp-tag.kp-tag-match {
    background: #fff7d6;
    color: #9a6700;
    box-shadow: inset 0 0 0 1px #f5c542;
}

.kp-tag-delete {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 50%;
    line-height: 1;
}

.kp-tag-delete:hover {
    background: #ff4444;
    color: white;
}

/* ─── Knowledge Point Manager ─────────────────────────────── */
.kp-manager-content {
    max-height: 60vh;
    overflow-y: auto;
}

.kp-manager-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    gap: 8px;
}

.kp-manager-item:hover {
    background: #f5f5f5;
}

.kp-manager-item .kp-name {
    flex: 1;
    font-size: 13px;
}

.kp-manager-item .kp-level {
    font-size: 11px;
    color: #888;
    padding: 2px 6px;
    background: #eee;
    border-radius: 8px;
}

.kp-manager-item .kp-delete {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
}

.kp-manager-item .kp-delete:hover {
    background: #ff4444;
    color: white;
}

.kp-manager-add {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    display: flex;
    gap: 8px;
}

.kp-manager-add input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.kp-manager-add select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.kp-manager-add button {
    padding: 6px 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.kp-manager-add button:hover {
    background: #45a049;
}

.questions-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.question-item {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid #e0e0e0;
    transition: all 0.15s;
}

.question-item:hover {
    border-color: #1976d2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.question-item.active {
    border-color: #1976d2;
    background: #e3f2fd;
}

.question-item.selected {
    border-color: #1976d2;
    background: #e3f2fd;
    font-weight: 500;
}

.question-item input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.question-item span {
    cursor: pointer;
}

.question-item .q-tags {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 2px;
    padding-left: 20px;
}

.question-detail-panel {
    background: #fff;
    overflow-y: auto;
    padding: 14px;
    min-width: 0;
    min-height: 0;
}

.question-detail-panel > * {
    width: 100%;
    max-width: none;
    min-width: 0;
    box-sizing: border-box;
}

.question-stream-export-action-dropdown {
    position: relative;
    display: inline-flex;
    align-items: flex-end;
}

.question-stream-export-action-dropdown > .btn.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.question-stream-export-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 90;
    width: min(430px, calc(100vw - 32px));
    max-height: min(560px, calc(100vh - 140px));
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 18px 42px rgba(47, 39, 25, 0.18);
}

.question-stream-export-panel.hidden {
    display: none;
}

.question-stream-export-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.question-stream-export-panel-head h3 {
    margin: 0;
    color: var(--ink);
    font-size: 15px;
    line-height: 1.2;
}

.question-stream-export-panel-head span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.question-stream-export-panel-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.question-stream-export-template-list {
    display: grid;
    gap: 10px;
    overflow-y: auto;
    padding-right: 3px;
}

.question-stream-export-template-option,
.question-stream-export-dock-target {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 10px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
    text-align: left;
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.question-stream-export-template-option {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 10px 12px;
}

.question-stream-export-template-toggle,
.question-stream-export-dock-target {
    appearance: none;
    cursor: pointer;
}

.question-stream-export-template-toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}

.question-stream-export-template-option:hover,
.question-stream-export-dock-target:hover {
    border-color: rgba(15, 118, 110, 0.34);
    background: #f7fffc;
}

.question-stream-export-template-option.active,
.question-stream-export-dock-target.active {
    border-color: var(--accent);
    background: #eefbf7;
    box-shadow: inset 4px 0 0 var(--accent), 0 8px 18px rgba(15, 118, 110, 0.10);
}

.question-stream-export-template-option.is-default,
.question-stream-export-dock-target.is-default {
    border-color: rgba(15, 118, 110, 0.48);
    background: #e9fbf6;
}

.question-stream-export-template-option.is-drag-over,
.question-stream-export-dock-target.is-drag-over,
.question-stream-export-dock.is-drag-over {
    border-color: var(--accent);
    background: rgba(15, 118, 110, 0.10);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14), 0 12px 28px rgba(47, 39, 25, 0.12);
    transform: translateY(-1px);
}

.question-stream-export-template-toggle span,
.question-stream-export-template-option span,
.question-stream-export-dock-target span {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.question-stream-export-template-toggle strong,
.question-stream-export-template-option strong,
.question-stream-export-dock-target strong {
    color: var(--accent);
    font-size: 12px;
    white-space: nowrap;
}

.question-stream-export-template-toggle em,
.question-stream-export-template-option em,
.question-stream-export-dock-target em {
    color: var(--muted);
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
    white-space: nowrap;
}

.question-stream-export-dock-target em {
    grid-column: 1 / -1;
}

.question-stream-export-template-option .question-stream-export-default-choice {
    justify-self: end;
}

.question-stream-export-default-choice {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    align-self: center;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

.question-stream-export-default-choice input {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
}

.question-stream-export-default-choice input:disabled + span,
.question-stream-export-default-choice.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.question-stream-export-dock {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 85;
    width: min(150px, calc(100vw - 24px));
    padding: 4px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 8px;
    background: rgba(255, 253, 247, 0.96);
    box-shadow: 0 12px 30px rgba(47, 39, 25, 0.14);
}

.question-stream-export-dock.is-expanded {
    width: min(190px, calc(100vw - 24px));
}

.question-stream-export-dock:not(.has-target) {
    display: none;
}

.question-stream-export-dock-actions {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: 4px;
}

.question-stream-export-dock:not(.can-expand) .question-stream-export-dock-actions {
    display: none;
}

.question-stream-export-dock-action {
    appearance: none;
    padding: 3px 6px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--muted);
    font-size: 9px;
    font-weight: 850;
    cursor: pointer;
}

.question-stream-export-dock-action:hover {
    border-color: rgba(15, 118, 110, 0.36);
    color: var(--accent);
}

body.question-stream-export-dragging .question-stream-export-dock {
    opacity: 0.88;
}

.question-stream-export-dock-list {
    display: none;
    gap: 5px;
    max-height: 168px;
    overflow-y: auto;
}

.question-stream-export-dock.has-target .question-stream-export-dock-list {
    display: grid;
}

.question-stream-export-dock-target {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 5px 6px;
    border-color: rgba(15, 118, 110, 0.16);
    background: rgba(255, 255, 255, 0.94);
}

.question-stream-export-dock-target.is-default {
    border-color: rgba(15, 118, 110, 0.72);
    background: #0f766e;
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

.question-stream-export-dock-target span {
    font-size: 10px;
    font-weight: 850;
}

.question-stream-export-dock-target strong {
    font-size: 10px;
}

.question-stream-export-dock-target em {
    font-size: 9px;
}

.question-stream-export-dock-target.is-default span,
.question-stream-export-dock-target.is-default strong,
.question-stream-export-dock-target.is-default em {
    color: #fff;
}

.question-stream-export-dock-empty {
    appearance: none;
    width: 100%;
    padding: 8px 9px;
    border: 1px dashed rgba(15, 118, 110, 0.28);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--accent);
    font-size: 11px;
    font-weight: 850;
    cursor: pointer;
}

.question-stream-export-drag-ghost {
    position: fixed;
    left: -1000px;
    top: -1000px;
    z-index: -1;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 2px solid rgba(255, 255, 255, 0.82);
    border-radius: 12px;
    background: #0f766e;
    color: #fff;
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.24);
    pointer-events: none;
}

.question-stream-browser {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 14px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.question-stream-sidebar {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: static;
    z-index: 7;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
}

.question-stream-kp-panel {
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow: hidden;
}

.question-stream-kp-panel .kp-tree-title {
    margin-bottom: 8px;
}

.question-stream-kp-panel .kp-tree-tools {
    margin-bottom: 8px;
}

.question-stream-kp-tree {
    flex: 1 1 auto;
    max-height: 100%;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}

.question-stream-sidebar > .btn {
    flex: 0 0 auto;
}

.question-stream-detail-panel {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
}

.question-stream-search-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

.question-stream-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#question-stream-pagination {
    flex: 0 0 auto;
    align-items: center;
    margin: 12px 0 2px;
    padding: 10px 12px;
    border: 1px solid rgba(15, 118, 110, 0.16);
    border-radius: 14px;
    background: rgba(255, 253, 247, 0.94);
    box-shadow: 0 8px 20px rgba(47, 39, 25, 0.08);
}

#question-stream-pagination span {
    min-width: 72px;
    padding: 5px 10px;
    border: 1px solid rgba(15, 118, 110, 0.14);
    border-radius: 999px;
    background: #fff;
    color: #0f172a;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}

#question-stream-pagination button {
    min-width: 76px;
    border-color: #0f5f58;
    border-radius: 999px;
    background: #0f5f58;
    color: #fff;
    font-weight: 900;
}

#question-stream-pagination button:hover:not(:disabled) {
    border-color: #0b4f4a;
    background: #0b4f4a;
    color: #fff;
}

#question-stream-pagination button:disabled {
    border-color: #cbd5e1;
    background: #e5e7eb;
    color: #64748b;
    cursor: not-allowed;
    opacity: 1;
    transform: none;
}

.question-stream-card {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    overflow: hidden;
}

.question-stream-tag-drop-target {
    position: relative;
}

.question-stream-card-clickable,
.question-stream-export-target,
.question-stream-stem[data-export-ids],
.question-stream-unit[data-export-ids] {
    cursor: pointer;
}

.question-stream-card.selected-for-export,
.question-stream-stem.selected-for-export,
.question-stream-unit.selected-for-export {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.18);
}

.question-stream-card.knowledge-context {
    border-color: #93c5fd;
    box-shadow: inset 5px 0 0 #38bdf8, 0 0 0 1px rgba(56, 189, 248, 0.18);
}

.question-stream-card.knowledge-context .question-stream-source {
    background: linear-gradient(90deg, rgba(239, 246, 255, 0.98), #f8fafc);
}

.question-stream-card.knowledge-context .question-stream-stem:not(.knowledge-match),
.question-stream-card.knowledge-context .question-stream-unit:not(.knowledge-match),
.question-stream-card.knowledge-context .question-stream-child:not(.knowledge-match) {
    border-left: 5px solid #38bdf8;
    background: #f8fbff;
}

.question-stream-card.knowledge-match,
.question-stream-stem.knowledge-match,
.question-stream-unit.knowledge-match,
.question-stream-child.knowledge-match {
    border-left: 7px solid #f97316;
    background: #fff7ed;
    box-shadow: inset 0 0 0 2px rgba(249, 115, 22, 0.36), 0 8px 22px rgba(249, 115, 22, 0.12);
}

.question-stream-card.knowledge-match .question-stream-source,
.question-stream-stem.knowledge-match .question-stream-unit-title,
.question-stream-unit.knowledge-match .question-stream-unit-title,
.question-stream-child.knowledge-match .question-stream-child-title {
    color: #9a3412;
}

.question-stream-source {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.question-stream-source strong {
    color: #0f172a;
}

.question-stream-source span {
    color: #475569;
    font-size: 12px;
}

.question-stream-title-main {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: #0f172a !important;
    font-size: 14px !important;
}

.question-stream-title-main strong {
    font-size: 14px;
}

.question-stream-difficulty {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
}

.question-stream-toolbar,
.question-stream-unit-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #eef2f7;
}

.question-stream-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
}

.question-stream-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 800;
}

.question-stream-tag.selected {
    border: 2px solid #f97316;
    background: #fff7ed;
    color: #9a3412;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.28), 0 6px 14px rgba(249, 115, 22, 0.14);
    font-weight: 900;
    padding: 3px 8px;
}

.question-stream-tag-text {
    min-width: 0;
}

.question-stream-tag-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 0;
}

.question-stream-tag-delete:hover {
    background: #ef4444;
    color: #fff;
}

.question-stream-tags.muted {
    color: #94a3b8;
    font-size: 12px;
}

.question-stream-image,
.question-stream-stem,
.question-stream-child,
.question-stream-answer,
.question-stream-empty-image {
    padding: 12px 14px;
}

.question-stream-image img,
.question-stream-stem img,
.question-stream-child img,
.question-stream-answer img {
    max-width: 100%;
    border-radius: 6px;
    display: block;
}

.question-stream-lazy-image-frame {
    position: relative;
    min-height: 132px;
    border-radius: 6px;
    background: #f8fafc;
    overflow: hidden;
}

.question-stream-lazy-image-frame.is-loaded {
    min-height: 0;
    background: transparent;
}

.question-stream-lazy-image-frame.is-error {
    background: #fff7ed;
}

.question-stream-lazy-image {
    opacity: 0;
    transition: opacity 0.18s ease;
}

.question-stream-lazy-image.is-loaded {
    opacity: 1;
}

.question-stream-lazy-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 12px;
    pointer-events: none;
}

.question-stream-lazy-image-frame.is-loaded .question-stream-lazy-placeholder {
    display: none;
}

.question-stream-lazy-image-frame.is-error .question-stream-lazy-placeholder {
    color: #c2410c;
}

.question-stream-lazy-image-frame.is-error .question-stream-lazy-placeholder::after {
    content: "，正在重试";
}

.question-stream-stem {
    border-top: 1px solid #eef2f7;
}

.question-stream-unit {
    border-top: 1px solid #dbe3ef;
}

.question-stream-unit-title,
.question-stream-child-title {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.question-stream-child {
    border-top: 1px dashed #e2e8f0;
}

.question-stream-answer-actions {
    padding: 0 14px 12px;
}

.question-stream-answer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.question-stream-answer-item + .question-stream-answer-item {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #cbd5e1;
}

.question-stream-error,
.question-stream-empty-image {
    color: #94a3b8;
    font-size: 13px;
}

.question-image-area {
    border-radius: 8px;
    transition: all 0.2s;
}

.question-image-area.drag-over {
    background: #e8f0ff;
    outline: 2px dashed #1a56db;
}

.question-detail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 16px;
}

.question-detail-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.question-detail-header h3 {
    margin: 0 0 8px 0;
}

.question-detail-meta {
    font-size: 13px;
    color: #666;
}

.question-detail-image {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.question-detail-tags {
    margin: 12px 0;
}

.question-detail-section {
    margin: 20px 0;
}

.question-detail-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.question-detail-actions .answer-toggle-btn {
    min-height: 34px;
    padding-inline: 12px;
}

.parent-detail-toolbar .question-detail-actions {
    margin-top: 0;
}

.parent-detail-toolbar .question-detail-section {
    flex-basis: 100%;
    margin: 4px 0 0 0;
}

#answer-container {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 2px solid #4CAF50;
}

#answer-container h4 {
    color: #4CAF50;
    margin: 0 0 12px 0;
}

/* ─── Paper Browser (Split View) ─────────────────────────── */
.paper-browser {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 0;
    height: calc(100vh - 72px);
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f8fd;
    position: relative;
    transition: grid-template-columns 0.22s ease;
}

.paper-browser.paper-list-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
}

.paper-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: end;
    gap: 6px;
    padding: 8px 8px 9px;
    margin-bottom: 0;
    border: 0;
    border-bottom: 1px solid #dbe3ef;
    border-radius: 0;
    background: #fafafa;
    position: sticky;
    top: 0;
    z-index: 2;
}

.paper-admin-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px;
    border-bottom: 1px solid #e3eaf4;
    background: #f7f9fc;
}

.paper-admin-panel .btn,
.paper-admin-panel label.btn {
    width: auto;
    justify-content: center;
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
}

.paper-viewer-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px;
    border-bottom: 1px solid #e3eaf4;
    background: #fdfefe;
}

.paper-viewer-controls .btn {
    width: auto;
    justify-content: center;
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
}

.paper-viewer-meta {
    grid-column: 1 / -1;
    min-width: 0;
    padding: 0 2px 2px;
}

.paper-viewer-meta-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 2px;
}

.paper-viewer-meta-title {
    font-size: 12px;
    color: #0f172a;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.paper-toolbar-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.paper-toolbar-group label {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}

.paper-toolbar-group select {
    padding: 5px 8px;
    border: 1px solid #d7dee8;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
}

.paper-list-panel {
    border-right: 1px solid #ddd;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.paper-browser.paper-list-collapsed .paper-list-panel {
    border-right: 0;
    overflow: hidden;
}

.papers-list {
    padding: 6px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.paper-item {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid #e0e0e0;
    transition: all 0.15s;
}

.paper-item:hover {
    border-color: #1976d2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.paper-item.active {
    border-color: #1976d2;
    background: #e3f2fd;
}

.paper-item .paper-title {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 13px;
}

.paper-item .paper-meta {
    font-size: 11px;
    color: #666;
}

.paper-item .paper-status {
    display: inline-block;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
}

.paper-status.status-processed {
    background: #e8f5e9;
    color: #2e7d32;
}

.paper-status.status-pending {
    background: #fff3e0;
    color: #ef6c00;
}

.paper-detail-panel {
    background: #fff;
    overflow: hidden;
    padding: 0;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.paper-browser.paper-list-collapsed .paper-detail-panel {
    border-left: 0;
}

.paper-detail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 16px;
}

.paper-detail-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.paper-detail-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.paper-pdf-frame {
    flex: 1 1 auto;
    min-height: 0;
    border: 0;
    border-left: 1px solid #dbe3ef;
    border-radius: 0;
    background: #f3f7fc;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-gutter: stable both-edges;
}

.paper-pdf-frame embed {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 100%;
    background: #fff;
    border: 0;
}

.paper-pdf-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    height: 100%;
    padding: 4px;
    background: #f3f7fc;
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
}

.paper-pdf-pane {
    display: flex;
    flex-direction: column;
    width: auto;
    min-width: 0;
    min-height: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.paper-pdf-pane-body {
    flex: 1 1 auto;
    min-height: 0;
}

.paper-pdf-pane-body embed {
    width: 100%;
    height: 100%;
    min-height: 100%;
    display: block;
    border: 0;
}

.paper-pdf-scrollbar {
    flex: 0 0 26px;
    height: 26px;
    padding: 2px 12px 6px;
    border-left: 1px solid #dbe3ef;
    background: #eef4fc;
    display: flex;
    align-items: center;
}

.paper-pdf-scrollbar.hidden {
    display: none;
}

.paper-pdf-scrollbar input[type="range"] {
    width: 100%;
    margin: 0;
}

.paper-panel-reopen {
    position: absolute;
    top: 14px;
    left: 16px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.paper-panel-reopen:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

.paper-panel-reopen-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    line-height: 1;
}

.paper-panel-reopen-label {
    white-space: nowrap;
}

.paper-panel-reopen.hidden {
    display: none;
}

.paper-detail-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}

/* ─── Task Center ─────────────────────────────────────────── */
.task-center-panel {
    background: #fff;
    border: 1px solid #dbe4f0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(20, 45, 90, 0.05);
}

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

.task-center-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-center-note {
    font-size: 12px;
    color: #6b7280;
}

.jobs-list.is-refreshing {
    opacity: 0.92;
}

.task-center-header h3 {
    font-size: 16px;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.task-center-header p {
    color: #6b7280;
    font-size: 12px;
}


.task-center-active-block {
    margin-bottom: 14px;
}

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

.task-center-section-label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.task-center-history-note {
    font-size: 12px;
    color: #6b7280;
}

.active-job-panel {
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: linear-gradient(135deg, #eff6ff, #f8fbff);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.08);
}

.active-job-panel.is-empty {
    border-style: dashed;
    border-color: #cbd5e1;
    background: #f8fafc;
    box-shadow: none;
}

.active-job-panel.status-paused {
    border-color: #fcd34d;
    background: linear-gradient(135deg, #fff8e6, #fffdf7);
    box-shadow: 0 8px 22px rgba(245, 158, 11, 0.10);
}

.active-job-panel.status-failed {
    border-color: #fecaca;
    background: linear-gradient(135deg, #fff5f5, #fffafa);
    box-shadow: 0 8px 22px rgba(239, 68, 68, 0.08);
}

.active-job-panel.is-selected {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), 0 10px 26px rgba(37, 99, 235, 0.10);
}

.active-job-card {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
}

.active-job-main {
    flex: 1;
    min-width: 0;
}

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

.active-job-caption {
    font-size: 12px;
    color: #2563eb;
    font-weight: 700;
    margin-bottom: 4px;
}

.active-job-topline h4 {
    margin: 0;
    font-size: 20px;
    color: #0f172a;
}

.active-job-kind,
.active-job-updated {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

.active-job-status-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.active-job-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.active-job-metrics div {
    padding: 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.active-job-metrics span {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.active-job-metrics strong {
    color: #0f172a;
    font-size: 14px;
    word-break: break-word;
}

.active-job-actions {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.active-job-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.active-job-tip {
    font-size: 12px;
    color: #475569;
}

.active-job-empty {
    padding: 18px;
    text-align: center;
    color: #64748b;
}

.task-center-body {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.jobs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.job-item {
    position: relative;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #94a3b8;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fafcff;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.job-item.job-running {
    border-left-color: #2563eb;
    background: linear-gradient(90deg, rgba(37,99,235,0.16), rgba(37,99,235,0.04));
    box-shadow: 0 0 0 1px rgba(37,99,235,0.12), 0 6px 18px rgba(37,99,235,0.12);
}

.job-item.job-running .job-kind {
    color: #1d4ed8;
}

.job-item.job-running::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    box-shadow: 0 0 0 0 rgba(37,99,235,0.20);
    animation: jobPulse 1.8s ease-out infinite;
    pointer-events: none;
}

.job-item.job-paused {
    border-left-color: #f59e0b;
    background: linear-gradient(90deg, rgba(245,158,11,0.12), rgba(245,158,11,0.03));
    box-shadow: 0 0 0 1px rgba(245,158,11,0.08);
}

.job-item.job-paused .job-kind {
    color: #b45309;
}

.job-item.job-failed {
    border-left-color: #ef4444;
    background: #fff5f5;
}

.job-item.job-completed {
    border-left-color: #10b981;
    background: #f3fff9;
}

.job-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.job-item.selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

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

.job-item-status-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.job-refresh-chip {
    font-size: 11px;
    color: #2563eb;
    background: rgba(37,99,235,0.08);
    border: 1px solid rgba(37,99,235,0.12);
    border-radius: 999px;
    padding: 2px 8px;
}

.job-kind {
    font-weight: 600;
    color: #111827;
}

.job-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.job-status.status-running { background: #dbeafe; color: #1d4ed8; }
.job-status.status-paused { background: #fef3c7; color: #b45309; }
.job-status.status-failed { background: #fee2e2; color: #b91c1c; }
.job-status.status-completed { background: #d1fae5; color: #047857; }
.job-status.status-pending { background: #e5e7eb; color: #374151; }

.job-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px 12px;
    font-size: 12px;
    color: #4b5563;
}

.job-meta-label {
    color: #6b7280;
    margin-right: 4px;
}

.job-empty {
    text-align: center;
    padding: 20px;
    color: #9ca3af;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px dashed #d1d5db;
}

/* ─── Search Panel ─────────────────────────────────────────── */
.search-panel {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
}

.search-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 100px;
}

.search-field-text {
    flex: 1;
    min-width: 200px;
}

.search-field label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.search-field select,
.search-field input {
    height: 34px;
    padding: 0 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
}

.search-field input {
    width: 100%;
}

.subject-filter-select,
.inline-filter-select {
    border: 1px solid #d7dee8;
    border-radius: 8px;
    padding: 7px 10px;
    background: #fff;
    font-size: 13px;
}

.inline-filter-select {
    margin-left: 6px;
    padding: 5px 8px;
}

/* ─── Answer Browser (Split View) ────────────────────────── */
.answer-browser {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    height: calc(100vh - 180px);
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.answer-list-panel {
    border-right: 1px solid #ddd;
    overflow-y: auto;
    background: #fafafa;
    display: flex;
    flex-direction: column;
}

.answer-list-panel .filters {
    padding: 8px 10px;
    background: #fff;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.answer-list-panel .filters select,
.answer-list-panel .filters input {
    width: auto;
    margin-bottom: 0;
    flex: 1;
    min-width: 60px;
}

.ms-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.ms-item {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid #e0e0e0;
    transition: all 0.15s;
}

.ms-item:hover {
    border-color: #4caf50;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ms-item.active {
    border-color: #4caf50;
    background: #e8f5e9;
}

.ms-item .ms-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.ms-item .ms-meta {
    font-size: 12px;
    color: #666;
}

.answer-detail-panel {
    background: #fff;
    overflow-y: auto;
    padding: 20px;
}

.answer-detail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 16px;
}

.answer-questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.answer-question-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    background: #fafafa;
}

.answer-question-card img {
    max-width: 100%;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.answer-question-card .q-num {
    font-weight: 600;
    margin-bottom: 8px;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .logo { font-size: 16px; }
    .sidebar .logo-text,
    .sidebar .nav-label,
    .sidebar .sidebar-toggle { display: none; }
    .sidebar .sidebar-header { justify-content: center; padding: 0 8px 16px; }
    .sidebar .nav-tabs li { padding: 14px; justify-content: center; }
    .content { margin-left: 60px; width: calc(100% - 60px); }
    .export-layout { grid-template-columns: 1fr; }
    .question-browser { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .question-list-panel { border-right: none; border-bottom: 1px solid #ddd; max-height: 40vh; }
}


/* ─── Question Selection Checkbox ──────────────────────────── */
.question-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.question-item .q-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.question-item.selected {
    background-color: #e3f2fd;
}


.job-results-preview {
    margin-top: 10px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
}

.job-detail-panel {
    min-height: 220px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    padding: 16px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
    transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

.job-detail-panel.is-refreshing {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 0 0 2px rgba(37,99,235,0.06);
}

.job-detail-empty,
.job-detail-empty-inline {
    color: #9ca3af;
}

.job-detail-empty {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    padding: 20px;
}

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

.job-detail-header-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.job-detail-refresh-note {
    font-size: 11px;
    color: #6b7280;
}

.job-detail-header h4 {
    margin: 0 0 4px;
    font-size: 18px;
    color: #111827;
}

.job-detail-subtitle {
    font-size: 12px;
    color: #6b7280;
}

.job-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

.job-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.job-action-tip {
    font-size: 12px;
    color: #6b7280;
}

.job-action-feedback {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.job-action-feedback.success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.job-action-feedback.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.job-detail-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.job-detail-summary div,
.job-detail-meta-item {
    border: 1px solid #eef2f7;
    border-radius: 8px;
    background: #f8fafc;
    padding: 10px 12px;
}

.job-detail-summary span,
.job-detail-meta-item span {
    display: block;
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.job-detail-summary strong {
    color: #111827;
    font-size: 13px;
    word-break: break-word;
}

.job-detail-section {
    margin-top: 18px;
}

.job-detail-section h5 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #1f2937;
}

.job-detail-summary-text {
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 8px;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.6;
}

.job-detail-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.job-detail-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fbfdff;
    padding: 10px 12px;
}

.job-detail-card-error {
    background: #fff7f7;
    border-color: #fecaca;
}

.job-detail-card-title {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.job-detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.job-json {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    color: #374151;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@keyframes jobPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37,99,235,0.18);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(37,99,235,0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37,99,235,0);
    }
}

@media (max-width: 980px) {
    .task-center-body {
        grid-template-columns: 1fr;
    }

    .task-center-header,
    .task-center-history-head,
    .active-job-card,
    .active-job-topline,
    .job-detail-header {
        flex-direction: column;
    }

    .job-detail-header-side,
    .active-job-status-wrap {
        align-items: flex-start;
    }

    .job-action-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .active-job-side {
        width: 100%;
    }
}

/* ─── RBAC ───────────────────────────────────────────────── */
.rbac-summary-panel, .rbac-section {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.rbac-layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 16px;
    align-items: start;
}
.rbac-summary-panel { margin-bottom: 16px; }
.rbac-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}
.rbac-stat { background: #f7f9fc; border-radius: 10px; padding: 12px; }
.rbac-stat span { display:block; font-size:12px; color:#667085; margin-bottom:4px; }
.rbac-stat strong { font-size:15px; color:#1f2937; }
.rbac-table { width:100%; border-collapse: collapse; }
.rbac-table th, .rbac-table td { padding: 10px 8px; border-bottom:1px solid #eef2f7; text-align:left; font-size:13px; vertical-align: top; }
.rbac-status { display:inline-block; padding:2px 8px; border-radius:999px; font-size:12px; }
.rbac-status.is-active { background:#e8f5e9; color:#2e7d32; }
.rbac-status.is-inactive { background:#ffebee; color:#c62828; }
.rbac-card-list { display:flex; flex-direction:column; gap:10px; }
.rbac-card { border:1px solid #eef2f7; border-radius:10px; padding:12px; background:#fbfdff; }
.rbac-card h4 { margin-bottom:4px; }
.rbac-card-subtitle, .rbac-inline-tip { font-size:12px; color:#667085; }
.rbac-card-meta { margin:8px 0; font-size:12px; color:#475467; }
.rbac-chip-list { display:flex; flex-wrap:wrap; gap:6px; }
.rbac-chip { background:#eef4ff; color:#1d4ed8; border-radius:999px; padding:3px 8px; font-size:11px; }
.rbac-empty { color:#667085; padding: 16px 4px; }
@media (max-width: 1200px) {
  .rbac-layout { grid-template-columns: 1fr; }
  .rbac-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ─── Public Homepage / Auth Gate ───────────────────────── */
.auth-loading-screen {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #f4f8f9;
}

.auth-shell {
    --public-ink: #0f2734;
    --public-text: #1f3440;
    --public-muted: #617381;
    --public-line: #d9e5e8;
    --public-soft: #f4f8f9;
    --public-cyan: #1597a7;
    --public-green: #2d8762;
    --public-amber: #c98518;
    --public-coral: #ce5f4f;
    min-height: 100vh;
    width: 100%;
    background:
        linear-gradient(180deg, rgba(232, 244, 245, 0.75) 0%, rgba(255, 255, 255, 0.98) 34%, #ffffff 100%);
    color: var(--public-text);
}

.auth-loading-screen.hidden,
.auth-shell.hidden,
.app-shell.hidden {
    display: none !important;
}

.public-home {
    width: 100%;
    min-height: 100vh;
}

.public-nav {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    width: 100%;
    padding: 18px clamp(20px, 4vw, 56px);
    border-bottom: 1px solid rgba(217, 229, 232, 0.78);
    background: rgba(250, 253, 253, 0.92);
    backdrop-filter: blur(14px);
}

.public-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--public-ink);
    text-decoration: none;
    min-width: 220px;
}

.public-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--public-ink);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0;
}

.public-brand strong,
.public-brand small {
    display: block;
    line-height: 1.15;
}

.public-brand strong {
    font-size: 16px;
    letter-spacing: 0;
}

.public-brand small {
    margin-top: 3px;
    color: var(--public-muted);
    font-size: 12px;
}

.public-nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(14px, 2vw, 28px);
    flex: 1 1 auto;
}

.public-nav-links a {
    color: var(--public-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
}

.public-nav-links a:hover {
    color: var(--public-ink);
}

.public-nav-actions,
.public-hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.public-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 750;
    line-height: 1;
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.public-btn:hover {
    transform: translateY(-1px);
}

.public-btn-primary {
    background: var(--public-ink);
    color: #fff;
    border-color: var(--public-ink);
}

.public-btn-primary:hover {
    background: #183948;
    color: #fff;
}

.public-btn-secondary {
    background: #fff;
    color: var(--public-ink);
    border-color: var(--public-line);
}

.public-btn-secondary:hover,
.public-btn-ghost:hover {
    border-color: var(--public-cyan);
    color: var(--public-cyan);
}

.public-btn-ghost {
    background: transparent;
    color: var(--public-ink);
    border-color: transparent;
}

.public-btn-large {
    min-height: 48px;
    padding: 0 22px;
    font-size: 15px;
}

.public-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(420px, 0.98fr);
    align-items: center;
    gap: clamp(34px, 5vw, 74px);
    min-height: calc(100vh - 76px);
    padding: clamp(52px, 7vw, 96px) clamp(20px, 5vw, 76px) 40px;
}

.public-hero-copy {
    max-width: 760px;
}

.public-eyebrow {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    margin-bottom: 18px;
    padding: 0 12px;
    border: 1px solid rgba(21, 151, 167, 0.28);
    border-radius: 999px;
    background: rgba(21, 151, 167, 0.08);
    color: #0f6f78;
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.public-hero h1 {
    max-width: 760px;
    color: var(--public-ink);
    font-size: clamp(44px, 6vw, 78px);
    line-height: 0.98;
    font-weight: 830;
    letter-spacing: 0;
}

.public-hero-lead {
    margin-top: 24px;
    max-width: 690px;
    color: #405562;
    font-size: 18px;
    line-height: 1.78;
}

.public-hero-actions {
    margin-top: 30px;
}

.public-hero-note {
    max-width: 660px;
    margin-top: 14px;
    color: #6b7d87;
    font-size: 13px;
    line-height: 1.62;
}

.public-hero-proof {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 38px;
    max-width: 680px;
}

.public-hero-proof div {
    min-height: 92px;
    padding: 16px;
    border: 1px solid var(--public-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
}

.public-hero-proof strong {
    display: block;
    color: var(--public-ink);
    font-size: 15px;
}

.public-hero-proof span {
    display: block;
    margin-top: 8px;
    color: var(--public-muted);
    font-size: 13px;
    line-height: 1.5;
}

.public-product-preview {
    position: relative;
    border: 1px solid #c8d8dc;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 26px 70px rgba(15, 39, 52, 0.16);
    overflow: hidden;
}

.public-product-preview::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(21, 151, 167, 0.08), transparent 38%, rgba(201, 133, 24, 0.08));
}

.preview-toolbar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--public-line);
    background: #f8fbfb;
}

.preview-title {
    color: var(--public-ink);
    font-size: 14px;
    font-weight: 800;
}

.preview-status {
    color: var(--public-green);
    font-size: 12px;
    font-weight: 750;
}

.preview-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 154px minmax(0, 1fr) 132px;
    min-height: 420px;
}

.preview-subjects {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 12px;
    border-right: 1px solid var(--public-line);
    background: #f3f8f8;
}

.preview-subjects button {
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #516875;
    text-align: left;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 750;
}

.preview-subjects button.is-active {
    color: var(--public-ink);
    background: #ffffff;
    border-color: #cddde1;
}

.preview-main {
    padding: 18px;
}

.preview-search {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 10px 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--public-line);
    border-radius: 8px;
    background: #fff;
}

.preview-search span {
    color: var(--public-muted);
    font-size: 12px;
}

.preview-search strong {
    color: var(--public-ink);
    font-size: 13px;
}

.preview-topic-tree {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.topic-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid #e5eef0;
    border-radius: 8px;
    color: #536a76;
    background: #fbfdfd;
    font-size: 13px;
    font-weight: 650;
}

.topic-row span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--public-cyan);
}

.topic-row.is-strong {
    color: var(--public-ink);
    border-color: rgba(21, 151, 167, 0.34);
    background: rgba(21, 151, 167, 0.07);
}

.preview-question {
    margin-top: 18px;
    padding: 18px;
    border-radius: 8px;
    background: var(--public-ink);
    color: #ffffff;
}

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

.preview-question-head strong {
    font-size: 14px;
}

.preview-question-head span {
    color: #f1c36a;
    font-size: 12px;
    font-weight: 800;
}

.preview-question p {
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    line-height: 1.65;
}

.preview-insight {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 14px;
    border-left: 1px solid var(--public-line);
    background: #fbfdfd;
}

.insight-block {
    padding: 14px;
    border: 1px solid var(--public-line);
    border-radius: 8px;
    background: #fff;
}

.insight-block span,
.resource-table span {
    display: block;
    color: var(--public-muted);
    font-size: 12px;
    font-weight: 700;
}

.insight-block strong {
    display: block;
    margin-top: 6px;
    color: var(--public-ink);
    font-size: 20px;
}

.insight-block.accent strong {
    color: var(--public-amber);
    font-size: 15px;
}

.public-section {
    padding: clamp(56px, 7vw, 92px) clamp(20px, 5vw, 76px);
}

.public-section[id] {
    scroll-margin-top: 96px;
}

.public-trust-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding-top: 32px;
    padding-bottom: 32px;
    border-top: 1px solid var(--public-line);
    border-bottom: 1px solid var(--public-line);
    background: #ffffff;
}

.public-trust-strip div {
    min-height: 104px;
    padding: 18px;
    border: 1px solid rgba(217, 229, 232, 0.92);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 248, 249, 0.82)),
        #ffffff;
}

.public-trust-strip strong {
    display: block;
    color: var(--public-ink);
    font-size: 18px;
}

.public-trust-strip span {
    display: block;
    margin-top: 9px;
    color: var(--public-muted);
    font-size: 13px;
    line-height: 1.58;
}

.public-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 30px;
}

.public-section-heading.compact {
    align-items: start;
}

.public-section-heading h2,
.public-split-section h2,
.resource-copy h2,
.public-final-cta h2 {
    color: var(--public-ink);
    font-size: clamp(30px, 3vw, 44px);
    line-height: 1.12;
    letter-spacing: 0;
}

.public-section-heading p,
.public-split-section p,
.resource-copy p,
.public-final-cta p {
    max-width: 640px;
    color: var(--public-muted);
    font-size: 16px;
    line-height: 1.72;
}

.public-subject-band {
    border-top: 1px solid var(--public-line);
    border-bottom: 1px solid var(--public-line);
    background: #ffffff;
}

.subject-rail {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.subject-rail span {
    min-height: 56px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border: 1px solid var(--public-line);
    border-radius: 8px;
    color: var(--public-ink);
    background: #f8fbfb;
    font-size: 14px;
    font-weight: 750;
}

.subject-rail span:nth-child(3n + 1) {
    border-left: 4px solid var(--public-cyan);
}

.subject-rail span:nth-child(3n + 2) {
    border-left: 4px solid var(--public-green);
}

.subject-rail span:nth-child(3n) {
    border-left: 4px solid var(--public-amber);
}

.public-workflow-section {
    background: #f7faf9;
}

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

.workflow-panel {
    min-height: 220px;
    padding: 24px;
    border: 1px solid #d5e3e5;
    border-radius: 8px;
    background: #ffffff;
}

.workflow-index {
    display: block;
    color: var(--public-cyan);
    font-size: 13px;
    font-weight: 850;
    margin-bottom: 42px;
}

.workflow-panel h3 {
    color: var(--public-ink);
    font-size: 22px;
    margin-bottom: 12px;
}

.workflow-panel p {
    color: var(--public-muted);
    font-size: 15px;
    line-height: 1.68;
}

.public-demo-section {
    background:
        radial-gradient(circle at 12% 12%, rgba(21, 151, 167, 0.12), transparent 28%),
        radial-gradient(circle at 88% 8%, rgba(201, 133, 24, 0.12), transparent 30%),
        #ffffff;
    border-top: 1px solid var(--public-line);
    border-bottom: 1px solid var(--public-line);
}

.demo-card-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
    gap: 18px;
}

.demo-card {
    min-height: 280px;
    padding: clamp(24px, 4vw, 36px);
    border: 1px solid #d5e3e5;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 18px 48px rgba(15, 39, 52, 0.08);
}

.demo-card-primary {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    background:
        linear-gradient(135deg, rgba(15, 39, 52, 0.98), rgba(22, 91, 90, 0.96)),
        var(--public-ink);
    color: #ffffff;
}

.demo-label {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(21, 151, 167, 0.12);
    color: #0f6f78;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.demo-card-primary .demo-label {
    background: rgba(255, 255, 255, 0.13);
    color: #bdeff1;
}

.demo-card h3 {
    margin-top: 18px;
    color: var(--public-ink);
    font-size: clamp(26px, 3vw, 40px);
    line-height: 1.08;
}

.demo-card-primary h3 {
    color: #ffffff;
}

.demo-card p {
    max-width: 560px;
    margin-top: 16px;
    color: var(--public-muted);
    font-size: 15px;
    line-height: 1.72;
}

.demo-card-primary p {
    color: rgba(255, 255, 255, 0.78);
}

.demo-card-primary .public-btn {
    margin-top: 28px;
    background: #ffffff;
    color: var(--public-ink);
    border-color: #ffffff;
}

.demo-steps {
    margin-top: 20px;
    padding-left: 22px;
    color: #314956;
}

.demo-steps li {
    margin: 0 0 16px;
    padding-left: 6px;
    font-size: 16px;
    line-height: 1.65;
}

.public-demo-browser {
    margin-top: 24px;
}

.public-demo-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.public-demo-list,
.public-demo-detail {
    border: 1px solid #d5e3e5;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 48px rgba(15, 39, 52, 0.08);
}

.public-demo-list {
    padding: 14px;
    position: sticky;
    top: 108px;
}

.public-demo-list-kicker {
    margin-bottom: 10px;
    color: var(--public-muted);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.public-demo-list-item {
    width: 100%;
    display: block;
    margin-bottom: 10px;
    padding: 14px;
    border: 1px solid #dce8ea;
    border-radius: 12px;
    background: #ffffff;
    color: var(--public-ink);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.public-demo-list-item:hover,
.public-demo-list-item.is-active {
    border-color: rgba(21, 151, 167, 0.48);
    background: rgba(21, 151, 167, 0.07);
    transform: translateY(-1px);
}

.public-demo-list-item strong,
.public-demo-list-item span {
    display: block;
}

.public-demo-list-item strong {
    font-size: 14px;
}

.public-demo-list-item span {
    margin-top: 6px;
    color: var(--public-muted);
    font-size: 12px;
    line-height: 1.45;
}

.public-demo-lock-note {
    margin-top: 14px;
    padding: 12px;
    border-radius: 12px;
    background: #f7faf9;
    color: var(--public-muted);
    font-size: 12px;
    line-height: 1.6;
}

.public-demo-detail {
    padding: clamp(18px, 3vw, 28px);
    overflow: hidden;
}

.public-demo-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.public-demo-detail h3 {
    margin-top: 8px;
    color: var(--public-ink);
    font-size: clamp(22px, 2.2vw, 32px);
    line-height: 1.16;
}

.public-demo-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(21, 151, 167, 0.1);
    color: #0f6f78;
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.public-demo-meta,
.public-demo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.public-demo-meta span,
.public-demo-tags span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
}

.public-demo-meta span {
    background: #f4f8f9;
    color: var(--public-muted);
}

.public-demo-tags span {
    background: rgba(201, 133, 24, 0.1);
    color: #8a5d12;
}

.public-demo-excerpt {
    margin: 16px 0;
    color: #405562;
    font-size: 14px;
    line-height: 1.72;
}

.public-demo-image-frame,
.public-demo-answer-item {
    border: 1px solid #dce8ea;
    border-radius: 14px;
    background: #ffffff;
}

.public-demo-image-frame {
    max-height: 520px;
    overflow: auto;
    padding: 12px;
}

.public-demo-image-frame img,
.public-demo-answer-item img {
    width: 100%;
    height: auto;
    display: block;
}

.public-demo-answer-actions {
    margin-top: 16px;
}

.public-demo-answer {
    display: grid;
    gap: 14px;
    margin-top: 14px;
}

.public-demo-answer.hidden {
    display: none;
}

.public-demo-answer-item {
    padding: 14px;
}

.public-demo-answer-item strong {
    display: block;
    margin-bottom: 10px;
    color: var(--public-ink);
}

.public-demo-answer-item p {
    margin: 0;
    color: #405562;
    line-height: 1.65;
}

.public-demo-loading,
.public-demo-error,
.public-demo-empty,
.public-demo-empty-image {
    padding: 24px;
    border: 1px solid #d5e3e5;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--public-muted);
    font-size: 14px;
    line-height: 1.65;
}

.public-fit-section {
    background: #fbfdfd;
}

.public-split-section,
.public-resource-section {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
    gap: clamp(28px, 5vw, 72px);
    align-items: center;
}

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

.student-flow div {
    min-height: 118px;
    padding: 22px;
    border: 1px solid var(--public-line);
    border-radius: 8px;
    background: #fff;
}

.student-flow strong {
    display: block;
    color: var(--public-ink);
    font-size: 20px;
}

.student-flow span {
    display: block;
    margin-top: 10px;
    color: var(--public-muted);
    font-size: 14px;
}

.public-resource-section {
    border-top: 1px solid var(--public-line);
    background: #ffffff;
}

.resource-table {
    border: 1px solid var(--public-line);
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}

.resource-table div {
    display: grid;
    grid-template-columns: minmax(120px, 0.55fr) minmax(0, 1fr);
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--public-line);
}

.resource-table div:last-child {
    border-bottom: 0;
}

.resource-table strong {
    color: var(--public-ink);
    font-size: 15px;
    line-height: 1.4;
}

.public-final-cta {
    margin: 0 clamp(20px, 5vw, 76px) clamp(42px, 5vw, 72px);
    padding: clamp(34px, 5vw, 54px);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(15, 39, 52, 0.98), rgba(33, 84, 86, 0.98)),
        #0f2734;
    color: #ffffff;
}

.public-final-cta h2 {
    color: #ffffff;
}

.public-final-cta p {
    margin: 14px 0 26px;
    color: rgba(255, 255, 255, 0.78);
}

.public-final-cta .public-disclaimer {
    max-width: 780px;
    margin: 22px 0 0;
    color: rgba(255, 255, 255, 0.58);
    font-size: 12px;
    line-height: 1.62;
}

.public-final-cta .public-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.24);
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
}

.auth-modal.hidden {
    display: none !important;
}

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(6, 21, 28, 0.58);
    cursor: pointer;
}

.auth-modal-panel {
    position: relative;
    z-index: 1;
    width: min(100%, 470px);
    max-height: calc(100vh - 44px);
    overflow: auto;
}

.auth-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 34px;
    height: 34px;
    border: 1px solid #d9e4f2;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.auth-modal-open {
    overflow: hidden;
}

.auth-panel-wrap {
    width: 100%;
    max-width: 460px;
}

.auth-card {
    background: rgba(255,255,255,0.98);
    border: 1px solid #d9e4f2;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.16);
    border-radius: 8px;
    padding: 34px 28px 30px;
}

.auth-card-compact {
    max-width: 420px;
    text-align: center;
}

.auth-brand {
    font-size: 26px;
    font-weight: 780;
    color: #0f172a;
    margin-bottom: 14px;
}

.auth-card h1 {
    font-size: 28px;
    margin-bottom: 8px;
    color: #0f172a;
}

.auth-subtitle,
.auth-card p {
    color: #64748b;
    line-height: 1.6;
}

.login-form {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.auth-field span {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.auth-field input,
.auth-field select {
    width: 100%;
    height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-field input:focus,
.auth-field select:focus {
    border-color: #1597a7;
    box-shadow: 0 0 0 4px rgba(21, 151, 167, 0.15);
}

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

.auth-role-option {
    position: relative;
    display: grid;
    gap: 5px;
    min-height: 82px;
    padding: 14px 14px 12px 38px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.auth-role-option input {
    position: absolute;
    top: 16px;
    left: 14px;
    width: 16px;
    height: 16px;
    accent-color: #1597a7;
}

.auth-role-option strong {
    color: #0f172a;
    font-size: 14px;
    line-height: 1.25;
}

.auth-role-option small {
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
}

.auth-role-option:has(input:checked) {
    border-color: #1597a7;
    background: rgba(21, 151, 167, 0.07);
    box-shadow: 0 0 0 3px rgba(21, 151, 167, 0.12);
}

.auth-challenge-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 8px;
}

.auth-refresh-btn {
    height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.auth-refresh-btn:hover {
    border-color: #1597a7;
    color: #1597a7;
}

.auth-field-hint {
    color: #64748b;
    font-size: 12px;
    line-height: 1.45;
}

.auth-error {
    padding: 10px 12px;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 13px;
}

.auth-submit {
    height: 44px;
    font-size: 15px;
    font-weight: 650;
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: #64748b;
}

.auth-switch a {
    color: #1597a7;
    text-decoration: none;
    font-weight: 650;
}

.auth-switch a:hover {
    text-decoration: underline;
}

@media (max-width: 1180px) {
    .public-hero {
        grid-template-columns: 1fr;
        min-height: auto;
        padding-top: 48px;
    }

    .public-hero-copy {
        max-width: 880px;
    }

    .public-product-preview {
        max-width: 860px;
    }

    .subject-rail {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    .public-nav {
        position: relative;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 14px;
    }

    .public-brand {
        min-width: 0;
        flex: 1 1 260px;
    }

    .public-nav-links {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .public-hero {
        padding-top: 36px;
    }

    .public-hero h1 {
        font-size: clamp(38px, 10vw, 56px);
    }

    .public-hero-proof,
    .public-trust-strip,
    .workflow-layout,
    .demo-card-grid,
    .public-demo-shell,
    .public-split-section,
    .public-resource-section {
        grid-template-columns: 1fr;
    }

    .public-section-heading {
        display: block;
    }

    .public-section-heading p {
        margin-top: 12px;
    }

    .preview-grid {
        grid-template-columns: 120px minmax(0, 1fr);
    }

    .preview-insight {
        grid-column: 1 / -1;
        border-left: 0;
        border-top: 1px solid var(--public-line);
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .public-nav {
        padding: 14px 16px;
    }

    .public-brand strong {
        font-size: 14px;
    }

    .public-nav-actions,
    .public-hero-actions {
        width: 100%;
    }

    .public-nav-actions .public-btn,
    .public-hero-actions .public-btn,
    .public-final-cta .public-btn {
        flex: 1 1 150px;
    }

    .public-hero,
    .public-section {
        padding-left: 16px;
        padding-right: 16px;
    }

    .public-hero-lead {
        font-size: 16px;
    }

    .public-hero-proof,
    .public-trust-strip,
    .subject-rail,
    .demo-card-grid,
    .public-demo-shell,
    .student-flow,
    .preview-insight {
        grid-template-columns: 1fr;
    }

    .preview-toolbar,
    .preview-question-head {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .preview-subjects {
        border-right: 0;
        border-bottom: 1px solid var(--public-line);
        flex-direction: row;
        overflow-x: auto;
    }

    .preview-subjects button {
        flex: 0 0 auto;
        min-width: 118px;
        text-align: center;
    }

    .preview-search,
    .resource-table div {
        grid-template-columns: 1fr;
    }

    .public-final-cta {
        margin-left: 16px;
        margin-right: 16px;
        padding: 28px 18px;
    }

    .auth-modal {
        align-items: flex-start;
        padding: 14px;
    }

    .auth-card {
        padding: 30px 20px 24px;
    }

    .auth-role-options {
        grid-template-columns: 1fr;
    }
}

.app-shell {
    width: 100%;
}

.shell-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #dbe4f0;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    color: #64748b;
}

.shell-switcher.hidden {
    display: none;
}

.global-subject-switcher {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 5px 8px;
    align-items: center;
    width: 100%;
    background: rgba(248, 250, 252, 0.96);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 12px;
    padding: 9px 10px;
    color: #0f172a;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.global-subject-switcher > span {
    font-size: 12px;
    color: #475569;
    font-weight: 800;
}

.global-subject-trigger {
    justify-self: end;
    max-width: 112px;
    min-width: 76px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid rgba(15, 118, 110, 0.22);
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.08);
    color: #0f5f58;
    cursor: pointer;
    outline: none;
    padding: 4px 9px;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.global-subject-trigger:hover,
.global-subject-trigger[aria-expanded="true"] {
    border-color: rgba(15, 118, 110, 0.34);
    background: rgba(15, 118, 110, 0.14);
}

.global-subject-trigger strong,
.global-subject-trigger span {
    font-size: 13px;
    font-weight: 850;
    line-height: 1;
}

.global-subject-switcher small {
    grid-column: 1 / -1;
    color: #475569;
    font-size: 11px;
    line-height: 1.3;
}

.global-subject-popover {
    position: fixed;
    z-index: 10000;
    max-width: calc(100vw - 24px);
}

.global-subject-popover.hidden {
    display: none;
}

.global-subject-panel {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.2);
}

.subject-picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.35fr;
    gap: 10px;
}

.subject-picker-column {
    min-width: 0;
}

.subject-picker-heading {
    margin-bottom: 7px;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.subject-picker-options {
    display: grid;
    gap: 6px;
}

.subject-picker-option {
    min-height: 34px;
    width: 100%;
    border: 1px solid #dbe4f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #1f2937;
    cursor: pointer;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.2;
    padding: 7px 9px;
    text-align: left;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.subject-picker-option:hover:not(:disabled) {
    border-color: rgba(15, 118, 110, 0.34);
    background: rgba(15, 118, 110, 0.08);
}

.subject-picker-option.is-active {
    border-color: rgba(15, 118, 110, 0.8);
    background: #0f766e;
    color: #fff;
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

.subject-picker-option:disabled {
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.58;
}

.subject-picker-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.subject-picker-current {
    min-width: 58px;
    border-radius: 999px;
    background: #ecfeff;
    color: #0f5f58;
    font-size: 12px;
    font-weight: 850;
    padding: 5px 10px;
    text-align: center;
}

.subject-picker-apply {
    min-height: 32px;
    border: 0;
    border-radius: 8px;
    background: #0f766e;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 850;
    padding: 7px 16px;
}

.subject-picker-apply:disabled {
    background: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
}

@media (max-width: 720px) {
    .global-subject-popover {
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
    }

    .subject-picker-grid {
        grid-template-columns: 1fr;
        max-height: 62vh;
        overflow-y: auto;
    }
}

.sidebar-footer .shell-switcher,
.sidebar-footer .global-subject-switcher,
.sidebar-footer .user-chip {
    width: 100%;
    border-radius: 12px;
}

.sidebar-footer .shell-switcher {
    justify-content: space-between;
    gap: 8px;
    padding: 9px 10px;
    background: rgba(248, 250, 252, 0.96);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
    color: #0f172a;
}

.sidebar-suggestion-btn {
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    border: 1px solid rgba(94, 234, 212, 0.28);
    border-radius: 12px;
    background: rgba(20, 184, 166, 0.16);
    color: rgba(240, 253, 250, 0.96);
    cursor: pointer;
    font-size: 13px;
    font-weight: 850;
    text-align: center;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.sidebar-suggestion-btn:hover {
    border-color: rgba(94, 234, 212, 0.44);
    background: rgba(20, 184, 166, 0.24);
    color: #fff;
}

.sidebar-footer .user-chip {
    align-items: flex-start;
    gap: 4px;
    padding: 10px;
}

.shell-switcher select {
    min-width: 0;
    max-width: 112px;
    border: 1px solid rgba(15, 118, 110, 0.22);
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.08);
    font-size: 13px;
    font-weight: 850;
    color: #0f5f58;
    outline: none;
    padding: 4px 8px;
}

.shell-switcher span {
    flex: 0 0 auto;
    color: #475569;
    font-weight: 800;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 8px 12px;
}

.user-chip-label,
.user-chip-meta {
    font-size: 12px;
    color: #64748b;
}

.user-chip strong {
    color: #0f172a;
}

.sidebar-logout-btn {
    width: 100%;
}

.dashboard-shell {
    min-height: 320px;
}

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

.dashboard-card {
    background: #fff;
    border: 1px solid #dbe4f0;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.dashboard-card-updates {
    grid-column: span 2;
}

.dashboard-card-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.dashboard-card h3 {
    margin-bottom: 10px;
    font-size: 18px;
    color: #0f172a;
}

.dashboard-card-heading h3 {
    margin-bottom: 0;
}

.dashboard-card-heading span {
    color: #64748b;
    font-size: 13px;
}

.dashboard-card-hero {
    grid-column: span 2;
    background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
}

.teacher-home-layout {
    display: grid;
    gap: 20px;
}

.teacher-home-top {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
    gap: 18px;
    align-items: stretch;
}

.teacher-home-panel {
    border: 1px solid #dbe4f0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
    padding: 20px;
}

.teacher-home-command {
    position: relative;
    overflow: hidden;
    border-color: rgba(20, 184, 166, 0.2);
    background:
        radial-gradient(circle at 92% 12%, rgba(45, 212, 191, 0.22), transparent 32%),
        linear-gradient(135deg, #102a36 0%, #0f5f58 58%, #1b7a61 100%);
    color: #fff;
}

.teacher-home-command::before {
    content: "";
    position: absolute;
    inset: auto -70px -95px auto;
    width: 230px;
    height: 230px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}

.teacher-home-command > * {
    position: relative;
}

.teacher-home-kicker {
    display: inline-flex;
    margin-bottom: 10px;
    color: rgba(240, 253, 250, 0.78);
    font-size: 13px;
    font-weight: 850;
}

.teacher-home-command-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.teacher-home-command-head h3 {
    margin: 0;
    color: #fff;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1;
}

.teacher-home-command-head p,
.teacher-home-copy {
    color: rgba(240, 253, 250, 0.78);
}

.teacher-home-command-head p {
    margin: 6px 0 0;
    font-size: 15px;
    font-weight: 750;
}

.teacher-home-copy {
    max-width: 640px;
    margin: 18px 0 0;
    font-size: 15px;
    line-height: 1.75;
}

.teacher-home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.teacher-home-command .btn {
    min-height: 38px;
}

.teacher-home-command .btn-primary {
    border-color: rgba(255, 255, 255, 0.82);
    background: #fff;
    color: #0f3f3b;
}

.teacher-home-command .btn-secondary {
    border-color: rgba(255, 255, 255, 0.26);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.teacher-home-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 24px;
}

.teacher-home-metrics div {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 14px;
}

.teacher-home-metrics span,
.teacher-home-metrics strong {
    display: block;
}

.teacher-home-metrics span {
    color: rgba(240, 253, 250, 0.72);
    font-size: 12px;
    font-weight: 750;
}

.teacher-home-metrics strong {
    margin-top: 7px;
    color: #fff;
    font-size: 28px;
    line-height: 1;
}

.teacher-home-updates {
    border-top: 4px solid #14b8a6;
}

.teacher-home-section {
    display: grid;
    gap: 12px;
}

.teacher-home-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.teacher-home-section-head h3,
.teacher-home-activity h4 {
    margin: 0;
    color: #0f172a;
}

.teacher-home-section-head h3 {
    font-size: 18px;
}

.teacher-home-section-head p {
    margin: 5px 0 0;
    color: #64748b;
    font-size: 13px;
}

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

.teacher-home-activity {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.teacher-home-activity h4 {
    font-size: 16px;
}

.teacher-home-activity .dashboard-list-item {
    align-items: flex-start;
    flex-direction: column;
}

.teacher-home-activity .history-card-actions {
    width: 100%;
    justify-content: flex-start;
}

.teacher-home-activity .dashboard-empty {
    padding: 18px;
}

@media (max-width: 980px) {
    .teacher-home-top,
    .teacher-home-activity-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-copy {
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 14px;
}

.site-update-list {
    display: grid;
    gap: 14px;
}

.site-update-item {
    border-top: 1px solid #e2e8f0;
    padding-top: 14px;
}

.site-update-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.site-update-title-row {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.site-update-title-row h4 {
    color: #0f172a;
    font-size: 16px;
    margin: 0;
}

.site-update-title-row time {
    color: #64748b;
    flex: 0 0 auto;
    font-size: 12px;
    line-height: 1.6;
}

.site-update-item p {
    color: #475569;
    font-size: 14px;
    line-height: 1.7;
    margin: 8px 0 0;
}

.site-update-points {
    color: #475569;
    font-size: 13px;
    line-height: 1.7;
    margin: 8px 0 0;
    padding-left: 18px;
}

.site-update-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.site-update-tags span {
    background: #eef6ff;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    color: #2563eb;
    font-size: 12px;
    padding: 4px 8px;
}

.dashboard-hero-title {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 14px;
}

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

.dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dashboard-list-item,
.history-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e4ebf5;
    border-radius: 12px;
    background: #f8fafc;
}

.dashboard-list-button {
    border: none;
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.dashboard-list-button:hover {
    border-color: #9fc3ff;
    background: #f2f7ff;
}

.dashboard-list-meta,
.history-card-meta {
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.history-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-empty {
    padding: 24px;
    border: 1px dashed #d9e2ee;
    border-radius: 14px;
    color: #64748b;
    background: #fbfdff;
}

.dashboard-stat {
    font-size: 42px;
    font-weight: 800;
    color: #1f4aa8;
    margin: 12px 0 18px;
}

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

.dashboard-stat-grid div {
    padding: 14px;
    border: 1px solid #e4ebf5;
    border-radius: 12px;
    background: #f8fafc;
}

.dashboard-stat-grid strong {
    display: block;
    font-size: 28px;
    line-height: 1;
    color: #1f4aa8;
    margin-bottom: 8px;
}

.dashboard-stat-grid span {
    display: block;
    font-size: 12px;
    color: #64748b;
}

.student-practice-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 12px;
    padding: 14px 16px;
    border: 1px solid #cfe0f5;
    border-radius: 14px;
    background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.student-practice-meta {
    min-width: 0;
}

.student-practice-title {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
}

.student-practice-hint {
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}

.student-practice-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.student-practice-progress {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 10px;
    border: 1px solid #d7e3f4;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}

.q-state-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 999px;
    background: #fff5d8;
    color: #9a6700;
}

.q-state-badge-wrong {
    background: #fde8e8;
    color: #b42318;
}

.learning-actions {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.practice-result-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding: 12px;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #f8fafc;
}

.practice-result-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.practice-result-copy strong {
    color: #0f172a;
    font-size: 14px;
}

.practice-result-copy span {
    color: #64748b;
    font-size: 12px;
    line-height: 1.45;
}

.practice-result-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.feedback-review-section {
    padding-bottom: 28px;
}

.feedback-page-header {
    align-items: flex-start;
}

.feedback-page-header p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}

.feedback-review-toolbar {
    position: sticky;
    top: var(--sticky-top, 0px);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    margin-bottom: 10px;
    background: #f6f8fb;
    border-bottom: 1px solid #e2e8f0;
}

.feedback-review-toolbar select {
    min-width: 136px;
    border: 1px solid #d7e0ec;
    border-radius: 8px;
    padding: 8px 10px;
    color: #0f172a;
    background: #fff;
    font: inherit;
}

.feedback-review-toolbar span {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.review-list,
.feedback-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.review-card,
.feedback-card {
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.review-card-main {
    border: 0;
    border-bottom: 1px solid #eef2f7;
    border-radius: 0;
    background: #f8fafc;
}

.review-card-footer,
.feedback-actions,
.feedback-card-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
}

.review-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #64748b;
    font-size: 12px;
}

.review-meta strong {
    color: #0f172a;
    font-size: 14px;
}

.review-actions,
.feedback-actions {
    flex-wrap: wrap;
}

.feedback-card {
    padding-bottom: 4px;
}

.feedback-card-main {
    align-items: flex-start;
}

.feedback-chip {
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef6ff;
    color: #1f4aa8;
    font-size: 12px;
    font-weight: 700;
}

.feedback-inline-tip {
    align-self: center;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.feedback-status-resolved .feedback-chip {
    background: #dcfce7;
    color: #166534;
}

.feedback-status-dismissed .feedback-chip {
    background: #fee2e2;
    color: #991b1b;
}

.feedback-status-reviewing .feedback-chip {
    background: #fef3c7;
    color: #92400e;
}

.feedback-message,
.feedback-resolution {
    margin: 0 14px 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.feedback-resolution {
    background: #f0fdf4;
    color: #166534;
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.feedback-form h3 {
    margin: 0;
    color: #0f172a;
}

.feedback-form-note {
    margin: -4px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.feedback-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.feedback-form select,
.feedback-form textarea {
    width: 100%;
    border: 1px solid #d8e2ee;
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
}

.feedback-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.feedback-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 0 2px;
    color: #64748b;
    font-size: 13px;
}

@media (max-width: 768px) {
    .app-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-card {
        padding: 24px 20px;
    }

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

    .dashboard-card-hero {
        grid-column: span 1;
    }

    .dashboard-card-updates {
        grid-column: span 1;
    }

    .teacher-home-top,
    .teacher-home-activity-grid {
        grid-template-columns: 1fr;
    }

    .teacher-home-command {
        padding: 18px;
    }

    .teacher-home-metrics {
        grid-template-columns: 1fr;
    }

    .teacher-home-actions {
        flex-direction: column;
    }

    .teacher-home-actions .btn {
        width: 100%;
    }

    .dashboard-card-heading,
    .teacher-home-section-head,
    .site-update-title-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-stat-grid {
        grid-template-columns: 1fr;
    }

    .student-practice-bar,
    .practice-result-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .student-practice-controls,
    .practice-result-actions {
        justify-content: flex-start;
    }
}

/* ─── Account Management Page ────────────────────────────── */
.account-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    min-height: 60vh;
}

.account-sidebar {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px 0;
    box-shadow: 0 4px 18px rgba(15,23,42,0.05);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.account-user-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 20px 20px;
    border-bottom: 1px solid #eef2f7;
    margin-bottom: 8px;
}

.account-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 10px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
}

.account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.account-user-name {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
}

.account-user-roles {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    text-align: center;
}

.account-nav {
    list-style: none;
    padding: 0;
}

.account-nav li {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    color: #475467;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.account-nav li:hover {
    background: #f8fafc;
    color: #0f172a;
}

.account-nav li.active {
    background: #eef4ff;
    color: #1d4ed8;
    border-left-color: #4fc3f7;
    font-weight: 600;
}

.account-content {
    min-width: 0;
}

.account-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 4px 18px rgba(15,23,42,0.05);
}

.account-section h3 {
    font-size: 17px;
    color: #0f172a;
    margin-bottom: 16px;
}

.account-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 520px;
}

.account-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.account-field label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.account-field input,
.account-field select {
    height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.account-field input:focus,
.account-field select:focus {
    border-color: #4fc3f7;
    box-shadow: 0 0 0 3px rgba(79,195,247,0.12);
}

.account-field input:disabled {
    background: #f8fafc;
    color: #94a3b8;
}

.account-field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.avatar-upload-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar-preview {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    flex-shrink: 0;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pw-strength-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.pw-strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.3s, background 0.3s;
}

.pw-strength-text {
    font-size: 12px;
    margin-top: 2px;
}

.account-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #334155;
}

.account-toggle-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.page-permission-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 16px;
}

.page-permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.page-permission-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    padding: 6px 12px;
}

.page-permission-group {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    background: #f8fafc;
}

.page-permission-group h4 {
    margin: 0 0 8px;
    font-size: 13px;
    color: #0f172a;
}

.page-permission-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-top: 1px solid #e5e7eb;
}

.page-permission-row:first-of-type {
    border-top: 0;
}

.page-permission-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
    cursor: pointer;
}

.page-permission-row input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex: 0 0 auto;
}

.page-permission-check span {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.page-permission-row strong {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #1e293b;
}

.page-permission-mode-badge {
    font-style: normal;
    color: #475569;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 11px;
    line-height: 1.5;
}

.page-permission-row small {
    color: #64748b;
    font-size: 11px;
    line-height: 1.35;
}

.page-permission-order-actions {
    display: inline-flex;
    gap: 6px;
    flex: 0 0 auto;
}

.account-alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.account-alert.danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

@media (max-width: 768px) {
    .account-layout {
        grid-template-columns: 1fr;
    }
    .account-sidebar {
        position: static;
    }
}

.rbac-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 4px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
}

.rbac-tabs .btn {
    border-radius: 8px 8px 0 0;
    border-bottom: none;
    font-size: 13px;
    padding: 8px 16px;
}

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

.rbac-table th {
    background: #f8fafc;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #334155;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.rbac-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #475467;
}

.rbac-table tr:hover td {
    background: #f8fafc;
}

.rbac-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.rbac-status.is-active {
    background: #dcfce7;
    color: #166534;
}

.rbac-status.is-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.rbac-empty {
    text-align: center;
    padding: 32px;
    color: #94a3b8;
    font-size: 14px;
}

.usage-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.usage-toolbar h3 {
    margin: 0;
}

.usage-toolbar select {
    height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 10px;
    color: #334155;
    background: #fff;
}

.usage-stat-grid {
    margin-bottom: 18px;
}

.usage-panels {
    display: grid;
    grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
    gap: 16px;
}

.usage-panel {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px;
    background: #f8fafc;
    min-width: 0;
}

.usage-panel h4 {
    margin: 0 0 12px;
    font-size: 14px;
    color: #0f172a;
}

.usage-day-row {
    display: grid;
    grid-template-columns: 86px minmax(80px, 1fr) 64px;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    color: #475569;
    font-size: 12px;
}

.usage-day-row strong {
    text-align: right;
    color: #0f172a;
}

.usage-day-bar {
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.usage-day-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #0ea5e9;
}

.rbac-inline-tip {
    font-size: 11px;
    color: #94a3b8;
    font-style: italic;
}

.rbac-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ─── Sub-question Cards ──────────────────────────────────── */
.parent-detail-layout {
    padding: 8px;
    overflow-y: auto;
    height: auto;
    min-height: 100%;
    display: block;
    min-width: 0;
    min-height: 0;
}

.parent-detail-layout > * {
    margin-bottom: 10px;
}

.parent-detail-layout > *:last-child {
    margin-bottom: 0;
}

.parent-detail-hero,
.parent-stem-flow {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.parent-detail-hero {
    padding: 14px 16px;
    background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
}

.parent-detail-title {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}

.parent-detail-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.parent-stem-flow {
    padding: 14px 16px;
}

.parent-stem-image {
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid #dbe6f2;
    display: block;
}

.parent-flow-label {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.parent-unit-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.parent-unit-toggle {
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #334155;
}

.parent-unit-count {
    font-size: 12px;
    color: #64748b;
}

.subq-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 8px;
    overflow: visible;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15,23,42,0.04);
    transition: box-shadow 0.2s;
    width: 100%;
    min-width: 0;
    min-height: 0;
    display: block;
    position: relative;
}

.subq-card:hover {
    box-shadow: 0 4px 16px rgba(15,23,42,0.08);
}

.subq-card.filter-match {
    border-color: #f5c542;
    box-shadow: 0 0 0 3px rgba(245,197,66,0.18), 0 6px 18px rgba(15,23,42,0.08);
}

.subq-card.detail-keyword-match,
.subq-child-item.detail-keyword-match,
.parent-stem-flow.detail-keyword-match {
    border-color: #f97316;
    background: linear-gradient(180deg, #fff7ed 0%, #ffffff 72%);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.18), 0 10px 24px rgba(124, 45, 18, 0.12);
}

.subq-card.detail-knowledge-match,
.subq-child-item.detail-knowledge-match,
.parent-stem-flow.detail-knowledge-match {
    border-color: #0d9488;
    background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 72%);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.16), 0 10px 24px rgba(15, 118, 110, 0.12);
}

.subq-card.detail-keyword-match.detail-knowledge-match,
.subq-child-item.detail-keyword-match.detail-knowledge-match,
.parent-stem-flow.detail-keyword-match.detail-knowledge-match {
    border-color: #a16207;
    background: linear-gradient(135deg, #fff7ed 0%, #ecfdf5 100%);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18), 0 0 0 8px rgba(13, 148, 136, 0.10), 0 10px 24px rgba(47, 39, 25, 0.12);
}

.subq-card.detail-focused {
    border-color: #2f80ed;
    box-shadow: 0 0 0 3px rgba(47,128,237,0.18), 0 8px 20px rgba(15,23,42,0.10);
}

#question-detail-panel [data-detail-question-id].detail-focused:not(.subq-card):not(.detail-export-item) {
    border-radius: 10px;
    box-shadow: 0 0 0 3px rgba(47,128,237,0.18);
}

.subq-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.subq-header input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4fc3f7;
}

.subq-label {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.subq-difficulty-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
}

.subq-filter-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fff7d6;
    color: #9a6700;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.detail-match-badges {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.detail-match-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.detail-match-keyword-badge {
    background: #fed7aa;
    color: #7c2d12;
}

.detail-match-knowledge-badge {
    background: #ccfbf1;
    color: #0f5f58;
}

.subq-image-wrap {
    padding: 6px 10px;
    width: 100%;
    min-width: 0;
    overflow: visible;
}

.subq-inline-export {
    padding: 8px 10px 0 10px;
}

.subq-inline-export-label,
.detail-export-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #334155;
    font-weight: 600;
}

.subq-child-list {
    display: block;
    margin-top: 8px;
    padding: 0 10px 10px 10px;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: visible;
}

.subq-child-list-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    margin-bottom: -2px;
}

.subq-child-item {
    border: 1px solid #e5edf6;
    border-radius: 10px;
    padding: 6px;
    background: #fbfdff;
    transition: box-shadow 0.2s, background-color 0.2s;
    display: block;
    height: auto;
    min-height: 0;
    width: 100%;
    min-width: 0;
    overflow: visible;
    position: relative;
    clear: both;
}

.subq-child-item + .subq-child-item {
    margin-top: 8px;
}

.detail-export-heading {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0;
}

.subq-child-item.detail-focused {
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(47,128,237,0.22);
}

.subq-child-image-wrap {
    padding: 6px 0 0 0;
    display: block;
    width: 100%;
    overflow: visible;
    min-width: 0;
}

.subq-image-wrap img,
.subq-child-image-wrap img {
    width: 100%;
    height: auto;
    max-height: none;
    background: #fff;
    display: block;
    object-fit: contain;
    aspect-ratio: auto;
}

.subq-inline-actions {
    margin-top: 8px;
    padding: 0;
}

.subq-answer-block {
    padding: 10px 12px;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-top: 2px solid #f59e0b;
}

.subq-answer-header {
    font-size: 12px;
    color: #b45309;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.subq-answer-block img {
    border: 1px solid #fde68a;
    border-radius: 6px;
}

.subq-answer-item + .subq-answer-item {
    margin-top: 10px;
}

@media (max-width: 768px) {
    .parent-detail-layout {
        padding: 12px;
        gap: 12px;
    }
    .parent-detail-hero,
    .parent-stem-flow {
        border-radius: 12px;
    }
    .parent-detail-hero,
    .parent-stem-flow {
        padding: 14px;
    }
    .subq-card {
        border-radius: 8px;
        margin-bottom: 8px;
    }
    .subq-header {
        padding: 10px 12px;
    }
    .subq-image-wrap {
        padding: 8px 12px;
    }
    .subq-answer-block {
        padding: 10px 12px;
    }
}

/* Question list badges */
.q-subcount {
    color: #999;
    font-size: 12px;
    margin-left: 4px;
    white-space: nowrap;
}

.q-type-badge {
    display: inline-block;
    padding: 1px 6px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 6px;
    white-space: nowrap;
}

/* Maintenance dashboard */
.maintenance-header {
    gap: 12px;
    flex-wrap: wrap;
}

.maintenance-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.maintenance-model-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #475569;
}

.maintenance-model-control select {
    min-width: 220px;
}

.maintenance-controls select {
    border: 1px solid #d7dee8;
    border-radius: 8px;
    padding: 7px 10px;
    background: #fff;
    font-size: 13px;
}

.maintenance-dashboard {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-bottom: 24px;
}

.maintenance-health {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    border: 1px solid #d6dee8;
    border-radius: 8px;
    padding: 12px;
    background: #f8fafc;
}

.maintenance-health-good { border-left: 4px solid #059669; }
.maintenance-health-warn { border-left: 4px solid #d97706; }
.maintenance-health-bad { border-left: 4px solid #dc2626; }

.maintenance-health div,
.maintenance-metric {
    min-width: 0;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}

.maintenance-health span,
.maintenance-metric span {
    display: block;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
}

.maintenance-health strong,
.maintenance-metric strong {
    display: block;
    color: #0f172a;
    font-size: 22px;
    line-height: 1.15;
    word-break: break-word;
}

.maintenance-health em,
.maintenance-metric em {
    display: block;
    color: #64748b;
    font-size: 12px;
    font-style: normal;
    margin-top: 6px;
    min-height: 16px;
}

.maintenance-metric.good {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.maintenance-metric.warn {
    border-color: #fde68a;
    background: #fffbeb;
}

.maintenance-metric.bad {
    border-color: #fecaca;
    background: #fff5f5;
}

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

.maintenance-panel {
    border: 1px solid #dde5ef;
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.maintenance-panel h3 {
    margin: 0 0 12px 0;
    color: #172033;
    font-size: 15px;
}

.maintenance-wide {
    width: 100%;
}

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

.maintenance-progress-row {
    margin-top: 10px;
}

.maintenance-progress-head,
.maintenance-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #64748b;
    font-size: 12px;
}

.maintenance-progress-head strong {
    color: #0f172a;
}

.maintenance-progress-track {
    height: 8px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
    margin: 6px 0;
}

.maintenance-progress-track div {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0f766e, #2563eb);
}

.maintenance-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.maintenance-action,
.maintenance-job {
    width: 100%;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
    padding: 11px 12px;
    text-align: left;
    cursor: pointer;
}

.maintenance-action-upload {
    display: block;
}

.maintenance-action-upload input {
    display: none;
}

.maintenance-action-danger {
    border-color: #fecaca;
    background: #fff5f5;
}

.maintenance-action-danger strong {
    color: #b91c1c;
}

.maintenance-action:hover,
.maintenance-job:hover {
    border-color: #2563eb;
    background: #f9fbff;
}

.maintenance-action strong,
.maintenance-action span {
    display: block;
}

.maintenance-action strong {
    color: #0f172a;
    font-size: 13px;
    margin-bottom: 5px;
}

.maintenance-action span {
    color: #64748b;
    font-size: 11px;
    word-break: break-all;
}

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

.maintenance-job {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
}

.maintenance-job strong,
.maintenance-job span,
.maintenance-job em {
    display: block;
}

.maintenance-job strong {
    color: #0f172a;
    font-size: 13px;
}

.maintenance-job div span,
.maintenance-job em {
    color: #64748b;
    font-size: 11px;
    font-style: normal;
}

.maintenance-table-wrap {
    max-height: 360px;
    overflow: auto;
    border: 1px solid #edf1f6;
    border-radius: 8px;
}

.maintenance-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.maintenance-table th,
.maintenance-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #edf1f6;
    text-align: left;
    vertical-align: top;
}

.maintenance-table th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: #475569;
    z-index: 1;
}

.maintenance-empty {
    padding: 16px;
    color: #64748b;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    text-align: center;
}

.maintenance-integrated-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 14px;
    margin-top: 14px;
}

.maintenance-detail-tabs {
    margin-top: 14px;
}

.maintenance-detail-tabbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--line, #e2e8f0);
    border-radius: var(--radius-lg, 16px);
    background: #f8fafc;
    overflow-x: auto;
    margin-bottom: 12px;
}

.maintenance-detail-tab {
    flex: 0 0 auto;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    padding: 10px 14px;
    white-space: nowrap;
}

.maintenance-detail-tab:hover {
    background: #eef2f7;
    color: #0f172a;
}

.maintenance-detail-tab.active {
    background: #1f4aa8;
    color: #fff;
    box-shadow: 0 6px 14px rgba(31, 74, 168, 0.18);
}

.maintenance-detail-panel {
    border: 1px solid var(--line, #e2e8f0);
    border-radius: var(--radius-lg, 16px);
    background: var(--panel, #fff);
    box-shadow: var(--shadow-tight, 0 8px 22px rgba(15, 23, 42, 0.04));
    padding: 16px;
    min-height: 260px;
}

.maintenance-detail-panel-metrics {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    min-height: 0;
}

.maintenance-detail-panel[hidden] {
    display: none;
}

.maintenance-review-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.maintenance-panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.maintenance-panel-heading h3 {
    margin-bottom: 4px;
}

.maintenance-panel-heading p {
    margin: 0;
    color: #64748b;
    font-size: 12px;
}

.maintenance-subtoolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.maintenance-subtoolbar label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #475569;
    font-size: 12px;
}

.maintenance-subtoolbar select {
    border: 1px solid #d7dee8;
    border-radius: 8px;
    padding: 6px 9px;
    background: #fff;
    font-size: 13px;
}

@media (max-width: 1100px) {
    .maintenance-health,
    .maintenance-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .maintenance-controls {
        width: 100%;
        margin-left: 0;
    }
    .maintenance-health,
    .maintenance-grid,
    .maintenance-integrated-grid,
    .maintenance-metric-grid,
    .maintenance-actions,
    .maintenance-job {
        grid-template-columns: 1fr;
    }
}

/* ─── 2026 Workspace Redesign ───────────────────────────── */
:root {
    --app-bg: #ece7dc;
    --app-bg-2: #f8f4ea;
    --ink: #18211f;
    --muted: #66736d;
    --panel: rgba(255, 253, 247, 0.92);
    --panel-solid: #fffdf7;
    --line: rgba(31, 41, 35, 0.12);
    --line-strong: rgba(31, 41, 35, 0.2);
    --accent: #0f766e;
    --accent-2: #b45309;
    --accent-blue: #2563eb;
    --danger: #b91c1c;
    --shadow-soft: 0 18px 45px rgba(47, 39, 25, 0.12);
    --shadow-tight: 0 8px 24px rgba(47, 39, 25, 0.10);
    --radius-lg: 22px;
    --radius-md: 16px;
    --sidebar-w: 188px;
    --sidebar-collapsed-w: 64px;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: "Aptos", "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(15, 118, 110, 0.12), transparent 30%),
        radial-gradient(circle at 90% 16%, rgba(180, 83, 9, 0.12), transparent 28%),
        linear-gradient(135deg, var(--app-bg-2), var(--app-bg));
}

.app-shell {
    width: 100%;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-w);
    padding: 14px 0;
    background:
        linear-gradient(180deg, rgba(17, 31, 28, 0.98), rgba(25, 29, 24, 0.96)),
        radial-gradient(circle at top left, rgba(20, 184, 166, 0.24), transparent 42%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 12px 0 36px rgba(28, 24, 16, 0.18);
}

.sidebar-header {
    padding: 0 12px 14px;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.logo {
    font-size: 18px;
    letter-spacing: -0.02em;
}

.nav-tabs {
    margin-top: 14px;
    padding: 0 8px;
}

.nav-tabs li {
    margin-bottom: 4px;
    padding: 10px 10px;
    border-left: 0;
    border-radius: 12px;
    color: rgba(241, 245, 249, 0.82);
    align-items: flex-start;
    white-space: normal;
}

.nav-tabs .nav-label {
    min-width: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.28;
    font-size: 15px;
}

.lang-en .nav-tabs .nav-label {
    font-size: 11.5px;
    line-height: 1.14;
}

.nav-tabs li:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.nav-tabs li.active {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

.sidebar-footer {
    padding: 12px;
    background: rgba(255, 255, 255, 0.045);
}

.sidebar-footer .shell-switcher,
.sidebar-footer .global-subject-switcher,
.sidebar-footer .user-chip {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(241, 245, 249, 0.86);
}

.sidebar-footer .shell-switcher,
.sidebar-footer .global-subject-switcher {
    background: rgba(248, 250, 252, 0.96);
    border-color: rgba(226, 232, 240, 0.95);
    color: #0f172a;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.sidebar-footer .sidebar-suggestion-btn {
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.sidebar-footer .shell-switcher span,
.sidebar-footer .global-subject-switcher > span {
    color: #475569;
}

.sidebar-footer .shell-switcher select,
.sidebar-footer .global-subject-trigger {
    color: #0f5f58;
    background: rgba(15, 118, 110, 0.08);
    border-color: rgba(15, 118, 110, 0.22);
}

.sidebar-footer .user-chip strong,
.sidebar-footer .user-chip-label,
.sidebar-footer .user-chip-meta {
    color: rgba(248, 250, 252, 0.9);
}

.content {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    height: 100vh;
    padding: 12px;
    overflow: hidden;
}

.app-shell.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-w);
}

.app-shell.sidebar-collapsed .content {
    margin-left: var(--sidebar-collapsed-w);
    width: calc(100% - var(--sidebar-collapsed-w));
}

.tab-content {
    min-width: 0;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.tab-content.question-stream-section.active {
    overflow: hidden;
    padding-bottom: 0;
}

.dashboard-section.active,
.ops-section.active,
.feedback-review-section.active,
.export-workspace-section.active {
    overflow-y: auto;
    padding-bottom: 6px;
}

.section-header,
.page-header {
    flex: 0 0 auto;
    min-height: 48px;
    margin-bottom: 10px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 247, 0.82);
    box-shadow: 0 10px 28px rgba(47, 39, 25, 0.08);
    backdrop-filter: blur(16px);
}

.section-header h2,
.page-header h2,
.ocr-toolbar h3 {
    color: var(--ink);
    font-size: 18px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.btn {
    border-radius: 999px;
    border-color: rgba(31, 41, 35, 0.14);
    background: var(--panel-solid);
    color: var(--ink);
    font-weight: 700;
    box-shadow: none;
}

.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.btn-primary {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff;
}

.btn-primary:hover {
    background: #0b5f59;
    color: #fff;
}

.btn-secondary {
    background: #31413d;
    border-color: #31413d;
    color: #fff;
}

.btn-danger {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

select,
input,
textarea {
    color: var(--ink);
}

.subject-filter-select,
.inline-filter-select,
.search-field select,
.search-field input,
.paper-toolbar-group select,
.maintenance-controls select,
.ocr-toolbar select {
    border-color: rgba(31, 41, 35, 0.14) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.86) !important;
    color: var(--ink);
    outline: none;
}

.subject-filter-select:focus,
.inline-filter-select:focus,
.search-field select:focus,
.search-field input:focus,
.paper-toolbar-group select:focus,
.ocr-toolbar select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

/* Core workspace: papers */
.paper-workspace-section {
    gap: 0;
}

.paper-workspace-section .process-progress,
.paper-workspace-section .import-progress {
    flex: 0 0 auto;
    margin-bottom: 8px;
}

.paper-browser {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    grid-template-columns: 282px minmax(0, 1fr);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 253, 247, 0.72);
    box-shadow: var(--shadow-soft);
}

.paper-browser.paper-list-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
}

.paper-list-panel {
    background: rgba(245, 240, 229, 0.88);
    border-right-color: var(--line);
}

.paper-toolbar,
.paper-admin-panel,
.paper-viewer-controls {
    background: rgba(255, 253, 247, 0.82);
    border-bottom-color: var(--line);
}

.paper-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
    gap: 8px;
}

.paper-toolbar .btn {
    min-height: 32px;
}

.paper-admin-panel {
    grid-template-columns: 1fr;
    padding: 8px 10px;
}

.paper-viewer-controls {
    padding: 10px;
}

.paper-viewer-meta-title {
    color: var(--ink);
}

.papers-list {
    padding: 8px;
}

.paper-item {
    appearance: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
    width: 100%;
    padding: 10px 10px;
    border: 1px solid rgba(31, 41, 35, 0.1);
    border-radius: 14px;
    background: rgba(255, 253, 247, 0.9);
    color: var(--ink);
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.paper-item:hover {
    border-color: rgba(15, 118, 110, 0.36);
    box-shadow: 0 8px 18px rgba(47, 39, 25, 0.08);
}

.paper-item.active {
    border-color: var(--accent);
    background: #f1fbf8;
    box-shadow: inset 3px 0 0 var(--accent), 0 10px 24px rgba(15, 118, 110, 0.10);
}

.paper-item .paper-title {
    grid-column: 1 / -1;
    color: var(--ink);
    font-size: 12px;
    line-height: 1.3;
}

.paper-item .paper-meta {
    color: var(--muted);
}

.paper-status {
    justify-self: end;
    margin-top: 0;
    border-radius: 999px;
}

.paper-status.status-processed {
    background: #e5f5ef;
    color: #0f766e;
}

.paper-status.status-pending {
    background: #fff4dc;
    color: #a16207;
}

.paper-detail-panel {
    background: #ede8dd;
}

.paper-detail-placeholder,
.question-detail-placeholder {
    color: var(--muted);
    background: repeating-linear-gradient(135deg, rgba(255,255,255,0.3), rgba(255,255,255,0.3) 12px, rgba(255,255,255,0.16) 12px, rgba(255,255,255,0.16) 24px);
}

.paper-detail-shell {
    height: 100%;
}

.paper-pdf-frame {
    border-left-color: var(--line);
    background: #262b28;
}

.paper-pdf-frame embed {
    background: #fff;
}

.paper-pdf-scrollbar {
    border-left-color: var(--line);
    background: rgba(255, 253, 247, 0.9);
}

.paper-panel-reopen {
    top: 12px;
    left: 14px;
    border-color: rgba(15, 118, 110, 0.2);
    background: rgba(255, 253, 247, 0.92);
}

/* Core workspace: questions */
.question-workspace-section {
    gap: 0;
}

.question-topbar {
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.question-topbar h2 {
    flex: 0 0 auto;
    margin-right: 8px;
}

.question-topbar .btn,
.question-topbar label {
    flex: 0 0 auto;
    white-space: nowrap;
}

.question-topbar .btn {
    min-height: 32px;
    padding: 7px 11px;
    font-size: 12px;
}

.question-topbar #tagging-model-select {
    min-width: 190px !important;
}

.question-filterbar {
    flex: 0 0 auto;
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 247, 0.78);
    box-shadow: 0 8px 22px rgba(47, 39, 25, 0.07);
    backdrop-filter: blur(14px);
}

.question-stream-section .question-filterbar {
    position: sticky;
    top: 0;
    z-index: 9;
    background: rgba(255, 253, 247, 0.96);
}

.search-row {
    gap: 8px;
}

.question-filterbar .search-row {
    flex-wrap: nowrap;
    overflow: visible;
    padding-bottom: 2px;
    scrollbar-width: thin;
}

.search-field {
    min-width: 86px;
}

.search-field-text {
    min-width: 240px;
}

.search-field label {
    color: var(--muted);
    font-weight: 800;
}

.search-field select,
.search-field input {
    height: 32px;
}

.search-field select[hidden] {
    display: none !important;
}

.paper-prefix-multiselect {
    position: relative;
    min-width: 118px;
}

.paper-prefix-multiselect-button {
    width: 100%;
    height: 32px;
    border: 1px solid #d8ddd8;
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    line-height: 1;
    text-align: left;
    padding: 0 34px 0 10px;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
    position: relative;
}

.paper-prefix-multiselect-button::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}

.paper-prefix-multiselect-button[aria-expanded="true"]::after {
    transform: translateY(-35%) rotate(225deg);
}

.paper-prefix-multiselect-button:focus,
.paper-prefix-multiselect-button:hover {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(21, 128, 120, 0.12);
}

.paper-prefix-multiselect-menu {
    position: absolute;
    z-index: 30;
    left: 0;
    top: calc(100% + 6px);
    width: 100%;
    min-width: 132px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(47, 39, 25, 0.16);
}

.paper-prefix-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 30px;
    padding: 5px 7px;
    border-radius: 8px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    user-select: none;
}

.paper-prefix-option:hover {
    background: rgba(21, 128, 120, 0.08);
}

.paper-prefix-option input {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
}

.paper-prefix-option-all {
    border-bottom: 1px solid var(--line);
    border-radius: 8px 8px 0 0;
    margin-bottom: 4px;
}

.question-browser {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    grid-template-columns: 218px 252px minmax(0, 1fr);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 253, 247, 0.74);
    box-shadow: var(--shadow-soft);
}

.question-browser.no-kp-panel {
    grid-template-columns: 276px minmax(0, 1fr);
}

.kp-tree-panel,
.question-list-panel {
    border-right-color: var(--line);
    background: rgba(245, 240, 229, 0.82);
    min-width: 0;
}

.kp-tree-header {
    padding: 10px 12px;
    background: rgba(255, 253, 247, 0.86);
    border-bottom-color: var(--line);
    color: var(--ink);
}

.kp-tree-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 700;
}

.kp-tree-title-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.kp-tree-clear {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
}

.kp-tree-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px;
    margin-top: 8px;
}

.kp-tree-tools input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.86);
    padding: 6px 8px;
    font-size: 12px;
}

.kp-tree-tools button {
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 10px;
    background: rgba(15, 118, 110, 0.08);
    color: #0f5f58;
    padding: 6px 8px;
    font-size: 12px;
    cursor: pointer;
}

.kp-tree {
    padding: 8px;
    overflow-x: hidden;
}

.kp-tree-item {
    align-items: flex-start;
    border-radius: 10px;
    padding: 6px 8px;
    min-width: 0;
}

.kp-tree-item.level-1 {
    font-weight: 700;
    color: #24423e;
}

.kp-tree-item.level-2 {
    font-weight: 600;
}

.kp-tree-item.level-3,
.kp-tree-item.level-4 {
    font-size: 11px;
    color: var(--muted);
}

.kp-tree-item:hover {
    background: rgba(15, 118, 110, 0.08);
}

.kp-tree-item.selected {
    background: #dff6ef;
    color: #0f5f58;
}

.kp-tree-item.matched {
    box-shadow: inset 0 0 0 1px rgba(191, 127, 0, 0.24);
    background: rgba(255, 244, 214, 0.72);
}

.kp-tree-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 28px;
    margin-right: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: #0f5f58;
    font-size: 10px;
    font-weight: 700;
}

.kp-tree-label {
    min-width: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.kp-tree-toggle {
    margin-top: 1px;
}

.kp-tree-children {
    margin-left: 10px;
}

.kp-tree-count {
    flex: 0 0 auto;
    margin-top: 2px;
}

.question-browser.kp-tree-wide {
    grid-template-columns: clamp(300px, 29vw, 390px) 252px minmax(0, 1fr);
}

.question-browser.no-kp-panel.kp-tree-wide {
    grid-template-columns: 276px minmax(0, 1fr);
}

.kp-tree-empty {
    color: var(--muted);
    padding: 16px 12px;
    font-size: 12px;
    text-align: center;
}

.question-list-panel {
    overflow: hidden;
}

.questions-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
}

.question-item {
    appearance: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 6px;
    padding: 10px 10px !important;
    border: 1px solid rgba(31, 41, 35, 0.1) !important;
    border-radius: 14px;
    background: rgba(255, 253, 247, 0.88);
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.question-item:hover {
    border-color: rgba(15, 118, 110, 0.34) !important;
    box-shadow: 0 8px 18px rgba(47, 39, 25, 0.08);
}

.question-item.selected {
    background: #f0fbf8;
    border-color: var(--accent) !important;
    box-shadow: inset 3px 0 0 var(--accent), 0 10px 24px rgba(15, 118, 110, 0.10);
}

.question-item-main {
    min-width: 0;
}

.question-item-title {
    display: block;
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.question-item-meta {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.question-item-difficulty-line {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    margin-top: 5px;
    color: #8a5a00;
    font-size: 11px;
    font-weight: 700;
}

.question-item-difficulty-line strong {
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.14);
    color: #7c2d12;
    font-size: 10px;
    font-weight: 900;
}

.question-item-difficulty-line span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.question-item-difficulty-line.empty {
    color: #64748b;
}

.question-item-difficulty-line.empty strong {
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
}

.question-match-line {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    min-width: 0;
}

.question-match-group {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex-wrap: wrap;
}

.question-match-label {
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: #0f5f58;
    font-size: 10px;
    font-weight: 900;
}

.question-match-keyword .question-match-label {
    background: rgba(245, 158, 11, 0.16);
    color: #7c2d12;
}

.question-hit-chip,
.question-hit-more {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    background: rgba(255, 255, 255, 0.78);
    color: #0f5f58;
    font-size: 10px;
    font-weight: 900;
}

.question-match-keyword .question-hit-chip {
    border-color: rgba(245, 158, 11, 0.26);
    color: #9a3412;
    background: rgba(255, 247, 237, 0.9);
}

.question-hit-more {
    color: #64748b;
    border-color: rgba(100, 116, 139, 0.18);
}

.question-item-flags {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: wrap;
}

.q-type-badge,
.q-state-badge,
.q-subcount {
    margin-left: 0;
}

.q-type-badge {
    border-radius: 999px;
    background: #e5f5ef;
    color: #0f766e;
}

.question-detail-panel {
    padding: 0;
    background: #ede8dd;
}

.parent-detail-layout {
    padding: 10px;
    min-height: 100%;
}

.parent-detail-hero,
.parent-stem-flow,
.subq-card,
.question-meta-card {
    border-color: rgba(31, 41, 35, 0.12);
    background: rgba(255, 253, 247, 0.94);
    box-shadow: var(--shadow-tight);
}

.parent-detail-hero {
    padding: 12px 14px;
    background:
        linear-gradient(135deg, rgba(255, 253, 247, 0.96), rgba(229, 245, 239, 0.92));
}

.parent-detail-title {
    font-size: 17px;
}

.parent-stem-flow {
    padding: 10px 12px;
}

.subq-card {
    border-radius: 16px;
    margin-bottom: 10px;
}

.subq-header {
    padding: 9px 12px;
    background: rgba(246, 241, 231, 0.82);
    border-bottom-color: rgba(31, 41, 35, 0.10);
}

.subq-image-wrap,
.subq-child-list {
    padding-left: 12px;
    padding-right: 12px;
}

.subq-image-wrap img,
.subq-child-image-wrap img,
.parent-stem-image,
.question-detail-image {
    border: 1px solid rgba(31, 41, 35, 0.1);
    border-radius: 12px;
}

.subq-answer-block {
    border-top-color: rgba(180, 83, 9, 0.35);
}

/* Secondary pages */
.task-center-panel,
.maintenance-panel,
.account-section,
.account-sidebar,
.dashboard-card,
.export-sidebar,
.export-preview,
.rbac-summary-panel,
.rbac-section,
.job-detail-panel,
.active-job-panel,
.dashboard-list-item,
.history-card {
    border-color: var(--line);
    background: var(--panel);
    box-shadow: var(--shadow-tight);
}

.task-center-panel,
.maintenance-panel,
.dashboard-card,
.account-section,
.export-sidebar,
.export-preview {
    border-radius: var(--radius-lg);
}

.task-center-body {
    grid-template-columns: minmax(300px, 0.42fr) minmax(0, 1fr);
    min-height: 0;
}

.jobs-list,
.job-detail-panel {
    max-height: none;
}

.maintenance-dashboard {
    padding-bottom: 8px;
}

.maintenance-integrated-grid {
    min-height: 0;
}

.maintenance-health,
.maintenance-panel {
    border-radius: var(--radius-lg);
}

.maintenance-health {
    background: rgba(255, 253, 247, 0.78);
}

.maintenance-progress-track div {
    background: linear-gradient(90deg, var(--accent), var(--accent-blue));
}

.export-workspace-section .export-layout {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: 320px minmax(0, 1fr);
}

.export-sidebar,
.export-preview {
    min-height: 0;
    overflow: auto;
}

#preview-area {
    min-height: 0;
    border-color: rgba(31, 41, 35, 0.14);
    background: rgba(255, 255, 255, 0.58);
}

.export-command-bar {
    position: sticky;
    top: 0;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.export-command-title {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.export-command-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.export-header-actions .btn.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.export-action-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.export-action-dropdown > .btn {
    white-space: nowrap;
}

.export-dropdown-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    z-index: 40;
    width: min(560px, calc(100vw - 40px));
    max-width: calc(100vw - 24px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    box-shadow: 0 18px 40px rgba(31, 41, 35, 0.16);
    padding: 14px;
}

.export-dropdown-panel.auto-compose-panel {
    width: min(620px, calc(100vw - 40px));
    margin: 0;
}

.export-dropdown-panel.export-history-panel {
    width: min(430px, calc(100vw - 40px));
}

.export-dropdown-panel[hidden] {
    display: none;
}

.export-dropdown-panel .export-tool-head {
    margin-bottom: 12px;
}

.export-dropdown-panel .compose-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.export-dropdown-panel .compose-grid label:first-child {
    grid-column: auto;
}

.export-dropdown-panel .compose-grid input,
.export-dropdown-panel .compose-kp-rule input,
.export-dropdown-panel .compose-kp-rule select {
    min-height: 38px;
    border-color: var(--line);
}

.export-dropdown-panel .compose-kp-rule {
    grid-template-columns: minmax(0, 1fr) 76px 34px;
}

.export-dropdown-panel .compose-kp-remove {
    height: 38px;
    border-radius: 999px;
}

.export-dropdown-panel .export-template-list {
    max-height: min(420px, calc(100vh - 260px));
    overflow: auto;
}

.export-count-pill,
.export-edit-status {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid rgba(31, 41, 35, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.export-count-pill strong {
    margin-right: 4px;
    color: var(--ink);
    font-size: 14px;
}

.export-edit-status.is-editing {
    border-color: rgba(37, 99, 235, 0.28);
    background: rgba(239, 246, 255, 0.86);
    color: #1d4ed8;
}

.export-workspace-section .export-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 14px;
    align-items: start;
    min-height: auto;
}

.export-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.export-panel,
.export-tool-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    box-shadow: var(--shadow-tight);
}

.export-panel {
    overflow: hidden;
}

.export-layout > .export-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.export-panel-head,
.export-tool-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.export-panel-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 253, 247, 0.7);
}

.export-panel-head h3,
.export-tool-head h3 {
    margin: 0;
    color: var(--ink);
    font-size: 15px;
    line-height: 1.2;
}

.export-panel-head span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.export-preview-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: 8px;
    min-width: min(100%, 520px);
    flex-wrap: wrap;
}

.export-inline-name {
    display: flex;
    min-width: 220px;
    flex: 1 1 240px;
    flex-direction: column;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.export-inline-name input {
    width: 100%;
    min-height: 34px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
}

.export-panel-count {
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    background: rgba(15, 118, 110, 0.08);
    color: var(--accent) !important;
}

.export-tool-card {
    padding: 14px;
}

.export-tool-head {
    margin-bottom: 10px;
}

.export-field-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.export-field-label input,
.export-sidebar input {
    width: 100%;
    min-height: 38px;
    margin: 0;
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.82);
    color: var(--ink);
}

.export-paper-actions,
.export-template-actions {
    display: grid;
    gap: 8px;
}

.export-paper-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 10px;
}

.export-template-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 0;
}

.export-tool-card.auto-compose-panel {
    margin: 0;
    padding: 14px;
    border-color: var(--line);
    background: var(--panel);
}

.export-tool-card .compose-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.export-tool-card .compose-grid label:first-child {
    grid-column: auto;
}

.export-tool-card .compose-grid input,
.export-tool-card .compose-kp-rule input,
.export-tool-card .compose-kp-rule select {
    min-height: 38px;
    border-color: var(--line);
}

.export-tool-card .compose-kp-rule {
    grid-template-columns: minmax(0, 1fr) 68px 30px;
}

.export-tool-card .compose-kp-remove {
    height: 38px;
    border-radius: 999px;
}

.export-selected-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 86px;
    padding: 12px;
    overflow: visible;
}

.selected-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.76);
    cursor: grab;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}

.selected-item-main {
    color: var(--ink);
    line-height: 1.35;
}

.selected-item-main strong {
    color: var(--accent);
}

.selected-item small {
    color: var(--muted);
}

.selected-item-order {
    display: inline-flex;
    gap: 5px;
}

.selected-order-btn {
    width: 28px;
    height: 28px;
    border-color: var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
}

.selected-order-btn:not(:disabled):hover {
    border-color: var(--accent);
    color: var(--accent);
}

.selected-item .remove-btn {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(185, 28, 28, 0.18);
    border-radius: 999px;
    background: rgba(254, 242, 242, 0.86);
    color: var(--danger);
}

.selected-item.export-dragging,
.export-preview-question.export-dragging {
    cursor: grabbing;
    opacity: 0.46;
    transform: scale(0.995);
}

.export-preview-question.export-focus-pulse {
    border-color: rgba(15, 118, 110, 0.72);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.16);
}

body.export-pointer-dragging,
body.export-pointer-dragging * {
    cursor: grabbing !important;
    user-select: none;
}

.selected-item.export-drop-before,
.selected-item.export-drop-after,
.export-preview-question.export-drop-before,
.export-preview-question.export-drop-after {
    border-color: rgba(15, 118, 110, 0.55);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.selected-item.export-drop-before,
.export-preview-question.export-drop-before {
    border-top-color: var(--accent);
    box-shadow: inset 0 4px 0 var(--accent), 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.selected-item.export-drop-after,
.export-preview-question.export-drop-after {
    border-bottom-color: var(--accent);
    box-shadow: inset 0 -4px 0 var(--accent), 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.export-preview {
    padding: 0;
}

#preview-area {
    min-height: 440px;
    padding: 16px;
    border: 0;
    background: rgba(255, 255, 255, 0.38);
    color: var(--muted);
    text-align: left;
}

.export-empty-state,
.export-loading-state {
    display: flex;
    min-height: 170px;
    align-items: center;
    justify-content: center;
    border: 1px dashed rgba(31, 41, 35, 0.18);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.58);
    color: var(--muted);
    font-weight: 800;
    text-align: center;
}

.export-selected-list .export-empty-state {
    width: 100%;
    min-height: 62px;
}

.export-preview-question .export-empty-state {
    min-height: 70px;
    margin-top: 10px;
}

.export-preview-note {
    margin: 0 0 12px;
    border: 1px solid rgba(15, 118, 110, 0.14);
    border-radius: 12px;
    background: rgba(15, 118, 110, 0.06);
}

.export-preview-source {
    margin-bottom: 14px;
}

.export-preview-order-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.export-preview-source-title {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 253, 247, 0.9);
    color: var(--ink);
    font-size: 12px;
}

.export-preview-question {
    position: relative;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.86);
    cursor: grab;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}

.export-preview-question-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-right: 32px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 850;
}

.export-preview-remove-btn {
    position: absolute;
    top: 9px;
    right: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(31, 41, 35, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--muted);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.export-preview-remove-btn:hover,
.export-preview-remove-btn:focus {
    border-color: rgba(185, 28, 28, 0.34);
    background: #fff5f5;
    color: #b91c1c;
    outline: none;
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

.export-preview-question-title small {
    flex: 0 0 auto;
    max-width: 44%;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-align: right;
}

.export-preview-image {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-top: 10px;
    border: 1px solid rgba(31, 41, 35, 0.12);
    border-radius: 10px;
    background: #fff;
    pointer-events: none;
    user-select: none;
}

.export-delete-dropzone {
    position: fixed;
    left: calc(var(--sidebar-w) + 24px);
    right: 24px;
    bottom: 18px;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    padding: 12px 18px;
    border: 2px dashed rgba(185, 28, 28, 0.38);
    border-radius: 16px;
    background: rgba(254, 242, 242, 0.96);
    color: var(--danger);
    font-size: 14px;
    font-weight: 900;
    text-align: center;
    box-shadow: 0 16px 38px rgba(47, 39, 25, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(16px);
    transition: opacity 0.16s ease, visibility 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.export-reorder-strip {
    position: fixed;
    right: 24px;
    top: 92px;
    bottom: 88px;
    z-index: 79;
    display: flex;
    width: 186px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(15, 118, 110, 0.22);
    border-radius: 16px;
    background: rgba(255, 253, 247, 0.97);
    box-shadow: 0 14px 34px rgba(47, 39, 25, 0.16);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(16px);
    transition: opacity 0.16s ease, visibility 0.16s ease, transform 0.16s ease;
}

.export-reorder-strip-title {
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.export-reorder-strip-items {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 2px 2px 4px;
    scrollbar-width: thin;
}

.export-reorder-chip {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    width: 100%;
    min-height: 38px;
    padding: 6px 8px;
    border: 1px solid rgba(31, 41, 35, 0.14);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-size: 12px;
    font-weight: 900;
    text-align: left;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.export-reorder-chip-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: var(--accent);
    font-size: 11px;
}

.export-reorder-chip-index-continuation {
    background: transparent;
    color: transparent;
}

.export-reorder-chip-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.export-reorder-chip.export-dragging {
    opacity: 0.46;
}

.export-reorder-chip.is-reorder-focused,
.export-reorder-chip.export-drop-before,
.export-reorder-chip.export-drop-after {
    border-color: rgba(15, 118, 110, 0.58);
    background: rgba(240, 253, 250, 0.98);
    color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.export-reorder-chip.export-drop-before {
    box-shadow: inset 0 4px 0 var(--accent), 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.export-reorder-chip.export-drop-after {
    box-shadow: inset 0 -4px 0 var(--accent), 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.app-shell.sidebar-collapsed .export-delete-dropzone {
    left: calc(var(--sidebar-collapsed-w) + 24px);
}

.app-shell.sidebar-collapsed .export-reorder-strip {
    right: 24px;
}

body.export-pointer-dragging .export-delete-dropzone,
body.export-native-dragging .export-delete-dropzone {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

body.export-pointer-dragging .export-reorder-strip,
body.export-native-dragging .export-reorder-strip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
}

.export-delete-dropzone.is-active {
    border-color: rgba(185, 28, 28, 0.72);
    background: rgba(254, 226, 226, 0.98);
    box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.12), 0 18px 42px rgba(47, 39, 25, 0.22);
    transform: translateY(-2px);
}

.export-template-panel {
    margin-top: 0;
    padding-top: 14px;
    border-top: 0;
}

.export-template-list {
    max-height: 300px;
    overflow: auto;
    padding-right: 2px;
}

.export-layout > .export-sidebar .export-template-list {
    max-height: calc(100vh - 250px);
}

.export-template-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    border-color: var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
}

.export-template-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.export-template-buttons .btn {
    min-height: 30px;
}

.selected-list {
    max-height: none;
}

.selected-list.export-selected-list {
    max-height: 360px;
    overflow-y: auto;
}

.account-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 14px;
}

.account-sidebar {
    top: 12px;
}

#verify-results,
#ocr-review-list {
    flex: 1 1 auto;
    max-height: none !important;
    min-height: 0;
    overflow: auto !important;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow-tight);
}

.verify-filters {
    border: 1px solid var(--line);
    background: rgba(255, 253, 247, 0.78) !important;
}

.ocr-toolbar {
    justify-content: flex-start;
}

#ocr-stats {
    margin-left: auto !important;
}

.maintenance-model-control select,
.maintenance-subtoolbar select {
    border-color: rgba(31, 41, 35, 0.14) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.86) !important;
}

.maintenance-subtoolbar {
    border-color: var(--line);
    background: rgba(255, 253, 247, 0.74);
}

.maintenance-panel-heading p {
    color: var(--muted);
}

.maintenance-action-danger {
    border-color: rgba(185, 28, 28, 0.26);
    background: rgba(255, 245, 245, 0.92);
}

/* Knowledge manager workspace */
.knowledge-manager-section.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.knowledge-manager-header {
    align-items: flex-start;
}

.knowledge-manager-heading h2 {
    margin: 0;
}

.knowledge-manager-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.knowledge-manager-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.knowledge-manager-controls select,
.knowledge-manager-search input,
.km-form-grid input,
.km-form-grid select,
.km-inline-form input,
.km-inline-form select {
    border: 1px solid rgba(31, 41, 35, 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
    outline: none;
}

.knowledge-manager-controls select:focus,
.knowledge-manager-search input:focus,
.km-form-grid input:focus,
.km-form-grid select:focus,
.km-inline-form input:focus,
.km-inline-form select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.knowledge-manager-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(300px, 34vw) minmax(0, 1fr);
    gap: 10px;
}

.knowledge-manager-sidebar,
.knowledge-manager-detail {
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 253, 247, 0.84);
    box-shadow: var(--shadow-tight);
    overflow: hidden;
}

.knowledge-manager-sidebar {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
}

.knowledge-manager-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
}

.km-stat-card {
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid rgba(31, 41, 35, 0.1);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.64);
}

.km-stat-card.warn {
    border-color: rgba(185, 28, 28, 0.28);
    background: rgba(255, 245, 245, 0.9);
}

.km-stat-card span,
.km-meta-grid span,
.km-eyebrow {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.km-stat-card strong {
    display: block;
    margin-top: 3px;
    color: var(--ink);
    font-size: 16px;
    line-height: 1.1;
}

.knowledge-manager-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
}

.knowledge-manager-search input {
    width: 100%;
    padding: 9px 11px;
}

.knowledge-manager-search button {
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 11px;
    background: rgba(15, 118, 110, 0.08);
    color: #0f5f58;
    padding: 8px 9px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.knowledge-manager-search button:hover {
    border-color: rgba(15, 118, 110, 0.36);
    background: rgba(15, 118, 110, 0.13);
}

.knowledge-manager-tree {
    min-height: 0;
    overflow: auto;
    padding: 8px;
}

.km-tree-node {
    min-width: 0;
}

.km-tree-row {
    appearance: none;
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    width: 100%;
    margin: 0 0 4px;
    padding: 7px 8px 7px calc(8px + var(--km-depth, 0) * 14px);
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.km-tree-row:hover {
    border-color: rgba(15, 118, 110, 0.18);
    background: rgba(15, 118, 110, 0.07);
}

.km-tree-row.selected {
    border-color: rgba(15, 118, 110, 0.34);
    background: #e5f5ef;
    box-shadow: inset 3px 0 0 var(--accent);
}

.km-tree-row.matched {
    border-color: rgba(180, 83, 9, 0.28);
    background: rgba(255, 244, 214, 0.72);
}

.km-tree-row.level-0,
.km-tree-row.level-1 {
    font-weight: 800;
}

.km-tree-branch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 11px;
}

.km-tree-branch.has-children {
    color: #0f5f58;
}

.km-tree-branch.has-children:hover {
    background: rgba(15, 118, 110, 0.12);
}

.km-tree-label {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 6px;
    overflow: hidden;
}

.km-tree-label > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.km-tree-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 30px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: #0f5f58;
    font-size: 10px;
    font-weight: 900;
}

.km-tree-meta,
.km-node-id {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.knowledge-manager-detail {
    overflow: auto;
    padding: 12px;
}

.knowledge-manager-empty {
    height: 100%;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--muted);
    text-align: center;
}

.knowledge-manager-empty strong {
    color: var(--ink);
    font-size: 16px;
}

.knowledge-manager-empty.compact {
    min-height: 120px;
    padding: 16px;
}

.km-detail-card {
    margin-bottom: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.62);
}

.km-detail-primary {
    background:
        linear-gradient(135deg, rgba(255, 253, 247, 0.96), rgba(229, 245, 239, 0.9));
}

.km-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.km-detail-head h3,
.km-detail-card h3 {
    margin: 0;
    color: var(--ink);
}

.km-detail-head h3 {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 18px;
}

.km-path {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
}

.km-path span {
    color: rgba(31, 41, 35, 0.28);
}

.km-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.km-meta-grid div {
    padding: 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.66);
}

.km-meta-grid strong {
    display: block;
    margin-top: 4px;
    color: var(--ink);
}

.km-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.72fr);
    gap: 10px;
    margin-top: 12px;
}

.km-form-grid label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.km-form-grid input,
.km-form-grid select,
.km-inline-form input,
.km-inline-form select {
    min-width: 0;
    padding: 9px 11px;
}

.km-inline-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.7fr) auto;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
}

.km-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.km-danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-color: rgba(185, 28, 28, 0.22);
    background: rgba(255, 245, 245, 0.82);
}

.km-danger-zone p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 1180px) {
    .question-browser {
        grid-template-columns: 190px 220px minmax(0, 1fr);
    }

    .paper-browser {
        grid-template-columns: 248px minmax(0, 1fr);
    }

    .knowledge-manager-layout {
        grid-template-columns: minmax(260px, 36vw) minmax(0, 1fr);
    }

    .knowledge-manager-stats,
    .km-meta-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    html,
    body {
        overflow: auto;
    }

    .sidebar {
        width: var(--sidebar-collapsed-w);
    }

    .sidebar .logo-text,
    .sidebar .nav-label,
    .sidebar .sidebar-footer-subtitle,
    .sidebar .sidebar-footer-controls,
    .sidebar .sidebar-toggle {
        display: none;
    }

    .content,
    .app-shell.sidebar-collapsed .content {
        margin-left: var(--sidebar-collapsed-w);
        width: calc(100% - var(--sidebar-collapsed-w));
        min-height: 100vh;
        height: auto;
        overflow: visible;
        padding: 8px;
    }

    .tab-content.active {
        height: auto;
        min-height: calc(100vh - 16px);
        overflow: visible;
    }

    .question-topbar,
    .question-filterbar .search-row {
        flex-wrap: wrap;
        overflow: visible;
    }

    .question-browser,
    .paper-browser,
    .export-workspace-section .export-layout,
    .account-layout,
    .knowledge-manager-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .question-browser {
        grid-template-rows: auto auto minmax(520px, auto);
    }

    .question-browser.no-kp-panel {
        grid-template-rows: auto minmax(520px, auto);
    }

    .question-browser.kp-tree-wide,
    .question-browser.no-kp-panel.kp-tree-wide {
        grid-template-columns: 1fr;
    }

    .kp-tree-panel,
    .question-list-panel,
    .paper-list-panel,
    .knowledge-manager-sidebar {
        max-height: 36vh;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .paper-detail-panel {
        min-height: 70vh;
    }

    .question-detail-panel {
        min-height: 70vh;
    }

    .tab-content.question-stream-section.active {
        height: calc(100vh - 16px);
        min-height: 0;
        overflow: hidden;
    }

    .dashboard-grid,
    .maintenance-health,
    .maintenance-grid,
    .maintenance-integrated-grid,
    .maintenance-metric-grid,
    .maintenance-actions,
    .knowledge-manager-stats,
    .usage-panels,
    .km-meta-grid,
    .km-form-grid,
    .km-inline-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .tab-content.question-stream-section.active {
        height: auto;
        min-height: calc(100vh - 16px);
        overflow: visible;
    }

    .question-stream-export-panel {
        position: fixed;
        top: auto;
        right: 12px;
        bottom: 84px;
        width: min(360px, calc(100vw - 24px));
        max-height: min(420px, calc(100vh - 118px));
    }

    .question-stream-export-dock {
        right: 12px;
        bottom: 84px;
        width: min(150px, calc(100vw - 24px));
    }

    .question-stream-export-dock.is-expanded {
        width: min(190px, calc(100vw - 24px));
    }

    .question-stream-browser {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .question-stream-sidebar,
    .question-stream-detail-panel {
        max-height: none;
        overflow: visible;
    }

    .question-stream-kp-tree {
        max-height: 36vh;
    }
}

/* Mobile responsive consolidation */
@media (max-width: 820px) {
    html,
    body {
        width: 100%;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    body {
        display: block;
    }

    button,
    input,
    select,
    textarea {
        max-width: 100%;
        font-size: 16px;
    }

    img,
    embed,
    iframe {
        max-width: 100%;
    }

    .public-home,
    .auth-shell {
        overflow-x: hidden;
    }

    .public-nav {
        position: relative;
        align-items: center;
        gap: 10px;
        padding: 12px 14px;
    }

    .public-brand {
        flex: 1 1 170px;
        min-width: 0;
        gap: 10px;
    }

    .public-brand-mark {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }

    .public-brand strong {
        font-size: 14px;
    }

    .public-brand small {
        display: none;
    }

    .public-nav-links {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        gap: 10px;
        overflow-x: auto;
        padding: 2px 0 4px;
        scrollbar-width: none;
    }

    .public-nav-links::-webkit-scrollbar {
        display: none;
    }

    .public-nav-links a {
        flex: 0 0 auto;
        padding: 7px 10px;
        border: 1px solid rgba(217, 229, 232, 0.9);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.78);
        font-size: 12px;
    }

    .public-nav-actions {
        width: auto;
        flex: 0 0 auto;
        gap: 6px;
    }

    .public-btn {
        min-height: 38px;
        padding: 0 12px;
        font-size: 13px;
    }

    .public-hero {
        grid-template-columns: 1fr;
        gap: 22px;
        min-height: auto;
        padding: 28px 14px 26px;
    }

    .public-hero h1 {
        font-size: clamp(32px, 10vw, 46px);
        line-height: 1.06;
    }

    .public-hero-lead {
        margin-top: 18px;
        font-size: 15px;
        line-height: 1.72;
    }

    .public-hero-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        margin-top: 22px;
    }

    .public-hero-actions .public-btn,
    .public-final-cta .public-btn {
        width: 100%;
    }

    .public-hero-proof,
    .public-trust-strip,
    .subject-rail,
    .workflow-layout,
    .demo-card-grid,
    .public-demo-shell,
    .public-split-section,
    .public-resource-section,
    .student-flow {
        grid-template-columns: 1fr;
    }

    .public-hero-proof {
        gap: 10px;
        margin-top: 24px;
    }

    .public-hero-proof div {
        min-height: 0;
        padding: 13px 14px;
    }

    .public-product-preview {
        border-radius: 10px;
        box-shadow: 0 16px 36px rgba(15, 39, 52, 0.12);
    }

    .preview-toolbar {
        padding: 12px 14px;
    }

    .preview-grid,
    .preview-search,
    .resource-table div {
        grid-template-columns: 1fr;
    }

    .preview-grid {
        min-height: 0;
    }

    .preview-main,
    .preview-insight {
        padding: 14px;
    }

    .preview-subjects {
        flex-direction: row;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--public-line);
        padding: 12px;
        scrollbar-width: none;
    }

    .preview-subjects::-webkit-scrollbar {
        display: none;
    }

    .preview-subjects button {
        flex: 0 0 auto;
        min-width: 116px;
        text-align: center;
    }

    .preview-insight {
        grid-template-columns: 1fr;
        border-left: 0;
        border-top: 1px solid var(--public-line);
    }

    .public-section {
        padding: 42px 14px;
    }

    .public-section-heading {
        display: block;
        margin-bottom: 20px;
    }

    .public-section-heading h2,
    .public-split-section h2,
    .resource-copy h2,
    .public-final-cta h2 {
        font-size: 28px;
        line-height: 1.18;
    }

    .public-section-heading p,
    .public-split-section p,
    .resource-copy p,
    .public-final-cta p {
        margin-top: 10px;
        font-size: 15px;
    }

    .workflow-panel,
    .demo-card,
    .student-flow div {
        min-height: 0;
        padding: 18px;
    }

    .workflow-index {
        margin-bottom: 24px;
    }

    .demo-card h3 {
        font-size: 26px;
    }

    .public-demo-list {
        position: static;
    }

    .public-demo-detail-head {
        display: block;
    }

    .public-demo-detail-head .public-btn {
        margin-top: 14px;
        width: 100%;
    }

    .public-demo-image-frame {
        max-height: 420px;
    }

    .public-final-cta {
        margin: 0 14px 36px;
        padding: 28px 18px;
    }

    .auth-modal,
    .modal {
        align-items: flex-start;
        justify-content: center;
        padding: 10px;
        overflow-y: auto;
    }

    .auth-modal-panel,
    .modal-content {
        width: 100%;
        max-width: none;
        max-height: calc(100dvh - 20px);
        overflow-y: auto;
        border-radius: 14px;
    }

    .auth-card,
    .modal-content {
        padding: 22px 16px;
    }

    .auth-modal-close,
    .modal-close {
        top: 10px;
        right: 10px;
    }

    .auth-role-options,
    .auth-challenge-row {
        grid-template-columns: 1fr;
    }

    .auth-refresh-btn,
    .auth-submit {
        width: 100%;
    }

    .app-shell,
    .app-shell.sidebar-collapsed {
        width: 100%;
        min-height: 100dvh;
        height: auto;
        overflow: visible;
        padding-bottom: calc(74px + env(safe-area-inset-bottom));
    }

    .sidebar,
    .app-shell.sidebar-collapsed .sidebar {
        position: fixed;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1200;
        width: 100% !important;
        height: calc(70px + env(safe-area-inset-bottom));
        min-height: 0;
        overflow: hidden;
        padding: 0 max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        border-right: 0;
        box-shadow: 0 -14px 32px rgba(28, 24, 16, 0.18);
        flex-direction: row;
        align-items: stretch;
    }

    .sidebar-header,
    .sidebar-footer,
    .app-shell.sidebar-collapsed .sidebar-header,
    .app-shell.sidebar-collapsed .sidebar-footer {
        display: none;
    }

    .nav-tabs,
    .app-shell.sidebar-collapsed .nav-tabs {
        width: 100%;
        min-width: 0;
        margin: 0;
        padding: 6px 4px;
        display: flex;
        flex: 1 1 auto;
        flex-direction: row;
        align-items: center;
        gap: 2px;
        overflow-x: hidden;
        overflow-y: hidden;
        scrollbar-width: none;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tabs li,
    .app-shell.sidebar-collapsed .nav-tabs li {
        flex: 1 1 0;
        min-width: 0;
        height: 56px;
        margin: 0;
        padding: 6px 2px;
        border-left: 0;
        border-radius: 12px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
        font-size: 11px;
        line-height: 1.1;
        text-align: center;
        white-space: normal;
    }

    .nav-icon {
        flex: 0 0 auto;
        width: auto;
        font-size: 18px;
        line-height: 1;
    }

    .sidebar .nav-label,
    .app-shell.sidebar-collapsed .nav-label {
        display: block;
        max-width: 100%;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        font-size: 10px;
        line-height: 1.05;
    }

    .app-shell.shell-admin .sidebar .nav-label {
        font-size: 9px;
    }

    .content,
    .app-shell.sidebar-collapsed .content {
        margin-left: 0;
        width: 100%;
        min-height: 100dvh;
        height: auto;
        padding: 10px 10px calc(86px + env(safe-area-inset-bottom));
        overflow: visible;
    }

    .tab-content.active,
    .dashboard-section.active,
    .ops-section.active,
    .export-workspace-section.active,
    .knowledge-manager-section.active {
        height: auto;
        min-height: calc(100dvh - 96px);
        overflow: visible;
        padding-bottom: 10px;
    }

    .section-header,
    .page-header,
    .question-topbar,
    .maintenance-header,
    .knowledge-manager-header {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
        min-height: 0;
        padding: 10px;
        margin-bottom: 10px;
    }

    .section-header h2,
    .page-header h2,
    .knowledge-manager-heading h2 {
        font-size: 21px;
        line-height: 1.2;
    }

    .section-header .btn,
    .page-header .btn,
    .section-header select,
    .page-header select,
    .subject-filter-select,
    .inline-filter-select {
        width: 100%;
    }

    .btn {
        min-height: 40px;
        padding: 9px 13px;
        white-space: normal;
    }

    .btn-small {
        min-height: 34px;
        padding: 7px 10px;
        font-size: 12px;
    }

    .dashboard-shell,
    .dashboard-grid,
    .dashboard-stat-grid,
    .maintenance-health,
    .maintenance-grid,
    .maintenance-integrated-grid,
    .maintenance-metric-grid,
    .maintenance-actions,
    .export-workspace-section .export-layout,
    .account-layout,
    .knowledge-manager-layout,
    .task-center-body,
    .active-job-metrics,
    .job-detail-summary,
    .job-detail-meta-grid {
        grid-template-columns: 1fr !important;
    }

    .dashboard-card,
    .dashboard-card-hero,
    .maintenance-panel,
    .account-section,
    .export-sidebar,
    .export-preview,
    .task-center-panel,
    .active-job-panel,
    .job-detail-panel,
    .knowledge-manager-sidebar,
    .knowledge-manager-detail {
        border-radius: 14px;
    }

    .dashboard-card {
        padding: 16px;
    }

    .dashboard-card-hero {
        grid-column: span 1;
    }

    .dashboard-hero-title {
        font-size: 18px;
        line-height: 1.3;
    }

    .dashboard-stat {
        font-size: 34px;
    }

    .dashboard-actions,
    .review-actions,
    .feedback-actions,
    .feedback-review-toolbar,
    .export-header-actions,
    .task-center-actions,
    .active-job-actions-row,
    .job-action-buttons,
    .paper-viewer-controls,
    .paper-detail-actions,
    .question-detail-actions,
    .learning-actions,
    .km-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        gap: 8px;
    }

    .export-action-dropdown,
    .export-action-dropdown > .btn {
        width: 100%;
    }

    .export-dropdown-panel {
        left: 0;
        right: auto;
        width: min(520px, calc(100vw - 32px));
    }

    .feedback-review-toolbar {
        align-items: stretch;
    }

    .feedback-review-toolbar select {
        width: 100%;
    }

    .dashboard-list-item,
    .history-card,
    .review-card-main,
    .review-card-footer,
    .feedback-card-main,
    .feedback-actions,
    .task-center-header,
    .task-center-history-head,
    .active-job-card,
    .active-job-topline,
    .job-detail-header,
    .job-action-bar,
    .maintenance-panel-heading,
    .km-detail-head,
    .km-danger-zone {
        align-items: stretch;
        flex-direction: column;
    }

    .student-practice-bar,
    .practice-result-panel {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
        padding: 12px;
        border-radius: 12px;
    }

    .student-practice-controls,
    .practice-result-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 8px;
    }

    .student-practice-controls .btn,
    .practice-result-actions .btn,
    .student-practice-progress {
        width: 100%;
        justify-content: center;
    }

    .student-practice-progress {
        grid-column: 1 / -1;
    }

    .question-filterbar,
    .search-panel,
    .maintenance-subtoolbar,
    .verify-filters {
        padding: 10px;
        overflow: visible;
    }

    .search-row,
    .question-filterbar .search-row,
    .compose-grid,
    .km-form-grid,
    .km-inline-form,
    .knowledge-manager-search,
    .paper-toolbar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 9px;
        overflow: visible;
    }

    .search-field,
    .search-field-text,
    .paper-toolbar-group,
    .maintenance-model-control,
    .maintenance-controls,
    .knowledge-manager-controls,
    .feedback-form,
    .account-form {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .search-field select,
    .search-field input,
    .paper-toolbar-group select,
    .maintenance-controls select,
    .maintenance-subtoolbar select,
    .maintenance-model-control select,
    .knowledge-manager-controls select,
    .knowledge-manager-search input,
    .km-form-grid input,
    .km-form-grid select,
    .km-inline-form input,
    .km-inline-form select,
    .account-field input,
    .account-field select,
    .compose-grid select,
    .compose-grid input,
    .compose-kp-rule select,
    .compose-kp-rule input,
    .export-sidebar input {
        width: 100%;
        min-width: 0;
        height: 40px;
    }

    .paper-prefix-multiselect,
    .paper-prefix-multiselect-button {
        width: 100%;
    }

    .paper-prefix-multiselect-button {
        height: 40px;
    }

    .paper-prefix-option input {
        width: 15px;
        height: 15px;
    }

    .question-browser,
    .question-browser.no-kp-panel,
    .question-browser.kp-tree-wide,
    .question-browser.no-kp-panel.kp-tree-wide,
    .paper-browser,
    .paper-browser.paper-list-collapsed {
        display: grid;
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
        overflow: visible;
        border-radius: 14px;
    }

    .question-browser {
        grid-template-rows: auto auto minmax(520px, auto);
    }

    .question-browser.no-kp-panel {
        grid-template-rows: auto minmax(520px, auto);
    }

    .paper-browser,
    .paper-browser.paper-list-collapsed {
        grid-template-rows: auto minmax(620px, auto);
    }

    .kp-tree-panel,
    .question-list-panel,
    .paper-list-panel,
    .knowledge-manager-sidebar {
        max-height: 34dvh;
        min-height: 0;
        overflow: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .paper-list-panel {
        max-height: none;
        overflow: visible;
    }

    .paper-toolbar,
    .paper-viewer-controls {
        position: static;
        min-height: 0;
    }

    .papers-list {
        max-height: 34dvh;
        overflow-y: auto;
    }

    .question-list-panel,
    .paper-list-panel {
        display: flex;
        flex-direction: column;
    }

    .questions-list,
    .papers-list,
    .kp-tree,
    .knowledge-manager-tree {
        max-height: none;
        -webkit-overflow-scrolling: touch;
    }

    .papers-list {
        max-height: 34dvh;
        overflow-y: auto;
    }

    .question-detail-panel,
    .paper-detail-panel,
    .knowledge-manager-detail,
    .export-preview,
    #preview-area {
        min-height: 58dvh;
        overflow: visible;
    }

    .parent-detail-layout,
    .question-meta-card,
    .subq-card,
    .parent-detail-hero,
    .parent-stem-flow {
        border-radius: 14px;
    }

    .question-title-row,
    .detail-question-heading-row,
    .question-meta-row,
    .question-meta-admin-row,
    .question-meta-actions,
    .export-selection-bar,
    .subq-inline-export {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .question-item {
        grid-template-columns: minmax(0, 1fr);
    }

    .question-item-flags {
        justify-content: flex-start;
    }

    .question-item-title,
    .question-item-difficulty-line span,
    .km-tree-label > span:last-child {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .question-detail-image,
    .parent-stem-image,
    .subq-image-wrap img,
    .subq-child-image-wrap img,
    .answer-question-card img {
        width: 100%;
        height: auto;
    }

    .paper-detail-shell,
    .paper-pdf-split {
        height: auto;
        min-height: 70dvh;
    }

    .paper-pdf-split {
        grid-template-columns: 1fr;
    }

    .paper-pdf-frame,
    .paper-pdf-pane,
    .paper-pdf-pane-body {
        min-height: 60dvh;
    }

    .paper-pdf-scrollbar {
        display: none;
    }

    .paper-panel-reopen {
        top: 10px;
        left: 10px;
    }

    .maintenance-detail-tabbar,
    .account-nav,
    .rbac-tabs {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 6px;
        scrollbar-width: none;
    }

    .maintenance-detail-tabbar::-webkit-scrollbar,
    .account-nav::-webkit-scrollbar,
    .rbac-tabs::-webkit-scrollbar {
        display: none;
    }

    .maintenance-detail-tab,
    .account-nav li,
    .rbac-tabs .btn {
        flex: 0 0 auto;
        border-radius: 999px;
        border-left: 0;
        white-space: nowrap;
    }

    .maintenance-detail-panel,
    .maintenance-review-panel,
    .account-section {
        padding: 14px;
        overflow-x: auto;
    }

    .maintenance-table-wrap,
    .account-section,
    .export-preview,
    .job-detail-section,
    #verify-results,
    #ocr-review-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .maintenance-table,
    .rbac-table {
        min-width: 640px;
    }

    .account-sidebar {
        position: static;
        padding: 12px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .account-layout,
    .account-page,
    .account-content,
    .account-form,
    .account-field,
    .account-field label,
    .account-nav,
    .rbac-tabs {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .account-user-card {
        align-items: center;
        flex-direction: row;
        padding: 0 0 12px;
        margin-bottom: 10px;
        text-align: left;
    }

    .account-avatar {
        width: 48px;
        height: 48px;
        margin: 0;
        font-size: 22px;
    }

    .account-user-name,
    .account-user-roles {
        text-align: left;
    }

    .avatar-upload-row,
    .account-toggle-row {
        align-items: stretch;
        flex-direction: column;
    }

    .export-sidebar,
    .export-preview {
        min-height: 0;
        overflow: visible;
    }

    .selected-list,
    .export-template-list {
        max-height: none;
    }

    .export-paper-actions {
        grid-template-columns: 1fr;
    }

    .compose-kp-rule {
        grid-template-columns: 1fr;
    }

    .task-center-note,
    .task-center-history-note,
    .active-job-updated,
    .job-detail-refresh-note {
        align-self: flex-start;
    }

    .job-json {
        max-width: 100%;
        overflow-x: auto;
    }
}

@media (max-width: 420px) {
    .public-nav {
        align-items: stretch;
    }

    .public-brand {
        flex-basis: 100%;
    }

    .public-nav-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .public-nav-actions .public-btn {
        width: 100%;
    }

    .public-nav-actions .language-switcher {
        width: 100%;
        justify-content: center;
    }

    .content,
    .app-shell.sidebar-collapsed .content {
        padding-left: 8px;
        padding-right: 8px;
    }

    .nav-tabs li,
    .app-shell.sidebar-collapsed .nav-tabs li {
        flex-basis: 0;
    }

    .sidebar .nav-label,
    .app-shell.sidebar-collapsed .nav-label {
        max-width: 100%;
        font-size: 9px;
    }

}

@media (max-width: 360px) {
    .student-practice-controls,
    .practice-result-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1180px) {
    .export-workspace-section .export-layout {
        grid-template-columns: 1fr;
    }

    .export-layout > .export-sidebar {
        display: flex;
    }

    .export-layout > .export-sidebar .export-template-list {
        max-height: 360px;
    }
}

@media (max-width: 760px) {
    .export-command-bar {
        position: static;
        align-items: stretch;
    }

    .export-command-title,
    .export-command-meta {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .export-count-pill,
    .export-edit-status {
        justify-content: center;
        width: 100%;
    }

    .export-layout > .export-sidebar {
        display: flex;
    }

    .export-panel-head,
    .export-tool-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .export-preview-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .export-inline-name {
        min-width: 0;
    }

    .export-paper-actions,
    .export-template-actions,
    .export-tool-card .compose-grid,
    .export-tool-card .compose-kp-rule,
    .export-dropdown-panel .compose-grid,
    .export-dropdown-panel .compose-kp-rule {
        grid-template-columns: 1fr;
    }

    .selected-item {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .selected-item-order {
        grid-column: 1 / -1;
        order: 3;
    }

    .selected-item-main {
        order: 1;
    }

    .selected-item .remove-btn {
        order: 2;
    }

    #preview-area {
        min-height: 300px;
        padding: 12px;
    }

    .export-template-item {
        grid-template-columns: 1fr;
    }

    .export-template-buttons {
        justify-content: flex-start;
    }

    .export-delete-dropzone,
    .app-shell.sidebar-collapsed .export-delete-dropzone {
        left: 12px;
        right: 12px;
        bottom: calc(76px + env(safe-area-inset-bottom));
        min-height: 54px;
        border-radius: 14px;
    }

    .export-reorder-strip,
    .app-shell.sidebar-collapsed .export-reorder-strip {
        left: 12px;
        right: 12px;
        top: auto;
        bottom: calc(138px + env(safe-area-inset-bottom));
        width: auto;
        max-height: 34dvh;
        gap: 6px;
        min-height: 62px;
        transform: translateY(14px);
    }

    .export-reorder-strip-title {
        font-size: 11px;
    }

    body.export-pointer-dragging .export-reorder-strip,
    body.export-native-dragging .export-reorder-strip {
        transform: translateY(0);
    }
}
