/* ==========================================================================
   CareerFlora Exam Archives — Flagship Stylesheet (/syllabus & /pyq)
   Light-first editorial + crisp dark-adaptive parity
   ========================================================================== */

:root {
    --ex-bg: #f8fafc;
    --ex-surface: #ffffff;
    --ex-surface-2: #f1f5f9;
    --ex-surface-hover: #fef2f2;
    --ex-border: #e2e8f0;
    --ex-border-strong: #cbd5e1;
    --ex-text: #0f172a;
    --ex-text-muted: #475569;
    --ex-text-subtle: #64748b;
    --ex-brand: #d62828;
    --ex-brand-hover: #b81d1d;
    --ex-brand-soft: rgba(214, 40, 40, 0.09);
    --ex-brand-border: rgba(214, 40, 40, 0.24);
    --ex-accent: #1d4ed8;
    --ex-emerald: #059669;
    --ex-amber: #d97706;
    --ex-violet: #7c3aed;
    --ex-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --ex-shadow-sm: 0 4px 14px rgba(15, 23, 42, 0.05);
    --ex-shadow-md: 0 12px 30px -10px rgba(15, 23, 42, 0.12);
    --ex-radius: 16px;
    --ex-radius-sm: 11px;
    --ex-max: 1240px;
}

@media (prefers-color-scheme: dark) {
    html:not([data-cf-theme="light"]) {
        --ex-bg: #0b1120;
        --ex-surface: #111a2e;
        --ex-surface-2: #17223a;
        --ex-surface-hover: #1e2943;
        --ex-border: #22304d;
        --ex-border-strong: #32446a;
        --ex-text: #f1f5f9;
        --ex-text-muted: #cbd5e1;
        --ex-text-subtle: #94a3b8;
        --ex-brand: #ef4444;
        --ex-brand-hover: #dc2626;
        --ex-brand-soft: rgba(239, 68, 68, 0.14);
        --ex-brand-border: rgba(239, 68, 68, 0.34);
        --ex-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
        --ex-shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.35);
        --ex-shadow-md: 0 16px 36px -8px rgba(0, 0, 0, 0.55);
    }
}

html[data-cf-theme="dark"] {
    --ex-bg: #0b1120;
    --ex-surface: #111a2e;
    --ex-surface-2: #17223a;
    --ex-surface-hover: #1e2943;
    --ex-border: #22304d;
    --ex-border-strong: #32446a;
    --ex-text: #f1f5f9;
    --ex-text-muted: #cbd5e1;
    --ex-text-subtle: #94a3b8;
    --ex-brand: #ef4444;
    --ex-brand-hover: #dc2626;
    --ex-brand-soft: rgba(239, 68, 68, 0.14);
    --ex-brand-border: rgba(239, 68, 68, 0.34);
    --ex-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --ex-shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.35);
    --ex-shadow-md: 0 16px 36px -8px rgba(0, 0, 0, 0.55);
}

/* Base Scope */
.ex-page {
    background: var(--ex-bg);
    color: var(--ex-text);
    min-height: 70vh;
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
}

.ex-container {
    width: 100%;
    max-width: var(--ex-max);
    margin: 0 auto;
    padding: 0 20px;
}

.ex-main-wrap {
    padding: 28px 0 64px;
}

/* ── Full-Bleed Flagship Hero ── */
.ex-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 86% 18%, rgba(214, 40, 40, 0.10), transparent 40%),
        radial-gradient(circle at 12% 88%, rgba(29, 78, 216, 0.08), transparent 42%),
        linear-gradient(135deg, var(--ex-surface) 0%, var(--ex-bg) 100%);
    border-bottom: 1px solid var(--ex-border);
    padding: 34px 0 38px;
}

html[data-cf-theme="dark"] .ex-hero {
    background:
        radial-gradient(circle at 86% 18%, rgba(239, 68, 68, 0.15), transparent 42%),
        radial-gradient(circle at 12% 88%, rgba(59, 130, 246, 0.12), transparent 44%),
        linear-gradient(135deg, #0f172a 0%, #0b1120 100%);
}

.ex-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(var(--ex-border-strong) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.35;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, transparent 100%);
    pointer-events: none;
}

.ex-hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.9fr);
    gap: 28px;
    align-items: center;
}

.ex-hero-grid--single {
    grid-template-columns: minmax(0, 1fr);
}

/* Breadcrumb Pill */
.ex-bc {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    box-shadow: var(--ex-shadow-xs);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ex-text-subtle);
    margin-bottom: 14px;
    max-width: 100%;
}

.ex-bc a {
    color: var(--ex-text-muted);
    text-decoration: none;
    transition: color 0.16s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ex-bc a:hover {
    color: var(--ex-brand);
}

.ex-bc .ex-bc-sep {
    opacity: 0.45;
    font-size: 12px;
}

.ex-bc .ex-bc-cur {
    color: var(--ex-brand);
    font-weight: 700;
}

/* Kicker Pill */
.ex-eyebrow-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.ex-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--ex-brand-soft);
    border: 1px solid var(--ex-brand-border);
    color: var(--ex-brand);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ex-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ex-brand);
    box-shadow: 0 0 0 4px rgba(214, 40, 40, 0.18);
}

/* Display H1 */
.ex-hero-title {
    font-family: 'Plus Jakarta Sans', 'Instrument Serif', system-ui, sans-serif;
    font-size: clamp(1.75rem, 3.2vw, 2.55rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--ex-text);
    margin: 0 0 10px;
}

.ex-hero-title span {
    color: var(--ex-brand);
}

.ex-hero-title i {
    color: var(--ex-brand);
    margin-right: 6px;
    font-size: 0.86em;
}

.ex-hero-desc {
    font-size: 15px;
    line-height: 1.62;
    color: var(--ex-text-muted);
    max-width: 650px;
    margin: 0 0 16px;
}

/* Hero Integrated Search Bar */
.ex-hero-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--ex-surface);
    border: 1.5px solid var(--ex-border-strong);
    border-radius: 13px;
    padding: 10px 14px;
    max-width: 600px;
    box-shadow: var(--ex-shadow-sm);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    margin-bottom: 14px;
}

.ex-hero-search:focus-within {
    border-color: var(--ex-brand);
    box-shadow: 0 0 0 4px var(--ex-brand-soft);
}

.ex-hero-search > i {
    color: var(--ex-brand);
    font-size: 15px;
    flex-shrink: 0;
}

.ex-hero-search input {
    border: none;
    outline: none;
    background: transparent;
    color: var(--ex-text);
    font-size: 14.5px;
    font-weight: 500;
    width: 100%;
    min-width: 0;
}

.ex-hero-search input::placeholder {
    color: var(--ex-text-subtle);
}

.ex-hero-search kbd {
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--ex-surface-2);
    border: 1px solid var(--ex-border);
    color: var(--ex-text-subtle);
    font-size: 11.5px;
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, monospace;
}

/* Popular Clickable Chips */
.ex-chip-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.ex-chip-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ex-text-subtle);
    margin-right: 2px;
}

.ex-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    color: var(--ex-text-muted);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.16s ease;
}

.ex-chip:hover,
.ex-chip.is-active {
    background: var(--ex-brand);
    border-color: var(--ex-brand);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(214, 40, 40, 0.22);
}

/* Hero Meta Pills (Sub-pages) */
.ex-hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.ex-hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border-radius: 999px;
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    color: var(--ex-text-muted);
    font-size: 12.5px;
    font-weight: 700;
    box-shadow: var(--ex-shadow-xs);
}

.ex-hero-pill i {
    color: var(--ex-brand);
}

/* Hero 4-Tile Stat Grid */
.ex-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ex-stat-tile {
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: 14px;
    padding: 15px 16px;
    box-shadow: var(--ex-shadow-xs);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.ex-stat-tile:hover {
    transform: translateY(-2px);
    border-color: var(--ex-brand-border);
}

.ex-stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: var(--ex-text-subtle);
}

.ex-stat-top i {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--ex-brand-soft);
    color: var(--ex-brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
}

.ex-stat-val {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--ex-text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.ex-stat-sub {
    font-size: 11.5px;
    color: var(--ex-text-subtle);
}

/* ── Section Headers ── */
.ex-sec-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 18px;
}

.ex-sec-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--ex-text);
    margin: 0;
}

.ex-sec-title i {
    color: var(--ex-brand);
}

.ex-sec-sub {
    margin: 4px 0 0;
    font-size: 13.5px;
    color: var(--ex-text-subtle);
}

.ex-count-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--ex-brand-soft);
    border: 1px solid var(--ex-brand-border);
    color: var(--ex-brand);
    font-size: 12px;
    font-weight: 800;
}

.ex-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    color: var(--ex-text-muted);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--ex-shadow-xs);
    transition: all 0.16s ease;
    margin-bottom: 18px;
}

.ex-back-btn:hover {
    border-color: var(--ex-brand);
    color: var(--ex-brand);
    transform: translateX(-2px);
}

/* ── Flagship Exam Track / Category Grid ── */
.ex-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
    gap: 16px;
}

.ex-cat-card {
    position: relative;
    overflow: hidden;
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius);
    padding: 20px 18px 18px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    box-shadow: var(--ex-shadow-xs);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.ex-cat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--cc, var(--ex-brand));
    opacity: 0.9;
}

.ex-cat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--ex-shadow-md);
    border-color: var(--cc, var(--ex-brand));
}

.ex-cat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.ex-cat-ico {
    width: 48px;
    height: 48px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: var(--cc-light, var(--ex-brand-soft));
    color: var(--cc, var(--ex-brand));
    border: 1px solid var(--ex-border);
    overflow: hidden;
    flex-shrink: 0;
}

.ex-cat-ico img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ex-cat-arrow {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--ex-surface-2);
    color: var(--ex-text-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.ex-cat-card:hover .ex-cat-arrow {
    background: var(--cc, var(--ex-brand));
    color: #ffffff;
    transform: translateX(2px);
}

.ex-cat-card h3 {
    font-size: 16px;
    font-weight: 800;
    color: var(--ex-text);
    margin: 0 0 6px;
    line-height: 1.3;
}

.ex-cat-desc {
    font-size: 13px;
    line-height: 1.5;
    color: var(--ex-text-subtle);
    margin: 0 0 14px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ex-cat-foot {
    padding-top: 12px;
    border-top: 1px dashed var(--ex-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ex-cat-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: var(--ex-text-muted);
}

.ex-cat-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ex-cat-meta i {
    color: var(--cc, var(--ex-brand));
}

.ex-progress {
    height: 5px;
    width: 100%;
    border-radius: 999px;
    background: var(--ex-surface-2);
    overflow: hidden;
}

.ex-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--cc, var(--ex-brand));
}

/* ── Hierarchy Nodes (Sub-cat / Sub-sub-cat / Topic Cards) ── */
.ex-node-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 14px;
}

.ex-node-card {
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: 14px;
    padding: 18px 16px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--ex-shadow-xs);
    transition: all 0.2s ease;
    position: relative;
}

.ex-node-card:hover {
    transform: translateY(-3px);
    border-color: var(--node-color, var(--ex-brand));
    box-shadow: var(--ex-shadow-md);
}

.ex-node-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ex-node-ico {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--node-soft, var(--ex-brand-soft));
    color: var(--node-color, var(--ex-brand));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    overflow: hidden;
    flex-shrink: 0;
}

.ex-node-ico img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ex-node-card h3 {
    font-size: 15px;
    font-weight: 800;
    color: var(--ex-text);
    margin: 0;
    line-height: 1.35;
}

.ex-node-desc {
    font-size: 12.5px;
    color: var(--ex-text-subtle);
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ex-node-badge {
    align-self: flex-start;
    margin-top: auto;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--ex-surface-2);
    border: 1px solid var(--ex-border);
    color: var(--ex-text-muted);
    font-size: 11.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ── Sticky Discovery Dock & Toolbar ── */
.ex-dock {
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: 15px;
    padding: 14px 16px;
    margin-bottom: 18px;
    box-shadow: var(--ex-shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ex-dock-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.ex-search-inline {
    flex: 1;
    min-width: 210px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--ex-bg);
    border: 1px solid var(--ex-border-strong);
    border-radius: 10px;
    padding: 8px 12px;
    transition: border-color 0.16s ease;
}

.ex-search-inline:focus-within {
    border-color: var(--ex-brand);
}

.ex-search-inline i {
    color: var(--ex-text-subtle);
    font-size: 13.5px;
}

.ex-search-inline input {
    border: none;
    outline: none;
    background: transparent;
    color: var(--ex-text);
    font-size: 13.5px;
    font-weight: 500;
    width: 100%;
    min-width: 0;
}

.ex-select {
    background: var(--ex-bg);
    color: var(--ex-text);
    border: 1px solid var(--ex-border-strong);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}

.ex-select:focus {
    border-color: var(--ex-brand);
}

.ex-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8.5px 15px;
    border-radius: 10px;
    background: var(--ex-brand);
    color: #ffffff;
    border: 1px solid var(--ex-brand);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.16s ease;
}

.ex-btn-primary:hover {
    background: var(--ex-brand-hover);
    color: #ffffff;
}

.ex-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--ex-surface-2);
    color: var(--ex-text-muted);
    border: 1px solid var(--ex-border);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.16s ease;
}

.ex-btn-ghost:hover,
.ex-btn-ghost.is-active {
    background: var(--ex-brand-soft);
    border-color: var(--ex-brand-border);
    color: var(--ex-brand);
}

/* Pills rail inside dock */
.ex-rail {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.ex-rail-label {
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ex-text-subtle);
    margin-right: 4px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ex-rail-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--ex-bg);
    border: 1px solid var(--ex-border);
    color: var(--ex-text-muted);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.ex-rail-pill:hover {
    border-color: var(--ex-brand);
    color: var(--ex-brand);
}

.ex-rail-pill.active {
    background: var(--ex-brand);
    border-color: var(--ex-brand);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(214, 40, 40, 0.22);
}

.ex-dock-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ex-text-subtle);
}

.ex-view-toggle {
    display: inline-flex;
    padding: 3px;
    border-radius: 10px;
    background: var(--ex-surface-2);
    border: 1px solid var(--ex-border);
    gap: 2px;
}

.ex-view-btn {
    border: none;
    background: transparent;
    color: var(--ex-text-subtle);
    width: 30px;
    height: 28px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12.5px;
}

.ex-view-btn.is-active {
    background: var(--ex-surface);
    color: var(--ex-brand);
    box-shadow: var(--ex-shadow-xs);
}

/* ── Flagship File Cards (Grid & List) ── */
.ex-file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
    gap: 16px;
}

.ex-file-grid.is-list {
    grid-template-columns: 1fr;
}

.ex-file-card {
    position: relative;
    overflow: hidden;
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--ex-shadow-xs);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.ex-file-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3.5px;
    background: linear-gradient(90deg, var(--fc-accent, var(--ex-brand)), transparent 92%);
}

.ex-file-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ex-shadow-md);
    border-color: var(--fc-accent, var(--ex-brand-border));
}

.ex-file-grid.is-list .ex-file-card {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 15px 18px;
}

.ex-file-grid.is-list .ex-file-top {
    flex: 1 1 320px;
}

.ex-file-grid.is-list .ex-file-actions {
    width: auto;
    min-width: 240px;
}

.ex-file-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.ex-file-ico {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.ex-file-title-wrap {
    flex: 1;
    min-width: 0;
}

.ex-file-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--ex-text);
    line-height: 1.38;
    margin: 0 0 3px;
}

.ex-file-sub {
    font-size: 12.5px;
    color: var(--ex-text-subtle);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ex-icon-tools {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.ex-tool-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--ex-border);
    background: var(--ex-surface-2);
    color: var(--ex-text-subtle);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ex-tool-btn:hover,
.ex-tool-btn.is-saved {
    background: var(--ex-brand-soft);
    border-color: var(--ex-brand-border);
    color: var(--ex-brand);
}

.ex-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ex-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid var(--ex-border);
    background: var(--ex-surface-2);
    color: var(--ex-text-muted);
}

.ex-badge--hot {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.35);
    color: var(--ex-amber);
}

.ex-badge--year {
    background: rgba(5, 150, 105, 0.11);
    border-color: rgba(5, 150, 105, 0.30);
    color: var(--ex-emerald);
}

.ex-badge--subj {
    background: rgba(124, 58, 237, 0.10);
    border-color: rgba(124, 58, 237, 0.28);
    color: var(--ex-violet);
}

.ex-file-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ex-text-subtle);
    padding-top: 8px;
    border-top: 1px dashed var(--ex-border);
}

.ex-file-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ex-file-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

.ex-act-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.16s ease;
}

.ex-act-btn--preview {
    background: var(--ex-surface-2);
    color: var(--ex-text);
    border: 1px solid var(--ex-border);
}

.ex-act-btn--preview:hover {
    border-color: var(--ex-brand);
    color: var(--ex-brand);
}

.ex-act-btn--dl {
    background: var(--ex-brand);
    color: #ffffff;
}

.ex-act-btn--dl:hover {
    background: var(--ex-brand-hover);
    color: #ffffff;
}

/* ── Two-Column Layout for Sub-views & Sidebar ── */
.ex-two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 24px;
    align-items: start;
}

.ex-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ex-widget {
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--ex-shadow-xs);
}

.ex-widget-head {
    padding: 13px 16px;
    border-bottom: 1px solid var(--ex-border);
    font-size: 13.5px;
    font-weight: 800;
    color: var(--ex-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ex-widget-body {
    padding: 12px 14px;
}

.ex-trend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.ex-trend-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 13px;
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    text-decoration: none;
    color: var(--ex-text);
    box-shadow: var(--ex-shadow-xs);
    transition: all 0.18s ease;
}

.ex-trend-card:hover {
    transform: translateY(-2px);
    border-color: var(--ex-brand-border);
    box-shadow: var(--ex-shadow-sm);
}

.ex-rank {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    background: var(--ex-surface-2);
    color: var(--ex-text-muted);
}

.ex-rank--1 { background: rgba(245, 158, 11, 0.16); color: #d97706; }
.ex-rank--2 { background: rgba(100, 116, 139, 0.16); color: var(--ex-text); }
.ex-rank--3 { background: rgba(214, 40, 40, 0.14); color: var(--ex-brand); }

.ex-trend-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ex-trend-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--ex-border);
}

.ex-trend-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ex-trend-list a {
    color: var(--ex-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    display: block;
}

.ex-trend-list a:hover {
    color: var(--ex-brand);
}

.ex-cat-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ex-cat-links a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border-radius: 9px;
    text-decoration: none;
    color: var(--ex-text-muted);
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
}

.ex-cat-links a:hover,
.ex-cat-links a.is-current {
    background: var(--ex-brand-soft);
    color: var(--ex-brand);
    font-weight: 700;
}

.ex-cat-links .ex-cnt {
    margin-left: auto;
    font-size: 11.5px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--ex-surface-2);
    color: var(--ex-text-subtle);
}

/* ── Empty State & Divider ── */
.ex-divider {
    border: none;
    border-top: 1.5px dashed var(--ex-border);
    margin: 30px 0;
}

.ex-empty {
    background: var(--ex-surface);
    border: 1px dashed var(--ex-border-strong);
    border-radius: var(--ex-radius);
    padding: 52px 24px;
    text-align: center;
    color: var(--ex-text-subtle);
}

.ex-empty i {
    font-size: 38px;
    color: var(--ex-brand);
    opacity: 0.4;
    margin-bottom: 12px;
    display: block;
}

.ex-empty h3 {
    font-size: 17px;
    font-weight: 800;
    color: var(--ex-text);
    margin: 0 0 6px;
}

.ex-empty p {
    font-size: 13.5px;
    margin: 0 0 14px;
}

/* ── Cross-Hubs Navigator ── */
.ex-crosshubs {
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid var(--ex-border);
}

.ex-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
}

.ex-hub-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 13px;
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    text-decoration: none;
    color: var(--ex-text);
    transition: all 0.18s ease;
}

.ex-hub-card:hover {
    border-color: var(--ex-brand);
    transform: translateY(-2px);
    box-shadow: var(--ex-shadow-sm);
}

.ex-hub-ico {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--ex-brand-soft);
    color: var(--ex-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.ex-hub-card strong {
    display: block;
    font-size: 13.5px;
    font-weight: 800;
}

.ex-hub-card span {
    display: block;
    font-size: 11.5px;
    color: var(--ex-text-subtle);
}

/* ── FAQ Accordion ── */
.ex-faq {
    margin-top: 36px;
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius);
    padding: 22px 24px;
    box-shadow: var(--ex-shadow-xs);
}

.ex-faq h2 {
    margin: 0 0 14px;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--ex-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ex-faq-list {
    display: grid;
    gap: 10px;
}

.ex-faq-item {
    border: 1px solid var(--ex-border);
    border-radius: 11px;
    padding: 12px 15px;
    background: var(--ex-bg);
}

.ex-faq-item summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    color: var(--ex-text);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ex-faq-item summary::-webkit-details-marker {
    display: none;
}

.ex-faq-item summary::after {
    content: "+";
    font-size: 16px;
    font-weight: 800;
    color: var(--ex-brand);
}

.ex-faq-item[open] summary::after {
    content: "−";
}

.ex-faq-item p {
    margin: 9px 0 0;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--ex-text-muted);
}

.ex-faq-item a {
    color: var(--ex-brand);
    font-weight: 700;
}

/* ── Native Dialog PDF Preview Modal ── */
dialog.ex-dialog {
    border: 1px solid var(--ex-border);
    border-radius: 18px;
    padding: 0;
    width: min(94vw, 940px);
    height: min(88vh, 760px);
    max-width: 940px;
    background: var(--ex-surface);
    color: var(--ex-text);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    margin: auto;
    overflow: hidden;
}

dialog.ex-dialog::backdrop {
    background: rgba(15, 23, 42, 0.68);
    backdrop-filter: blur(4px);
}

.ex-dialog-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ex-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--ex-border);
    background: var(--ex-surface);
}

.ex-dialog-head h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ex-dialog-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ex-dialog-close {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    border: 1px solid var(--ex-border);
    background: var(--ex-surface-2);
    color: var(--ex-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ex-dialog-close:hover {
    background: var(--ex-brand);
    border-color: var(--ex-brand);
    color: #ffffff;
}

.ex-dialog-body {
    flex: 1;
    background: var(--ex-bg);
}

.ex-dialog-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Toast Notification ── */
.ex-toast {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 99999;
    padding: 10px 16px;
    border-radius: 11px;
    background: #0f172a;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ex-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 980px) {
    .ex-hero-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .ex-two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .ex-hero {
        padding: 24px 0 28px;
    }
    .ex-container {
        padding: 0 14px;
    }
    .ex-cat-grid,
    .ex-node-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 11px;
    }
    .ex-file-grid {
        grid-template-columns: 1fr;
    }
    .ex-cat-card,
    .ex-node-card {
        padding: 14px 13px;
    }
    .ex-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
