/* Reset & Collegiate Design System Tokens */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --school-primary: #861F41;
    --school-primary-hover: #6e1735;
    --school-primary-light: #fcf3f5;
    --school-primary-border: #f4d2db;
    --school-secondary: #E87722;
    --school-secondary-hover: #cf6214;
    --school-secondary-light: #fff5ed;
    --school-secondary-border: #ffdbc8;
    --school-accent: #e5e1e0;
    --school-text-on-primary: #ffffff;
    --school-text-on-secondary: #ffffff;
    --school-badge-bg: #861F41;
    --school-badge-text: #ffffff;
}

/* Built-in Collegiate Themes */
[data-theme="virginia_tech"], .theme-virginia-tech {
    --school-primary: #861F41;
    --school-primary-hover: #6e1735;
    --school-primary-light: #fcf3f5;
    --school-primary-border: #f4d2db;
    --school-secondary: #E87722;
    --school-secondary-hover: #cf6214;
    --school-secondary-light: #fff5ed;
    --school-secondary-border: #ffdbc8;
    --school-accent: #e5e1e0;
    --school-text-on-primary: #ffffff;
    --school-text-on-secondary: #ffffff;
    --school-badge-bg: #861F41;
    --school-badge-text: #ffffff;
}

[data-theme="michigan"], .theme-michigan {
    --school-primary: #00274C;
    --school-primary-hover: #001b36;
    --school-primary-light: #f0f4fa;
    --school-primary-border: #c7d7ec;
    --school-secondary: #FFCB05;
    --school-secondary-hover: #e0b000;
    --school-secondary-light: #fffdeb;
    --school-secondary-border: #ffe97d;
    --school-accent: #e8ecef;
    --school-text-on-primary: #ffffff;
    --school-text-on-secondary: #00274c;
    --school-badge-bg: #00274C;
    --school-badge-text: #FFCB05;
}

[data-theme="uva"], .theme-uva {
    --school-primary: #232D4B;
    --school-primary-hover: #171f36;
    --school-primary-light: #f2f5f9;
    --school-primary-border: #cad5e4;
    --school-secondary: #E57200;
    --school-secondary-hover: #c85f00;
    --school-secondary-light: #fff5eb;
    --school-secondary-border: #ffd9b3;
    --school-accent: #f1f3f5;
    --school-text-on-primary: #ffffff;
    --school-text-on-secondary: #ffffff;
    --school-badge-bg: #232D4B;
    --school-badge-text: #ffffff;
}

[data-theme="unc"], .theme-unc {
    --school-primary: #7BAFD4;
    --school-primary-hover: #5f99c2;
    --school-primary-light: #f0f7fb;
    --school-primary-border: #cbe2f1;
    --school-secondary: #13294B;
    --school-secondary-hover: #0c1a32;
    --school-secondary-light: #eff4fa;
    --school-secondary-border: #c5d7ec;
    --school-accent: #ffffff;
    --school-text-on-primary: #13294b;
    --school-text-on-secondary: #ffffff;
    --school-badge-bg: #13294B;
    --school-badge-text: #7BAFD4;
}

[data-theme="duke"], .theme-duke {
    --school-primary: #001A57;
    --school-primary-hover: #00113a;
    --school-primary-light: #f1f4fa;
    --school-primary-border: #c6d3eb;
    --school-secondary: #00539B;
    --school-secondary-hover: #004078;
    --school-secondary-light: #eff6fc;
    --school-secondary-border: #b9dcf7;
    --school-accent: #eceef2;
    --school-text-on-primary: #ffffff;
    --school-text-on-secondary: #ffffff;
    --school-badge-bg: #001A57;
    --school-badge-text: #ffffff;
}

[data-theme="penn_state"], .theme-penn_state {
    --school-primary: #041E42;
    --school-primary-hover: #021229;
    --school-primary-light: #f0f4f8;
    --school-primary-border: #c7d4e5;
    --school-secondary: #596B82;
    --school-secondary-hover: #455467;
    --school-secondary-light: #f4f6f8;
    --school-secondary-border: #d5dce4;
    --school-accent: #f2f4f7;
    --school-text-on-primary: #ffffff;
    --school-text-on-secondary: #ffffff;
    --school-badge-bg: #041E42;
    --school-badge-text: #ffffff;
}

[data-theme="ohio_state"], .theme-ohio_state {
    --school-primary: #BB0000;
    --school-primary-hover: #990000;
    --school-primary-light: #fcf2f2;
    --school-primary-border: #f6c8c8;
    --school-secondary: #666666;
    --school-secondary-hover: #4d4d4d;
    --school-secondary-light: #f7f7f7;
    --school-secondary-border: #d9d9d9;
    --school-accent: #f5f5f5;
    --school-text-on-primary: #ffffff;
    --school-text-on-secondary: #ffffff;
    --school-badge-bg: #BB0000;
    --school-badge-text: #ffffff;
}

[data-theme="uc_berkeley"], .theme-uc_berkeley {
    --school-primary: #003262;
    --school-primary-hover: #002347;
    --school-primary-light: #f0f5fa;
    --school-primary-border: #c6d8eb;
    --school-secondary: #FDB515;
    --school-secondary-hover: #de9c08;
    --school-secondary-light: #fffdf0;
    --school-secondary-border: #ffe79e;
    --school-accent: #f8f9fb;
    --school-text-on-primary: #ffffff;
    --school-text-on-secondary: #003262;
    --school-badge-bg: #003262;
    --school-badge-text: #FDB515;
}

[data-theme="stanford"], .theme-stanford {
    --school-primary: #8C1515;
    --school-primary-hover: #6f1010;
    --school-primary-light: #fdf2f2;
    --school-primary-border: #f8caca;
    --school-secondary: #007C92;
    --school-secondary-hover: #006173;
    --school-secondary-light: #f0f9fa;
    --school-secondary-border: #bce3e9;
    --school-accent: #eaeaea;
    --school-text-on-primary: #ffffff;
    --school-text-on-secondary: #ffffff;
    --school-badge-bg: #8C1515;
    --school-badge-text: #ffffff;
}

[data-theme="default"], .theme-default {
    --school-primary: #1D4ED8;
    --school-primary-hover: #1e40af;
    --school-primary-light: #eff6ff;
    --school-primary-border: #bfdbfe;
    --school-secondary: #059669;
    --school-secondary-hover: #047857;
    --school-secondary-light: #ecfdf5;
    --school-secondary-border: #a7f3d0;
    --school-accent: #64748B;
    --school-text-on-primary: #ffffff;
    --school-text-on-secondary: #ffffff;
    --school-badge-bg: #1D4ED8;
    --school-badge-text: #ffffff;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f8f9fa;
    color: #191c1d;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Common Layout Utilities */
.hidden {
    display: none !important;
}

.error-msg {
    color: #ba1a1a;
    font-size: 14px;
    margin-top: 12px;
    text-align: center;
}

/* 1. Passcode Lock Screen */
.gate-container {
    background-color: #f8f9fa;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    z-index: 1000;
}

.gate-card {
    background: #ffffff;
    padding: 32px 24px;
    width: 90%;
    max-width: 400px;
    border-radius: 16px;
    border: 1px solid #e1e3e4;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gate-icon {
    font-size: 44px;
    margin-bottom: 16px;
}

.gate-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: capitalize;
}

.gate-card p {
    font-size: 14px;
    color: #575f69;
    text-align: center;
    margin-bottom: 24px;
}

.gate-card form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gate-card input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 18px;
    border: 1px solid #e1e3e4;
    border-radius: 8px;
    text-align: center;
    letter-spacing: 4px;
    outline: none;
    transition: border-color 0.2s;
    background: #f8f9fa;
}

.gate-card input[type="password"]:focus {
    border-color: var(--school-primary);
    background: #ffffff;
}

/* Buttons and Controls */
.primary-btn {
    background-color: var(--school-primary);
    color: var(--school-text-on-primary);
    border: none;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-btn:hover {
    background-color: var(--school-primary-hover);
}

.secondary-btn {
    background-color: #f1f3f4;
    color: #3c4043;
    border: 1px solid #dadce0;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.secondary-btn:hover {
    background-color: #e8eaed;
}

/* Google OAuth */
.google-signin-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 14px;
}

.google-oauth-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 20px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 24px;
    color: #3c4043;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    min-height: 44px;
}

.google-oauth-link-btn:hover {
    background: #f8fafd;
    border-color: #d2e3fc;
    box-shadow: 0 2px 6px rgba(66, 133, 244, 0.18);
}

/* User Profile Badge */
.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f3f4;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #3c4043;
    font-weight: 500;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 2. Main Chat App Layout */
.app-container {
    background-color: #ffffff;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: 1080px;
    max-height: 940px;
    border-radius: 16px;
    border: 1px solid #e1e3e4;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

@media (max-width: 960px) {
    .app-container {
        border-radius: 0;
        border: none;
        max-height: 100dvh;
        max-width: 100vw;
    }
}

/* Header */
.app-header {
    background-color: #ffffff;
    padding: 12px 18px;
    border-bottom: 1px solid #e1e3e4;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    flex-shrink: 0;
}

.header-logo-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-logo {
    font-size: 28px;
    line-height: 1;
}

.school-theme-badge {
    background: var(--school-badge-bg);
    color: var(--school-badge-text);
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.header-info {
    flex-grow: 1;
    min-width: 0;
}

.header-info h1 {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-subrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    flex-wrap: wrap;
}

.workspace-selector-wrapper, .school-selector-wrapper {
    display: inline-flex;
    align-items: center;
}

.workspace-dropdown, .school-theme-dropdown {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 220px;
    text-overflow: ellipsis;
    height: 26px;
}

.workspace-dropdown:hover, .workspace-dropdown:focus,
.school-theme-dropdown:hover, .school-theme-dropdown:focus {
    border-color: var(--school-primary);
    background: #ffffff;
    box-shadow: 0 0 0 2px var(--school-primary-border);
}

.status-online {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #2e7d32;
}

.status-online .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #2e7d32;
    display: inline-block;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.mobile-menu-btn {
    display: none;
    background: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 16px;
    cursor: pointer;
    color: #3c4043;
    min-height: 40px;
    min-width: 40px;
    align-items: center;
    justify-content: center;
}

@media (max-width: 820px) {
    .mobile-menu-btn {
        display: flex;
    }

    .header-actions {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        background: #ffffff;
        border-bottom: 2px solid var(--school-primary-border);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        z-index: 400;
    }

    .header-actions.mobile-open {
        display: flex;
    }

    .header-actions .dashboard-btn,
    .header-actions .pro-badge-btn,
    .header-actions .logout-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 14px;
        font-size: 13px;
    }

    .header-actions .user-badge {
        max-width: 100%;
        justify-content: center;
    }
}

.dashboard-btn {
    background-color: var(--school-primary);
    color: var(--school-text-on-primary);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.pro-badge-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.pro-badge-btn:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.logout-btn {
    background: none;
    border: 1px solid #e1e3e4;
    color: #575f69;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.logout-btn:hover {
    background-color: #f8f9fa;
    color: #191c1d;
    border-color: #575f69;
}

/* Chat Message Logs Area */
.chat-log {
    flex-grow: 1;
    padding: 16px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background-color: #f8f9fa;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 600px) {
    .chat-log {
        padding: 12px 14px;
        gap: 10px;
    }
}

.message {
    max-width: 84%;
    display: flex;
    flex-direction: column;
}

@media (max-width: 600px) {
    .message {
        max-width: 94%;
    }
}

.message.user-msg {
    align-self: flex-end;
}

.message.bot-msg {
    align-self: flex-start;
}

.message.system-msg {
    align-self: center;
    max-width: 92%;
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14.5px;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.user-msg .message-content {
    background-color: var(--school-secondary);
    color: var(--school-text-on-secondary);
    border-bottom-right-radius: 4px;
}

.bot-msg .message-content {
    background-color: var(--school-primary-light);
    color: #191c1d;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--school-primary-border);
}

.system-msg .message-content {
    background-color: #ffffff;
    color: #575f69;
    border: 1px solid #e1e3e4;
    font-size: 13.5px;
    text-align: center;
}

/* Responsive Table Rendering inside Chat */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 10px 0;
    border-radius: 8px;
    border: 1px solid var(--school-primary-border);
    background: #ffffff;
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 320px;
}

.message-content th, 
.message-content td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--school-primary-border);
    white-space: nowrap;
}

.message-content th {
    background: var(--school-primary-light);
    color: var(--school-primary);
    font-weight: 700;
}

.user-msg .message-content a {
    color: #ffffff;
    text-decoration: underline;
    font-weight: 600;
}

.bot-msg .message-content a {
    color: var(--school-primary);
    text-decoration: none;
    font-weight: 600;
}

.bot-msg .message-content a:hover {
    color: var(--school-secondary);
    text-decoration: underline;
}

.bot-msg .message-content strong,
.bot-msg .message-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--school-primary);
    padding: 2px 5px;
    border-radius: 4px;
}

/* Thinking Indicator */
.thinking-container {
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #f8f9fa;
    border-top: 1px solid #e1e3e4;
}

.thinking-dot {
    width: 6px;
    height: 6px;
    background-color: var(--school-primary);
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.thinking-dot:nth-child(1) { animation-delay: -0.32s; }
.thinking-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

.thinking-text {
    font-size: 12px;
    color: #575f69;
    margin-left: 6px;
}

/* Thought Container Details */
.thought-container {
    background-color: #faf6f7;
    border-left: 3px solid var(--school-primary);
    border-radius: 6px;
    margin: 8px 0 12px 0;
    padding: 10px 14px;
    font-size: 13px;
    color: #575f69;
}

.thought-header {
    font-weight: 700;
    color: var(--school-primary);
    cursor: pointer;
    outline: none;
    user-select: none;
}

.thought-content {
    margin-top: 8px;
    font-style: italic;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Suggestions Bar (Touch Horizontal Scroll) */
.suggestions-bar {
    padding: 10px 18px;
    background-color: #ffffff;
    border-top: 1px solid #e1e3e4;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.suggestions-bar::-webkit-scrollbar {
    display: none;
}

.chip-btn {
    background-color: var(--school-secondary-light);
    color: var(--school-secondary);
    border: 1px solid var(--school-secondary-border);
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    min-height: 36px;
}

.chip-btn:hover {
    background-color: var(--school-secondary);
    color: var(--school-text-on-secondary);
    border-color: var(--school-secondary);
}

/* App Footer / Input Area */
.app-footer {
    background-color: #ffffff;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e1e3e4;
    flex-shrink: 0;
}

.app-footer form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.upload-btn {
    background-color: #f8f9fa;
    border: 1px solid #e1e3e4;
    font-size: 18px;
    padding: 0 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
}

.upload-btn:hover {
    background-color: var(--school-secondary-light);
    border-color: var(--school-secondary);
}

.app-footer input[type="text"] {
    flex-grow: 1;
    padding: 10px 14px;
    font-size: 14.5px;
    border: 1px solid #e1e3e4;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
    min-height: 44px;
}

.app-footer input[type="text"]:focus {
    border-color: var(--school-primary);
    box-shadow: 0 0 0 2px var(--school-primary-border);
}

.send-btn {
    background-color: var(--school-primary);
    color: var(--school-text-on-primary);
    border: none;
    padding: 10px 20px;
    font-size: 14.5px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    min-height: 44px;
    white-space: nowrap;
}

.send-btn:hover {
    background-color: var(--school-primary-hover);
}

/* Drag & Drop Overlay */
.drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.drop-card {
    background: #ffffff;
    padding: 32px 40px;
    border-radius: 16px;
    border: 2px dashed var(--school-primary);
    text-align: center;
    box-shadow: 0 12px 32px rgba(0,0,0,0.15);
    max-width: 90%;
}

.drop-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.drop-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--school-primary);
    margin-bottom: 6px;
}

.drop-card p {
    font-size: 14px;
    color: #575f69;
}

/* Modals & Popups (Fluid & Responsive) */
.modal-container, .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 600;
    padding: 16px;
}

.modal-card {
    background: #ffffff;
    padding: 24px 28px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
    border: 1px solid #e1e3e4;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 600px) {
    .modal-card {
        padding: 18px 16px;
        border-radius: 12px;
    }
}

.wide-modal {
    max-width: 860px !important;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.modal-icon {
    font-size: 24px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #191c1d;
    flex-grow: 1;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    min-height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal-btn:hover {
    color: #1e293b;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.form-group input {
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    min-height: 42px;
}

.form-group input:focus {
    border-color: var(--school-primary);
    box-shadow: 0 0 0 2px var(--school-primary-border);
}

.upload-preview-text {
    font-size: 13px;
    color: var(--school-primary);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 16px;
    word-break: break-all;
    background: var(--school-primary-light);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--school-primary-border);
}

/* Pricing Grid */
.pricing-modal-card {
    max-width: 820px !important;
    background: #0f172a !important;
    color: #f8fafc !important;
}

.pricing-modal-card .modal-header h3 {
    color: #f8fafc !important;
}

.pricing-subtitle {
    font-size: 13.5px;
    color: #94a3b8;
    margin-bottom: 18px;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

@media (max-width: 680px) {
    .pricing-grid {
        grid-template-columns: 1fr;
    }
}

.pricing-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.pro-card {
    border-color: #f59e0b;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
}

.popular-ribbon {
    position: absolute;
    top: -10px;
    right: 14px;
    background: #f59e0b;
    color: #000;
    font-size: 10.5px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.plan-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}

.pro-badge {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.lifetime-badge {
    background: rgba(139, 92, 246, 0.2);
    color: #c084fc;
}

.plan-header h4 {
    font-size: 16px;
    font-weight: 700;
    margin: 8px 0 4px;
}

.plan-price {
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
}

.plan-price .currency {
    font-size: 16px;
    vertical-align: top;
}

.plan-price .period {
    font-size: 12px;
    color: #94a3b8;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 14px 0 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plan-features li {
    font-size: 12.5px;
    color: #cbd5e1;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.4;
}

.plan-features .check-icon {
    color: #10b981;
    font-weight: 800;
}

.plan-btn {
    width: 100%;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
    margin-top: auto;
}

.pro-cta-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: #ffffff !important;
    border: none !important;
}

.pricing-portal-section {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

/* Health Cards Grid */
.health-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin: 14px 0;
}

@media (max-width: 500px) {
    .health-cards-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.health-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.health-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: #64748b;
}

.health-value {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.health-sub {
    font-size: 11px;
    color: #94a3b8;
}

.status-good { color: #16a34a !important; }
.status-warning { color: #d97706 !important; }
.status-neutral { color: #64748b !important; }

.remediation-actions-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 10px 12px;
    border-radius: 8px;
    margin: 14px 0;
}

.actions-bar-title {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    margin-right: 4px;
}

.action-chip-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 36px;
}

.action-chip-btn:hover {
    background: var(--school-primary);
    color: var(--school-text-on-primary);
    border-color: var(--school-primary);
}

.remediation-table-wrapper {
    max-height: 260px;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.remediation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    min-width: 480px;
}

.remediation-table th {
    background: #f8fafc;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.remediation-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}

.status-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
