/* =========================================================================
   ATELIER PRO STYLES
   Styles for new features added in the workspace upgrade:
   - Spaces (Section 6)
   - Page Mode (Section 7)
   - Document Layout (Section 9)
   - Improved Tables (Section 10)
   - Comments (Section 11)
   - Suggesting Mode (Section 12)
   - Find & Replace (Section 13)
   - Document Outline (Section 14)
   - Student Writing Tools (Section 15)
   - Image Behavior (Section 16)
   - Version History (Section 17)
   - Retro Theme (Section 22)
   - User Mode Setup (Section 23)
   ========================================================================= */

/* ========== SPACES (Section 6) ========== */
.spaces-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--surface-border);
    background: var(--surface-bg);
    position: relative;
    z-index: 99998;
}

.spaces-current {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--surface-bg-hover);
    border: 1px solid var(--surface-border);
    cursor: pointer;
    transition: background 0.15s;
}

.spaces-current:hover {
    background: var(--surface-bg-active);
}

.spaces-current-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.spaces-current-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spaces-current-caret {
    color: var(--text-muted);
    font-size: 11px;
}

.spaces-dropdown {
    position: fixed;
    background: var(--bg-elevated, var(--surface-bg-elevated, #1f2127));
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.25);
    z-index: 2147483000;
    padding: 6px;
    max-height: 400px;
    overflow-y: auto;
}

.spaces-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
    font-size: 13px;
    transition: background 0.15s;
}

.spaces-dropdown-item:hover {
    background: var(--surface-bg-hover);
}

.spaces-dropdown-item.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 600;
}

.spaces-dropdown-divider {
    height: 1px;
    background: var(--surface-border);
    margin: 6px 0;
}

.spaces-dropdown-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.spaces-dropdown-action:hover {
    background: var(--surface-bg-hover);
    color: var(--text-primary);
}

/* ========== PAGE MODE (Section 7) ========== */
.editor.page-mode-active,
body.notes-pages-mode .editor {
    background: var(--bg-secondary);
    padding: 40px 0;
    min-height: 100%;
}

.editor.page-mode-active .page-mode-container,
body.notes-pages-mode .page-mode-page {
    background: #ffffff;
    color: #2a2621;
    margin: 0 auto 30px auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .editor.page-mode-active .page-mode-container,
[data-theme="dark"] body.notes-pages-mode .page-mode-page {
    background: #f8f5ee;
    color: #1a1a1a;
}

/* US Letter: 8.5" × 11" — at 96 DPI = 816 × 1056 px */
.page-mode-page.size-letter {
    width: 816px;
    min-height: 1056px;
}

/* A4: 210 × 297 mm — at 96 DPI = 794 × 1123 px */
.page-mode-page.size-a4 {
    width: 794px;
    min-height: 1123px;
}

.page-mode-page-content {
    padding: 96px 96px 96px 96px; /* default 1" margins on each side at 96 DPI */
    outline: none;
    min-height: calc(100% - 192px);
    line-height: 1.6;
    font-size: 16px;
}

.page-mode-page-header,
.page-mode-page-footer {
    position: absolute;
    left: 96px;
    right: 96px;
    font-size: 11px;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-mode-page-header {
    top: 30px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    padding-bottom: 8px;
}

.page-mode-page-footer {
    bottom: 30px;
    border-top: 1px solid rgba(0,0,0,0.08);
    padding-top: 8px;
}

.page-mode-page-number {
    font-variant-numeric: tabular-nums;
    color: #888;
    font-size: 11px;
}

.page-mode-page-break {
    height: 30px;
    margin: 30px -96px;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.04) 50%, transparent 100%);
    position: relative;
}

.page-mode-page-break::after {
    content: 'Page break';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    padding: 2px 10px;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 999px;
}

/* Page mode print styles - improved fidelity */
@media print {
    body.notes-pages-mode .page-mode-page {
        page-break-after: always;
        box-shadow: none;
        margin: 0;
        border-radius: 0;
    }
    body.notes-pages-mode .page-mode-page:last-child {
        page-break-after: auto;
    }
    .page-mode-page-break {
        display: none;
    }
    /* Hide non-essential UI in print */
    .sidebar, .toolbar, .toolbar-wrapper, .breadcrumbs, .tags-container,
    .page-title-input, .page-temporary-meta, .comments-panel,
    .doc-outline-panel, .find-replace-panel, .floating-fab {
        display: none !important;
    }
}

/* Mobile page mode adjustments */
@media (max-width: 900px) {
    .page-mode-page.size-letter,
    .page-mode-page.size-a4 {
        width: 100%;
        min-height: auto;
    }
    .page-mode-page-content {
        padding: 40px 24px;
        min-height: 400px;
    }
    .page-mode-page-header,
    .page-mode-page-footer {
        left: 24px;
        right: 24px;
    }
}

/* ========== TABLES (Section 10) ========== */
.editor table {
    border-collapse: collapse;
    width: 100%;
    margin: 14px 0;
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    overflow: hidden;
}

.editor table th,
.editor table td {
    border: 1px solid var(--surface-border);
    padding: 10px 14px;
    text-align: left;
    min-width: 80px;
    vertical-align: top;
    /* Critical: ensure cells are editable */
    user-select: text;
    -webkit-user-select: text;
}

.editor table th {
    background: var(--surface-bg);
    font-weight: 600;
    color: var(--text-primary);
}

.editor table td {
    background: transparent;
}

.editor table tr:hover td {
    background: var(--surface-bg);
}

.table-toolbar {
    position: absolute;
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    padding: 4px;
    display: flex;
    gap: 2px;
    z-index: 100;
    animation: tooltip-fade 0.15s ease both;
}

.table-toolbar button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s, color 0.15s;
}

.table-toolbar button:hover {
    background: var(--surface-bg-hover);
    color: var(--text-primary);
}

@keyframes tooltip-fade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile tables - horizontal scroll */
@media (max-width: 768px) {
    .editor table {
        display: block;
        overflow-x: auto;
        max-width: 100%;
    }
}

/* ========== COMMENTS (Section 11) ========== */
.comments-panel {
    position: fixed;
    right: 80px;
    top: 140px;
    bottom: 80px;
    width: 340px;
    max-width: calc(100vw - 96px);
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.25);
    display: none;
    flex-direction: column;
    z-index: 9000;
    animation: panel-slide-in 0.25s ease both;
}

.comments-panel.active {
    display: flex;
}

@keyframes panel-slide-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.comments-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--surface-border);
}

.comments-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.comments-panel-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    border-radius: 5px;
}

.comments-panel-close:hover {
    background: var(--surface-bg-hover);
    color: var(--text-primary);
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-item {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 10px 12px;
}

.comment-item.resolved {
    opacity: 0.6;
}

.comment-item.resolved .comment-text {
    text-decoration: line-through;
}

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

.comment-author {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.comment-time {
    font-size: 11px;
    color: var(--text-muted);
}

.comment-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    word-wrap: break-word;
}

.comment-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--surface-border);
}

.comment-action-btn {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.comment-action-btn:hover {
    background: var(--surface-bg-hover);
    color: var(--text-primary);
    border-color: var(--surface-border-strong);
}

.comment-action-btn.primary {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--accent);
}

.comment-add {
    padding: 12px;
    border-top: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comment-add textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--surface-bg);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.comments-empty {
    padding: 30px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Comment marker in text */
.comment-mark {
    background: rgba(255, 220, 0, 0.25);
    border-bottom: 2px solid #d4a30b;
    cursor: pointer;
    padding: 1px 2px;
    border-radius: 2px;
}

.comment-mark.resolved {
    background: rgba(0, 0, 0, 0.04);
    border-bottom: 1px dashed var(--text-muted);
    opacity: 0.6;
}

/* Mobile: comments become bottom sheet */
@media (max-width: 768px) {
    .comments-panel {
        right: 0;
        left: 0;
        top: auto;
        bottom: 0;
        width: 100%;
        height: 60vh;
        border-radius: 16px 16px 0 0;
        border-bottom: none;
    }
}

/* ========== SUGGESTING MODE (Section 12) ========== */
body.suggesting-mode .editor::before {
    content: "Suggesting mode is on. Edits show as suggestions until accepted.";
    display: block;
    background: rgba(80, 190, 110, 0.1);
    color: rgba(80, 190, 110, 0.9);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(80, 190, 110, 0.3);
}

.suggestion-insert {
    background: rgba(80, 190, 110, 0.18);
    color: rgba(50, 140, 80, 1);
    border-bottom: 2px solid rgba(80, 190, 110, 0.6);
    padding: 1px 2px;
}

.suggestion-delete {
    background: rgba(255, 80, 80, 0.18);
    color: rgba(180, 50, 50, 1);
    text-decoration: line-through;
    padding: 1px 2px;
}

[data-theme="dark"] .suggestion-insert {
    color: rgba(140, 220, 160, 1);
}

[data-theme="dark"] .suggestion-delete {
    color: rgba(255, 160, 160, 1);
}

.suggestion-toolbar {
    position: absolute;
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    padding: 4px;
    display: flex;
    gap: 4px;
    z-index: 200;
}

.suggestion-toolbar button {
    background: transparent;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: background 0.15s;
}

.suggestion-toolbar button.accept {
    color: rgba(50, 140, 80, 1);
}

.suggestion-toolbar button.reject {
    color: rgba(180, 50, 50, 1);
}

.suggestion-toolbar button:hover {
    background: var(--surface-bg-hover);
}

/* ========== FIND & REPLACE (Section 13) ========== */
.find-replace-panel {
    position: fixed;
    top: 140px;
    right: 24px;
    width: 380px;
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.25);
    z-index: 9000;
    padding: 16px;
    display: none;
    animation: panel-slide-down 0.2s ease both;
    max-width: calc(100vw - 48px);
}

.find-replace-panel.active {
    display: block;
}

@keyframes panel-slide-down {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.find-replace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.find-replace-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.find-replace-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 5px;
}

.find-replace-close:hover {
    background: var(--surface-bg-hover);
}

.find-replace-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}

.find-replace-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--surface-bg);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
}

.find-replace-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-elevated);
}

.find-replace-btn {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.find-replace-btn:hover {
    background: var(--surface-bg-hover);
}

.find-replace-btn.primary {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--accent);
}

.find-replace-info {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.find-highlight {
    background: rgba(255, 220, 0, 0.6);
    color: #1a1a1a;
    border-radius: 2px;
}

.find-highlight.current {
    background: rgba(255, 140, 0, 0.8);
}

@media (max-width: 768px) {
    .find-replace-panel {
        left: 12px;
        right: 12px;
        width: auto;
    }
}

/* ========== DOCUMENT OUTLINE (Section 14) ========== */
.doc-outline-panel {
    position: fixed;
    left: 80px;
    top: 140px;
    bottom: 80px;
    width: 260px;
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.25);
    display: none;
    flex-direction: column;
    z-index: 9000;
    animation: panel-slide-in-left 0.25s ease both;
}

.doc-outline-panel.active {
    display: flex;
}

@keyframes panel-slide-in-left {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.doc-outline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--surface-border);
}

.doc-outline-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.doc-outline-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 5px;
}

.doc-outline-close:hover {
    background: var(--surface-bg-hover);
}

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

.doc-outline-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12.5px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
    margin-bottom: 1px;
}

.doc-outline-item:hover {
    background: var(--surface-bg-hover);
    color: var(--text-primary);
}

.doc-outline-item.level-1 {
    font-weight: 600;
    padding-left: 10px;
    color: var(--text-primary);
}

.doc-outline-item.level-2 {
    padding-left: 22px;
    font-size: 12px;
}

.doc-outline-item.level-3 {
    padding-left: 34px;
    font-size: 11.5px;
    color: var(--text-muted);
}

.doc-outline-empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

@media (max-width: 1100px) {
    .doc-outline-panel {
        display: none !important;
    }
}

/* ========== STUDENT WRITING TOOLS (Section 15) ========== */
.footnote-marker {
    color: var(--accent-strong);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8em;
    vertical-align: super;
    line-height: 1;
}

.footnote-marker:hover {
    text-decoration: underline;
}

.footnotes-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--surface-border);
    font-size: 13px;
    color: var(--text-secondary);
}

.footnotes-section h4 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.footnote-item {
    margin-bottom: 6px;
    padding-left: 14px;
    position: relative;
    line-height: 1.5;
}

.footnote-num {
    position: absolute;
    left: 0;
    color: var(--accent-strong);
    font-weight: 600;
}

.bibliography-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--surface-border);
}

.bibliography-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.citation-entry {
    margin-bottom: 10px;
    padding-left: 14px;
    text-indent: -14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.equation-block {
    display: block;
    text-align: center;
    margin: 16px 0;
    padding: 10px;
    background: var(--surface-bg);
    border-radius: 6px;
    font-family: 'Cambria Math', 'Latin Modern Math', 'STIX Two Math', serif;
    font-size: 16px;
}

.equation-inline {
    font-family: 'Cambria Math', 'Latin Modern Math', 'STIX Two Math', serif;
    color: var(--accent-strong);
    background: var(--surface-bg);
    padding: 1px 4px;
    border-radius: 3px;
}

/* ========== IMAGES (Section 16) ========== */
.editor img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
    margin: 14px auto;
}

.image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    margin: 14px 0;
}

.image-wrapper.align-left {
    float: left;
    margin-right: 16px;
}

.image-wrapper.align-right {
    float: right;
    margin-left: 16px;
}

.image-wrapper.align-center {
    display: block;
    margin: 14px auto;
}

.image-wrapper.align-fullwidth img {
    width: 100%;
}

.image-resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
    bottom: -6px;
    right: -6px;
    cursor: nwse-resize;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.15s;
}

.image-wrapper:hover .image-resize-handle {
    opacity: 1;
}

.image-toolbar {
    position: absolute;
    top: -36px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    box-shadow: var(--shadow-soft);
    padding: 3px;
    display: none;
    gap: 2px;
    z-index: 20;
}

.image-wrapper:hover .image-toolbar {
    display: flex;
}

.image-toolbar button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: background 0.15s;
}

.image-toolbar button:hover {
    background: var(--surface-bg-hover);
    color: var(--text-primary);
}

.image-toolbar button.active {
    color: var(--accent-strong);
    background: var(--accent-soft);
}

/* Image grid (snap to grid layout) */
.image-grid {
    display: grid;
    gap: 10px;
    margin: 14px 0;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.image-grid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    margin: 0;
}

.image-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.image-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.image-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 600px) {
    .image-grid.cols-3,
    .image-grid.cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== VERSION HISTORY (Section 17) ========== */
.version-history-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.version-history-modal.active {
    display: flex;
    animation: atelier-dialog-fade 0.18s ease both;
}

.version-history-content {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    box-shadow: var(--shadow-soft-lg);
    width: 100%;
    max-width: 640px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.version-history-modal.active .version-history-content {
    animation: atelier-dialog-pop 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.version-history-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.version-history-heading {
    min-width: 0;
}

.version-history-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.version-history-subtitle {
    margin: 3px 0 0;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 460px;
}

.version-history-subtitle:empty {
    display: none;
}

.version-history-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.version-history-close:hover {
    background: var(--surface-bg-hover);
    color: var(--text-primary);
}

.version-history-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

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

.version-history-save-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 9px;
    border: 1px solid var(--surface-border-strong);
    background: var(--surface-bg);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.version-history-save-btn:hover {
    background: var(--surface-bg-hover);
    border-color: var(--accent, var(--surface-border-strong));
}

.version-history-save-btn:active {
    transform: translateY(1px);
}

.version-history-count {
    font-size: 12px;
    color: var(--text-muted);
}

.version-history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.version-history-empty i {
    font-size: 30px;
    opacity: 0.4;
    margin-bottom: 12px;
    display: block;
}

.version-history-empty-title {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.version-history-empty-sub {
    margin: 0 auto;
    font-size: 12px;
    line-height: 1.5;
    max-width: 360px;
}

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

.version-item {
    padding: 12px 14px;
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    background: var(--surface-bg);
    transition: background 0.15s, border-color 0.15s;
}

.version-item:hover {
    background: var(--surface-bg-hover);
    border-color: var(--surface-border-strong);
}

.version-item.is-current {
    border-color: var(--accent, var(--surface-border-strong));
    background: var(--surface-bg-active);
}

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

.version-item-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.version-current-chip {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--accent-strong, var(--text-primary));
    background: var(--accent-soft, var(--surface-bg-active));
    padding: 2px 7px;
    border-radius: 999px;
}

.version-item-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.version-item-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.version-item-preview {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 60px;
    overflow: hidden;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    display: -webkit-box;
}

.version-item-empty {
    font-style: italic;
    color: var(--text-muted);
}

.version-item-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    justify-content: flex-end;
}

.version-restore-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--surface-border-strong);
    background: var(--surface-bg);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.version-restore-btn:hover:not(:disabled) {
    background: var(--accent-soft, var(--surface-bg-hover));
    border-color: var(--accent, var(--surface-border-strong));
}

.version-restore-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

@media (max-width: 600px) {
    .version-history-modal {
        padding: 0;
        align-items: stretch;
    }
    .version-history-content {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }
    .version-history-subtitle {
        max-width: 60vw;
    }
}

/* ========== RETRO THEME (Section 22) ========== */
body.theme-retro,
[data-theme="retro"] {
    --bg-primary: #d4cfc1;
    --bg-secondary: #c5bfb0;
    --bg-elevated: #e0dcd0;
    --bg-hover: #b8b1a3;
    --text-primary: #2d2820;
    --text-secondary: #5d564b;
    --text-muted: #8a8275;
    --accent: #4a6b7c;
    --accent-rgb: 74, 107, 124;
    --accent-strong: #345567;
    --accent-soft: rgba(74, 107, 124, 0.18);
    --border: rgba(45, 40, 32, 0.35);
    --surface-bg: rgba(45, 40, 32, 0.06);
    --surface-bg-hover: rgba(45, 40, 32, 0.12);
    --surface-bg-active: rgba(45, 40, 32, 0.18);
    --surface-border: rgba(45, 40, 32, 0.28);
    --surface-border-strong: rgba(45, 40, 32, 0.42);
    --editor-bg: #e0dcd0;
    --code-bg: #bdb6a5;
    --shadow-soft: 2px 2px 0 rgba(45, 40, 32, 0.25);
    --shadow-soft-lg: 4px 4px 0 rgba(45, 40, 32, 0.3);
    --radius: 4px;
    --radius-lg: 6px;
    --radius-pill: 4px;
}

body.theme-retro,
[data-theme="retro"] body {
    background: var(--bg-primary);
    font-family: "VT323", "Courier New", monospace;
}

body.theme-retro .glass-card,
[data-theme="retro"] .glass-card {
    background: var(--bg-elevated);
    border: 2px solid var(--surface-border-strong);
    border-radius: 4px;
    box-shadow: var(--shadow-soft);
}

body.theme-retro .neumo-btn,
body.theme-retro .toolbar-btn,
body.theme-retro button:not(.fab-add-task),
[data-theme="retro"] .neumo-btn,
[data-theme="retro"] .toolbar-btn {
    background: var(--bg-elevated);
    border: 2px solid var(--surface-border-strong);
    border-radius: 3px;
    box-shadow: 2px 2px 0 rgba(45, 40, 32, 0.4);
    transition: all 0.1s;
    font-family: inherit;
}

body.theme-retro .neumo-btn:hover,
body.theme-retro .toolbar-btn:hover {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 rgba(45, 40, 32, 0.4);
}

body.theme-retro .editor {
    font-family: "Courier New", "Lucida Console", monospace;
    background: var(--editor-bg);
}

body.theme-retro h1,
body.theme-retro h2,
body.theme-retro h3 {
    font-family: "VT323", "Courier New", monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

body.theme-retro .sidebar {
    background: var(--bg-secondary);
    border-right: 2px solid var(--surface-border-strong);
}

body.theme-retro .chatbot-panel,
[data-theme="retro"] .chatbot-panel {
    background: var(--bg-elevated);
    border: 2px solid var(--surface-border-strong);
    box-shadow: var(--shadow-soft-lg);
    border-radius: 4px;
    overflow: hidden;
}

body.theme-retro .chatbot-header,
[data-theme="retro"] .chatbot-header {
    background: linear-gradient(180deg, #567698 0%, #415c77 100%);
    color: #f6f1e6;
    border-bottom: 2px solid rgba(45, 40, 32, 0.34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

body.theme-retro .chatbot-header .chatbot-title,
body.theme-retro .chatbot-header .chatbot-provider-chip,
body.theme-retro .chatbot-header .chatbot-icon-btn,
[data-theme="retro"] .chatbot-header .chatbot-title,
[data-theme="retro"] .chatbot-header .chatbot-provider-chip,
[data-theme="retro"] .chatbot-header .chatbot-icon-btn {
    color: #f6f1e6;
}

body.theme-retro .chatbot-header .chatbot-provider-chip,
body.theme-retro .chatbot-header .chatbot-icon-btn,
[data-theme="retro"] .chatbot-header .chatbot-provider-chip,
[data-theme="retro"] .chatbot-header .chatbot-icon-btn {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.2), 1px 1px 0 rgba(45, 40, 32, 0.22);
}

body.theme-retro .chatbot-keybanner,
body.theme-retro .chat-settings-popover,
[data-theme="retro"] .chatbot-keybanner,
[data-theme="retro"] .chat-settings-popover {
    background: var(--bg-elevated);
    border: 2px solid var(--surface-border-strong);
    box-shadow: var(--shadow-soft);
    border-radius: 4px;
}

body.theme-retro .chatbot-messages,
[data-theme="retro"] .chatbot-messages {
    background: #f2ecd9;
}

body.theme-retro .chatbot-input textarea,
body.theme-retro .chatbot-input button,
body.theme-retro .chatbot-settings select,
body.theme-retro .chatbot-settings input,
[data-theme="retro"] .chatbot-input textarea,
[data-theme="retro"] .chatbot-input button,
[data-theme="retro"] .chatbot-settings select,
[data-theme="retro"] .chatbot-settings input {
    background: #f3ebdc;
    border: 2px solid var(--surface-border-strong);
    border-radius: 3px;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.55), 1px 1px 0 rgba(45, 40, 32, 0.15);
    color: var(--text-primary);
}

body.theme-retro .flow-context-chip-row,
[data-theme="retro"] .flow-context-chip-row {
    padding-top: 6px;
}

body.theme-retro .flow-context-chip,
body.theme-retro .flow-memory-chip,
body.theme-retro .flow-selection-flag,
[data-theme="retro"] .flow-context-chip,
[data-theme="retro"] .flow-memory-chip,
[data-theme="retro"] .flow-selection-flag {
    background: #e8e1d1;
    border: 2px solid rgba(45, 40, 32, 0.34);
    box-shadow: 1px 1px 0 rgba(45, 40, 32, 0.18), inset 1px 1px 0 rgba(255, 255, 255, 0.48);
}

body.theme-retro .flow-memory-chip[data-state="stateful"],
[data-theme="retro"] .flow-memory-chip[data-state="stateful"] {
    background: #dfe8ef;
}

body.theme-retro .flow-selection-flag,
[data-theme="retro"] .flow-selection-flag {
    background: #ece0cb;
}

/* ========== USER MODE SETUP (Section 23) ========== */
.user-mode-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.user-mode-overlay.active {
    display: flex;
}

.user-mode-card {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    box-shadow: var(--shadow-soft-lg);
    padding: 32px 28px;
    max-width: 560px;
    width: 100%;
    text-align: center;
    animation: user-mode-pop 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes user-mode-pop {
    from { transform: scale(0.92) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.user-mode-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.user-mode-card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.user-mode-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.user-mode-option {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 18px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}

.user-mode-option:hover {
    background: var(--surface-bg-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.user-mode-option.selected {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.user-mode-option-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.user-mode-option-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.user-mode-option-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.user-mode-skip {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.15s;
}

.user-mode-skip:hover {
    color: var(--text-primary);
    background: var(--surface-bg-hover);
}

@media (max-width: 500px) {
    .user-mode-options {
        grid-template-columns: 1fr;
    }
}

/* ========== STAY HUNGRY QUOTE (Section 25) ========== */
.stay-hungry-quote {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
    letter-spacing: 0.02em;
    padding: 14px 20px;
    margin-top: 20px;
    opacity: 0.7;
    transition: opacity 0.3s;
    font-family: var(--font-heading, "Playfair Display", Georgia, serif);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stay-hungry-quote:hover {
    opacity: 1;
}

/* Children of the dynamically hydrated quote */
.daily-lock-in-quote-text {
    display: block;
    line-height: 1.45;
    color: var(--text-muted);
}

.daily-lock-in-quote-author {
    display: block;
    font-size: 10px;
    font-style: normal;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    opacity: 0.7;
    font-family: var(--font-body, "DM Sans", system-ui, sans-serif);
}

/* Entrance fade after JS hydration */
.daily-lock-in-quote--hydrated {
    animation: notif-quote-fade-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes notif-quote-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 0.7; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .daily-lock-in-quote--hydrated { animation: none; }
}

body.motion-off .daily-lock-in-quote--hydrated { animation: none; }

/* ========== WORD COUNT IMPROVEMENTS (Section 21) ========== */
.doc-stats-panel {
    display: flex;
    gap: 12px;
    padding: 8px 14px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin: 10px 0;
}

.doc-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.doc-stat-label {
    color: var(--text-muted);
}

.doc-stat-value {
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* ========== LINK POPUP (Section 20) ========== */
.link-popup {
    position: absolute;
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
    padding: 10px;
    z-index: 100;
    min-width: 280px;
    display: none;
}

.link-popup.active {
    display: block;
}

.link-popup-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.link-popup-input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    background: var(--surface-bg);
    color: var(--text-primary);
    font-size: 12.5px;
}

.link-popup-btn {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    padding: 7px 11px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
}

.link-popup-btn.primary {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--accent);
}

/* ===== ATELIER NATIVE DIALOGS (replaces browser prompt/confirm/alert) ===== */
.atelier-dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99990;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.atelier-dialog-backdrop.active {
    display: flex;
    animation: atelier-dialog-fade 0.18s ease both;
}

@keyframes atelier-dialog-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.atelier-dialog {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 4px 12px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 480px;
    padding: 24px;
    animation: atelier-dialog-pop 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes atelier-dialog-pop {
    from { transform: scale(0.95) translateY(8px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.atelier-dialog-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.atelier-dialog-message {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 14px;
}

.atelier-dialog-input,
.atelier-dialog-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--surface-bg);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 12px;
}

.atelier-dialog-input:focus,
.atelier-dialog-textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-elevated);
}

.atelier-dialog-textarea {
    min-height: 80px;
    resize: vertical;
}

.atelier-dialog-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 6px;
}

.atelier-dialog-btn {
    padding: 9px 18px;
    border-radius: 999px;
    border: 1px solid var(--surface-border);
    background: var(--surface-bg);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.atelier-dialog-btn:hover {
    background: var(--surface-bg-hover);
}

.atelier-dialog-btn.primary {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--accent);
}

.atelier-dialog-btn.primary:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

.atelier-dialog-btn.danger {
    background: rgba(200, 56, 56, 0.12);
    color: #c83838;
    border-color: rgba(200, 56, 56, 0.4);
}

.atelier-dialog-btn.danger:hover {
    background: rgba(200, 56, 56, 0.25);
}

/* ===== DOCUMENT STATISTICS MODAL ===== */
.doc-stats-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99990;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.doc-stats-modal.active {
    display: flex;
    animation: atelier-dialog-fade 0.18s ease both;
}

.doc-stats-content {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 4px 12px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
    animation: atelier-dialog-pop 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.doc-stats-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-stats-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.doc-stats-title i {
    color: var(--accent-strong);
    font-size: 15px;
}

.doc-stats-title h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.doc-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 20px;
}

.doc-stat-card {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.doc-stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

/* Let the first card span the full width as a highlighted "Words" stat */
.doc-stat-card:first-child {
    grid-column: 1 / -1;
    background: var(--accent-soft);
    border-color: var(--accent);
}

.doc-stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    color: var(--accent-strong);
    font-size: 14px;
}

.doc-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.doc-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

@media (max-width: 480px) {
    .doc-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Improve floating side buttons positioning */
#docOutlineToggleBtn,
#commentsToggleBtn {
    z-index: 8500 !important;
}

/* ========================================================================
   CRAM HUB (Section 31)
   ======================================================================== */

.cramhub-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.cramhub-header {
    margin-bottom: 24px;
}

.cramhub-header .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-strong);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.cramhub-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
    max-width: 60ch;
}

/* Create session card */
.cramhub-create-card {
    padding: 24px;
    margin-bottom: 28px;
    border-radius: 14px;
}

.cramhub-create-card h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.cramhub-section-help {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 18px;
    line-height: 1.5;
}

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

.cramhub-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cramhub-field-full {
    grid-column: 1 / -1;
}

.cramhub-field label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.cramhub-field input,
.cramhub-field select {
    padding: 10px 12px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--surface-bg);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}

.cramhub-field input:focus,
.cramhub-field select:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-elevated);
}

.cramhub-range {
    width: 100%;
    accent-color: var(--accent);
}

.cramhub-range-value {
    display: inline-block;
    margin-left: 8px;
    font-weight: 700;
    color: var(--accent-strong);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.cramhub-actions {
    flex-direction: row;
    justify-content: flex-end;
    margin-top: 6px;
}

.cramhub-btn-primary {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border: 1px solid var(--accent);
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.cramhub-btn-primary:hover {
    background: var(--accent);
    color: var(--bg-primary);
    transform: translateY(-1px);
}

/* Sessions section */
.cramhub-sessions-section {
    margin-bottom: 24px;
}

.cramhub-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.cramhub-section-head h3 {
    font-size: 1.05rem;
    color: var(--text-primary);
    font-weight: 700;
}

.cramhub-sessions-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

/* Session card */
.cram-session-card {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.cram-session-card:hover {
    transform: translateY(-2px);
    border-color: var(--surface-border-strong);
    box-shadow: var(--shadow-soft);
}

.cram-session-card-urgent {
    border-left: 3px solid #e07a5f;
}

.cram-session-card-critical {
    border-left: 3px solid #c83838;
    animation: cram-pulse-border 2s ease-in-out infinite;
}

@keyframes cram-pulse-border {
    0%, 100% { border-left-color: #c83838; }
    50% { border-left-color: #ff5555; }
}

.cram-session-card-emergency {
    border-left: 3px solid #ff6b35;
    background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(255, 107, 53, 0.04) 100%);
}

.cram-session-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cram-session-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.cram-session-card-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.cram-session-card-chip.subject {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--accent);
}

.cram-session-card-chip.urgent {
    background: rgba(224, 122, 95, 0.15);
    color: #c66247;
    border-color: rgba(224, 122, 95, 0.4);
}

.cram-session-card-chip.critical {
    background: rgba(200, 56, 56, 0.18);
    color: #b02828;
    border-color: rgba(200, 56, 56, 0.5);
}

.cram-session-card-deadline {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.cram-session-card-deadline strong {
    color: var(--text-primary);
}

.cram-progress-bar {
    height: 5px;
    background: var(--surface-bg);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 8px;
}

.cram-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    border-radius: 999px;
    transition: width 0.4s ease;
}

.cram-session-card-progress-text {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.cram-session-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.cram-session-card-action {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--surface-border);
    background: var(--surface-bg);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.cram-session-card-action:hover {
    background: var(--surface-bg-hover);
    color: var(--text-primary);
}

.cram-session-card-action.danger:hover {
    background: rgba(200, 56, 56, 0.1);
    color: #c83838;
    border-color: rgba(200, 56, 56, 0.4);
}

/* Session detail view */
.cramhub-session-detail {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    padding: 24px;
    margin-top: 20px;
    animation: cram-detail-in 0.3s ease both;
}

@keyframes cram-detail-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.cram-detail-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--surface-border);
    gap: 16px;
}

.cram-detail-title-area {
    flex: 1;
}

.cram-detail-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.cram-detail-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.cram-detail-close {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.cram-detail-close:hover {
    background: var(--surface-bg-hover);
    color: var(--text-primary);
}

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

.cram-stat {
    padding: 12px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    text-align: center;
}

.cram-stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.cram-stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.cram-stat-value.urgent {
    color: #c66247;
}

.cram-stat-value.critical {
    color: #c83838;
}

.cram-stat-note {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 3px;
}

/* Section grouping inside detail */
.cram-section {
    margin-bottom: 24px;
}

.cram-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--surface-border);
}

.cram-section-title i {
    margin-right: 6px;
    color: var(--accent-strong);
}

.cram-add-mini {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}

.cram-add-mini:hover {
    background: var(--surface-bg-hover);
    color: var(--text-primary);
}

/* Study blocks */
.cram-blocks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cram-block {
    padding: 12px 14px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: all 0.15s;
}

.cram-block.completed {
    opacity: 0.65;
}

.cram-block.completed .cram-block-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.cram-block-checkbox {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.cram-block-body {
    flex: 1;
    min-width: 0;
}

.cram-block-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.cram-block-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 6px;
}

.cram-block-meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--text-muted);
    align-items: center;
}

.cram-block-duration {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    color: var(--accent-strong);
}

.cram-block-start {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border: 1px solid var(--accent);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.cram-block-start:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

.cram-block-break {
    background: var(--surface-bg-elevated);
    border-style: dashed;
}

.cram-block-break .cram-block-title {
    color: var(--text-secondary);
    font-style: italic;
}

/* Emergency mode panel */
.cram-emergency-panel {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.08), rgba(200, 56, 56, 0.04));
    border: 1px solid rgba(255, 107, 53, 0.35);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.cram-emergency-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 800;
    color: #c83838;
    margin-bottom: 10px;
}

.cram-emergency-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

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

.cram-emergency-block {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 12px;
}

.cram-emergency-block h4 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.cram-emergency-block textarea {
    width: 100%;
    min-height: 80px;
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    background: var(--surface-bg);
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.5;
    font-family: inherit;
    resize: vertical;
}

/* Brain Dump section */
.cram-braindump {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 24px;
}

.cram-braindump textarea {
    width: 100%;
    min-height: 100px;
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 10px;
}

.cram-braindump-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Resources tabs */
.cram-resources-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--surface-border);
}

.cram-resource-tab {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 6px 6px 0 0;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.15s;
}

.cram-resource-tab:hover {
    background: var(--surface-bg-hover);
}

.cram-resource-tab.active {
    color: var(--accent-strong);
    background: var(--accent-soft);
    border-bottom: 2px solid var(--accent);
}

.cram-resource-panel {
    display: none;
}

.cram-resource-panel.active {
    display: block;
}

.cram-resource-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.cram-resource-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
}

.cram-resource-item-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
}

.cram-resource-item-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
}

.cram-resource-item-remove:hover {
    color: #c83838;
    background: rgba(200, 56, 56, 0.1);
}

.cram-resource-add-row {
    display: flex;
    gap: 6px;
}

.cram-resource-add-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    background: var(--surface-bg);
    color: var(--text-primary);
    font-size: 13px;
}

/* Built-in timer */
.cram-timer-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    padding: 24px;
    box-shadow: var(--shadow-soft-lg);
    z-index: 9000;
    display: none;
    flex-direction: column;
    align-items: center;
    min-width: 280px;
}

.cram-timer-modal.active {
    display: flex;
}

.cram-timer-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 8999;
    display: none;
}

.cram-timer-modal-backdrop.active {
    display: block;
}

.cram-timer-display {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    margin: 12px 0;
}

.cram-timer-task {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    text-align: center;
}

.cram-timer-controls {
    display: flex;
    gap: 8px;
}

.cram-timer-controls button {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--surface-border);
    background: var(--surface-bg);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 600;
}

.cram-timer-controls button.primary {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--accent);
}

/* Mobile */
@media (max-width: 768px) {
    .cramhub-container {
        padding: 12px;
    }
    .cramhub-form {
        grid-template-columns: 1fr;
    }
    .cramhub-sessions-list {
        grid-template-columns: 1fr;
    }
    .cram-detail-head {
        flex-direction: column;
    }
    .cram-detail-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .cram-emergency-grid {
        grid-template-columns: 1fr;
    }
    .cram-block {
        padding: 10px;
    }
    .cram-resources-tabs {
        font-size: 12px;
    }
}

/* Retro theme overrides */
body.theme-retro .cram-session-card,
body.theme-retro .cramhub-create-card,
body.theme-retro .cramhub-session-detail {
    border-radius: 4px;
    box-shadow: 3px 3px 0 rgba(45, 40, 32, 0.3);
}

body.theme-retro .cram-block,
body.theme-retro .cram-stat,
body.theme-retro .cram-emergency-block {
    border-radius: 3px;
}

/* ========================================================================
   TESTING HUB (Section 32) — Standardized Testing Workspace
   ======================================================================== */

.testing-hub-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.testing-hub-header {
    margin-bottom: 20px;
}

.testing-hub-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
    max-width: 60ch;
}

/* Internal section navigation (Exams / Review / Cram / Practice / Mistakes / Resources) */
.testing-hub-section-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 4px;
    margin-bottom: 18px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    scrollbar-width: thin;
}

.testing-hub-section-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 9px 14px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
}

.testing-hub-section-tab:hover {
    background: var(--surface-bg-hover);
    color: var(--text-primary);
}

.testing-hub-section-tab.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 0 0 1px var(--surface-border);
}

.testing-hub-section-panel {
    display: none;
}

.testing-hub-section-panel.active {
    display: block;
    animation: testing-panel-fade 0.2s ease both;
}

/* When the Review or Cram view content is portaled inside Testing Hub,
   strip the original outer chrome so it sits flush within the section. */
.testing-hub-portal > .review-mount,
.testing-hub-portal > .cramhub-container {
    margin: 0;
}

.testing-hub-portal:empty::before {
    content: 'Loading…';
    display: block;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
}

.testing-hub-summary {
    display: grid;
    gap: 16px;
}

.testing-hub-summary-card {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    padding: 20px 24px;
}

.testing-hub-summary-card h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.testing-hub-summary-card p {
    margin: 0 0 14px;
    color: var(--text-secondary);
    font-size: 13px;
}

.testing-hub-summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.testing-hub-summary-stat {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 12px;
}

.testing-hub-summary-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.testing-hub-summary-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.testing-hub-summary-exams {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.testing-hub-summary-exam-link {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: background 0.15s, border-color 0.15s;
}

.testing-hub-summary-exam-link:hover {
    background: var(--surface-bg-hover);
    border-color: var(--accent);
}

.testing-hub-summary-exam-link .meta {
    color: var(--text-secondary);
    font-size: 11px;
}

@media (max-width: 720px) {
    .testing-hub-section-nav {
        border-radius: 10px;
    }
    .testing-hub-section-tab {
        padding: 8px 11px;
        font-size: 12px;
    }
    .testing-hub-summary-card {
        padding: 16px;
    }
}

.testing-hub-exam-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 6px 4px 12px;
    border-bottom: 1px solid var(--surface-border);
    margin-bottom: 18px;
    scrollbar-width: thin;
}

.testing-hub-exam-tab {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.testing-hub-exam-tab:hover {
    background: var(--surface-bg-hover);
    color: var(--text-primary);
}

.testing-hub-exam-tab.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--accent);
    font-weight: 700;
}

.testing-hub-exam-panel {
    display: none;
}

.testing-hub-exam-panel.active {
    display: block;
    animation: testing-panel-fade 0.2s ease both;
}

@keyframes testing-panel-fade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================================================
   TESTING HUB — SAT/ACT specialized dashboard widgets
   ======================================================================== */

/* Callout card: short intro + format facts */
.exam-callout-card {
    background: linear-gradient(135deg, var(--accent-soft), transparent);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 16px;
}
.exam-callout-eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--accent-strong);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.exam-callout-body {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Pacing reference table */
.exam-pacing-table {
    display: grid;
    gap: 1px;
    background: var(--surface-border);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    overflow: hidden;
}
.exam-pacing-row {
    display: grid;
    grid-template-columns: 1.8fr 1fr 1fr 1fr;
    background: var(--surface-bg);
    padding: 10px 14px;
    font-size: 13px;
    align-items: center;
}
.exam-pacing-row.exam-pacing-head {
    background: var(--bg-elevated);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}
@media (max-width: 600px) {
    .exam-pacing-row {
        grid-template-columns: 1.4fr 1fr 1fr;
        font-size: 12px;
    }
    /* Hide the "Per question" column on narrow viewports */
    .exam-pacing-row > div:last-child {
        display: none;
    }
}

/* Topic mastery chips */
.exam-mastery-section {
    margin-bottom: 14px;
}
.exam-mastery-section:last-child { margin-bottom: 0; }
.exam-mastery-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}
.exam-mastery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
}
.exam-mastery-chip {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.exam-mastery-chip:hover {
    background: var(--surface-bg-hover);
    transform: translateY(-1px);
}
.exam-mastery-chip:active { transform: translateY(0); }
.exam-mastery-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.exam-mastery-state {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}
.exam-mastery-untracked .exam-mastery-state { color: var(--text-muted); }
.exam-mastery-weak    { border-color: #d9534f; background: rgba(217, 83, 79, 0.08); }
.exam-mastery-weak    .exam-mastery-state { color: #d9534f; }
.exam-mastery-ok      { border-color: #d9a72a; background: rgba(217, 167, 42, 0.08); }
.exam-mastery-ok      .exam-mastery-state { color: #b88318; }
.exam-mastery-strong  { border-color: #2e8b57; background: rgba(46, 139, 87, 0.10); }
.exam-mastery-strong  .exam-mastery-state { color: #2e8b57; }

/* Official practice tests checklist */
.exam-official-tests {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 6px;
}
.exam-official-test {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: background 0.15s;
}
.exam-official-test:hover { background: var(--surface-bg-hover); }
.exam-official-test input { accent-color: var(--accent); cursor: pointer; }
.exam-official-test.done {
    background: rgba(46, 139, 87, 0.06);
    border-color: rgba(46, 139, 87, 0.4);
}
.exam-official-test.done span {
    color: var(--text-muted);
    text-decoration: line-through;
}

/* Exam dashboard inside each panel */
.exam-dashboard {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
}

.exam-dashboard-head {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--surface-border);
}

.exam-dashboard-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
}

.exam-dashboard-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.exam-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.exam-stat {
    padding: 14px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    text-align: center;
}

.exam-stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.exam-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.exam-stat-value.urgent { color: #c66247; }
.exam-stat-value.critical { color: #c83838; }

.exam-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.exam-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.exam-field-full { grid-column: 1 / -1; }

.exam-field label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.exam-field input,
.exam-field select,
.exam-field textarea {
    padding: 10px 12px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--surface-bg);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}

.exam-field textarea {
    min-height: 80px;
    resize: vertical;
}

.exam-section {
    margin-bottom: 24px;
}

.exam-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--surface-border);
}

.exam-section-title i {
    margin-right: 6px;
    color: var(--accent-strong);
}

.exam-add-btn {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border: 1px solid var(--accent);
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.exam-add-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

/* Practice test log */
.practice-test-list,
.mistake-list,
.task-list-exam {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.practice-test-item,
.mistake-item,
.task-item-exam {
    padding: 12px 14px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: flex-start;
}

.practice-test-header,
.mistake-header {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.practice-test-source {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 13px;
}

.practice-test-date {
    font-size: 11px;
    color: var(--text-muted);
}

.practice-test-scores {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.exam-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-bg-active);
    border: 1px solid var(--surface-border);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.exam-chip.status-unresolved { background: rgba(200, 56, 56, 0.15); color: #b02828; border-color: rgba(200, 56, 56, 0.4); }
.exam-chip.status-reviewed { background: rgba(255, 165, 0, 0.15); color: #b07020; border-color: rgba(255, 165, 0, 0.4); }
.exam-chip.status-mastered { background: rgba(80, 190, 110, 0.15); color: #2d8c4f; border-color: rgba(80, 190, 110, 0.4); }

.exam-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.exam-item-action {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.15s;
}

.exam-item-action:hover {
    background: var(--surface-bg-hover);
    color: var(--text-primary);
}

.exam-item-action.danger:hover {
    background: rgba(200, 56, 56, 0.1);
    color: #c83838;
}

.exam-empty {
    padding: 30px 20px;
    text-align: center;
    border: 1px dashed var(--surface-border);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 13px;
}

.exam-empty i {
    display: block;
    font-size: 28px;
    margin-bottom: 8px;
    opacity: 0.6;
}

/* Mobile */
@media (max-width: 768px) {
    .testing-hub-shell { padding: 12px; }
    .testing-hub-exam-tabs { padding-bottom: 8px; }
    .testing-hub-exam-tab { padding: 7px 11px; font-size: 12px; }
    .exam-form-grid { grid-template-columns: 1fr; }
    .exam-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .practice-test-item,
    .mistake-item { grid-template-columns: 1fr; }
    .exam-item-actions { justify-content: flex-end; }
}

/* Retro theme */
body.theme-retro .testing-hub-exam-tab,
body.theme-retro .exam-dashboard,
body.theme-retro .practice-test-item,
body.theme-retro .mistake-item,
body.theme-retro .exam-stat {
    border-radius: 4px;
    box-shadow: 2px 2px 0 rgba(45, 40, 32, 0.25);
}

/* =========================================================================
   TESTING HUB v2 — dashboard-first redesign (Section 32, redesign)
   Calmer hierarchy: hero header, segmented nav, KPI grid, exam cards,
   collapsible detail, expanded summary panels.
   ========================================================================= */

/* Hero header */
.testing-hub-shell.th2 .th2-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.th2-hero-text { max-width: 60ch; }
.th2-hero-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 6px;
}
.th2-hero-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Primary / ghost buttons used by the hero and detail toolbar */
.th2-btn-primary {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: filter 0.15s, transform 0.15s;
}
.th2-btn-primary:hover { filter: brightness(1.05); }
.th2-btn-primary:active { transform: translateY(1px); }
.th2-btn-primary.th2-btn-large {
    padding: 12px 18px;
    font-size: 14px;
}
.th2-btn-ghost {
    background: var(--surface-bg);
    color: var(--text-primary);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s, border-color 0.15s;
}
.th2-btn-ghost:hover {
    background: var(--surface-bg-hover);
    border-color: var(--accent);
}

/* Segmented section nav (desktop) */
.testing-hub-shell.th2 .testing-hub-section-nav.th2-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 4px;
    margin-bottom: 18px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
}
/* Mobile dropdown nav (hidden on desktop) */
.th2-nav-mobile { display: none; }
.th2-nav-mobile-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.th2-select {
    width: 100%;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}

/* Exam strip on the Exams section */
.testing-hub-shell.th2 .testing-hub-exam-tabs.th2-exam-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    padding: 4px;
    margin-bottom: 18px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    border-bottom: 1px solid var(--surface-border);
    scrollbar-width: thin;
}
.th2-strip-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    font-weight: 700;
    padding: 0 6px;
    flex: 0 0 auto;
}
.th2-strip-chips {
    display: inline-flex;
    gap: 6px;
    flex: 1 1 auto;
    flex-wrap: wrap;
    min-height: 36px;
    align-items: center;
}
.th2-strip-empty {
    color: var(--text-secondary);
    font-size: 12px;
    padding: 6px 10px;
}
.th2-strip-chip {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, border-color 0.15s;
}
.th2-strip-chip:hover { background: var(--surface-bg-hover); border-color: var(--accent); }
.th2-strip-chip.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: var(--accent);
}
.th2-strip-more,
.th2-strip-add {
    background: transparent;
    color: var(--text-secondary);
    border: 1px dashed var(--surface-border);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.th2-strip-more:hover,
.th2-strip-add:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: var(--surface-bg-hover);
}

/* Empty state shared style */
.th2-empty-state {
    background: var(--bg-elevated);
    border: 1px dashed var(--surface-border);
    border-radius: 14px;
    padding: 36px 28px;
    text-align: center;
    color: var(--text-secondary);
}
.th2-empty-state h3 {
    margin: 8px 0 4px;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
}
.th2-empty-state p { margin: 0 0 16px; font-size: 14px; max-width: 56ch; margin-left: auto; margin-right: auto; }
.th2-empty-icon { font-size: 28px; color: var(--text-secondary); opacity: 0.55; }
.th2-empty-inline {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 14px 16px;
    background: var(--surface-bg);
    border: 1px dashed var(--surface-border);
    border-radius: 10px;
}

/* ===== Dashboard ===== */
.th2-dashboard { display: grid; gap: 18px; }

.th2-dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: linear-gradient(135deg, var(--accent-soft), transparent 70%);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    padding: 22px 26px;
    flex-wrap: wrap;
}
.th2-dashboard-hero .eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--accent-strong);
    margin-bottom: 6px;
}
.th2-dashboard-hero h3 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}
.th2-next-reason {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    max-width: 56ch;
}
.th2-dashboard-hero-action { flex: 0 0 auto; }

/* KPI grid */
.th2-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.th2-kpi {
    text-align: left;
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    padding: 16px 18px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, background 0.15s;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: inherit;
    font-family: inherit;
}
.th2-kpi:hover { border-color: var(--accent); transform: translateY(-1px); }
.th2-kpi-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.th2-kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}
.th2-kpi-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Quick actions block */
.th2-dashboard-quick { display: grid; gap: 10px; }
.th2-dashboard-quick-head h3 { margin: 0 0 2px; font-size: 16px; font-weight: 700; }
.th2-section-sub { margin: 0; color: var(--text-secondary); font-size: 13px; }
.th2-dashboard-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 8px;
}
.th2-quick-action {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s, border-color 0.15s;
}
.th2-quick-action:hover { background: var(--surface-bg-hover); border-color: var(--accent); }

/* ===== Exam grid (cards) ===== */
.th2-exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.th2-exam-card {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    padding: 18px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.15s, transform 0.15s;
    outline: none;
    /* Hard-cap content to the card so a long description / chip never bleeds
       past the rounded border. Grid children also need min-width: 0 so the
       card can shrink to its column. */
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
}
.th2-exam-card > * { min-width: 0; }
.th2-exam-card-title { min-width: 0; }
.th2-exam-card-title h3 {
    overflow-wrap: anywhere;
    word-break: break-word;
}
.th2-exam-card:hover,
.th2-exam-card:focus-visible {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.th2-exam-card.critical { border-color: rgba(220, 60, 60, 0.5); }
.th2-exam-card.urgent { border-color: rgba(220, 150, 60, 0.5); }
.th2-exam-card.past {
    border-color: var(--surface-border);
    opacity: 0.78;
}
.th2-exam-card.past .th2-card-countdown-num { color: var(--text-secondary); }
.th2-exam-card.past .th2-exam-card-status { color: var(--text-secondary); }

.th2-exam-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.th2-exam-card-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.th2-exam-card-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex: 0 0 auto;
}
.th2-exam-card-title {
    flex: 1 1 auto;
    min-width: 0;
}
.th2-exam-card-title h3 {
    margin: 0 0 2px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}
.th2-exam-card-status {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: var(--text-secondary);
}
.th2-exam-card-status.status-studying { color: var(--accent-strong); }
.th2-exam-card-status.status-ready { color: rgba(40, 160, 80, 0.95); }

.th2-exam-card-countdown {
    text-align: right;
    flex: 0 0 auto;
}
.th2-card-countdown-num {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}
.th2-card-countdown-date {
    font-size: 11px;
    color: var(--text-secondary);
}
.th2-exam-card.critical .th2-card-countdown-num { color: rgba(220, 60, 60, 0.95); }
.th2-exam-card.urgent .th2-card-countdown-num { color: rgba(220, 150, 60, 0.95); }

.th2-exam-card-meta {
    display: grid;
    /* auto-fit + minmax lets crowded cards reflow to 2 columns rather than
       force-overflow when the card column itself is narrow. minmax(0, 1fr)
       lets each cell shrink past its intrinsic content width. */
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    min-width: 0;
}
.th2-card-meta-item {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
}
.th2-card-meta-item.is-warning { border-color: rgba(220, 150, 60, 0.5); }
.th2-card-meta-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.th2-card-meta-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.th2-exam-card-next {
    background: var(--surface-bg);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.th2-exam-card-next i { color: var(--accent-strong); }

.th2-exam-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.th2-card-action {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.th2-card-action:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: var(--surface-bg-hover);
}
.th2-card-action-primary {
    margin-left: auto;
    color: var(--accent-strong);
    border-color: var(--accent);
}

/* ===== Exam detail ===== */
.th2-exam-detail { margin-top: 6px; }
.th2-detail-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 14px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    flex-wrap: wrap;
}
.th2-detail-back {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, border-color 0.15s;
}
.th2-detail-back:hover { background: var(--surface-bg-hover); border-color: var(--accent); }
.th2-detail-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
}
.th2-detail-tools {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}
.th2-detail-tool {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s, border-color 0.15s;
}
.th2-detail-tool:hover { color: var(--text-primary); border-color: var(--accent); }
.th2-detail-tool.danger:hover { color: rgba(220, 60, 60, 0.95); border-color: rgba(220, 60, 60, 0.5); }
.th2-detail-body { display: block; }

/* Collapsible exam sections inside detail */
.exam-collapse {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}
.exam-collapse-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    list-style: none;
    gap: 8px;
    transition: background 0.12s;
}
.exam-collapse-summary::-webkit-details-marker { display: none; }
.exam-collapse-summary:hover { background: var(--surface-bg-hover); }
.exam-collapse[open] .exam-collapse-summary { border-bottom: 1px solid var(--surface-border); }
.exam-collapse-summary span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.exam-collapse-meta {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    font-weight: 600;
}
.exam-collapse-body { padding: 14px 18px; }

/* AP anchor wrapping */
.th2-ap-anchor { display: block; }
.th2-ap-anchor[hidden] { display: none !important; }

/* ===== Subview summary headers (Review / Cram) ===== */
.th2-subview-summary,
.th2-summary-header {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.th2-subview-summary-text .eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-strong);
    font-weight: 700;
    margin-bottom: 4px;
}
.th2-subview-summary-text h3 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.th2-subview-summary-text p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}
.th2-subview-summary-actions {
    flex: 0 0 auto;
    display: inline-flex;
    gap: 8px;
}

/* When the cram summary is showing active sessions, collapse the new-session
   form so it doesn't dominate. */
#cramhubCreateCard[data-th2-collapsed="true"] {
    max-height: 60px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    padding-top: 16px;
    padding-bottom: 8px;
}
#cramhubCreateCard[data-th2-collapsed="true"]::after {
    content: 'Click to expand';
    position: absolute;
    bottom: 4px;
    right: 14px;
    font-size: 11px;
    color: var(--text-secondary);
}
#cramhubCreateCard[data-th2-collapsed="true"]:hover { max-height: none; cursor: default; }
#cramhubCreateCard[data-th2-collapsed="true"]:hover::after { display: none; }

/* ===== Summary panels (Practice / Mistakes / Resources) ===== */
.th2-summary-panel {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 14px;
    padding: 20px;
    display: grid;
    gap: 14px;
}
.th2-summary-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.th2-summary-panel-head h3 {
    margin: 0 0 2px;
    font-size: 17px;
    font-weight: 700;
}
.th2-summary-panel-actions {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}
.th2-filter-select {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 6px 10px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    min-height: 32px;
}

.th2-stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}
.th2-stat {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 10px 12px;
}
.th2-stat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}
.th2-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.th2-rows { display: grid; gap: 8px; }
.th2-practice-row,
.th2-mistake-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    flex-wrap: wrap;
}
.th2-mistake-row.status-unresolved { border-left: 3px solid rgba(220, 150, 60, 0.7); }
.th2-mistake-row.status-mastered { border-left: 3px solid rgba(40, 160, 80, 0.7); }
.th2-practice-row-main,
.th2-mistake-row-main { flex: 1 1 280px; min-width: 0; }
.th2-practice-row-head,
.th2-mistake-row-head {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 4px;
}
.th2-row-exam-chip {
    background: var(--accent-soft);
    color: var(--accent-strong);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    gap: 5px;
    align-items: center;
}
.th2-row-source { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.th2-row-date { font-size: 11px; color: var(--text-secondary); margin-left: auto; }
.th2-row-chip {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-primary);
    font-weight: 600;
}
.th2-row-chip-soft { color: var(--text-secondary); }
.th2-row-takeaways {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.5;
    margin-top: 4px;
}
.th2-row-next {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.th2-row-status {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
}
.th2-status-unresolved { background: rgba(220, 150, 60, 0.15); color: rgba(180, 110, 30, 1); }
.th2-status-reviewed { background: rgba(40, 130, 200, 0.15); color: rgba(40, 110, 180, 1); }
.th2-status-mastered { background: rgba(40, 160, 80, 0.18); color: rgba(40, 130, 70, 1); }
.th2-practice-row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 0 0 auto;
    align-items: center;
}
.th2-row-btn {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.th2-row-btn:hover { color: var(--text-primary); border-color: var(--accent); }
.th2-row-btn.danger:hover { color: rgba(220, 60, 60, 0.95); border-color: rgba(220, 60, 60, 0.5); }

.th2-resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.th2-resource-card {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 14px 16px;
    display: grid;
    gap: 10px;
}
.th2-resource-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.th2-resource-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.th2-resource-body {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--text-primary);
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    line-height: 1.5;
    max-height: 220px;
    overflow: auto;
}

/* ===== Exam picker modal ===== */
.th2-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 18, 14, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
}
.th2-modal-overlay[hidden] { display: none; }
.th2-modal {
    background: var(--bg-elevated);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    width: 100%;
    max-width: 880px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    box-sizing: border-box;
}
.th2-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--surface-border);
    gap: 12px;
    flex: 0 0 auto;
    background: var(--bg-elevated);
}
.th2-modal-head h3 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.th2-modal-sub { margin: 0; color: var(--text-secondary); font-size: 13px; }
.th2-modal-close {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    flex: 0 0 auto;
    line-height: 1;
}
.th2-modal-close:hover { background: var(--surface-bg-hover); color: var(--text-primary); }
.th2-modal-body {
    padding: 18px 22px 22px;
    overflow: auto;
    display: grid;
    gap: 18px;
    flex: 1 1 auto;
    min-height: 0;
    /* Reserve gutter so the scrollbar never overlaps card content */
    scrollbar-gutter: stable;
    /* Themed scrollbar so it disappears into the modal surface */
    scrollbar-color: var(--surface-border) transparent;
    scrollbar-width: thin;
}
.th2-modal-body::-webkit-scrollbar {
    width: 10px;
}
.th2-modal-body::-webkit-scrollbar-track {
    background: transparent;
}
.th2-modal-body::-webkit-scrollbar-thumb {
    background: var(--surface-border);
    border-radius: 8px;
    border: 2px solid var(--bg-elevated);
}
.th2-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Sticky footer — always-visible primary action (e.g. "Create custom exam") */
.th2-modal-foot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--surface-border);
    background: var(--bg-elevated);
    flex: 0 0 auto;
}
.th2-modal-foot .th2-btn-primary.is-focused {
    box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent);
    animation: th2-pulse 1.4s ease-out 1;
}
@keyframes th2-pulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.th2-picker-group { display: grid; gap: 8px; }
.th2-picker-group-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-weight: 700;
}
.th2-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.th2-picker-card {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 14px;
    text-align: left;
    cursor: pointer;
    display: grid;
    gap: 6px;
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
    color: inherit;
}
.th2-picker-card:hover { border-color: var(--accent); background: var(--surface-bg-hover); }
.th2-picker-card.is-pinned { border-color: var(--accent); background: var(--accent-soft); }
.th2-picker-card.th2-picker-card-create { border-style: dashed; }
.th2-picker-card.is-focused {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}
.th2-picker-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
}
.th2-picker-card-title { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.th2-picker-card-blurb { margin: 0; font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.th2-picker-pinned {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent-strong);
    margin-left: auto;
    font-weight: 700;
}
.th2-picker-empty {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 8px 0;
}

/* ===== Tablet + Mobile responsive ===== */
@media (max-width: 1100px) {
    .th2-exam-card-meta { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .testing-hub-shell.th2 .th2-hero { flex-direction: column; align-items: flex-start; }
    .th2-dashboard-hero { flex-direction: column; align-items: flex-start; }
    .th2-detail-toolbar { gap: 8px; }
}
@media (max-width: 720px) {
    /* Swap segmented control for the dropdown on small screens */
    .testing-hub-shell.th2 .testing-hub-section-nav.th2-nav { display: none; }
    .th2-nav-mobile { display: block; margin-bottom: 14px; }
    .testing-hub-shell.th2 .testing-hub-exam-tabs.th2-exam-strip {
        flex-direction: column;
        align-items: stretch;
    }
    .th2-strip-chips { width: 100%; }
    .th2-strip-more,
    .th2-strip-add { width: 100%; justify-content: center; }
    .th2-exam-grid { grid-template-columns: 1fr; }
    .th2-resource-grid { grid-template-columns: 1fr; }
    .th2-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .th2-summary-panel-actions .th2-filter-select { flex: 1 1 0; min-width: 0; }
}

/* =====================================================================
   CALM EXAM OVERVIEW (redesign) — hero + 4 cards + More details.
   Token-driven so it inherits every theme (light/dark/retro/etc.).
   ===================================================================== */
.th2-ov { display: flex; flex-direction: column; gap: 18px; }
.th2-ov-setupbar { display: flex; justify-content: flex-end; margin-bottom: -4px; }
.th2-ov-setup-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--surface-bg); border: 1px solid var(--surface-border);
    color: var(--text-secondary); border-radius: var(--radius-pill, 999px);
    padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background var(--transition-fast, .18s), color .18s, border-color .18s;
}
.th2-ov-setup-btn:hover { background: var(--surface-bg-hover); color: var(--text-primary); border-color: var(--accent); }

/* ---- Hero ---- (own class so it never collides with the page header's .th2-hero) */
.th2-xhero {
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: var(--bg-elevated, var(--glass-01)); border: 1px solid var(--surface-border);
    border-radius: var(--radius, 18px); box-shadow: var(--shadow-soft);
    padding: 22px 8px; gap: 0;
}
.th2-hero-cell { padding: 4px 22px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.th2-hero-cell + .th2-hero-cell { border-left: 1px solid var(--surface-border); }
.th2-hero-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
    font-weight: 700; color: var(--text-secondary); display: flex; align-items: center; gap: 6px;
}
.th2-hero-big { font-size: 1.7rem; line-height: 1.15; font-weight: 600; color: var(--text-primary); font-family: var(--font-heading, inherit); }
.th2-hero-big strong { font-weight: 800; }
.th2-hero-sub { font-size: 12.5px; color: var(--text-secondary); line-height: 1.4; }
.th2-hero-score { font-size: 1.6rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; }
.th2-hero-arrow { color: var(--accent-strong); font-weight: 700; margin: 0 4px; }
.th2-hero-scorelabels { display: flex; gap: 36px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.th2-readiness {
    display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
    padding: 6px 14px; border-radius: var(--radius-pill, 999px); font-size: 13px; font-weight: 700;
    background: rgba(46, 139, 87, 0.12); color: #2e8b57; border: 1px solid rgba(46, 139, 87, 0.32);
}
.th2-readiness-behind { background: rgba(217, 167, 42, 0.14); color: #b88318; border-color: rgba(217, 167, 42, 0.4); }
.th2-readiness-no-data { background: var(--surface-bg); color: var(--text-secondary); border-color: var(--surface-border); }
.th2-readiness-ahead { background: rgba(46, 139, 87, 0.16); color: #2e8b57; border-color: rgba(46, 139, 87, 0.4); }
.th2-hero-action { justify-content: flex-start; }
.th2-nba {
    display: flex; align-items: center; gap: 12px; margin-top: 2px;
    background: var(--accent-soft); border: 1px solid var(--surface-border);
    border-radius: 14px; padding: 12px 14px;
}
.th2-nba-icon {
    flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
    display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font-size: 14px;
}
.th2-nba-body { flex: 1 1 auto; min-width: 0; }
.th2-nba-title { font-size: 13.5px; font-weight: 700; color: var(--text-primary); line-height: 1.25; }
.th2-nba-meta { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.th2-nba-btn {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
    background: var(--accent-strong); color: #fff; border: none; border-radius: var(--radius-pill, 999px);
    padding: 8px 15px; font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap;
    transition: filter .18s, transform .1s;
}
.th2-nba-btn:hover { filter: brightness(1.06); }
.th2-nba-btn:active { transform: translateY(1px); }

/* ---- Cards grid ---- */
.th2-ov-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.th2-card {
    display: flex; flex-direction: column; gap: 14px;
    background: var(--bg-elevated, var(--glass-01)); border: 1px solid var(--surface-border);
    border-radius: var(--radius, 18px); box-shadow: var(--shadow-soft); padding: 20px 22px;
}
.th2-card-head { display: flex; align-items: center; gap: 10px; }
.th2-card-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-primary); }
.th2-card-num {
    flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center; font-size: 12px; font-weight: 700;
    background: var(--surface-bg); color: var(--text-secondary); border: 1px solid var(--surface-border);
}
.th2-card-link {
    background: none; border: none; cursor: pointer; color: var(--accent-strong);
    font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px;
    padding: 0; align-self: flex-end;
}
.th2-card-link.inline { margin-left: auto; align-self: center; }
.th2-card-link:hover { text-decoration: underline; }
.th2-card-empty { font-size: 13px; color: var(--text-secondary); padding: 8px 0; }
.th2-card-empty .th2-link { padding: 0; }

/* Focus card */
.th2-card-focus .th2-focus-body { display: flex; gap: 16px; align-items: flex-start; }
.th2-focus-icon {
    flex: 0 0 auto; width: 56px; height: 56px; border-radius: 14px;
    display: grid; place-items: center; font-size: 22px;
    background: var(--accent-soft); color: var(--accent-strong);
}
.th2-focus-main { min-width: 0; }
.th2-focus-title { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.th2-focus-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: 0 0 12px; }
.th2-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.th2-badge {
    display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
    padding: 4px 10px; border-radius: var(--radius-pill, 999px);
    background: var(--surface-bg); color: var(--text-secondary); border: 1px solid var(--surface-border);
}
.th2-badge-high { background: rgba(217, 167, 42, 0.14); color: #b88318; border-color: rgba(217, 167, 42, 0.34); }
.th2-focus-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.th2-btn-dark {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--text-primary); color: var(--bg-primary);
    border: none; border-radius: 12px; padding: 11px 18px; font-size: 13px; font-weight: 700; cursor: pointer;
    transition: filter .18s, transform .1s;
}
.th2-btn-dark:hover { filter: brightness(1.12); }
.th2-btn-dark:active { transform: translateY(1px); }
.th2-link {
    background: none; border: none; cursor: pointer; color: var(--text-secondary);
    font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; padding: 0;
}
.th2-link:hover { color: var(--accent-strong); text-decoration: underline; }

/* Score progress */
.th2-progress { display: flex; gap: 18px; align-items: center; }
.th2-progress-chart { flex: 1 1 auto; min-width: 0; }
.th2-chart-svg { width: 100%; height: 120px; display: block; }
.th2-chart-line { stroke: var(--accent-strong); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.th2-chart-dots circle { fill: var(--accent-strong); }
.th2-chart-target { stroke: var(--text-muted); stroke-width: 1.5; opacity: 0.6; }
.th2-chart-empty {
    height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    color: var(--text-muted); font-size: 12.5px; text-align: center;
    background: var(--surface-bg); border-radius: 12px; border: 1px dashed var(--surface-border);
}
.th2-chart-empty i { font-size: 20px; opacity: 0.5; }
.th2-progress-summary { flex: 0 0 auto; display: flex; flex-direction: column; gap: 14px; text-align: right; }
.th2-prog-stat { display: flex; flex-direction: column; gap: 2px; }
.th2-prog-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.th2-prog-val { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.th2-prog-val small { font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }

/* Weak areas + recent practice rows */
.th2-weak-list, .th2-recent-list { display: flex; flex-direction: column; gap: 8px; }
.th2-weak-row, .th2-recent-row {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
    background: var(--surface-bg); border: 1px solid var(--surface-border); border-radius: 12px;
    padding: 10px 12px; cursor: pointer; font-family: inherit;
    transition: background .15s, border-color .15s, transform .1s;
}
.th2-weak-row:hover, .th2-recent-row:hover { background: var(--surface-bg-hover); transform: translateY(-1px); }
.th2-weak-tile, .th2-recent-icon {
    flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px;
    display: grid; place-items: center; font-size: 13px;
}
.th2-weak-tile-0 { background: rgba(217, 83, 79, 0.14); color: #d9534f; }
.th2-weak-tile-1 { background: rgba(99, 102, 241, 0.14); color: #6366f1; }
.th2-weak-tile-2 { background: rgba(217, 167, 42, 0.16); color: #b88318; }
.th2-recent-icon { background: var(--accent-soft); color: var(--accent-strong); }
.th2-weak-name { flex: 1 1 auto; font-size: 13.5px; font-weight: 600; color: var(--text-primary); min-width: 0; }
.th2-weak-count { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.th2-pill {
    flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-pill, 999px);
    text-transform: none;
}
.th2-pill-high { background: rgba(217, 83, 79, 0.14); color: #d9534f; }
.th2-pill-med { background: rgba(217, 167, 42, 0.16); color: #b88318; }
.th2-pill-low { background: var(--surface-bg-hover); color: var(--text-secondary); }
.th2-row-chev { flex: 0 0 auto; color: var(--text-muted); font-size: 12px; }
.th2-recent-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.th2-recent-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.th2-recent-meta { font-size: 11.5px; color: var(--text-muted); }
.th2-recent-score { flex: 0 0 auto; font-size: 15px; font-weight: 700; color: var(--text-primary); }
.th2-recent-score small { font-size: 0.7em; font-weight: 500; color: var(--text-muted); }

/* ---- More details disclosure ---- */
.th2-more {
    background: var(--bg-elevated, var(--glass-01)); border: 1px solid var(--surface-border);
    border-radius: var(--radius, 18px); box-shadow: var(--shadow-soft); overflow: hidden;
}
.th2-more-summary {
    display: flex; align-items: center; gap: 14px; padding: 18px 22px; cursor: pointer; list-style: none;
}
.th2-more-summary::-webkit-details-marker { display: none; }
.th2-more-icon {
    flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
    background: var(--surface-bg); color: var(--text-secondary); font-size: 15px;
}
.th2-more-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.th2-more-text strong { font-size: 14px; color: var(--text-primary); }
.th2-more-text small { font-size: 12.5px; color: var(--text-secondary); }
.th2-more-chev { flex: 0 0 auto; color: var(--text-muted); transition: transform .2s; }
.th2-more[open] .th2-more-chev { transform: rotate(180deg); }
.th2-more-body {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
    padding: 0 22px 22px; border-top: 1px solid var(--surface-border); padding-top: 18px;
}
.th2-subcard {
    background: var(--surface-bg); border: 1px solid var(--surface-border); border-radius: 14px; padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
}
.th2-subcard[data-panel="setup"], .th2-subcard[data-panel="modules"], .th2-subcard[data-panel="resources"] { grid-column: 1 / -1; }
.th2-subcard-head {
    display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text-primary);
}
.th2-subcard-add, .th2-res-add, .th2-res-del {
    margin-left: auto; background: var(--surface-bg-hover); border: 1px solid var(--surface-border);
    color: var(--text-secondary); border-radius: 8px; padding: 4px 10px; font-size: 11.5px; font-weight: 600;
    cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
}
.th2-subcard-add:hover, .th2-res-add:hover, .th2-res-del:hover { color: var(--accent-strong); border-color: var(--accent); }
.th2-res-del { margin-left: 8px; padding: 3px 7px; }
.th2-panel-flash { animation: th2PanelFlash 1.2s ease; }
@keyframes th2PanelFlash { 0% { box-shadow: 0 0 0 2px var(--accent); } 100% { box-shadow: none; } }

/* Setup form */
.th2-setup-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.th2-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.th2-field-wide { grid-column: 1 / -1; }
.th2-input {
    width: 100%; box-sizing: border-box; padding: 9px 11px; font-size: 13px; font-family: inherit;
    background: var(--bg-primary); color: var(--text-primary);
    border: 1px solid var(--surface-border); border-radius: 9px;
}
.th2-input:focus { outline: none; border-color: var(--accent); }
.th2-textarea { min-height: 72px; resize: vertical; }
.th2-setup-stable { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.th2-setup-srow { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 8px; align-items: center; }
.th2-setup-sname { font-size: 12.5px; color: var(--text-primary); font-weight: 600; }
.th2-setup-shead { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 700; }
.th2-mod-sections { display: flex; flex-direction: column; gap: 6px; }
.th2-mod-srow { display: flex; justify-content: space-between; font-size: 13px; padding: 8px 12px; background: var(--bg-primary); border: 1px solid var(--surface-border); border-radius: 9px; color: var(--text-secondary); }
.th2-mod-srow strong { color: var(--text-primary); }

/* Resources */
.th2-res-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.th2-res-cat { background: var(--bg-primary); border: 1px solid var(--surface-border); border-radius: 10px; padding: 10px 12px; }
.th2-res-cat-head { display: flex; align-items: center; font-size: 12px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.th2-res-cat-head .th2-res-add { padding: 2px 7px; }
.th2-res-item { display: flex; align-items: flex-start; gap: 6px; padding: 6px 0; border-top: 1px solid var(--surface-border); }
.th2-res-item:first-of-type { border-top: none; }
.th2-res-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.th2-res-main a { color: var(--accent-strong); font-weight: 600; text-decoration: none; word-break: break-word; }
.th2-res-main a:hover { text-decoration: underline; }
.th2-res-notes { font-size: 11.5px; color: var(--text-muted); }
.th2-res-empty { font-size: 12px; color: var(--text-muted); }
.th2-res-legacy { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--surface-border); }
.th2-res-legacy-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 700; margin-bottom: 4px; }
.th2-res-legacy p { margin: 0; font-size: 13px; color: var(--text-secondary); white-space: pre-wrap; }
.th2-ap-slot { margin-top: 4px; }

/* When a single exam is open, collapse the Testing Hub chrome — only the
   detail (with its back arrow) remains. The back arrow returns to the full
   overview where the header, section nav, and exam strip live. */
#testingHubShell.th2-exam-detail-open .testing-hub-header,
#testingHubShell.th2-exam-detail-open .testing-hub-section-nav,
#testingHubShell.th2-exam-detail-open .th2-nav-mobile,
#testingHubShell.th2-exam-detail-open #testingHubExamTabs { display: none !important; }
.th2-detail-toolbar-min { display: flex; align-items: center; gap: 12px; }
.th2-detail-toolbar-min .th2-detail-tools { margin-left: auto; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .th2-xhero { grid-template-columns: repeat(2, 1fr); row-gap: 20px; padding: 20px 6px; }
    .th2-hero-cell:nth-child(3) { border-left: none; }
    .th2-hero-cell:nth-child(odd) { border-left: none; }
    .th2-ov-grid { grid-template-columns: 1fr; }
    .th2-more-body { grid-template-columns: 1fr; }
    .th2-subcard[data-panel] { grid-column: auto; }
}
@media (max-width: 640px) {
    .th2-xhero { grid-template-columns: 1fr; }
    .th2-hero-cell { border-left: none !important; padding: 12px 18px; }
    .th2-hero-cell + .th2-hero-cell { border-top: 1px solid var(--surface-border); }
    .th2-progress { flex-direction: column; align-items: stretch; }
    .th2-progress-summary { flex-direction: row; justify-content: space-between; text-align: left; }
    .th2-setup-grid { grid-template-columns: 1fr; }
    /* Spec mobile order: Focus, Weak, Recent, Score progress */
    .th2-ov-grid > .th2-card:nth-child(1) { order: 1; }
    .th2-ov-grid > .th2-card:nth-child(2) { order: 4; }
    .th2-ov-grid > .th2-card:nth-child(3) { order: 2; }
    .th2-ov-grid > .th2-card:nth-child(4) { order: 3; }
}

/* Retro theme polish */
body.theme-retro .th2-kpi,
body.theme-retro .th2-exam-card,
body.theme-retro .exam-collapse,
body.theme-retro .th2-summary-panel,
body.theme-retro .th2-modal,
body.theme-retro .th2-subview-summary,
body.theme-retro .th2-resource-card {
    border-radius: 4px;
    box-shadow: 2px 2px 0 rgba(45, 40, 32, 0.25);
}

/* =========================================================================
   TODAY COMMAND CENTER — Redesigned Today View (Section 25)
   ========================================================================= */

/* ── Main layout wrapper ── */
.today-cc-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Tagline under date ── */
.today-tagline {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 3px 0 0;
    font-style: italic;
    font-weight: 400;
    line-height: 1.4;
}

/* ── Section title labels ── */
.today-section-header {
    margin-bottom: 10px;
}
.today-section-title {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0;
    opacity: 0.8;
}

/* ══════════════════════════════════════════
   1. COMMAND CENTER HERO CARD
══════════════════════════════════════════ */
.today-command-center {
    display: grid;
    grid-template-columns: 1fr 172px;
    border-radius: 20px !important;
    overflow: hidden;
    padding: 0 !important;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--surface-border) !important;
    box-shadow: 0 16px 38px rgba(0,0,0,0.08) !important;
}

.tcc-nba-col {
    padding: 22px 26px;
    min-width: 0;
}

/* Override the default today-daily-brief padding since the parent now provides it */
.today-command-center .today-daily-brief {
    padding: 0 !important;
}

.tcc-stats-col {
    border-left: 1px solid rgba(0,0,0,0.07);
    display: flex;
    flex-direction: column;
}

.tcc-stat {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background 0.14s ease;
    cursor: default;
}
.tcc-stat:last-child { border-bottom: none; }
.tcc-stat:hover { background: rgba(255,255,255,0.42); }

.tcc-stat-icon {
    font-size: 0.82rem;
    color: var(--text-muted);
    width: 15px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.75;
}

.tcc-stat-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.tcc-stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.tcc-stat-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Alert state for overdue stat */
.tcc-stat-has-alert .tcc-stat-icon,
.tcc-stat-has-alert .tcc-stat-value {
    color: var(--accent, #c97c2e);
    opacity: 1;
}

/* ── Daily brief content within command center ── */
.today-command-center .today-brief-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.today-command-center .today-brief-head .eyebrow {
    font-size: 0.63rem;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 4px;
}
.today-command-center .today-brief-head h3 {
    margin: 0 0 2px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.015em;
}
.today-command-center .today-brief-mode {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}
.today-command-center .today-brief-counts {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.today-command-center .today-brief-count {
    font-size: 0.74rem;
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(0,0,0,0.04);
    white-space: nowrap;
}
.today-command-center .today-brief-count strong {
    color: var(--text-primary);
    font-weight: 700;
}
.today-command-center .today-brief-count.is-alert strong {
    color: var(--accent, #c97c2e);
}
.today-command-center .today-brief-nba {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.today-command-center .today-brief-nba-label {
    font-size: 0.63rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.today-command-center .today-brief-nba-title {
    font-size: 1.0rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
}
.today-command-center .today-brief-nba-meta {
    font-size: 0.79rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.today-command-center .today-brief-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.today-command-center .today-brief-actions .neumo-btn {
    font-size: 0.77rem;
    padding: 7px 13px;
}

/* ══════════════════════════════════════════
   2. WHAT NEEDS ATTENTION
══════════════════════════════════════════ */
.today-attention-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.today-attention-card {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 15px !important;
    border-radius: 16px !important;
    min-width: 0;
    background: var(--bg-secondary) !important;
    border: 1px solid var(--surface-border) !important;
    box-shadow: 0 9px 22px rgba(0,0,0,0.055) !important;
}

.tac-header {
    display: flex;
    align-items: center;
    gap: 7px;
}

.tac-icon {
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-shrink: 0;
    width: 14px;
    text-align: center;
    opacity: 0.8;
}

.tac-title {
    font-size: 0.79rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.tac-badge {
    font-size: 0.6rem !important;
    padding: 2px 7px !important;
    flex-shrink: 0;
    opacity: 0.85;
}

.tac-items {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-height: 50px;
}

.tac-item {
    display: grid;
    gap: 1px;
    padding: 6px 8px;
    border-radius: 7px;
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
}

.tac-item-title {
    font-size: 0.77rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tac-item-meta {
    font-size: 0.63rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.tac-item-overdue {
    border-color: rgba(200,100,50,0.22);
    background: rgba(200,100,50,0.04);
}
.tac-item-overdue .tac-item-meta {
    color: var(--accent, #c97c2e);
}

.tac-item-today {
    border-color: rgba(60,180,90,0.2);
    background: rgba(60,180,90,0.03);
}

.tac-empty {
    font-size: 0.74rem;
    color: var(--text-muted);
    padding: 10px 6px;
    font-style: italic;
}

.tac-footer-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    transition: color 0.14s ease;
    margin-top: auto;
    line-height: 1.2;
}
.tac-footer-link:hover { color: var(--text-primary); }

/* Review card inside attention grid */
#view-today .today-attention-card.today-review-card {
    padding: 15px !important;
}
#view-today .today-attention-card.today-review-card .review-due-row {
    display: flex;
    flex-direction: column;
    gap: 7px;
    height: 100%;
}
#view-today .today-attention-card.today-review-card .eyebrow {
    font-size: 0.63rem;
    letter-spacing: 0.1em;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    display: block;
    margin-bottom: 3px;
}
#view-today .today-attention-card.today-review-card .review-due-count {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}
#view-today .today-attention-card.today-review-card .review-due-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
}
#view-today .today-attention-card.today-review-card .review-due-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
}
#view-today .today-attention-card.today-review-card .review-due-actions .neumo-btn {
    font-size: 0.72rem;
    padding: 6px 10px;
}

/* ══════════════════════════════════════════
   3. TODAY'S PLAN (wrapper; split handled by existing styles.css)
══════════════════════════════════════════ */
.today-plan-section { /* layout handled by existing today-split CSS */ }

/* ══════════════════════════════════════════
   4. ATELIER SIGNALS
══════════════════════════════════════════ */
.today-signals-section { }

.today-signals-grid {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    align-items: stretch;
}
.today-signals-grid > * {
    flex: 1;
    min-width: 0;
}
/* Tracker card gets slightly less flex space */
.today-signals-grid .today-tracker-summary-card {
    flex: 0.8;
}
/* When tracker is empty/hidden, habits takes full width naturally */

/* ══════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
══════════════════════════════════════════ */
@media (max-width: 1280px) {
    .today-command-center {
        grid-template-columns: 1fr;
    }
    .tcc-stats-col {
        border-left: none;
        border-top: 1px solid rgba(0,0,0,0.07);
        flex-direction: row;
        flex-wrap: wrap;
    }
    .tcc-stat {
        flex: 1 1 100px;
        border-bottom: none;
        border-right: 1px solid rgba(0,0,0,0.05);
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        padding: 11px 14px;
    }
    .tcc-stat:last-child { border-right: none; }
    .tcc-stat-icon { width: auto; }
    .tcc-stat-value { font-size: 1.15rem; }
}

@media (max-width: 1100px) {
    .today-attention-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .today-signals-grid {
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .today-attention-grid {
        grid-template-columns: 1fr;
    }
    .tcc-stats-col {
        flex-wrap: wrap;
    }
    .tcc-stat {
        flex: 1 1 40%;
    }
    .tcc-stat:nth-child(odd):last-child {
        border-right: none;
    }
}

/* ══════════════════════════════════════════
   DARK THEME
══════════════════════════════════════════ */
[data-theme="dark"] .tcc-stats-col {
    border-left-color: var(--surface-border);
    border-top-color: var(--surface-border);
}
[data-theme="dark"] .tcc-stat {
    border-bottom-color: var(--surface-border);
    border-right-color: var(--surface-border);
}
[data-theme="dark"] .tcc-stat:hover { background: var(--surface-bg-hover); }
[data-theme="dark"] .today-command-center .today-brief-count {
    background: var(--surface-bg);
}
[data-theme="dark"] .today-command-center .tcc-stat-icon { color: var(--text-muted); }

/* ========== CUSTOM TIME PICKER (nf-time) ========== */
.nf-time {
    position: relative;
    display: inline-block;
    min-width: 0;
    vertical-align: middle;
    width: 100%;
}

.nf-time-native {
    position: absolute !important;
    inset: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

/* Trigger — mirrors nf-date-trigger exactly */
.nf-time-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--surface-border, var(--border));
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.86rem;
    font-family: var(--font-body);
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.15s, background 0.15s;
}

.nf-time:not(.is-disabled) .nf-time-trigger:hover {
    background: var(--bg-hover);
    border-color: var(--accent, var(--border));
}

.nf-time-trigger:focus-visible {
    outline: 2px solid var(--accent-strong, var(--accent));
    outline-offset: 2px;
}

.nf-time.open .nf-time-trigger {
    border-color: var(--accent-strong, var(--accent));
    background: var(--bg-hover);
}

.nf-time-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.nf-time.is-empty .nf-time-label {
    color: var(--text-secondary);
}

.nf-time-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: var(--text-muted);
    transition: color 0.15s;
}

.nf-time-trigger:hover .nf-time-icon { color: var(--text-secondary); }

/* Panel */
.nf-time-panel {
    position: fixed;
    z-index: 13100;
    background: var(--bg-elevated, var(--bg-primary));
    border: 1px solid var(--surface-border, var(--border));
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 16px;
    min-width: 220px;
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.nf-time-panel.is-open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

/* Spinners row */
.nf-time-spinners {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 14px;
}

.nf-time-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.nf-time-spin-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 28px !important;
    min-height: 0 !important;
    padding: 0 !important;
    background: var(--bg-hover) !important;
    border: 1px solid var(--surface-border, var(--border)) !important;
    border-radius: 8px !important;
    color: var(--text-secondary) !important;
    font-size: 0.75rem !important;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    width: auto !important;
    min-width: 32px !important;
}

.nf-time-spin-btn:hover {
    background: var(--accent-soft, var(--bg-hover)) !important;
    color: var(--text-primary) !important;
    border-color: var(--accent, var(--border)) !important;
}

.nf-time-spin-btn:active {
    background: var(--accent, var(--bg-hover)) !important;
}

.nf-time-num {
    font-size: 1.9rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1;
    min-width: 2ch;
    text-align: center;
    padding: 4px 2px;
    border-radius: 6px;
    cursor: ns-resize;
    user-select: none;
    transition: background 0.1s;
}

.nf-time-num:hover { background: var(--bg-hover); }

.nf-time-colon {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1;
    padding: 0 2px;
    margin-top: 2px;
    align-self: center;
}

/* AM / PM toggle */
.nf-time-period-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-left: 8px;
    align-self: center;
}

.nf-time-period-opt {
    padding: 5px 9px !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--bg-hover) !important;
    border: 1px solid var(--surface-border, var(--border)) !important;
    border-radius: 7px !important;
    color: var(--text-secondary) !important;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    width: auto !important;
    min-height: 0 !important;
    min-width: 0 !important;
    line-height: 1;
}

.nf-time-period-opt.is-active {
    background: var(--accent-strong, var(--accent)) !important;
    color: var(--bg-primary) !important;
    border-color: var(--accent-strong, var(--accent)) !important;
}

.nf-time-period-opt:hover:not(.is-active) {
    background: var(--accent-soft, var(--bg-hover)) !important;
    color: var(--text-primary) !important;
}

/* Footer */
.nf-time-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--surface-border, var(--border));
}

.nf-time-act {
    padding: 6px 14px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    background: none !important;
    border: 1px solid var(--surface-border, var(--border)) !important;
    border-radius: 8px !important;
    color: var(--text-secondary) !important;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    width: auto !important;
    min-height: 0 !important;
    min-width: 0 !important;
    line-height: 1;
}

.nf-time-act:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

.nf-time-act--done {
    background: var(--bg-secondary) !important;
    border-color: var(--accent-strong, var(--accent)) !important;
    color: var(--accent-strong, var(--text-primary)) !important;
    font-weight: 700 !important;
}

.nf-time-act--done:hover {
    background: var(--accent-strong, var(--accent)) !important;
    color: var(--bg-primary) !important;
}

@media (prefers-reduced-motion: reduce) {
    .nf-time-trigger,
    .nf-time-panel,
    .nf-time-spin-btn,
    .nf-time-period-opt { transition: none !important; }
}

/* =====================================================================
   COURSE HUB & ALL DUE  (premium, token-driven, theme-safe, responsive)
   Namespaces: .cw-*  (Course Hub + shared)   .ad-*  (All Due)
   ===================================================================== */
.course-hub-root, .all-due-root {
    max-width: 1480px; margin: 0 auto; padding: 24px 28px 64px;
    font-family: var(--font-body); color: var(--text-primary);
    display: flex; flex-direction: column; gap: 22px;
}
.cw-h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.01em; margin: 0; color: var(--text-primary); }
.cw-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--text-secondary); }

/* Header + controls */
.cw-header, .ad-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.cw-header-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cw-search { position: relative; display: inline-flex; align-items: center; }
.cw-search i { position: absolute; left: 12px; color: var(--text-muted); font-size: 12.5px; pointer-events: none; }
.cw-search input {
    width: 280px; max-width: 60vw; padding: 9px 12px 9px 32px; font-size: 13px; font-family: inherit;
    background: var(--surface-bg); border: 1px solid var(--surface-border); border-radius: var(--radius-pill, 999px);
    color: var(--text-primary); outline: none; transition: border-color .15s, background .15s;
}
.cw-search input:focus { border-color: var(--accent-strong); background: var(--bg-elevated, #fff); }
.cw-filter {
    padding: 9px 14px; font-size: 13px; font-family: inherit; cursor: pointer;
    background: var(--surface-bg); border: 1px solid var(--surface-border); border-radius: var(--radius-pill, 999px); color: var(--text-primary);
}

/* Buttons */
.cw-btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 11px; padding: 9px 15px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; transition: filter .15s, background .15s, transform .08s, border-color .15s; }
.cw-btn:active { transform: translateY(1px); }
.cw-btn-sm { padding: 6px 12px; font-size: 12.5px; }
.cw-btn-primary { background: var(--accent-strong); color: #fff; }
.cw-btn-primary:hover { filter: brightness(1.07); }
.cw-btn-ghost { background: var(--surface-bg); color: var(--text-primary); border-color: var(--surface-border); }
.cw-btn-ghost:hover { background: var(--surface-bg-hover); }
.cw-btn-danger { background: rgba(217,83,79,0.12); color: #c0392b; border-color: rgba(217,83,79,0.3); }
.cw-btn-danger:hover { background: rgba(217,83,79,0.2); }

/* Stat cards */
.cw-stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.ad-stat-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.cw-stat {
    display: flex; align-items: center; gap: 14px; padding: 16px 18px;
    background: var(--bg-elevated, var(--glass-01)); border: 1px solid var(--surface-border);
    border-radius: var(--radius, 18px); box-shadow: var(--shadow-soft);
}
.cw-stat-icon { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 17px; background: var(--accent-soft); color: var(--accent-strong); }
.ad-stat-overdue .cw-stat-icon { background: rgba(217,83,79,0.14); color: #d9534f; }
.cw-stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; color: var(--text-primary); }
.cw-stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.ad-stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* Layout: course list + detail */
.cw-layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.cw-course-list { display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 240px); overflow-y: auto; padding-right: 4px; }

/* Course card */
.cw-course-card {
    position: relative; display: flex; width: 100%; text-align: left; cursor: pointer;
    background: var(--bg-elevated, var(--glass-01)); border: 1px solid var(--surface-border);
    border-radius: 16px; box-shadow: var(--shadow-soft); padding: 0; overflow: hidden; font-family: inherit;
    transition: border-color .15s, box-shadow .15s, transform .1s;
}
.cw-course-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft-lg); }
.cw-course-card.is-selected { border-color: var(--accent-strong); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-soft); }
.cw-course-card.is-archived { opacity: 0.6; }
.cw-course-accent { flex: 0 0 5px; align-self: stretch; }
.cw-course-card-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 7px; padding: 14px 16px; }
.cw-course-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cw-course-name { font-size: 14.5px; font-weight: 700; color: var(--text-primary); line-height: 1.25; }
.cw-archived-tag { font-size: 10px; font-weight: 600; color: var(--text-muted); background: var(--surface-bg); padding: 1px 6px; border-radius: 6px; }
.cw-course-menu { flex: 0 0 auto; color: var(--text-muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.cw-course-menu:hover { background: var(--surface-bg-hover); color: var(--text-primary); }
.cw-course-meta { font-size: 12px; color: var(--text-secondary); }
.cw-course-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cw-course-daypill { font-size: 10.5px; font-weight: 600; color: var(--text-secondary); background: var(--surface-bg); border: 1px solid var(--surface-border); border-radius: 999px; padding: 2px 9px; }
.cw-course-next { font-size: 11px; color: var(--accent-strong); font-weight: 600; }
.cw-course-due { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.cw-course-due-label { color: var(--text-primary); display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-course-due-label i { color: var(--accent-strong); font-size: 9px; }
.cw-course-due-date { flex: 0 0 auto; color: var(--text-muted); font-weight: 600; }
.cw-course-counts { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-muted); }
.cw-course-counts i { margin-right: 3px; }
.cw-muted { color: var(--text-muted); }

/* Detail panel */
.cw-detail { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.cw-detail-header {
    display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
    background: var(--bg-elevated, var(--glass-01)); border: 1px solid var(--surface-border);
    border-radius: var(--radius, 18px); box-shadow: var(--shadow-soft); padding: 20px 22px;
}
.cw-detail-avatar { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; }
.cw-detail-headmain { flex: 1 1 260px; min-width: 0; }
.cw-detail-title { margin: 0; font-size: 1.4rem; font-weight: 700; color: var(--text-primary); }
.cw-detail-meta { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.cw-detail-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.cw-tag { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); background: var(--surface-bg); border: 1px solid var(--surface-border); border-radius: 999px; padding: 3px 11px; }
.cw-tag-add { cursor: pointer; color: var(--accent-strong); background: none; border-style: dashed; font-family: inherit; }
.cw-tag-add:hover { background: var(--accent-soft); }
.cw-detail-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Tabs */
.cw-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--surface-border); padding-bottom: 0; overflow-x: auto; }
.cw-tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--text-secondary); cursor: pointer; font-family: inherit; white-space: nowrap; transition: color .15s, border-color .15s; }
.cw-tab:hover { color: var(--text-primary); }
.cw-tab.is-active { color: var(--accent-strong); border-bottom-color: var(--accent-strong); }

/* Panels */
.cw-tab-content { min-width: 0; }
.cw-ov-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.cw-panel { display: flex; flex-direction: column; gap: 12px; background: var(--bg-elevated, var(--glass-01)); border: 1px solid var(--surface-border); border-radius: var(--radius, 18px); box-shadow: var(--shadow-soft); padding: 18px 20px; }
.cw-panel-span { grid-column: 1 / -1; }
.cw-panel-full { width: 100%; }
.cw-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cw-panel-head h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--text-primary); }
.cw-head-actions { display: flex; gap: 8px; }
.cw-subhead { margin: 10px 0 2px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.cw-link { background: none; border: none; cursor: pointer; color: var(--accent-strong); font-size: 12.5px; font-weight: 600; font-family: inherit; padding: 0; }
.cw-link:hover { text-decoration: underline; }
.cw-empty-line { font-size: 13px; color: var(--text-muted); padding: 6px 2px; }
.cw-add-inline { align-self: flex-start; background: none; border: 1px dashed var(--surface-border); border-radius: 9px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; color: var(--accent-strong); cursor: pointer; font-family: inherit; }
.cw-add-inline:hover { background: var(--accent-soft); }

/* Assignment rows */
.cw-assign-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border: 1px solid var(--surface-border); border-radius: 11px; background: var(--surface-bg); }
.cw-assign-row.is-done .cw-assign-title { text-decoration: line-through; color: var(--text-muted); }
.cw-check { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface-border-strong); background: none; cursor: pointer; display: grid; place-items: center; color: #fff; font-size: 10px; transition: background .15s, border-color .15s; }
.cw-check.is-checked { background: var(--accent-strong); border-color: var(--accent-strong); }
.cw-assign-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cw-assign-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.cw-assign-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cw-type-pill { font-size: 10.5px; font-weight: 600; color: var(--text-secondary); background: var(--surface-bg-hover); border: 1px solid var(--surface-border); border-radius: 999px; padding: 2px 9px; }
.cw-due { font-size: 11.5px; font-weight: 600; }
.cw-due-overdue, .ad-due-overdue { color: #d9534f; }
.cw-due-today, .ad-due-today { color: #c77c18; }
.cw-due-soon, .ad-due-soon { color: #b88318; }
.cw-due-normal, .ad-due-normal { color: var(--text-muted); }

/* Files */
.cw-file-list { display: flex; flex-direction: column; gap: 8px; }
.cw-file-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border: 1px solid var(--surface-border); border-radius: 11px; background: var(--surface-bg); }
.cw-file-icon { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font-size: 14px; }
.cw-file-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cw-file-name { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-file-meta { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-file-missing { color: #d9534f; }
.cw-file-actions { flex: 0 0 auto; display: flex; gap: 2px; }
.cw-icon-btn { width: 30px; height: 30px; border-radius: 8px; border: none; background: none; color: var(--text-muted); cursor: pointer; display: grid; place-items: center; font-size: 12.5px; transition: background .15s, color .15s; }
.cw-icon-btn:hover { background: var(--surface-bg-hover); color: var(--text-primary); }
.cw-icon-danger:hover { background: rgba(217,83,79,0.14); color: #d9534f; }

/* Dropzone */
.cw-dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 26px 18px; border: 2px dashed var(--surface-border-strong); border-radius: 14px; background: var(--surface-inset); cursor: pointer; transition: border-color .15s, background .15s; }
.cw-dropzone:hover, .cw-dropzone.is-dragover { border-color: var(--accent-strong); background: var(--accent-soft); }
.cw-dropzone i { font-size: 26px; color: var(--accent-strong); }
.cw-dropzone-text { font-size: 13.5px; color: var(--text-primary); }
.cw-dropzone-link { color: var(--accent-strong); font-weight: 600; }
.cw-dropzone-sub { font-size: 11.5px; color: var(--text-muted); }

/* Notes / study / grades panels */
.cw-note-row, .cw-study-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--surface-border); border-radius: 10px; background: var(--surface-bg); }
.cw-note-title { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-note-meta { font-size: 11px; color: var(--text-muted); flex: 0 0 auto; }
.cw-mini-btn { background: var(--surface-bg-hover); border: 1px solid var(--surface-border); border-radius: 8px; padding: 4px 10px; font-size: 11.5px; font-weight: 600; color: var(--text-primary); cursor: pointer; font-family: inherit; }
.cw-mini-btn:hover { background: var(--accent-soft); color: var(--accent-strong); }
.cw-topic-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cw-topic-chip { font-size: 11px; font-weight: 600; color: var(--accent-strong); background: var(--accent-soft); border-radius: 999px; padding: 3px 10px; }
.cw-grade-row { display: flex; gap: 24px; }
.cw-grade-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.cw-grade-val { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); }
.cw-grade-cats { display: flex; flex-direction: column; gap: 8px; }
.cw-grade-cat { display: grid; grid-template-columns: 90px 1fr 44px; align-items: center; gap: 10px; }
.cw-grade-cat-name { font-size: 12px; color: var(--text-secondary); }
.cw-grade-bar { height: 8px; border-radius: 999px; background: var(--surface-bg-hover); overflow: hidden; }
.cw-grade-bar span { display: block; height: 100%; border-radius: 999px; }
.cw-grade-cat-pct { font-size: 11.5px; font-weight: 600; color: var(--text-primary); text-align: right; }
.cw-nextclass-time { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.cw-nextclass-room { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.cw-quick-res { display: flex; flex-direction: column; gap: 8px; }
.cw-res-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--surface-border); border-radius: 10px; background: var(--surface-bg); font-size: 13px; font-weight: 600; color: var(--text-primary); cursor: pointer; font-family: inherit; text-align: left; }
.cw-res-card i { color: var(--accent-strong); }
.cw-res-card:hover { background: var(--surface-bg-hover); }

/* Forms */
.cw-form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cw-field { display: flex; flex-direction: column; gap: 5px; }
.cw-field-label { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.cw-field input, .cw-field select, .cw-field textarea { padding: 9px 11px; font-size: 13px; font-family: inherit; background: var(--surface-bg); border: 1px solid var(--surface-border); border-radius: 9px; color: var(--text-primary); outline: none; }
.cw-field input:focus, .cw-field select:focus, .cw-field textarea:focus { border-color: var(--accent-strong); }
.cw-field textarea { min-height: 64px; resize: vertical; }
.cw-gc-list { display: flex; flex-direction: column; gap: 8px; }
.cw-gc-row { display: grid; grid-template-columns: 1fr 100px 100px; gap: 8px; }
.cw-gc-row input { padding: 8px 10px; font-size: 12.5px; font-family: inherit; background: var(--surface-bg); border: 1px solid var(--surface-border); border-radius: 8px; color: var(--text-primary); }
.cw-danger-row { display: flex; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--surface-border); }

/* Pills / chips */
.cw-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.cw-pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cw-pill-high { background: rgba(217,83,79,0.14); color: #d9534f; }
.cw-pill-medium { background: rgba(217,167,42,0.16); color: #b88318; }
.cw-pill-low { background: var(--surface-bg-hover); color: var(--text-secondary); }
.cw-course-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.cw-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }

/* Empty state */
.cw-empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 60px 24px; background: var(--bg-elevated, var(--glass-01)); border: 1px solid var(--surface-border); border-radius: var(--radius, 18px); box-shadow: var(--shadow-soft); }
.cw-empty-icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 26px; background: var(--accent-soft); color: var(--accent-strong); }
.cw-empty-state h2 { margin: 6px 0 0; font-size: 1.3rem; font-weight: 700; }
.cw-empty-state p { margin: 0; font-size: 13.5px; color: var(--text-secondary); max-width: 460px; }
.cw-empty-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }

/* Generic form modal */
.cw-modal-overlay { position: fixed; inset: 0; z-index: 4000; background: rgba(20,24,33,0.42); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.cw-modal-card { width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; background: var(--bg-elevated, #fff); border: 1px solid var(--surface-border); border-radius: 18px; box-shadow: var(--shadow-soft-lg); }
.cw-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 4px; }
.cw-modal-head h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.cw-modal-close { background: none; border: none; font-size: 22px; line-height: 1; color: var(--text-muted); cursor: pointer; }
.cw-modal-form { display: flex; flex-direction: column; gap: 12px; padding: 12px 20px 20px; }
.cw-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---- All Due specifics ---- */
.ad-main-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }
/* Allow grid items to shrink below their min-content so wide inbox tables wrap
   instead of overflowing the track (prevents the mobile grid blowout). */
.ad-main-grid > * { min-width: 0; }
.ad-range-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ad-range-tab { display: inline-flex; align-items: center; gap: 7px; background: var(--surface-bg); border: 1px solid var(--surface-border); border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); cursor: pointer; font-family: inherit; }
.ad-range-tab:hover { background: var(--surface-bg-hover); }
.ad-range-tab.is-active { background: var(--accent-soft); border-color: var(--accent-strong); color: var(--accent-strong); }
.ad-range-count { font-size: 10.5px; font-weight: 700; background: var(--surface-bg-hover); border-radius: 999px; padding: 1px 7px; }
.ad-range-tab.is-active .ad-range-count { background: rgba(var(--accent-rgb), 0.25); }
.ad-table { display: flex; flex-direction: column; }
.ad-table-head { display: grid; grid-template-columns: 2.4fr 1.2fr 1fr 0.9fr 0.8fr; gap: 10px; padding: 8px 10px 8px 22px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border-bottom: 1px solid var(--surface-border); }
.ad-row { display: grid; grid-template-columns: 2.4fr 1.2fr 1fr 0.9fr 0.8fr; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 11px 10px 11px 22px; border: none; border-bottom: 1px solid var(--surface-border); background: none; cursor: pointer; font-family: inherit; transition: background .12s; position: relative; }
.ad-row:hover { background: var(--surface-bg); }
.ad-row-dot { width: 9px; height: 9px; border-radius: 50%; position: absolute; left: 6px; top: 50%; transform: translateY(-50%); }
.ad-dot-high { background: #d9534f; }
.ad-dot-medium { background: #d9a72a; }
.ad-dot-low { background: var(--text-muted); }
.ad-row-title { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-row-why { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ad-row-why i { font-size: 9px; opacity: .65; margin-right: 3px; }

/* ---- Starter Packs ---- */
.starter-packs-modal { max-width: 760px; width: 92vw; }
.starter-intro, .starter-preview-note { font-size: 13px; color: var(--text-secondary); margin: 0 0 14px; line-height: 1.5; }
.starter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.starter-card { display: flex; gap: 11px; text-align: left; padding: 14px; border: 1px solid var(--surface-border); border-radius: 14px; background: var(--surface-bg); cursor: pointer; font-family: inherit; transition: transform .1s, background .12s, border-color .12s; }
.starter-card:hover { transform: translateY(-1px); background: var(--surface-bg-hover); border-color: var(--accent-strong); }
.starter-pack-icon { font-size: 26px; line-height: 1; flex: 0 0 auto; }
.starter-card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.starter-card-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.starter-custom-tag { font-size: 10px; font-weight: 600; color: var(--accent-strong); border: 1px solid var(--accent-strong); border-radius: 6px; padding: 0 4px; margin-left: 4px; }
.starter-card-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.starter-card-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.starter-chip { font-size: 10.5px; font-weight: 600; color: var(--text-muted); background: var(--surface-bg-hover); border-radius: 999px; padding: 2px 8px; }
.starter-footer-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--surface-border); }
.starter-preview-head { display: flex; gap: 12px; align-items: center; margin: 12px 0; }
.starter-preview-head h3 { margin: 0; font-size: 17px; }
.starter-preview-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-secondary); }
.starter-group { border: 1px solid var(--surface-border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.starter-group-head { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.starter-group-count { font-size: 11px; color: var(--text-muted); background: var(--surface-bg-hover); border-radius: 999px; padding: 1px 7px; }
.starter-group-list { margin: 8px 0 0; padding-left: 20px; font-size: 12.5px; color: var(--text-secondary); display: grid; gap: 3px; }
.starter-preview-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.starter-applied { text-align: center; padding: 18px 8px; }
.starter-applied-icon { font-size: 40px; color: #67b08a; margin-bottom: 8px; }
.starter-applied h3 { margin: 0 0 4px; }
.starter-applied p { color: var(--text-secondary); font-size: 13px; margin: 0 0 4px; }
@media (max-width: 720px) {
    .starter-grid { grid-template-columns: 1fr; }
    .starter-preview-actions, .starter-footer-actions { flex-direction: column; }
    .starter-preview-actions .cw-btn, .starter-footer-actions .cw-btn { width: 100%; }
}
.ad-row-course { font-size: 12px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-row-due { font-size: 12px; font-weight: 600; }
.ad-viewall { align-self: flex-start; margin-top: 6px; background: none; border: none; color: var(--accent-strong); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 7px; }
.ad-viewall:hover { text-decoration: underline; }

.ad-exam-row { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 10px; border: 1px solid var(--surface-border); border-radius: 11px; background: var(--surface-bg); cursor: pointer; font-family: inherit; margin-bottom: 8px; transition: transform .1s, background .12s; }
.ad-exam-row:hover { transform: translateY(-1px); background: var(--surface-bg-hover); }
.ad-exam-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; }
.ad-exam-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ad-exam-title { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-exam-meta { font-size: 11.5px; color: var(--text-muted); }

.ad-lower-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.ad-course-row { display: flex; flex-direction: column; gap: 5px; padding: 9px 0; border-bottom: 1px solid var(--surface-border); }
.ad-course-row:last-child { border-bottom: none; }
.ad-course-name { font-size: 12.5px; font-weight: 600; color: var(--text-primary); display: inline-flex; align-items: center; gap: 7px; }
.ad-course-bar { height: 6px; border-radius: 999px; background: var(--surface-bg-hover); overflow: hidden; }
.ad-course-bar span { display: block; height: 100%; border-radius: 999px; }
.ad-course-counts { font-size: 11px; color: var(--text-muted); }
.ad-overdue-mini { color: #d9534f; font-weight: 600; }
.ad-sched-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.ad-sched-time { flex: 0 0 62px; font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.ad-sched-line { flex: 0 0 3px; align-self: stretch; border-radius: 3px; min-height: 28px; }
.ad-sched-main { flex: 1 1 auto; min-width: 0; }
.ad-sched-title { font-size: 12.5px; font-weight: 600; color: var(--text-primary); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-sched-sub { font-size: 11px; color: var(--text-muted); }
.ad-sched-dur { flex: 0 0 auto; font-size: 11px; color: var(--text-muted); }
.ad-quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ad-quick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border: 1px solid var(--surface-border); border-radius: 12px; background: var(--surface-bg); cursor: pointer; font-family: inherit; font-size: 11.5px; font-weight: 600; color: var(--text-primary); transition: background .12s, transform .1s; }
.ad-quick i { font-size: 17px; color: var(--accent-strong); }
.ad-quick:hover { background: var(--accent-soft); transform: translateY(-1px); }
.ad-file-row { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 8px; border: none; background: none; cursor: pointer; font-family: inherit; border-radius: 9px; }
.ad-file-row:hover { background: var(--surface-bg); }

/* Responsive */
@media (max-width: 1180px) {
    .cw-stat-row { grid-template-columns: repeat(2, 1fr); }
    .ad-stat-row { grid-template-columns: repeat(3, 1fr); }
    .ad-main-grid { grid-template-columns: 1fr; }
    .ad-lower-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
    .cw-layout { grid-template-columns: 1fr; }
    .cw-course-list { flex-direction: row; overflow-x: auto; max-height: none; padding-bottom: 6px; }
    .cw-course-card { flex: 0 0 260px; }
    .cw-ov-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .course-hub-root, .all-due-root { padding: 16px 14px 56px; }
    .cw-header, .ad-header { flex-direction: column; align-items: stretch; }
    .cw-header-controls { width: 100%; }
    .cw-search { flex: 1 1 100%; }
    .cw-search input { width: 100%; max-width: none; flex: 1 1 auto; }
    .ad-stat-row { grid-template-columns: repeat(2, 1fr); }
    .ad-lower-grid { grid-template-columns: 1fr; }
    .cw-form-grid { grid-template-columns: 1fr; }
    .ad-table-head { display: none; }
    .ad-row { grid-template-columns: 1fr auto; row-gap: 4px; padding-left: 24px; }
    .ad-row-title { grid-column: 1 / 2; }
    .ad-row-urgency { grid-column: 2 / 3; grid-row: 1; justify-self: end; }
    .ad-row-course { grid-column: 1 / 3; }
    .ad-row-due { grid-column: 1 / 2; }
    .ad-row-type { grid-column: 2 / 3; justify-self: end; }
    /* Student Inbox rows reuse the .ad-row base but have their own column model.
       Reset the legacy .ad-row mobile placements so inbox children stack in a
       single column instead of spilling into an implicit 2nd column. */
    .student-inbox-row { grid-template-columns: 1fr; row-gap: 6px; }
    .student-inbox-row > .ad-row-title,
    .student-inbox-row > .ad-row-course,
    .student-inbox-row > .ad-row-due,
    .student-inbox-row > .ad-row-type,
    .student-inbox-row > .ad-row-urgency,
    .student-inbox-row > .ad-row-actions {
        grid-column: 1 / -1;
        grid-row: auto;
        justify-self: start;
        min-width: 0;
    }
    .cw-detail-actions { width: 100%; }
}
@media (max-width: 440px) {
    .cw-stat-row, .ad-stat-row { grid-template-columns: 1fr; }
}
/* Public beta persistence health surfaces */
.sutra-save-failure-banner {
    position: fixed;
    left: clamp(12px, 3vw, 32px);
    right: clamp(12px, 3vw, 32px);
    bottom: clamp(88px, 10vh, 132px);
    z-index: 12000;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 16px;
    border: 1px solid color-mix(in srgb, var(--sutra-warning, #d97706) 40%, transparent);
    border-radius: 18px;
    background: color-mix(in srgb, var(--bg-elevated, #ffffff) 96%, var(--sutra-warning, #d97706) 4%);
    box-shadow: 0 22px 70px color-mix(in srgb, var(--sutra-warning, #d97706) 12%, rgba(0, 0, 0, 0.28));
    color: var(--text-primary);
}

.taskbar-save-status.failed {
    color: var(--sutra-warning, #d97706);
}

.storage-options.taskbar-failed {
    border-color: color-mix(in srgb, var(--sutra-warning, #d97706) 48%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--sutra-warning, #d97706) 18%, transparent), 0 14px 44px rgba(0, 0, 0, 0.28);
}

.sutra-save-failure-banner[hidden] {
    display: none !important;
}

.sutra-save-failure-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    min-width: 0;
}

.sutra-save-failure-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--sutra-warning, #d97706) 14%, transparent);
    color: var(--sutra-warning, #d97706);
}

.sutra-save-failure-copy h2 {
    margin: 0 0 4px;
    font-size: 1rem;
    line-height: 1.2;
}

.sutra-save-failure-copy p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.sutra-save-failure-meta {
    margin-top: 6px !important;
    font-size: 0.78rem !important;
}

.sutra-save-failure-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.sutra-health-btn {
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--surface-border-strong);
    border-radius: 999px;
    background: var(--surface-bg);
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

.sutra-health-btn:hover {
    background: var(--surface-bg-hover);
    border-color: var(--surface-border-strong);
}

.sutra-health-btn:active {
    transform: translateY(1px);
    background: var(--surface-bg-active);
}

.sutra-health-btn:disabled,
.sutra-health-btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.sutra-health-btn.primary {
    border-color: color-mix(in srgb, var(--sutra-warning, #d97706) 60%, transparent);
    background: color-mix(in srgb, var(--sutra-warning, #d97706) 14%, transparent);
}

.sutra-health-btn.primary:hover {
    background: color-mix(in srgb, var(--sutra-warning, #d97706) 22%, transparent);
}

.sutra-health-btn.primary:active {
    background: color-mix(in srgb, var(--sutra-warning, #d97706) 30%, transparent);
}

.sutra-health-btn:focus-visible,
.sutra-health-details:focus-visible,
.sutra-save-failure-details:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--sutra-warning, #d97706) 80%, transparent);
    outline-offset: 2px;
}

.sutra-save-failure-details {
    grid-column: 1 / -1;
    max-height: 180px;
    overflow: auto;
    margin: 0;
    padding: 12px;
    border-radius: 12px;
    background: var(--surface-bg-active);
    color: var(--text-secondary);
    white-space: pre-wrap;
    font-size: 0.78rem;
}

.sutra-health-details {
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid var(--surface-border, rgba(255,255,255,0.1));
    border-radius: 12px;
    background: var(--surface-bg, rgba(255,255,255,0.04));
    color: var(--text-secondary, rgba(255,255,255,0.72));
    font-size: 0.78rem;
    line-height: 1.45;
}

.sutra-password-modal {
    max-width: 480px;
}

.sutra-password-copy,
.sutra-password-warning,
.sutra-password-error,
.sutra-password-status {
    margin: 0 0 12px;
    line-height: 1.45;
}

.sutra-password-copy {
    color: var(--text-secondary);
}

.sutra-password-field {
    display: grid;
    gap: 6px;
    margin: 0 0 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.sutra-password-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.sutra-password-warning {
    padding: 10px 12px;
    border: 1px solid var(--surface-border, rgba(255,255,255,0.1));
    border-radius: 8px;
    background: var(--surface-bg, rgba(255,255,255,0.04));
    color: var(--text-secondary);
    font-size: 13px;
}

.sutra-password-error {
    min-height: 20px;
    color: var(--danger, #ef4444);
    font-size: 13px;
}

.sutra-password-status {
    min-height: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.sutra-drive-sync-actions,
.sutra-drive-conflict-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sutra-drive-sync-actions .cc-btn,
.sutra-drive-conflict-actions .btn {
    flex: 0 1 auto;
}

.sutra-drive-conflict-actions {
    margin: 12px 0;
}

body.sutra-modal-lock {
    overflow: hidden;
    touch-action: none;
}

[data-sutra-modal-enhanced="true"] {
    scroll-margin: 24px;
}

[data-sutra-modal-enhanced="true"]:focus {
    outline: none;
}

/* Student OS Phase 1: Inbox, Course Hub, Assistant Review, Data Safety */
.ad-filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0 16px;
}

.ad-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    border: 1px solid var(--surface-border);
    border-radius: 999px;
    padding: 6px 12px;
    background: var(--surface-bg);
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.ad-filter-chip span {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--surface-bg-active);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.ad-filter-chip.is-active {
    background: var(--accent-soft);
    border-color: rgba(var(--accent-rgb), 0.5);
    color: var(--accent-strong);
}

.ad-table-head-inbox,
.student-inbox-row {
    grid-template-columns: minmax(180px, 2.4fr) minmax(110px, 1.1fr) minmax(92px, 0.8fr) minmax(88px, 0.8fr) minmax(88px, 0.8fr) minmax(168px, 1.2fr);
}
.student-inbox-row {
    display: grid;
    align-items: center;
}
.ad-row-actions {
    display: flex;
    gap: 5px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.ad-row-badges {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.ad-signal-pill { background: rgba(var(--accent-rgb), 0.10); color: var(--accent-strong); }
.ad-unscheduled-pill { background: rgba(194, 135, 44, 0.16); color: #b06a2a; }
.ad-filter-caption {
    font-size: 12px;
    color: var(--text-muted);
}

.student-os-next-actions .cw-panel-head h3::after {
    content: "Student Inbox";
    display: inline-flex;
    margin-left: 8px;
    font-size: 10px;
    color: var(--accent-strong);
    background: var(--accent-soft);
    border-radius: 999px;
    padding: 2px 8px;
    vertical-align: middle;
}
.cw-next-primary {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid var(--accent-strong);
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent-strong) 8%, var(--surface-bg));
    cursor: pointer;
    font-family: inherit;
    transition: transform .1s, background .12s;
}
.cw-next-primary:hover { transform: translateY(-1px); }
.cw-next-primary-eyebrow { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-strong); }
.cw-next-primary-title { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.cw-next-primary-meta { font-size: 12px; color: var(--text-secondary); }
.cw-next-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cw-next-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    background: var(--surface-bg);
    color: var(--text-primary);
    text-align: left;
    font: inherit;
}
button.cw-next-action { cursor: pointer; }
button.cw-next-action:hover { background: var(--surface-bg-hover); }
.cw-next-action small {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}
.cw-next-action.is-static { cursor: default; }
.cw-grade-engine-note {
    font-size: 12px;
    color: var(--text-muted);
    margin: -4px 0 4px;
}

.sutra-data-safety-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin: 12px 0;
}
.sutra-data-safety-card {
    padding: 12px 14px;
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    background: var(--surface-bg);
}
.sutra-data-safety-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.sutra-data-safety-card strong {
    display: block;
    color: var(--text-primary);
    font-size: 15px;
    margin-bottom: 4px;
}
.sutra-data-safety-card small {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.35;
}
.sutra-data-safety-actions { margin-bottom: 10px; }

.flow-action-review-head,
.flow-act-batch-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    background: var(--surface-bg);
}
.flow-action-review-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.flow-action-review-title span,
.flow-act-batch-head span {
    color: var(--text-muted);
    font-size: 12px;
}
.flow-action-review-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.flow-action-select-btn,
.flow-action-select {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    border: 1px solid var(--surface-border);
    border-radius: 999px;
    background: var(--surface-bg);
    color: var(--text-primary);
    font: inherit;
    font-size: 12px;
    padding: 5px 10px;
}
.flow-action-select-btn { cursor: pointer; }
.flow-action-select input { accent-color: var(--accent-strong); }
.flow-before-after {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--text-secondary);
}
.flow-before-after span {
    border: 1px solid var(--surface-border);
    border-radius: 9px;
    padding: 7px 9px;
    background: var(--surface-bg);
}
.flow-before-after-danger span:last-child {
    color: var(--danger, #c0564f);
}
.flow-act-batch {
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.02);
}
.flow-action-review-modal { width: min(720px, 96vw); }

@media (max-width: 720px) {
    .sutra-save-failure-banner {
        grid-template-columns: 1fr;
        bottom: 76px;
        padding: 14px;
        border-radius: 18px 18px 0 0;
    }

    .sutra-save-failure-actions {
        justify-content: stretch;
    }

    .sutra-health-btn {
        flex: 1 1 140px;
    }

    .modal.active .modal-content,
    .cw-modal-overlay .cw-modal-card,
    [data-sutra-modal-enhanced="true"][role="dialog"] > .modal-content {
        border-radius: 20px 20px 0 0;
    }

    .sutra-password-modal {
        width: min(94vw, 480px);
        max-height: calc(100dvh - 32px);
        overflow-y: auto;
    }

    .sutra-drive-sync-actions .cc-btn,
    .sutra-drive-conflict-actions .btn {
        flex: 1 1 100%;
    }

    .ad-table-head-inbox { display: none; }
    .student-inbox-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 12px;
    }
    .ad-row-actions {
        justify-content: flex-start;
    }
    .cw-next-action {
        align-items: flex-start;
        flex-direction: column;
    }
    .cw-next-action small { white-space: normal; }
    .flow-before-after { grid-template-columns: 1fr; }
}
