:root {
    --bg: #0c1016;
    --bg-elevated: #131925;
    --bg-soft: #1a2230;
    --line: #252f3d;
    --line-strong: #334155;
    --text: #eef2f7;
    --text-muted: #9aabbd;
    --accent: #6aa1ff;
    --accent-soft: rgba(106, 161, 255, 0.16);
    --success: #63c27d;
    --warning: #f0b35d;
    --danger: #ef6c6c;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(90, 126, 173, 0.1), transparent 28%),
        linear-gradient(180deg, #0b1015 0%, #0f141c 100%);
    color: var(--text);
    font: 15px/1.5 "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    padding: 28px 22px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(11, 16, 22, 0.8);
    backdrop-filter: blur(16px);
}

.brand-block h1,
.page-header h2,
.panel h3,
.hero-main h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: -0.02em;
}

.brand-kicker,
.eyebrow,
.stat-label {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.brand-block p,
.muted,
.panel p,
.hero-goal,
.empty-inline,
.session-row p,
.material-head p {
    color: var(--text-muted);
}

.sidebar-nav {
    display: grid;
    gap: 8px;
    margin-top: 32px;
}

.sidebar-nav a {
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: var(--text-muted);
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
    border-color: rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.main-content {
    padding: 28px;
}

.page-header,
.panel-head,
.hero-title-row,
.material-head,
.exam-card-head,
.theme-card-head,
.hero-actions,
.session-row,
.session-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

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

.grid {
    display: grid;
    gap: 18px;
}

.grid-top {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 18px;
}

.dashboard-grid,
.detail-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
    margin-bottom: 18px;
}

.panel,
.theme-card,
.material-card,
.session-card,
.exam-card,
.notice,
.section-nav,
.summary-card {
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(20, 27, 37, 0.94), rgba(16, 21, 29, 0.98));
    box-shadow: var(--shadow);
}

.panel {
    padding: 20px;
}

.notice {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 14px 18px;
    margin-bottom: 18px;
}

.notice-error {
    border-color: rgba(239, 108, 108, 0.35);
    color: #ffd5d5;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

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

.button-primary {
    background: var(--accent);
    color: #07101b;
}

.button-secondary {
    border-color: rgba(255, 255, 255, 0.08);
    background: transparent;
}

.button-danger {
    border-color: rgba(239, 108, 108, 0.35);
    color: #ffd7d7;
}

.button-small {
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
}

.stat-card strong,
.hero-score,
.score-badge {
    font-size: 32px;
    font-weight: 700;
}

.exam-list,
.theme-list,
.material-list,
.achievement-list,
.session-list.full {
    display: grid;
    gap: 14px;
}

.exam-card,
.theme-card,
.material-card,
.session-card {
    padding: 18px;
}

.exam-card:hover,
.theme-card:hover,
.material-card:hover {
    border-color: rgba(106, 161, 255, 0.35);
}

.pill,
.achievement-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #bed5ff;
    font-size: 12px;
}

.achievement-pill {
    background: rgba(99, 194, 125, 0.14);
    color: #bce9c8;
}

.score-badge,
.hero-score,
.theme-score strong {
    color: #dbe8ff;
}

.hero-main {
    padding: 22px;
}

.detail-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    margin-bottom: 18px;
}

.hero-meta,
.exam-meta,
.summary-grid,
.form-grid,
.checkbox-grid,
.check-grid {
    display: grid;
    gap: 12px;
}

.hero-meta,
.exam-meta {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    margin-top: 16px;
    color: var(--text-muted);
}

.section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    margin-bottom: 18px;
}

.section-nav a {
    padding: 10px 14px;
    border-radius: 12px;
    color: var(--text-muted);
}

.section-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    margin-top: 16px;
}

.summary-card {
    padding: 14px;
}

.summary-card span {
    display: block;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.next-step-card {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
}

.stack-form,
.compact-form,
.inline-form,
.session-actions {
    display: grid;
    gap: 12px;
}

.stack-form,
.compact-stack {
    margin-top: 18px;
}

.form-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

label {
    display: grid;
    gap: 8px;
    color: var(--text-muted);
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: 1px solid rgba(106, 161, 255, 0.45);
    border-color: rgba(106, 161, 255, 0.4);
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.empty-state,
.empty-inline {
    padding: 22px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
}

.empty-state.compact {
    margin-top: 18px;
}

.theme-list {
    margin-top: 18px;
}

.theme-card {
    display: grid;
    gap: 14px;
}

.theme-score {
    text-align: right;
}

.child-theme-list {
    display: grid;
    gap: 12px;
    padding-left: 16px;
    border-left: 2px solid rgba(255, 255, 255, 0.06);
}

.nested-editor summary {
    cursor: pointer;
    color: #d8e6ff;
}

.inline-form {
    grid-template-columns: minmax(0, 1fr) 140px auto;
    align-items: end;
    margin-top: 12px;
}

.add-theme-form {
    grid-template-columns: minmax(0, 1fr) 180px auto;
}

.checkbox-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.checkbox-item {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
}

.checkbox-item input {
    width: auto;
    margin: 0;
}

.session-list,
.activity-list,
.gap-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.session-row,
.session-card,
.activity-list li,
.gap-list li,
.progress-row {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.session-list.full .session-card:last-child,
.activity-list li:last-child,
.gap-list li:last-child,
.progress-row:last-child {
    border-bottom: none;
}

.session-card {
    grid-template-columns: minmax(0, 1fr) auto;
}

.progress-table {
    display: grid;
    margin-top: 16px;
}

.progress-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(100px, 1.8fr) 48px;
    gap: 14px;
    align-items: center;
}

.progress-track {
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.progress-track div {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #78adff, #94c6ff);
}

.check-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-top: 20px;
}

.check-item {
    padding: 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
}

.toast-root {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: grid;
    gap: 10px;
    z-index: 30;
}

.toast {
    min-width: 240px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(14, 20, 29, 0.96);
    box-shadow: var(--shadow);
}

.toast.success {
    border-color: rgba(99, 194, 125, 0.35);
}

.toast.error {
    border-color: rgba(239, 108, 108, 0.35);
}

@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .grid-top,
    .dashboard-grid,
    .detail-grid,
    .detail-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .main-content {
        padding: 18px;
    }

    .page-header,
    .panel-head,
    .hero-title-row,
    .material-head,
    .exam-card-head,
    .theme-card-head,
    .session-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .inline-form,
    .add-theme-form,
    .progress-row {
        grid-template-columns: 1fr;
    }

    .session-actions {
        width: 100%;
    }
}
