@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

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

:root {
    /* Fig palette */
    --primary-color: #DB3E1D;      /* Cinnabar */
    --primary-hover: #C23518;
    --secondary-color: #CABAD7;    /* Lavender Gray */
    --accent-cream: #F7E9DE;       /* Albescent White */
    --accent-dark: #4F364B;        /* Eggplant */
    --success-color: #12b981;
    --danger-color: #ef4444;
    --warning-color: #f3a43b;
    --bg-color: #FDFBF9;
    --card-bg: #ffffff;
    --text-primary: #4F364B;
    --text-secondary: #7A6275;
    --border-color: #E8E0E6;
    --high-color: #DB3E1D;
    --low-color: #8B7BA8;
    --trend-color: #9A8A97;
    --category-bg: #E8DFF0;
    --category-border: #D8CDE3;
    --font-heading: 'DM Sans', system-ui, sans-serif;
    --font-body: 'DM Sans', system-ui, sans-serif;

    /* Landing palette — pastel blue/violet */
    --landing-blue:    #A8C0EC;
    --landing-violet:  #B8A8E0;
    --landing-periwinkle: #8B9FDE;
    --landing-bg:      #F0EFFE;
}

body {
    font-family: var(--font-body);
    background-color: #F4F2FC;  /* very subtle lavender-white — harmonises with landing gradient */
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
}

/* ========== HEADER ========== */
header {
    margin-bottom: 0;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(248, 246, 255, 0.72);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(180, 170, 230, 0.15);
    border-radius: 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    width: 40px;
    height: 40px;
    color: #7B8FE4;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.subtitle {
    display: none;
}

/* ========== AUTH SECTION ========== */
.auth-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.auth-section .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.auth-section .user-email {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.auth-section .sign-out-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.auth-section .sign-out-btn:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

/* Account Dropdown Menu */
.account-dropdown {
    position: relative;
}

.account-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.account-menu-btn:hover {
    border-color: var(--primary-color);
    background: rgba(229, 85, 47, 0.05);
}

.account-avatar {
    width: 32px;
    height: 32px;
    background: var(--secondary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-brown);
    font-weight: 600;
    font-size: 0.9rem;
}

.account-menu-btn svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.account-dropdown.open .account-menu-btn svg {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(61, 31, 14, 0.12);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 100;
}

.account-dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-email {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-all;
}

.dropdown-items {
    padding: 0.5rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--accent-cream);
}

.dropdown-item svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.dropdown-item.danger {
    color: var(--danger-color);
}

.dropdown-item.danger svg {
    color: var(--danger-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.auth-section .sign-in-btn {
    padding: 0.6rem 1.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: linear-gradient(135deg, #7B8FE4 0%, #9B78D4 100%);
    border: none;
    border-radius: 50px;
    color: white;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 12px rgba(130, 120, 210, 0.30);
}

.auth-section .sign-in-btn:hover {
    background: linear-gradient(135deg, #6B7FD4 0%, #8B68C4 100%);
    box-shadow: 0 4px 18px rgba(130, 120, 210, 0.45);
    transform: translateY(-1px);
}

h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

h2,
h3,
h4 {
    font-family: var(--font-heading);
}

/* ========== LANDING PAGE - Editorial Style ========== */
.landing-page {
    display: flex;
    flex-direction: column;
    position: relative;
    /* Gradient mesh — warm rose (near image) → cool lavender (left) */
    background:
        radial-gradient(ellipse 60% 55% at 80% 40%, rgba(248, 218, 228, 0.50) 0%, transparent 55%),
        radial-gradient(ellipse 70% 60% at 15% 15%, rgba(168, 196, 240, 0.50) 0%, transparent 52%),
        radial-gradient(ellipse 55% 55% at 50% 80%, rgba(200, 188, 240, 0.35) 0%, transparent 50%),
        radial-gradient(ellipse 40% 40% at 75% 75%, rgba(240, 220, 232, 0.30) 0%, transparent 50%),
        linear-gradient(155deg, #EDEAFD 0%, #EFF0FD 40%, #F8EEF4 75%, #F4ECFA 100%);
    min-height: 100vh;
}

/* Matte grain overlay — gives the "film grain" texture from design references */
.landing-page::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.045;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}

.landing-page.hidden {
    display: none;
}

/* ── Hero ── */
.landing-hero {
    position: relative;
    z-index: 1;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    text-align: left;
    padding: 4rem 2rem 4rem 5%;
    gap: 0;
}

/* floating orbs — pastel blue / lavender / periwinkle */
.landing-orbs {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.75;
}

/* Large periwinkle-blue — top-right anchor */
.orb-1 {
    width: 640px;
    height: 640px;
    background: radial-gradient(circle,
        rgba(168, 196, 244, 0.95) 0%,
        rgba(196, 216, 252, 0.45) 52%,
        transparent 100%);
    top: -18%;
    right: -10%;
    animation: floatOrb 18s ease-in-out infinite;
}

/* Soft lilac/violet — bottom-left */
.orb-2 {
    width: 480px;
    height: 480px;
    background: radial-gradient(circle,
        rgba(188, 168, 236, 0.85) 0%,
        rgba(212, 200, 252, 0.30) 55%,
        transparent 100%);
    bottom: -8%;
    left: -4%;
    opacity: 0.68;
    animation: floatOrb 24s ease-in-out infinite reverse;
}

/* Ice-blue — mid left */
.orb-3 {
    width: 340px;
    height: 340px;
    background: radial-gradient(circle,
        rgba(200, 220, 252, 0.90) 0%,
        rgba(176, 204, 248, 0.28) 55%,
        transparent 100%);
    top: 32%;
    left: 10%;
    opacity: 0.60;
    animation: floatOrb 28s ease-in-out infinite 4s;
}

/* Pale violet — centre-top accent */
.orb-4 {
    width: 260px;
    height: 260px;
    background: radial-gradient(circle,
        rgba(220, 208, 254, 0.88) 0%,
        rgba(196, 180, 244, 0.22) 55%,
        transparent 100%);
    top: 12%;
    left: 38%;
    opacity: 0.50;
    animation: floatOrb 21s ease-in-out infinite 9s;
}

@keyframes floatOrb {
    0%, 100% { transform: translate(0,   0)   scale(1.00); }
    33%       { transform: translate(28px, -38px) scale(1.04); }
    66%       { transform: translate(-18px, 22px) scale(0.96); }
}

/* ── 3D Hero Visual — large, offset right, behind text ── */
.hero-visual {
    position: absolute;
    z-index: 1;
    width: 700px;
    max-width: 62vw;
    height: auto;
    top: 50%;
    right: -2%;
    transform: translateY(-48%);
    pointer-events: none;
    user-select: none;
    filter: saturate(1.08) brightness(1.02);
    animation: floatVisual 18s ease-in-out infinite;
}

@keyframes floatVisual {
    0%, 100% { transform: translateY(-48%) scale(1); }
    50%      { transform: translateY(-50%) scale(1.02); }
}

/* ── Glass card for text ── */
.landing-text {
    position: relative;
    z-index: 2;
    max-width: 520px;
    margin: 0;
    padding: 3rem 2.5rem;
    /* Glassmorphism — no visible border lines */
    background: rgba(248, 246, 255, 0.48);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: none;
    border-radius: 28px;
    box-shadow: 0 12px 48px rgba(100, 90, 180, 0.05);
}

.landing-text h2 {
    font-family: var(--font-heading);
    font-size: 4rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.08;
    margin-bottom: 1.25rem;
    letter-spacing: -0.03em;
}

.landing-text h2 span {
    background: linear-gradient(130deg, #6E7ED8 0%, #A07CC8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-description {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    line-height: 1.7;
    max-width: 420px;
    margin-left: 0;
    margin-right: 0;
}

.landing-cta-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.landing-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2.25rem;
    font-size: 1.05rem;
    font-weight: 600;
    background: linear-gradient(135deg, #7B8FE4 0%, #9B78D4 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.28s ease;
    width: fit-content;
    box-shadow: 0 4px 22px rgba(130, 120, 210, 0.40),
                inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.landing-cta:hover {
    background: linear-gradient(135deg, #6B7FD4 0%, #8B68C4 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(130, 120, 210, 0.52),
                inset 0 1px 0 rgba(255, 255, 255, 0.20);
}

.landing-signin {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.landing-signin .link-btn {
    font-size: 0.9rem;
    color: #7B8FE4;
    font-weight: 600;
}

/* hide the old visual column — orbs replace it */
.landing-visual {
    display: none;
}

.gradient-blob {
    display: none;
}

/* Features Section */
.landing-features-section {
    position: relative;
    z-index: 1;
    padding: 4rem 2rem 6rem;
    border-top: 1px solid rgba(180, 170, 235, 0.18);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    max-width: 920px;
    margin: 0 auto;
}

/* ── Matte glass cards ── */
.feature-item {
    text-align: center;
    padding: 2rem 1.5rem;
    background: rgba(236, 234, 255, 0.52);   /* subtle lavender tint */
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.80);
    border-radius: 22px;
    box-shadow:
        0 2px 20px rgba(120, 110, 200, 0.09),
        0 1px 4px  rgba(100, 100, 180, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
    background: rgba(242, 240, 255, 0.62);
    box-shadow:
        0 10px 36px rgba(120, 110, 200, 0.16),
        0 2px 10px  rgba(100, 100, 180, 0.09),
        inset 0 1px 0 rgba(255, 255, 255, 0.70);
}

.feature-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 1rem;
    color: #8B9FDE;
    opacity: 0.90;
}

.feature-item h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.feature-item p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ========== APP CONTENT ========== */
.app-content.hidden {
    display: none;
}

/* Upload Section - Elegant Design */
.upload-section {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: stretch;
}

.upload-box {
    flex: 1;
    position: relative;
}

#pdfUpload {
    display: none;
}

.upload-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 100%;
}

.upload-label.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.upload-label:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(229, 85, 47, 0.1);
}

.upload-label svg {
    color: var(--primary-color);
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.upload-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.upload-label span {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-label small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.secondary-btn {
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(180, 170, 230, 0.30);
    border-radius: 50px;
    font-size: 0.9rem;
    font-family: var(--font-body);
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.secondary-btn:hover {
    border-color: #8B9FDE;
    color: #6E7ED8;
    background: rgba(240, 238, 255, 0.70);
}

.secondary-btn.danger-outline {
    color: var(--text-secondary);
}

.secondary-btn.danger-outline:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.05);
}

.upload-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.upload-status.hidden {
    display: none;
}

.upload-status-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.upload-status-title {
    font-weight: 600;
    color: var(--text-primary);
}

.upload-status-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.upload-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
}

.upload-status.success .upload-spinner {
    animation: none;
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.primary-btn {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #7B8FE4 0%, #9B78D4 100%);
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-family: var(--font-body);
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn:hover {
    background: linear-gradient(135deg, #6B7FD4 0%, #8B68C4 100%);
    box-shadow: 0 4px 18px rgba(130, 120, 210, 0.35);
    transform: translateY(-1px);
}

/* Settings Section */
.settings-section {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.settings-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.parser-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.parser-toggle label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.parser-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.icon-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.info-box {
    background: var(--accent-cream);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.info-box p {
    margin-bottom: 0.5rem;
}

.info-box ol {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.info-box li {
    margin-bottom: 0.25rem;
}

.info-box a {
    color: var(--primary-color);
    text-decoration: none;
}

.info-box a:hover {
    text-decoration: underline;
}

/* Filter Section */
.filter-section {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.filter-group select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    min-width: 200px;
}

.toggle-group {
    gap: 0.75rem;
}

.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 46px;
    height: 24px;
}

.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: var(--border-color);
    border-radius: 999px;
    transition: background-color 0.2s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

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

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

/* ========== TABLE ========== */
.table-container {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    max-height: none;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
}

/* Table Header */
thead {
    position: sticky;
    top: 0;
    z-index: 20;
    background: white;
}

thead tr {
    background: var(--category-bg);
}

th {
    padding: 0.75rem 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--category-border);
    text-align: center;
    white-space: nowrap;
    font-size: 0.8rem;
}

th.biomarker-col {
    position: sticky;
    left: 0;
    z-index: 21;
    background: var(--category-bg);
    text-align: left;
    min-width: 200px;
    max-width: 200px;
    padding-left: 1rem;
}

th.range-col {
    text-align: left;
    min-width: 100px;
    font-size: 0.75rem;
    padding-left: 0.5rem;
}

th.trend-col {
    text-align: center;
    min-width: 110px;
    max-width: 110px;
}

th.date-col {
    min-width: 70px;
    max-width: 70px;
    font-size: 0.7rem;
    padding: 0.5rem 0.25rem;
    line-height: 1.3;
}

th.date-col .date-year {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 500;
}

th.date-col.year-divider {
    border-left: 2px solid var(--category-border);
}

/* Table Body */
tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

tbody tr:hover {
    background: #faf7f4;
}

tbody tr.category-row {
    background: var(--category-bg);
    font-weight: 700;
    color: var(--text-primary);
}

tbody tr.category-row td {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    border-top: 2px solid var(--category-border);
}

tbody tr.category-row td:first-child {
    cursor: pointer;
    user-select: none;
}

tbody tr.category-row td:first-child::before {
    content: '▼ ';
    display: inline-block;
    transition: transform 0.3s;
    font-size: 0.7rem;
    margin-right: 0.5rem;
}

tbody tr.category-row.collapsed td:first-child::before {
    transform: rotate(-90deg);
}

td {
    padding: 0.5rem;
    color: var(--text-primary);
}

td.biomarker-col {
    position: sticky;
    left: 0;
    z-index: 10;
    background: white;
    text-align: left;
    font-weight: 500;
    padding-left: 1rem;
    min-width: 200px;
    max-width: 200px;
    font-size: 0.85rem;
}

tbody tr:hover td.biomarker-col {
    background: #faf7f4;
}

tbody tr.category-row td.biomarker-col {
    background: var(--category-bg);
}

td.range-col {
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.75rem;
    white-space: nowrap;
    padding-left: 0.5rem;
}

td.trend-col {
    text-align: center;
    min-width: 110px;
    max-width: 110px;
}

.sparkline {
    width: 90px;
    height: 26px;
}

.sparkline path {
    stroke: var(--trend-color);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sparkline circle {
    fill: var(--trend-color);
}

.sparkline-empty {
    color: var(--text-secondary);
}

td.value-cell {
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    min-width: 70px;
    max-width: 70px;
    padding: 0.5rem 0.25rem;
}

td.value-cell.high {
    background: #FDEEE8;
    color: var(--high-color);
}

td.value-cell.low {
    background: #F0EBF5;
    color: var(--low-color);
}

td.value-cell.empty {
    color: #cbd5e1;
    font-weight: 400;
}

td.value-cell.year-divider {
    border-left: 2px solid var(--category-border);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 3rem;
}

/* ========== MODALS ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    /* Cool purple-tinted overlay matching the landing palette */
    background:
        radial-gradient(ellipse at 30% 20%, rgba(168, 196, 240, 0.18) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(188, 168, 236, 0.15) 0%, transparent 50%),
        rgba(40, 32, 68, 0.48);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Matte glass modal card ── */
.modal-content {
    background: rgba(244, 242, 255, 0.72);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 2.5rem;
    border-radius: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.80);
    box-shadow:
        0 24px 64px rgba(60, 50, 120, 0.22),
        0 4px 16px rgba(60, 50, 120, 0.10),
        inset 0 1px 0 rgba(255, 255, 255, 0.70);
}

.close {
    float: right;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.close:hover {
    color: var(--text-primary);
    background: rgba(120, 110, 200, 0.10);
}

/* Auth Modal Specific Styles */
.auth-modal-content {
    max-width: 420px;
}

.auth-form h2 {
    margin-bottom: 0.5rem;
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: var(--danger-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.auth-success {
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #047857;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.auth-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.link-btn {
    background: none;
    border: none;
    color: #7B8FE4;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.25rem;
    font-family: var(--font-body);
}

.link-btn:hover {
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(180, 170, 230, 0.28);
}

.auth-divider span {
    padding: 0 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.magic-link-btn {
    width: 100%;
    justify-content: center;
}

.auth-form.hidden {
    display: none;
}

/* Not authenticated state */
.not-authenticated-notice {
    background: var(--accent-cream);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.not-authenticated-notice p {
    color: var(--accent-brown);
    font-size: 0.95rem;
    margin: 0;
}

.not-authenticated-notice .sign-in-prompt-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.not-authenticated-notice .sign-in-prompt-btn:hover {
    background: var(--primary-hover);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid rgba(180, 170, 230, 0.30);
    border-radius: 14px;
    font-size: 1rem;
    font-family: var(--font-body);
    background: rgba(255, 255, 255, 0.60);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #8B9FDE;
    background: rgba(255, 255, 255, 0.80);
    box-shadow: 0 0 0 3px rgba(123, 143, 228, 0.14);
}

.form-group input::placeholder {
    color: #A8A0C0;
}

/* Health data consent checkbox */
.health-consent {
    margin: 1.25rem 0 0.5rem;
    padding: 1rem 1.25rem;
    background: rgba(235, 232, 255, 0.50);
    border: 1px solid rgba(180, 170, 230, 0.25);
    border-radius: 14px;
}

.consent-label {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.consent-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: #7B8FE4;
    cursor: pointer;
}

.consent-label a {
    color: #7B8FE4;
    font-weight: 600;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.form-actions button {
    flex: 1;
}

/* Delete Account Modal */
.delete-modal-content {
    max-width: 450px;
}

.delete-modal-content h2 {
    color: #dc2626;
}

.delete-warning {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.delete-list {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.delete-list li {
    margin-bottom: 0.5rem;
}

.delete-confirm-text {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

#deleteConfirmInput {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1rem;
}

#deleteConfirmInput:focus {
    outline: none;
    border-color: #dc2626;
}

.danger-btn {
    padding: 0.6rem 1.2rem;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.danger-btn:hover {
    background: #fecaca;
    border-color: #f87171;
}

.danger-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== FOOTER ========== */
.site-footer {
    margin-top: 3rem;
    padding: 1.5rem 2rem;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
}

.footer-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer-brand {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-primary);
}

.footer-copyright {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-security {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
    th.date-col,
    td.value-cell {
        min-width: 65px;
        max-width: 65px;
        font-size: 0.7rem;
        padding: 0.5rem 0.15rem;
    }

    th.trend-col,
    td.trend-col {
        min-width: 90px;
        max-width: 90px;
    }
}

@media (max-width: 968px) {
    .landing-hero {
        min-height: 70vh;
        padding: 5rem 1.5rem 4rem;
    }

    .landing-text h2 {
        font-size: 2.8rem;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .orb-1 { width: 420px; height: 420px; }
    .orb-2 { width: 300px; height: 300px; }
    .orb-3 { width: 230px; height: 230px; }
    .orb-4 { width: 180px; height: 180px; }

    .hero-visual { width: 520px; right: -6%; }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .upload-section {
        flex-direction: column;
    }

    .upload-status {
        width: 100%;
    }

    .filter-section {
        flex-direction: column;
        align-items: flex-start;
    }

    th.biomarker-col,
    td.biomarker-col {
        min-width: 150px;
        max-width: 150px;
        font-size: 0.75rem;
    }

    th.trend-col,
    td.trend-col {
        min-width: 80px;
        max-width: 80px;
    }

    th.date-col,
    td.value-cell {
        min-width: 60px;
        max-width: 60px;
        font-size: 0.65rem;
    }

    th, td {
        padding: 0.5rem 0.25rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .landing-text h2 {
        font-size: 2rem;
    }

    .hero-visual {
        width: 380px;
        right: -8%;
        top: 15%;
        transform: translateY(0);
    }

    .landing-hero {
        align-items: center;
        text-align: center;
        min-height: auto;
        padding: 3rem 1.5rem 2rem;
    }

    .landing-text {
        max-width: 100%;
        padding: 2rem 1.5rem;
    }

    .landing-cta-group {
        align-items: center;
    }

    .landing-description {
        max-width: 100%;
    }
}

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

.hidden {
    display: none !important;
}
