:root {
    color-scheme: light;
    --bg: #f3f7fb;
    --bg-alt: #fbfdff;
    --surface: rgba(255, 255, 255, 0.72);
    --surface-strong: rgba(255, 255, 255, 0.9);
    --border: rgba(124, 149, 186, 0.14);
    --text: #16253b;
    --muted: #61728b;
    --muted-strong: #435268;
    --primary: #2563eb;
    --primary-strong: #1d4ed8;
    --accent: #14b8a6;
    --danger: #fb7185;
    --warn: #f8c14f;
    --success: #22c55e;
    --shadow: 0 24px 60px rgba(37, 99, 235, 0.12);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --font-display: "Manrope", sans-serif;
    --font-body: "Onest", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.1), transparent 28%),
        radial-gradient(circle at 10% 20%, rgba(20, 184, 166, 0.14), transparent 26%),
        linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    padding: 0 0 calc(9.75rem + env(safe-area-inset-bottom));
}

body[data-page="auth"] {
    padding-bottom: env(safe-area-inset-bottom);
}

body.modal-open {
    overflow: hidden;
}

button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

svg {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-shell {
    position: relative;
}

.app-frame {
    width: min(100%, 420px);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 0;
}

.liquid-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 999px;
    filter: blur(85px);
    opacity: 0.6;
    animation: drift 18s ease-in-out infinite alternate;
}

.blob-cyan {
    width: 18rem;
    height: 18rem;
    top: -3rem;
    right: -5rem;
    background: rgba(20, 184, 166, 0.48);
}

.blob-blue {
    width: 16rem;
    height: 16rem;
    left: -4rem;
    top: 18rem;
    background: rgba(37, 99, 235, 0.42);
    animation-delay: -5s;
}

.blob-red {
    width: 12rem;
    height: 12rem;
    right: -1rem;
    bottom: 9rem;
    background: rgba(251, 113, 133, 0.34);
    animation-delay: -10s;
}

.grid-haze {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(180deg, transparent, black 20%, black 80%, transparent);
}

.glass-panel {
    background: var(--surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 2rem;
    line-height: 1;
    letter-spacing: -0.04em;
}

.page-subtitle {
    margin: 0.4rem 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.avatar-pill,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
}

.avatar-pill {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    box-shadow: 0 12px 28px rgba(22, 37, 59, 0.12);
    font-weight: 700;
}

.icon-button {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
}

.floating-upload {
    position: fixed;
    right: 1rem;
    bottom: calc(5.25rem + env(safe-area-inset-bottom));
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
    width: 3.9rem;
    height: 3.9rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-weight: 800;
    box-shadow: 0 24px 40px rgba(37, 99, 235, 0.24);
    z-index: 40;
}

.floating-upload svg {
    width: 1.35rem;
    height: 1.35rem;
}

.floating-upload span {
    display: none;
}

.bottom-nav {
    position: fixed;
    inset: auto 1rem calc(1rem + env(safe-area-inset-bottom));
    max-width: 420px;
    margin: 0 auto;
    padding: 0.8rem 1rem;
    border-radius: 1.75rem;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem;
    z-index: 30;
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.28rem;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
}

.nav-link svg {
    width: 1.35rem;
    height: 1.35rem;
}

.nav-link.is-active {
    color: var(--primary);
}

.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 80;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(22, 37, 59, 0.42);
}

.modal-card {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: min(100%, 420px);
    transform: translateX(-50%);
    border-radius: 2rem 2rem 0 0;
    padding: 1.25rem 1.25rem calc(1.4rem + env(safe-area-inset-bottom));
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.modal-head h2 {
    margin: 0.2rem 0 0;
    font-family: var(--font-display);
    font-size: 1.55rem;
    line-height: 1;
}

.eyebrow {
    margin: 0;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.consent-card,
.dropzone,
.input-shell,
.upload-tab,
.primary-button,
.secondary-button,
.notice-card,
.stat-card,
.glass-card {
    border-radius: var(--radius-lg);
}

.consent-card {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border);
}

.consent-line {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    color: var(--muted-strong);
    font-size: 0.9rem;
}

.consent-line + .consent-line {
    margin-top: 0.8rem;
}

.consent-line input {
    margin-top: 0.22rem;
}

.upload-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
    margin: 1rem 0;
}

.upload-tab {
    border: 1px solid rgba(124, 149, 186, 0.12);
    background: rgba(255, 255, 255, 0.6);
    color: var(--muted);
    padding: 0.85rem 1rem;
    font-weight: 800;
}

.upload-tab.is-active {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

.upload-pane {
    display: grid;
    gap: 0.95rem;
}

.dropzone,
.input-shell {
    display: grid;
    gap: 0.4rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.82);
    border: 1px dashed rgba(37, 99, 235, 0.22);
}

.dropzone input,
.input-shell input,
.input-shell textarea,
.input-shell select {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
}

.input-shell textarea {
    min-height: 6.25rem;
    resize: vertical;
}

.dropzone-title,
.input-shell span {
    font-weight: 800;
    color: var(--text);
}

.dropzone-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.dropzone-file {
    color: var(--muted-strong);
    font-size: 0.9rem;
    font-weight: 700;
}

.dropzone-hint {
    color: var(--muted);
    font-size: 0.85rem;
}

.primary-button,
.secondary-button {
    border: 0;
    padding: 0.95rem 1.1rem;
    font-weight: 800;
}

.primary-button {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.secondary-button {
    background: rgba(255, 255, 255, 0.86);
    color: var(--text);
    border: 1px solid var(--border);
}

.form-message {
    min-height: 1.25rem;
    margin: 0.9rem 0 0;
    color: var(--muted-strong);
    font-size: 0.88rem;
}

.page-stack {
    display: grid;
    gap: 1rem;
}

.section-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.section-heading h2,
.section-heading h3 {
    margin: 0;
    font-family: var(--font-display);
    letter-spacing: -0.03em;
}

.section-heading p {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.glass-card,
.stat-card,
.notice-card {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.hero-card {
    position: relative;
    overflow: hidden;
    padding: 1.4rem;
    border-radius: var(--radius-xl);
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.65), transparent 32%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(237, 245, 255, 0.84));
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 26px 50px rgba(37, 99, 235, 0.16);
}

.hero-card::after {
    content: "";
    position: absolute;
    inset: auto -2rem -3rem auto;
    width: 9rem;
    height: 9rem;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.18), rgba(20, 184, 166, 0));
    filter: blur(18px);
}

.metric-value {
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 6vw, 4rem);
    line-height: 0.92;
    letter-spacing: -0.06em;
}

.metric-caption {
    color: var(--muted);
    font-size: 0.92rem;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.status-pill,
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.48rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
}

.status-pill.is-success,
.chip.is-success {
    background: rgba(34, 197, 94, 0.14);
    color: #15803d;
}

.status-pill.is-warn,
.chip.is-warn {
    background: rgba(248, 193, 79, 0.18);
    color: #b45309;
}

.status-pill.is-muted,
.chip.is-muted {
    background: rgba(97, 114, 139, 0.1);
    color: var(--muted-strong);
}

.chip.is-active-filter {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.status-pill.is-danger,
.chip.is-danger {
    background: rgba(251, 113, 133, 0.16);
    color: #be123c;
}

.data-grid {
    display: grid;
    gap: 0.85rem;
}

.two-col {
    display: grid;
    gap: 0.85rem;
}

.timeline {
    display: grid;
    gap: 0.9rem;
}

.timeline-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: start;
}

.timeline-dot {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.08);
    margin-top: 0.38rem;
}

.timeline-item h4,
.timeline-item p {
    margin: 0;
}

.list-stack {
    display: grid;
    gap: 0.7rem;
}

.list-row {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.list-row strong {
    display: block;
    font-weight: 800;
}

.list-row small,
.list-row p {
    color: var(--muted);
}

.list-row > :last-child {
    min-width: fit-content;
    white-space: nowrap;
}

.chart-shell {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255,255,255,0.8), rgba(244,248,255,0.7));
    border: 1px solid var(--border);
    padding: 1rem;
}

.progress-track {
    width: 100%;
    height: 0.45rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
    overflow: hidden;
}

.progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

.empty-state {
    padding: 1.25rem;
    text-align: center;
    color: var(--muted-strong);
}

.legal-docs {
    display: grid;
    gap: 0.7rem;
}

.legal-docs a,
.action-row button,
.action-row a {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.action-row {
    display: grid;
    gap: 0.65rem;
}

.table-shell {
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.84);
}

.marker-anchor {
    display: block;
    height: 0;
    scroll-margin-top: 1.25rem;
}

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

.table-shell th,
.table-shell td {
    padding: 0.85rem 0.95rem;
    text-align: left;
    font-size: 0.9rem;
}

.table-shell thead th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.table-shell tbody tr + tr td {
    border-top: 1px solid rgba(124, 149, 186, 0.1);
}

[data-marker-entry].is-targeted-marker {
    outline: 2px solid rgba(37, 99, 235, 0.28);
    outline-offset: 4px;
    background: rgba(219, 234, 254, 0.72);
}

.hidden {
    display: none !important;
}

@keyframes drift {
    from {
        transform: translate3d(0, 0, 0) scale(1);
    }
    to {
        transform: translate3d(-25px, 45px, 0) scale(1.08);
    }
}

@media (min-width: 768px) {
    .app-frame {
        width: min(100%, 980px);
        padding: 2rem 1.5rem 10rem;
    }

    .page-stack {
        gap: 1.2rem;
    }

    .two-col {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .section-heading {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }

    .list-row {
        flex-direction: row;
        gap: 1rem;
    }

    .bottom-nav {
        inset-inline: max(calc(50% - 490px), 1rem);
        max-width: 980px;
        width: calc(100% - 2rem);
    }

    .floating-upload {
        right: max(calc(50% - 455px), 2rem);
        left: auto;
        transform: none;
        bottom: calc(5.75rem + env(safe-area-inset-bottom));
        width: auto;
        height: auto;
        padding: 0.95rem 1.2rem;
        justify-content: flex-start;
    }

    .floating-upload span {
        display: inline;
    }

    .modal-card {
        border-radius: 2rem;
        bottom: 2rem;
    }
}
