:root {
    --brand-primary: #222f6e;
    --brand-secondary: #2563eb;
    --brand-accent: #eac000;
    --brand-hover: #1a2a60;
    --surface: #ffffff;
    --surface-alt: #f8fbff;
    --border: #e4e9f2;
    --text-main: #1e2a4a;
    --text-muted: #5f687b;
    --text-light: #9ca3af;
    --shadow-sm: 0 2px 8px rgba(34, 47, 110, 0.07);
    --shadow-md: 0 6px 18px rgba(34, 47, 110, 0.1);
}

/* ── Hero ── */
.tp-hero {
    background: linear-gradient(135deg, var(--brand-primary) 0%, #1e3a8a 100%);
    color: #fff;
    padding: 1.8rem 0 1.4rem;
}

.tp-hero-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.tp-breadcrumb {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.tp-breadcrumb a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
}

.tp-breadcrumb a:hover { color: #fff; }
.tp-breadcrumb .sep { opacity: 0.4; margin: 0 0.15rem; }

.tp-unit-label {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tp-topic-title {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
    margin-bottom: 0.9rem;
}

.tp-meta-row {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.tp-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
}

/* AI Teacher promo banner */
.tp-ai-banner {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-top: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.tp-ai-left {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.tp-ai-icon {
    font-size: 1.5rem;
    color: var(--brand-accent);
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.tp-ai-text strong {
    font-size: 0.95rem;
    font-weight: 700;
    display: block;
    margin-bottom: 0.2rem;
}

.tp-ai-text span {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.tp-ai-text span i { color: var(--brand-accent); }

.tp-ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--brand-accent);
    color: #000;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    text-decoration: none;
    border-bottom: 2px solid #c9a000;
    white-space: nowrap;
    flex-shrink: 0;
}

.tp-ai-btn:hover {
    background: #f0ca00;
    color: #000;
    text-decoration: none;
}

/* ── Body ── */
.tp-body {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 4rem;
}

/* ── Panels ── */
.tp-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.4rem 1.5rem;
    margin-bottom: 1.2rem;
    box-shadow: var(--shadow-sm);
}

.tp-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tp-panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.tp-panel-title i { color: var(--brand-secondary); }

.tp-panel-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Action buttons */
.tp-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.tp-btn-ghost {
    background: var(--surface-alt);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.tp-btn-ghost:hover {
    background: var(--border);
    color: var(--text-main);
    text-decoration: none;
}

.tp-btn-primary {
    background: var(--brand-primary);
    color: #fff;
}

.tp-btn-primary:hover {
    background: var(--brand-hover);
    color: #fff;
    text-decoration: none;
}

.tp-btn-accent {
    background: var(--brand-accent);
    color: #000;
    border-bottom: 2px solid #c9a000;
}

.tp-btn-accent:hover {
    background: #f0ca00;
    color: #000;
    text-decoration: none;
}

.tp-btn-outline {
    background: transparent;
    color: var(--brand-primary);
    border: 1.5px solid var(--border);
}

.tp-btn-outline:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    text-decoration: none;
}

.tp-btn-saved {
    background: var(--brand-primary);
    color: #fff;
}

/* Badge */
.tp-current-badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: rgba(34, 47, 110, 0.1);
    color: var(--brand-primary);
}

/* ── Notes content ── */
.tp-notes-body {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-main);
}

.tp-notes-body h1, .tp-notes-body h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid rgba(34, 47, 110, 0.12);
}

.tp-notes-body h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 1.2rem;
    margin-bottom: 0.4rem;
}

.tp-notes-body p { margin-bottom: 1rem; }

.tp-notes-body ul, .tp-notes-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.tp-notes-body li { margin-bottom: 0.35rem; }

.tp-notes-body code {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    font-size: 0.88em;
    color: #c0392b;
}

.tp-notes-body pre {
    background: #1e2a4a;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}

.tp-notes-body pre code {
    background: transparent;
    border: none;
    color: inherit;
    padding: 0;
}

.tp-notes-body blockquote {
    border-left: 3px solid var(--brand-secondary);
    padding: 0.5rem 1rem;
    background: var(--surface-alt);
    border-radius: 0 6px 6px 0;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Footer actions */
.tp-notes-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    margin-top: 1.2rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tp-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.65rem;
}

.tp-footer-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Next topic / upgrade alert */
.tp-next-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--brand-primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s;
}

.tp-next-btn:hover {
    background: var(--brand-hover);
    color: #fff;
    text-decoration: none;
}

.tp-upgrade-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 0.45rem 0.9rem;
    color: #92400e;
}

.tp-upgrade-inline a {
    font-weight: 700;
    color: #92400e;
    text-decoration: underline;
}

/* ── Sidebar: Topics list ── */
.tp-topics-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.tp-topic-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    border: 1px solid transparent;
    transition: all 0.15s;
}

.tp-topic-item:hover {
    background: var(--surface-alt);
    border-color: var(--border);
    text-decoration: none;
    color: var(--text-main);
}

.tp-topic-item.tp-current {
    background: rgba(34, 47, 110, 0.08);
    border-color: rgba(34, 47, 110, 0.2);
    color: var(--brand-primary);
    font-weight: 700;
}

.tp-topic-item.tp-locked {
    color: var(--text-light);
    cursor: not-allowed;
    pointer-events: none;
}

.tp-topic-icon {
    width: 26px;
    height: 26px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    flex-shrink: 0;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.tp-topic-item.tp-current .tp-topic-icon {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.tp-topic-item.tp-locked .tp-topic-icon {
    background: #fffbeb;
    border-color: #fde68a;
    color: #d97706;
}

.tp-topic-name {
    flex: 1;
    line-height: 1.35;
    font-size: 0.83rem;
}

.tp-topic-sub {
    font-size: 0.72rem;
    color: var(--text-light);
    display: block;
    font-weight: 400;
}

.tp-upgrade-pill {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    background: #fef3c7;
    color: #92400e;
    text-decoration: none;
    flex-shrink: 0;
}

.tp-upgrade-pill:hover {
    background: var(--brand-accent);
    color: #000;
}

/* ── Sidebar: Study resources ── */
.tp-resources-list {
    display: flex;
    flex-direction: column;
}

.tp-resource-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-main);
    transition: color 0.15s;
}

.tp-resource-item:last-child { border-bottom: none; }

.tp-resource-item:hover { color: var(--brand-secondary); text-decoration: none; }

.tp-resource-icon {
    width: 34px;
    height: 34px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.tp-resource-icon.icon-pdf    { background: #fef2f2; color: #b91c1c; }
.tp-resource-icon.icon-video  { background: #f0fdf4; color: #15803d; }
.tp-resource-icon.icon-quiz   { background: #eff6ff; color: #1d4ed8; }

.tp-resource-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.tp-resource-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Empty / No-notes ── */
.tp-no-notes {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.tp-no-notes i {
    font-size: 2.5rem;
    color: var(--border);
    display: block;
    margin-bottom: 0.75rem;
}

/* ── Responsive ── */
@media (max-width: 992px) {
    .tp-topic-title { font-size: 1.3rem; }
    .tp-ai-banner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 768px) {
    .tp-topic-title { font-size: 1.15rem; }
    .tp-notes-body { font-size: 0.95rem; }
    .tp-panel-header { flex-direction: column; align-items: flex-start; }
    .tp-panel-actions { width: 100%; }
    .tp-hero { padding: 1.4rem 0 1rem; }
    .tp-body { padding: 1rem 1rem 3rem; }
}
