:root {
    --primary: #3E4B5A;
    --primary-light: #5A6A7A;
    --accent: #7DD3DD;
    --accent-light: #A8E4EB;
    --coral: #F5A5A0;
    --coral-light: #FAC9C6;
    --mint: #9EDEC2;
    --mint-light: #C4EDD9;
    --lavender: #D8B4C8;
    --lavender-light: #E8D0DD;
    --success: #9EDEC2;
    --success-bg: #f0fdf7;
    --error: #F5A5A0;
    --error-bg: #fef5f5;
    --text-dark: #3E4B5A;
    --text-medium: #5A6A7A;
    --text-light: #8A9AAA;
    --border: #E8EDF2;
    --bg-light: #F8FAFC;
    --bg-white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(62,75,90,0.06);
    --shadow-md: 0 4px 12px rgba(62,75,90,0.08);
    --shadow-lg: 0 10px 40px rgba(62,75,90,0.12);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 15px;
}

.navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.15em;
}

.nav-brand-logo {
    height: 36px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.nav-link {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.nav-link.active {
    color: white;
    background: rgba(255,255,255,0.15);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    flex: 1;
}

.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header-logo {
    max-width: 420px;
    height: auto;
    margin-bottom: 1rem;
}

.header h1 {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.subtitle {
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 400;
}

.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.card h2 {
    color: var(--text-dark);
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
    font-weight: 600;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: var(--success-bg);
    color: #2d8659;
    border: 1px solid var(--mint);
}

.alert-success::before {
    content: "✓";
    font-weight: 700;
}

.alert-error {
    background: var(--error-bg);
    color: #c54040;
    border: 1px solid var(--coral);
}

.alert-error::before {
    content: "!";
    font-weight: 700;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

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

.form-grid-highlight {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    background: linear-gradient(135deg, #e8f4f8 0%, #f0f9fb 100%);
    border: 2px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(125, 211, 221, 0.15);
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    color: var(--text-medium);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-group input,
.form-group select {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: var(--bg-white);
    color: var(--text-dark);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(125, 211, 221, 0.2);
}

.form-group input::placeholder {
    color: var(--text-light);
}

.file-group {
    flex: 2;
}

.file-group input[type="file"] {
    padding: 0.5rem;
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--text-medium);
    padding: 0.375rem 0.75rem;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.checkbox-label:hover {
    border-color: var(--accent);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.btn {
    padding: 0.625rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #6BC5D0 100%);
    color: var(--text-dark);
    font-weight: 600;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6BC5D0 0%, var(--accent) 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-block {
    width: 100%;
    padding: 0.75rem 1.5rem;
}

.form-input {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text-dark);
    background: var(--bg-white);
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(125, 211, 221, 0.15);
}

.form-input::placeholder {
    color: var(--text-light);
}

.error-message {
    color: #dc3545;
    background: #fff5f5;
    border: 1px solid #f5c6cb;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 0;
}

.help-text {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: 1rem;
}

.results-section {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-subtitle {
    color: var(--text-light);
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}

.graph-toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.graph-toggle {
    display: inline-flex;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.25rem;
    gap: 0.25rem;
}

.graph-toggle .toggle-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-medium);
    cursor: pointer;
    transition: all 0.2s ease;
}

.graph-toggle .toggle-btn:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.graph-toggle .toggle-btn.active {
    background: var(--primary);
    color: white;
}

.graph-container {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: var(--radius-md);
}

.graph-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    border: none;
    outline: none;
    box-shadow: none;
}

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.table,
table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td,
table th,
table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.table th,
table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-medium);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table tr:last-child td,
table tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover,
table tbody tr:hover {
    background: var(--bg-light);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--coral-light) 0%, var(--lavender-light) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.empty-state h3 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.empty-state p {
    color: var(--text-light);
    max-width: 400px;
    margin: 0 auto;
}

.empty-message {
    color: var(--text-light);
    text-align: center;
    padding: 2rem;
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.settings-section {
    margin-bottom: 2rem;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.setting-label {
    font-weight: 600;
    color: var(--text-dark);
}

.setting-desc {
    font-size: 0.85rem;
    color: var(--text-light);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--accent);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--mint-light) 100%);
    color: var(--text-dark);
    padding: 0.375rem 0.875rem;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
}

.two-column {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .two-column {
        grid-template-columns: 1fr;
    }
}

/* Mobile-first responsive improvements */

/* Small tablets and large phones */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    
    .nav-container {
        flex-direction: column;
        gap: 0.5rem;
        height: auto;
        padding: 0.75rem 1rem;
    }
    
    .nav-brand {
        font-size: 1.1rem;
        gap: 0.5rem;
    }
    
    .nav-brand-logo {
        height: 28px;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .container {
        padding: 1.25rem 0.75rem;
    }
    
    .header {
        margin-bottom: 1.5rem;
    }
    
    .header h1 {
        font-size: 1.4rem;
        letter-spacing: 0.05em;
    }
    
    .header-logo {
        max-width: 280px;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .card {
        padding: 1.25rem 1rem;
        margin-bottom: 1rem;
        border-radius: var(--radius-md);
    }
    
    .card h2 {
        font-size: 1rem;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-group label {
        font-size: 0.85rem;
    }
    
    .form-group input,
    .form-group select {
        padding: 0.75rem 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .checkbox-group {
        gap: 0.5rem;
    }
    
    .checkbox-label {
        padding: 0.5rem 0.625rem;
        font-size: 0.85rem;
        min-height: 44px;
    }
    
    .checkbox-label input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }
    
    .options-group .checkbox-label {
        padding: 0.625rem 0.75rem;
    }
    
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
        min-height: 44px; /* Touch target size */
    }
    
    .btn-block {
        padding: 0.875rem 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .disclaimer-box {
        padding: 0.875rem 1rem;
        margin-top: 0.75rem;
    }
    
    .disclaimer-box p {
        font-size: 0.85rem;
        line-height: 1.4;
    }
    
    .table-container {
        margin: 0 -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .table th,
    .table td,
    table th,
    table td {
        padding: 0.625rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .table th,
    table th {
        font-size: 0.7rem;
    }
    
    .graph-toggle {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .graph-toggle .toggle-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        min-height: 44px;
    }
    
    .tab-buttons {
        gap: 0.375rem;
    }
    
    .tab-btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.85rem;
        flex: 1;
        min-width: 0;
        text-align: center;
        min-height: 44px;
    }
    
    .tab-panels {
        padding: 0.75rem;
    }
    
    .stats-note {
        padding: 0.875rem;
        margin-top: 1rem;
    }
    
    .stats-note strong {
        font-size: 0.9rem;
    }
    
    .stats-note li {
        font-size: 0.8rem;
    }
    
    .results-subtitle {
        font-size: 0.9rem;
    }
    
    .empty-state {
        padding: 2.5rem 1.5rem;
    }
    
    .empty-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .empty-state h3 {
        font-size: 1.1rem;
    }
    
    .empty-state p {
        font-size: 0.9rem;
    }
    
    .footer {
        padding: 1rem;
        font-size: 0.8rem;
    }
    
    .searchable-select .search-input {
        padding: 0.75rem 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .searchable-select .search-dropdown {
        max-height: 200px;
    }
    
    .searchable-select .search-option {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    .dataset-item {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .dataset-year {
        font-size: 1rem;
        min-width: auto;
    }
    
    .dataset-info {
        flex: 1 1 100%;
        order: 3;
        font-size: 0.85rem;
    }
    
    .delete-form {
        margin-left: auto;
    }
    
    .upload-form {
        padding: 1rem;
    }
    
    .help-text {
        font-size: 0.75rem;
    }
    
    .login-card {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .login-card h2 {
        font-size: 1.25rem;
    }
    
    .interpretation-text {
        font-size: 0.9rem;
        line-height: 1.7;
    }
    
    .terms-modal {
        max-height: 95vh;
        margin: 0.5rem;
    }
    
    .terms-modal h2 {
        font-size: 1.25rem;
        padding: 1rem 1rem 0.5rem;
    }
    
    .terms-updated {
        padding: 0 1rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .terms-content {
        padding: 1rem;
        font-size: 0.85rem;
    }
    
    .terms-accept {
        padding: 1rem;
    }
    
    .terms-checkbox-label {
        font-size: 0.9rem;
    }
}

/* Extra small phones */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .nav-container {
        padding: 0.625rem 0.75rem;
    }
    
    .nav-brand {
        font-size: 1rem;
    }
    
    .nav-brand-logo {
        height: 24px;
    }
    
    .nav-links {
        gap: 0.125rem;
    }
    
    .nav-link {
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .container {
        padding: 1rem 0.625rem;
    }
    
    .header h1 {
        font-size: 1.2rem;
    }
    
    .header-logo {
        max-width: 220px;
    }
    
    .card {
        padding: 1rem 0.75rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .tab-buttons {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        padding: 0.5rem 0.625rem;
        font-size: 0.8rem;
    }
    
    .graph-toggle .toggle-btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }
    
    .disclaimer-box {
        padding: 0.75rem;
    }
    
    .disclaimer-box p {
        font-size: 0.8rem;
    }
    
    .form-description {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td,
    table th,
    table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }
    
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
}

.footer {
    background: var(--primary);
    color: rgba(255,255,255,0.8);
    text-align: center;
    padding: 1.5rem 2rem;
    margin-top: auto;
    font-size: 0.9rem;
}

.footer-main {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.footer a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
}

.footer a:hover {
    color: white;
    text-decoration: underline;
}

.footer-contact-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    font-family: inherit;
}

.footer-contact-btn:hover {
    color: white;
    text-decoration: underline;
}

.contact-section {
    margin-top: 0.75rem;
}

.contact-section form {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
}

.contact-section input[type="text"] {
    width: 280px;
    padding: 0.4rem 0.75rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.1);
    color: white;
    font-family: inherit;
    font-size: 0.85rem;
}

.contact-section input[type="text"]::placeholder {
    color: rgba(255,255,255,0.5);
}

.contact-section input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-send {
    padding: 0.4rem 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-send:hover {
    background: #6bc4ce;
}

.contact-success {
    color: var(--accent);
    font-weight: 500;
    margin-top: 0.5rem;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.contact-modal {
    padding: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-dark);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-dark);
}

.contact-modal form {
    padding: 1.5rem;
}

.contact-modal .form-group {
    margin-bottom: 1rem;
}

.contact-modal label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.contact-modal input,
.contact-modal textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
}

.contact-modal input:focus,
.contact-modal textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.contact-modal textarea {
    resize: vertical;
    min-height: 100px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-secondary {
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--border);
    background: var(--bg-white);
    color: var(--text-dark);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-secondary:hover {
    background: var(--bg-light);
}

.success-message {
    text-align: center;
    padding: 2rem;
}

.success-message svg {
    margin-bottom: 1rem;
}

.success-message p {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.logout-link {
    color: var(--coral) !important;
    background: rgba(245, 165, 160, 0.1);
}

.logout-link:hover {
    background: rgba(245, 165, 160, 0.2) !important;
    color: #fff !important;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-card {
    max-width: 380px;
    width: 100%;
    padding: 2.5rem;
}

.login-card h2 {
    text-align: center;
    border-bottom: none;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    padding-bottom: 0;
}

.login-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-help {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.login-help a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.login-help a:hover {
    text-decoration: underline;
    color: #6BC5D0;
}

.upload-section {
    background: linear-gradient(135deg, var(--bg-white) 0%, var(--bg-light) 100%);
}

.upload-form {
    background: var(--bg-white);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 2px dashed var(--border);
    transition: border-color 0.2s ease;
}

.upload-form:hover {
    border-color: var(--accent);
}

.dataset-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dataset-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.dataset-year {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-dark);
    min-width: 60px;
}

.dataset-info {
    color: var(--text-light);
    font-size: 0.9rem;
    flex: 1;
}

.delete-form {
    margin: 0;
}

.btn-danger {
    background: linear-gradient(135deg, var(--coral) 0%, #E89590 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #E89590 0%, var(--coral) 100%);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.form-description {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.stats-note {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--mint-light) 50%, var(--lavender-light) 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent);
}

.stats-note strong {
    color: var(--text-dark);
    display: block;
    margin-bottom: 0.5rem;
}

.stats-note ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.stats-note li {
    color: var(--text-medium);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    padding-left: 0;
}

.stats-note li strong {
    display: inline;
    color: var(--text-dark);
    margin-bottom: 0;
}

.chart-tabs {
    margin: 1.5rem 0;
}

.tab-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.625rem 1.25rem;
    border: 2px solid var(--border);
    background: var(--bg-white);
    color: var(--text-medium);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-btn:hover {
    background: var(--bg-light);
    border-color: var(--accent);
    color: var(--primary);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--accent) 0%, #6BC5D0 100%);
    border-color: var(--accent);
    color: var(--text-dark);
    font-weight: 600;
}

.tab-panels {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.tab-panel img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

.terms-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(62, 75, 90, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.terms-modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(62, 75, 90, 0.3);
}

.terms-modal h2 {
    padding: 1.5rem 1.5rem 0.5rem;
    margin: 0;
    color: var(--text-dark);
    font-size: 1.5rem;
}

.terms-updated {
    padding: 0 1.5rem 1rem;
    margin: 0;
    color: var(--text-light);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.terms-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-medium);
}

.terms-content h3 {
    color: var(--text-dark);
    font-size: 1rem;
    margin: 1.5rem 0 0.75rem;
}

.terms-content h3:first-child {
    margin-top: 0;
}

.terms-content p {
    margin: 0.5rem 0;
}

.terms-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.terms-content li {
    margin: 0.4rem 0;
}

.terms-accept {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-light);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.terms-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.terms-checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
    cursor: pointer;
    accent-color: var(--accent);
}

.terms-accept .btn {
    width: 100%;
}

.terms-accept .btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    opacity: 0.6;
}

.disclaimer-box {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-left: 4px solid var(--coral);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-top: 1rem;
    text-align: left;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.disclaimer-box p {
    color: var(--text-medium);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0.4rem 0;
}

.disclaimer-box p:first-child {
    margin-top: 0;
    color: var(--text-dark);
    font-weight: 500;
}

.disclaimer-box p:last-child {
    margin-bottom: 0;
}

.options-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.options-group .checkbox-label {
    background: var(--bg-light);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.searchable-select {
    position: relative;
}

.searchable-select .search-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    background: #ffffff;
    color: var(--text-dark);
    cursor: text;
}

.searchable-select .search-input::placeholder {
    color: var(--text-dark);
    opacity: 1;
}

.searchable-select .search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(125, 211, 221, 0.15);
}

.searchable-select .search-input.has-value {
    background: var(--bg-light);
}

.searchable-select .search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background-color: #ffffff;
    border: 1px solid var(--accent);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: 0 8px 24px rgba(62, 75, 90, 0.2);
    z-index: 9999;
    display: none;
}

.searchable-select.open {
    position: relative;
    z-index: 9999;
}

.searchable-select.open .search-dropdown {
    display: block;
}

.searchable-select .search-option {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--bg-light);
    background-color: #ffffff;
}

.searchable-select .search-option:last-child {
    border-bottom: none;
}

.searchable-select .search-option:hover,
.searchable-select .search-option.highlighted {
    background: var(--accent);
    color: var(--text-dark);
}

.searchable-select .search-option.hidden {
    display: none;
}

.searchable-select .no-results {
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* Interpretation Section */
.interpretation-prompt {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-medium);
    margin-bottom: 1rem;
}

.interpretation-text {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-dark);
    margin-bottom: 0;
}

#interpretation-loading .interpretation-text,
#analysis-interpretation-loading .interpretation-text {
    color: var(--text-medium);
    font-style: italic;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(62, 75, 90, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    text-align: center;
    color: #ffffff;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    letter-spacing: 0.5px;
}

/* Daily Chart for Usage Metrics */
.daily-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 120px;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
}

.day-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 60px;
    height: 100%;
}

.bar-fill {
    width: 30px;
    background: linear-gradient(180deg, var(--accent) 0%, #9EDEC2 100%);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    margin-bottom: 0.5rem;
    transition: height 0.3s ease;
}

.bar-label {
    font-size: 0.75rem;
    color: var(--text-medium);
    font-weight: 500;
}

.bar-value {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* Contact Messages */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-item {
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    border: 1px solid var(--border);
}

.message-item.unread {
    background: #fffbf5;
    border-color: #f0e4c8;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.message-header strong {
    color: var(--text-dark);
}

.message-email {
    color: var(--text-medium);
    font-size: 0.85rem;
}

.message-time {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-left: auto;
}

.message-text {
    color: var(--text-medium);
    margin: 0;
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.5;
}

.btn-mark-read {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.btn-mark-read:hover {
    background: #6bc4ce;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.badge-coral {
    background: var(--coral);
    color: white;
}
