@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap');

/* EXAMS VENTURE - UNIFIED STYLESHEET (4.0 & 5.0)
   See config.js for scale-specific logic */

/* 1. CORE THEME & LAYOUT */
:root {
    --bg: #0f1b16;
    --card: #172721;
    --accent: #008753;
    --accent-soft: rgba(0, 135, 83, 0.14);
    --text: #edf5f1;
    --text-dim: #b8cbc2;
    --nav-navy: #1c2d26;
    --sidebar-bg: #11201a;
    --radius-xl: 24px;
    --radius-lg: 16px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --type-label: 0.75rem;
    --type-caption: 0.875rem;
    --type-body: 1rem;
    --type-body-sm: 0.9375rem;
    --type-title: 1.25rem;
    --type-headline: 1.5rem;
    --type-display: clamp(2.25rem, 8vw, 3.75rem);
    --motion-fast: 160ms;
    --motion-base: 220ms;
    --motion-ease: cubic-bezier(0.2, 0, 0, 1);
    --border-subtle: 1px solid rgba(148, 163, 184, 0.22);
    --elev-1: 0 2px 8px rgba(2, 12, 8, 0.16);
    --elev-2: 0 6px 16px rgba(2, 12, 8, 0.22);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Roboto', 'Segoe UI', sans-serif;
    overflow-x: hidden;
    min-height: 100dvh;
    overscroll-behavior-y: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.5;
}

/* 2. TOP BAR & NAVIGATION */
.top-bar {
    position: fixed;
    top: calc(50px + env(safe-area-inset-top, 0px));
    left: 0;
    width: 100%;
    height: 62px;
    background: rgba(15, 27, 22, 0.96);
    z-index: 1400;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid rgba(0, 135, 83, 0.2);
    pointer-events: none;
}

.top-bar .constant-menu-btn {
    pointer-events: auto;
}

@media (max-width: 768px) {
    .top-bar {
        height: 50px;
        padding: 0 12px;
    }
}

.app-logo-text {
    margin-left: 62px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

@media (max-width: 768px) {
    .app-logo-text {
        margin-left: 50px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .app-logo-text {
        margin-left: 40px;
        font-size: 0.9rem;
    }
}

.constant-menu-btn {
    position: absolute;
    left: 15px;
    width: 45px;
    height: 45px;
    background: rgba(0, 135, 83, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

@media (max-width: 480px) {
    .constant-menu-btn {
        width: 42px;
        height: 42px;
        left: 10px;
    }
}

/* Touch feedback for mobile */
@media (hover: none) and (pointer: coarse) {
    .constant-menu-btn:active {
        background: rgba(0, 135, 83, 0.16);
        transform: scale(0.95);
    }
}

.hamburger-icon span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--accent);
    margin: 3px 0;
    border-radius: 2px;
}

/* Animations */
@keyframes slideUp {
    from { transform: translate(-50%, 100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes slideDown {
    from { transform: translate(-50%, 0); opacity: 1; }
    to { transform: translate(-50%, 100%); opacity: 0; }
}

/* 3. MAIN CONTENT CONTAINER */
.app-container {
    width: 100%;
    max-width: 470px;
    margin: 0 auto;
    padding: 24px 18px;
    padding-top: 132px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 768px) {
    .app-container {
        padding: 18px 14px;
        padding-top: 120px;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 14px 12px;
        padding-top: 110px;
    }
}

/* 4. SIDEBAR & OVERLAY */
.sidebar {
    height: 100dvh;
    width: 280px;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--sidebar-bg);
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(148, 163, 184, 0.14);
    padding: 24px;
}

@media (max-width: 768px) {
    .sidebar {
        width: 75vw;
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 85vw;
        padding: 20px 16px;
    }
}

.sidebar.active { transform: translateX(0); }

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1500;
    backdrop-filter: none;
}

/* 5. SIDEBAR NAVIGATION */
.sidebar-nav {
    flex: 1;
    padding: 20px 10px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 14px;
    margin-bottom: 8px;
    border-radius: 16px;
    cursor: pointer;
    color: var(--text-dim);
    transition: background 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

@media (max-width: 480px) {
    .nav-item {
        padding: 12px;
        margin-bottom: 6px;
    }
}

.nav-item.active {
    background: rgba(0, 135, 83, 0.12);
    color: var(--accent);
    border-left: 4px solid var(--accent);
}

.nav-item .icon {
    font-size: 1.5rem;
    margin-right: 15px;
    width: 30px;
    text-align: center;
}

.nav-text {
    display: flex;
    flex-direction: column;
    margin-left: 12px;
}

.nav-text strong {
    font-size: 0.95rem;
    color: var(--text);
}

.nav-text small {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.nav-item-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
}

.nav-item-link:hover .nav-item {
    background: rgba(0, 135, 83, 0.12);
    border-left: 4px solid var(--accent);
}

/* 6. CARDS & UI ELEMENTS */
.stats-card {
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 6px 16px rgba(2, 12, 8, 0.18);
}

.history-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.history-action-btn {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.history-action-btn:hover {
    transform: translateY(-1px);
}

.history-action-edit {
    color: var(--accent);
    border-color: rgba(0, 135, 83, 0.22);
    background: rgba(0, 135, 83, 0.08);
}

.history-action-edit:hover {
    background: rgba(0, 135, 83, 0.14);
    border-color: rgba(0, 135, 83, 0.3);
}

.history-action-delete {
    color: #ff6b6b;
    border-color: rgba(255, 107, 107, 0.22);
    background: rgba(255, 107, 107, 0.08);
}

.history-action-delete:hover {
    background: rgba(255, 107, 107, 0.14);
    border-color: rgba(255, 107, 107, 0.3);
}

@media (max-width: 768px) {
    .stats-card {
        padding: 20px;
        border-radius: 18px;
    }
}

@media (max-width: 480px) {
    .stats-card {
        padding: 18px;
        border-radius: 16px;
        margin-bottom: 16px;
    }

    .history-actions {
        justify-content: flex-start;
        margin-top: 12px;
    }
}

#display-cgpa {
    font-size: 4rem;
    font-weight: 800;
    color: var(--accent);
}

@media (max-width: 768px) {
    #display-cgpa {
        font-size: 3.5rem;
    }
}

@media (max-width: 480px) {
    #display-cgpa {
        font-size: 2.5rem;
    }
}

.badge {
    background: rgba(251, 191, 36, 0.1);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.profile-pic {
    width: 50px;
    height: 50px;
    background: var(--accent);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.profile-trigger {
    display: flex;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    transition: 0.3s;
}

.profile-trigger:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.profile-info {
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 6px 16px rgba(2, 12, 8, 0.16);
}

/* 7. FORM INPUTS */
.course-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
    align-items: center;
}

@media (max-width: 480px) {
    .course-row {
        gap: 6px;
        flex-wrap: wrap;
    }
}

.course-row input, .course-row select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text);
    padding: 13px 10px;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    min-width: 0;
}

.course-row input::placeholder,
.inp-notes::placeholder,
#json-paste-area::placeholder {
    color: var(--text-dim);
}

@media (max-width: 480px) {
    .course-row input, .course-row select {
        padding: 10px 6px;
        font-size: 13px;
    }
}

.inp-code { flex: 3; text-transform: uppercase; font-weight: 600; }
.inp-unit { flex: 1.2; }
.inp-grade { flex: 1.5; }

@media (max-width: 480px) {
    .inp-code { flex: 2; }
    .inp-unit { flex: 1; }
    .inp-grade { flex: 1.2; }
    .btn-remove { flex-shrink: 0; width: 32px; padding: 0; }
}

.inp-select-pro, #sem-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text);
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23008753' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
}

@media (max-width: 480px) {
    .inp-select-pro, #sem-select {
        padding: 12px;
        font-size: 16px;
    }
}

.inp-notes {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text);
    padding: 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 50px;
}

.inp-notes:focus { border-color: var(--accent); outline: none; }

.selection-group label {
    display: block;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 8. BUTTONS */
.btn-save {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 10px 20px rgba(0, 135, 83, 0.24);
}

@media (max-width: 480px) {
    .btn-save {
        padding: 12px;
        font-size: 13px;
    }
}

.btn-save:hover {
    background: #006b42;
    box-shadow: 0 12px 22px rgba(0, 135, 83, 0.28);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text);
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
    font-size: 14px;
}

@media (max-width: 480px) {
    .btn-secondary {
        padding: 12px;
        font-size: 13px;
    }
}

.btn-secondary:hover {
    border-color: rgba(0, 135, 83, 0.45);
    color: var(--accent);
    background: rgba(0, 135, 83, 0.1);
}

.btn-back {
    background: rgba(0, 135, 83, 0.1);
    border: 1px solid rgba(0, 135, 83, 0.18);
    color: var(--text-dim);
    padding: 9px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-bottom: 10px;
    transition: 0.18s;
}

.btn-back:hover {
    background: rgba(0, 135, 83, 0.16);
    color: var(--text);
}

.btn-reset-sidebar {
    width: 100%;
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.3);
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 10px;
}

.btn-reset-sidebar:hover {
    background: #ff4444;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.4);
}

.action-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

@media (max-width: 480px) {
    .action-bar {
        gap: 8px;
        margin-top: 16px;
    }
}

/* 9. PROGRESS & CHARTS */
.progress-container {
    width: 100%;
    height: 8px;
    background: rgba(148, 163, 184, 0.3);
    border-radius: 999px;
    margin-bottom: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(0, 135, 83, 0.26);
    transition: width 1s ease-in-out;
}

.cgpa-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .stats-row {
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat small { color: var(--text-dim); font-size: 0.8rem; }
.stat b { font-size: 1.3rem; margin-top: 5px; color: var(--accent); }

/* 10. TARGET TRACKER RESULT CARDS */
.target-audit-title {
    color: var(--accent);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.target-audit-intro {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text);
}

.target-status-card,
.target-analytics-card,
.target-strategy-card,
.target-profile-card,
.target-alert-neutral {
    background: var(--card);
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 12px;
}

.target-status-card {
    padding: 15px;
    margin: 20px 0;
}

.target-status-head,
.target-strategy-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.target-micro-label,
.target-metric-label {
    color: var(--text-dim);
    display: block;
}

.target-micro-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.target-metric-label {
    font-size: 0.72rem;
}

.target-metric-label.tiny {
    font-size: 0.65rem;
}

.target-standing-value {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0;
}

.target-pill,
.target-risk-pill {
    background: var(--pill-color, var(--accent));
    color: #000;
    font-weight: 800;
    white-space: nowrap;
}

.target-pill {
    font-size: 0.65rem;
    padding: 4px 10px;
    border-radius: 6px;
}

.target-risk-pill {
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 4px;
}

.target-status-note {
    font-size: 0.75rem;
    margin-top: 10px;
    color: var(--status-color, var(--accent));
}

.target-analytics-card,
.target-strategy-card,
.target-profile-card,
.target-reco-card,
.target-critical-card,
.target-alert-danger,
.target-alert-neutral {
    padding: 12px;
    margin: 16px 0;
}

.target-analytics-title,
.target-profile-title {
    color: var(--accent);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.target-analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    font-size: 0.75rem;
}

.target-analytics-item {
    background: var(--metric-bg, rgba(0, 135, 83, 0.1));
    padding: 8px;
    border-radius: 8px;
    border-left: 2px solid var(--metric-color, var(--accent));
}

.target-alert-danger {
    background: rgba(255, 68, 68, 0.08);
    border-left: 4px solid #ff4444;
    border-radius: 10px;
}

.target-alert-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 5px;
}

.target-alert-title.danger {
    color: #ff4444;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.target-alert-copy {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text);
}

.target-engine-title {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--accent);
    border-bottom: 1px solid rgba(148, 163, 184, 0.26);
    padding-bottom: 8px;
}

.target-engine-intro {
    font-size: 0.85rem;
    margin-bottom: 15px;
    color: var(--text);
}

.target-strategy-title {
    font-size: 0.75rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: #20a86d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.target-strategy-grid {
    display: grid;
    gap: 10px;
}

.target-strategy-item {
    background: rgba(148, 163, 184, 0.08);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-left: 3px solid var(--risk-color, var(--accent));
}

.target-strategy-copy {
    flex: 1;
}

.target-strategy-name {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text);
}

.target-strategy-desc {
    color: var(--text-dim);
    display: block;
    margin-top: 4px;
}

.target-split-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.target-split-box {
    padding: 6px 8px;
    border-radius: 6px;
}

.target-split-box.a {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.target-split-box.b {
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.target-split-value {
    margin: 2px 0;
    font-weight: 800;
}

.target-split-value.a {
    color: #34d399;
}

.target-split-value.b {
    color: #60a5fa;
}

.target-profile-block {
    margin-bottom: 10px;
}

.target-profile-copy {
    margin: 0;
    font-size: 0.8rem;
}

.target-profile-copy.weak {
    color: #ff6b6b;
}

.target-profile-copy.strong {
    color: #34d399;
}

.target-variance-note {
    color: var(--text-dim);
    display: block;
    margin-top: 8px;
}

.target-reco-card {
    background: rgba(0, 135, 83, 0.1);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
}

.target-critical-card {
    background: rgba(32, 168, 109, 0.1);
    border-left: 3px solid #20a86d;
    border-radius: 8px;
}

.target-critical-copy {
    font-size: 0.75rem;
    color: var(--text);
    line-height: 1.5;
    margin: 0;
}

.target-footer-actions {
    margin-top: 25px;
    border-top: 1px solid rgba(148, 163, 184, 0.26);
    padding-top: 15px;
    text-align: center;
}

.target-adjust-btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.target-adjust-btn:hover {
    background: rgba(0, 135, 83, 0.14);
}

@media (max-width: 480px) {
    .target-analytics-grid {
        grid-template-columns: 1fr;
    }
}

/* 11. BULK IMPORT */
.bulk-import-section { margin: 20px 0; width: 100%; }

.btn-bulk-toggle {
    width: 100%;
    padding: 14px;
    background: rgba(251, 191, 36, 0.05);
    border: 1px dashed var(--accent);
    color: var(--accent);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.bulk-drawer {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
}

.code-copy-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.code-copy-box code {
    font-family: monospace;
    font-size: 0.7rem;
    color: #8b949e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

#json-paste-area {
    width: 100%;
    height: 100px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text);
    padding: 10px;
    border-radius: 12px;
    margin: 10px 0;
}

.btn-copy {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
    min-width: 60px;
}

.btn-process {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
}

/* 12. HISTORY LIST */
#dynamic-sem-list {
    display: flex;
    flex-direction: column;
    padding: 5px 0;
}

.clickable-history {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.clickable-history:hover {
    background: rgba(0, 135, 83, 0.1) !important;
    border-color: var(--accent);
    transform: translateX(4px);
}

.clickable-history::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}

.clickable-history:hover::after {
    opacity: 1;
}

.clickable-history span, 
.clickable-history button {
    flex-shrink: 0;
}

/* 13. VIEWS */
.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 14. LOGIN VIEW */
#view-login.active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    background: var(--bg);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-card {
    text-align: center;
    max-width: 350px;
    width: 100%;
}

.lock-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

#login-pin {
    display: block;
    margin: 20px auto;
    text-align: center;
    font-size: 2.5rem;
    letter-spacing: 10px;
    width: 180px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 135, 83, 0.24);
    color: var(--accent);
    border-radius: 12px;
    padding: 10px;
}

/* Prevent zoom on iOS when interacting with forms */
input, select, textarea {
    font-size: 16px;
}

@media (max-width: 480px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

.view-header, .main-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 480px) {
    .view-header, .main-header {
        gap: 12px;
        margin-bottom: 16px;
    }
}

.view-header h2 {
    font-size: 1.3rem;
}

@media (max-width: 480px) {
    .view-header h2 {
        font-size: 1.1rem;
    }
}

/* 14. SIDEBAR FOOTER */
.sidebar-links {
    margin-top: auto;
    padding-bottom: 20px;
}

.sidebar-footer {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 10px;
}

.theme-toggle-btn {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 10px;
    background: rgba(0, 135, 83, 0.08);
    border: 1px solid rgba(0, 135, 83, 0.14);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.theme-toggle-btn:hover {
    background: rgba(0, 135, 83, 0.14);
    border-color: var(--accent);
}

/* 15. ONBOARDING */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.onboarding-card {
    background: var(--card);
    border: 1px solid rgba(0, 135, 83, 0.18);
    border-radius: 16px;
    padding: 28px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.onboarding-step h3 {
    font-size: 1.1rem;
}

/* 16. AD HOUSE & MONETIZATION */
#ad-house {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: #020617;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    height: calc(50px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    z-index: 1300;
}

@media (max-width: 768px) {
    #ad-house {
        height: calc(50px + env(safe-area-inset-top, 0px));
    }
}

#dynamic-ad-wrapper {
    width: 320px;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50px;
    background-color: var(--card);
    position: relative;
}

@media (max-width: 480px) {
    #dynamic-ad-wrapper {
        min-height: 50px;
    }
}

.adsbygoogle {
    display: block;
    width: 320px;
    height: 50px;
    max-width: 100%;
}

/* 17. OFFLINE FUNCTIONALITY */
#offline-countdown {
    font-size: 0.8rem;
    color: #ff6b6b;
    font-weight: bold;
    display: none;
    margin-left: auto;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.offline-lockout-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.offline-lockout-overlay.active {
    display: flex;
}

.offline-lockout-card {
    background: var(--card);
    border: 1px solid #ff6b6b;
    border-radius: 16px;
    padding: 40px 30px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(255, 107, 107, 0.3);
    animation: slideUp 0.4s ease-out;
}

.offline-lockout-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
}

.offline-lockout-card h2 {
    font-size: 1.5rem;
    color: #ff6b6b;
    margin-bottom: 12px;
}

.offline-lockout-card p {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 12px;
}

.offline-lockout-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-style: italic;
}

/* Disable all interactive elements when offline lockout is active */
.offline-lockout-overlay.active ~ * button,
.offline-lockout-overlay.active ~ * input,
.offline-lockout-overlay.active ~ * select,
.offline-lockout-overlay.active ~ * textarea {
    pointer-events: none !important;
    opacity: 0.5 !important;
}

/* 15. PWA INSTALL BUTTON (Elite Minimalist) */
.pwa-install-trigger {
    display: none; /* Controlled by JS/Media Query */
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 14px 20px;
    font-weight: 800;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(0, 135, 83, 0.3);
    width: calc(100% - 24px);
    margin: 0 12px 15px;
}

.pwa-install-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 107, 66, 0.42);
    filter: brightness(1.1);
}

.pwa-install-trigger:active {
    transform: translateY(0);
}

.pwa-install-trigger .icon {
    font-size: 1.2rem;
}

@media (display-mode: standalone) {
    .pwa-install-trigger {
        display: none !important;
    }
}

.pwa-install-trigger.faded {
    opacity: 0.4;
    filter: grayscale(1);
    pointer-events: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    box-shadow: none;
}

/* ========== LIGHT THEME ========== */
[data-theme="light"] {
    --bg: #f2f7f4;
    --card: #ffffff;
    --accent: #008753;
    --text: #123126;
    --text-dim: #5d7368;
    --nav-navy: #e8f2ec;
    --sidebar-bg: #ffffff;
    --accent-soft: rgba(0, 135, 83, 0.12);
}

[data-theme="light"] body { background: #f2f7f4; color: #123126; }
[data-theme="light"] .top-bar { background: rgba(255, 255, 255, 0.94); border-bottom: 1px solid rgba(0, 135, 83, 0.14); }
[data-theme="light"] .constant-menu-btn { background: rgba(0, 135, 83, 0.1); border-color: rgba(0, 135, 83, 0.18); }
[data-theme="light"] .hamburger-icon span { background: #008753; }
[data-theme="light"] .sidebar { background-color: #fff; border-right-color: rgba(0, 135, 83, 0.14); }
[data-theme="light"] .nav-item { color: #4e6a5f; }
[data-theme="light"] .stats-card { background: #fff; border-color: rgba(0, 135, 83, 0.14); box-shadow: 0 12px 24px rgba(0, 135, 83, 0.08); }
[data-theme="light"] .profile-pic { background: #008753; color: #fff; }
[data-theme="light"] .btn-back { background: rgba(0, 135, 83, 0.08); border-color: rgba(0, 135, 83, 0.16); color: #008753; }
[data-theme="light"] .btn-back:hover { background: rgba(0, 135, 83, 0.14); color: #006b42; }
[data-theme="light"] .btn-secondary { background: #f7fbf9; border-color: rgba(0, 135, 83, 0.14); color: #123126; }
[data-theme="light"] .btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
[data-theme="light"] .inp-select-pro, [data-theme="light"] #sem-select { background: #f7fbf9; border-color: rgba(0, 135, 83, 0.14); color: #123126; }
[data-theme="light"] .course-row input, [data-theme="light"] .course-row select { background: #f7fbf9; border-color: rgba(0, 135, 83, 0.14); color: #123126; }
[data-theme="light"] .inp-notes { background: #f7fbf9; border-color: rgba(0, 135, 83, 0.14); color: #123126; }
[data-theme="light"] .bulk-drawer { background: #f7fbf9; border-color: rgba(0, 135, 83, 0.14); }
[data-theme="light"] .code-copy-box { background: #edf7f1; border-color: rgba(0, 135, 83, 0.14); }
[data-theme="light"] .code-copy-box code { color: #5d7368; }
[data-theme="light"] #json-paste-area { background: #f7fbf9; border-color: rgba(0, 135, 83, 0.14); color: #123126; }
[data-theme="light"] .clickable-history { background: #fff; border-color: rgba(0, 135, 83, 0.14); }
[data-theme="light"] .clickable-history:hover { background: rgba(0, 135, 83, 0.08) !important; box-shadow: 0 8px 18px rgba(0, 135, 83, 0.1); }
[data-theme="light"] #view-login.active { background-color: #f2f7f4 !important; }
[data-theme="light"] .login-card { background: #fff !important; border-color: rgba(0, 135, 83, 0.14); }
[data-theme="light"] .overlay { background: rgba(18, 49, 38, 0.24); }
[data-theme="light"] .theme-toggle-btn { background: rgba(0, 135, 83, 0.08); border-color: rgba(0, 135, 83, 0.14); color: #123126; }
[data-theme="light"] .theme-toggle-btn:hover { background: rgba(0, 135, 83, 0.12); }
[data-theme="light"] .onboarding-card { background: #fff; border-color: rgba(0, 135, 83, 0.12); box-shadow: 0 14px 30px rgba(0, 135, 83, 0.12); }
[data-theme="light"] #dynamic-ad-wrapper { background-color: #f7fbf9; border-bottom: 1px solid rgba(0, 135, 83, 0.14); }
[data-theme="light"] .offline-lockout-card { background: #fff; border-color: #008753; }
[data-theme="light"] .offline-lockout-card h2 { color: #008753; }
[data-theme="light"] .offline-lockout-card p { color: #123126; }
[data-theme="light"] .offline-lockout-hint { color: #5d7368; }

/* Material micro-pass: 4/8 spacing + type scale */
.top-bar {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.app-container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    padding-top: 132px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
}

.sidebar {
    padding: var(--space-6);
}

.sidebar-nav {
    padding: var(--space-5) var(--space-2);
}

.nav-item {
    padding: var(--space-3);
    margin-bottom: var(--space-2);
}

.app-logo-text,
.view-header h2,
.main-header h2,
.target-standing-value {
    font-size: var(--type-title);
}

#display-cgpa {
    font-size: var(--type-display);
}

.nav-text small,
.badge,
.footer-title,
.sidebar-footer {
    font-size: var(--type-label);
}

.nav-text strong,
.target-analytics-title,
.target-profile-title,
.target-engine-title,
.target-alert-title,
.target-audit-title {
    font-size: var(--type-caption);
}

.course-row input,
.course-row select,
.inp-select-pro,
#sem-select,
.inp-notes,
.btn-save,
.btn-secondary,
.btn-back,
.btn-reset-sidebar,
.btn-process,
.theme-toggle-btn {
    border-radius: 12px;
}

.btn-save,
.btn-secondary,
.btn-process {
    padding: var(--space-3) var(--space-4);
    font-size: var(--type-caption);
}

.stats-card,
.profile-info,
.bulk-drawer,
.onboarding-card,
.offline-lockout-card {
    padding: var(--space-6);
}

.stats-row,
.action-bar,
.target-analytics-grid,
.target-strategy-grid,
.target-split-grid {
    gap: var(--space-3);
}

.target-status-card,
.target-analytics-card,
.target-strategy-card,
.target-profile-card,
.target-reco-card,
.target-critical-card,
.target-alert-danger,
.target-alert-neutral,
.target-strategy-item {
    border-radius: 12px;
}

.clickable-history {
    border-radius: 12px;
    padding: var(--space-4);
}

.view-header,
.main-header {
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.pwa-install-trigger {
    padding: var(--space-3) var(--space-5);
    font-size: var(--type-caption);
}

@media (max-width: 768px) {
    .app-container {
        padding-left: var(--space-3);
        padding-right: var(--space-3);
        padding-top: 120px;
        padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    }

    .stats-card,
    .profile-info,
    .bulk-drawer,
    .onboarding-card,
    .offline-lockout-card {
        padding: var(--space-5);
    }
}

@media (max-width: 480px) {
    .app-container {
        padding-left: var(--space-3);
        padding-right: var(--space-3);
        padding-top: 110px;
        padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    }

    .sidebar {
        padding: var(--space-4);
    }
}

/* Material polish: motion, elevation, touch-target consistency */
.constant-menu-btn,
.nav-item,
.btn-save,
.btn-secondary,
.btn-back,
.btn-reset-sidebar,
.btn-copy,
.btn-process,
.target-adjust-btn,
.theme-toggle-btn,
.pwa-install-trigger,
.clickable-history {
    transition:
        color var(--motion-fast) var(--motion-ease),
        background-color var(--motion-fast) var(--motion-ease),
        border-color var(--motion-fast) var(--motion-ease),
        transform var(--motion-fast) var(--motion-ease),
        box-shadow var(--motion-base) var(--motion-ease),
        opacity var(--motion-fast) var(--motion-ease);
}

.stats-card,
.profile-info,
.bulk-drawer,
.target-status-card,
.target-analytics-card,
.target-strategy-card,
.target-profile-card,
.target-reco-card,
.target-critical-card,
.target-alert-danger,
.target-alert-neutral,
.clickable-history,
.code-copy-box,
.onboarding-card,
.offline-lockout-card {
    border: var(--border-subtle);
    box-shadow: var(--elev-1);
}

.btn-save,
.btn-process,
.pwa-install-trigger:hover,
.clickable-history:hover,
.target-adjust-btn:hover {
    box-shadow: var(--elev-2);
}

.constant-menu-btn,
.btn-save,
.btn-secondary,
.btn-back,
.btn-reset-sidebar,
.btn-copy,
.btn-process,
.target-adjust-btn,
.theme-toggle-btn,
.pwa-install-trigger,
.nav-item {
    min-height: 44px;
}

@media (max-width: 480px) {
    .constant-menu-btn,
    .btn-save,
    .btn-secondary,
    .btn-back,
    .btn-reset-sidebar,
    .btn-copy,
    .btn-process,
    .target-adjust-btn,
    .theme-toggle-btn,
    .pwa-install-trigger,
    .nav-item {
        min-height: 48px;
    }

    #display-cgpa {
        font-size: clamp(2.5rem, 12vw, 3rem);
    }
}