:root {
    --bg: #f4f7fb;
    --bg-accent: #d9f3ef;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #ffffff;
    --surface-soft: rgba(239, 244, 250, 0.88);
    --text: #10233d;
    --muted: #5d6b81;
    --accent: #0f766e;
    --accent-strong: #0b5d67;
    --accent-soft: rgba(15, 118, 110, 0.12);
    --secondary: #f59e0b;
    --secondary-soft: rgba(245, 158, 11, 0.14);
    --danger: #dc2626;
    --success: #047857;
    --border: rgba(16, 35, 61, 0.1);
    --shadow: 0 24px 70px rgba(16, 35, 61, 0.12);
    --radius-lg: 28px;
    --radius-md: 20px;
    --radius-sm: 14px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.18), transparent 32%),
        radial-gradient(circle at top right, rgba(245, 158, 11, 0.16), transparent 26%),
        linear-gradient(180deg, #f8fbff 0%, #eef3f8 100%);
}

img,
svg {
    max-width: 100%;
    vertical-align: top;
}

button,
input,
select {
    font: inherit;
}

code {
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    background: rgba(16, 35, 61, 0.07);
    font-size: 0.92rem;
}

.page-shell {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 4rem;
    overflow-x: hidden;
}

.dashboard {
    display: grid;
    gap: 1.5rem;
}

.panel {
    position: relative;
    overflow: hidden;
    padding: 1.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
}

[data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
}

[data-reveal].is-visible {
    opacity: 1;
    transform: none;
}

.eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1.45rem;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 250, 248, 0.92)),
        linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 45%);
}

.hero h1,
.panel h2,
.chart-card h3 {
    margin: 0;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    letter-spacing: -0.03em;
}

.hero h1 {
    font-size: clamp(1.9rem, 3vw, 2.6rem);
    line-height: 1.04;
    max-width: 10ch;
}

.hero__text,
.panel__description,
.chart-card__header p,
.stat-card span,
.empty-state p,
#reportSubtitle {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.hero__copy {
    display: grid;
    gap: 0.65rem;
}

.hero__badge {
    display: grid;
    gap: 0.9rem;
    align-self: stretch;
    padding: 1.35rem;
    border-radius: 24px;
    background:
        linear-gradient(160deg, rgba(15, 118, 110, 0.92), rgba(11, 93, 103, 0.92)),
        linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    color: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.hero__badge::before {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    right: -40px;
    top: -50px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 70%);
}

.hero__badge > * {
    position: relative;
    z-index: 1;
}

.hero__badge p,
#headerHint {
    color: rgba(255, 255, 255, 0.84);
}

.hero__badge-title {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.78;
}

.hero__badge strong {
    font-size: clamp(1.3rem, 2.4vw, 1.8rem);
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.hero__chips,
.meta-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.chip,
.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 700;
}

.chip {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.meta-chip {
    background: var(--surface-soft);
    border: 1px solid rgba(16, 35, 61, 0.08);
    color: var(--text);
}

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

.panel__header h2 {
    font-size: 1.65rem;
}

.panel__description,
#reportSubtitle {
    color: #46566f;
}

.panel--full {
    grid-column: 1 / -1;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
    align-items: end;
}

.field {
    display: grid;
    gap: 0.55rem;
    grid-column: span 3;
}

.field--file {
    grid-column: span 6;
}

.field span {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.field small {
    color: var(--muted);
}

.field input,
.field select {
    width: 100%;
    min-height: 54px;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(16, 35, 61, 0.12);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.field input:hover,
.field select:hover,
.field input:focus,
.field select:focus {
    outline: none;
    border-color: rgba(15, 118, 110, 0.45);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
    transform: translateY(-1px);
}

input[type="file"] {
    padding: 0.4rem;
}

input[type="file"]::file-selector-button {
    margin-right: 1rem;
    padding: 0.9rem 1.1rem;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.18), rgba(15, 118, 110, 0.1));
    color: var(--accent-strong);
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.24), rgba(15, 118, 110, 0.12));
}

.actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn {
    min-height: 52px;
    padding: 0.9rem 1.25rem;
    border: none;
    border-radius: 18px;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

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

.btn--primary {
    color: #ffffff;
    background: linear-gradient(135deg, #0f766e, #0b5d67);
    box-shadow: 0 18px 40px rgba(15, 118, 110, 0.22);
}

.btn--secondary {
    color: var(--text);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(242, 246, 252, 0.95));
    border: 1px solid rgba(16, 35, 61, 0.1);
}

.status-banner {
    margin-top: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    border: 1px solid transparent;
    font-weight: 700;
}

.status-banner.is-info {
    background: rgba(14, 165, 233, 0.1);
    border-color: rgba(14, 165, 233, 0.18);
    color: #075985;
}

.status-banner.is-success {
    background: rgba(4, 120, 87, 0.1);
    border-color: rgba(4, 120, 87, 0.16);
    color: var(--success);
}

.status-banner.is-error {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.14);
    color: var(--danger);
}

.empty-state {
    display: grid;
    place-items: center;
    gap: 1rem;
    min-height: 260px;
    text-align: center;
}

.empty-state h2 {
    font-size: 1.9rem;
}

.empty-state__icon {
    display: grid;
    gap: 0.5rem;
    width: 80px;
}

.empty-state__icon span {
    display: block;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.9), rgba(245, 158, 11, 0.85));
    animation: drift 2.8s ease-in-out infinite;
}

.empty-state__icon span:nth-child(2) {
    width: 70%;
    justify-self: end;
    animation-delay: 0.2s;
}

.empty-state__icon span:nth-child(3) {
    width: 85%;
    animation-delay: 0.4s;
}

.report-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
    gap: 1.5rem;
}

.report-banner {
    display: grid;
    gap: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.highlights-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.stat-card,
.chart-card,
.highlight-card {
    position: relative;
    overflow: hidden;
    padding: 1.15rem;
    border-radius: 22px;
    border: 1px solid rgba(16, 35, 61, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 247, 252, 0.92)),
        linear-gradient(135deg, rgba(15, 118, 110, 0.06), transparent 55%);
    box-shadow: 0 18px 40px rgba(16, 35, 61, 0.08);
    transition: box-shadow 0.2s ease;
}

.chart-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 253, 0.96)),
        linear-gradient(135deg, rgba(14, 165, 233, 0.06), transparent 55%);
}

.highlight-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 251, 248, 0.96)),
        linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 55%);
}

.stat-card:hover,
.chart-card:hover,
.highlight-card:hover {
    box-shadow: 0 24px 44px rgba(16, 35, 61, 0.12);
}

.stat-card p,
.highlight-card p {
    margin: 0 0 0.7rem;
    color: var(--muted);
    font-weight: 700;
}

.stat-card strong,
.highlight-card strong {
    display: block;
    margin-bottom: 0.45rem;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: clamp(1.5rem, 2vw, 2rem);
}

.highlight-card strong {
    font-size: clamp(1.25rem, 1.8vw, 1.6rem);
}

.highlight-card span {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.table-shell {
    overflow: auto;
    border-radius: 20px;
    border: 1px solid rgba(16, 35, 61, 0.08);
    background: rgba(255, 255, 255, 0.92);
}

.table-shell--tall {
    max-height: 460px;
}

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

thead th {
    background: rgba(244, 247, 251, 0.96);
    color: var(--text);
}

th,
td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid rgba(16, 35, 61, 0.08);
    text-align: left;
}

tbody tr:hover {
    background: rgba(15, 118, 110, 0.04);
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}

.chart-card--wide {
    grid-column: 1 / -1;
}

.chart-card__header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.chart-card__header h3 {
    font-size: 1.25rem;
}

.chart-image {
    flex: none;
    display: block;
    width: 100%;
    border: 1px solid rgba(16, 35, 61, 0.08);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff, #f7fafc);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    object-fit: contain;
}

.chart-image--trend {
    height: 420px;
    max-height: 420px;
}

.chart-image--standard {
    height: 380px;
    max-height: 380px;
}

.chart-empty {
    display: grid;
    place-items: center;
    min-height: 240px;
    margin: 0;
    color: var(--muted);
    font-weight: 700;
    text-align: center;
}

.raw-panel details {
    display: grid;
    gap: 1rem;
}

.raw-panel summary {
    cursor: pointer;
    font-weight: 800;
}

.raw-list {
    margin: 0;
    padding-left: 1.2rem;
    max-height: 320px;
    overflow: auto;
    color: var(--muted);
    line-height: 1.55;
}

.raw-list li {
    margin-bottom: 0.45rem;
}

.samples-table td,
.summary-table td {
    font-weight: 700;
}

@keyframes drift {
    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(7px);
    }
}

@media (max-width: 980px) {
    .hero,
    .report-grid {
        grid-template-columns: 1fr;
    }

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

    .field,
    .field--file {
        grid-column: span 6;
    }
}

@media (max-width: 720px) {
    .page-shell {
        width: min(100%, calc(100% - 1rem));
        padding-top: 1rem;
    }

    .panel,
    .hero {
        padding: 1.2rem;
        border-radius: 24px;
    }

    .panel__header,
    .chart-card__header {
        flex-direction: column;
    }

    .field,
    .field--file {
        grid-column: 1 / -1;
    }

    .stats-grid,
    .highlights-grid,
    .chart-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
    }

    .chart-image--trend {
        height: 320px;
    }

    .chart-image--standard {
        height: 300px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

body.printing-report [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
}

@media print {
    @page {
        size: a4;
        margin: 12mm;
    }

    html,
    body {
        background: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .hero,
    .controls-panel,
    #emptyState,
    .status-banner,
    .raw-panel,
    .metrics-panel {
        display: none !important;
    }

    .page-shell {
        width: auto;
        margin: 0;
        padding: 0;
    }

    .dashboard,
    .report-grid {
        display: block;
    }

    .chart-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10pt;
    }

    .stats-grid,
    .highlights-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10pt;
    }

    .panel,
    .chart-card,
    .stat-card,
    .highlight-card {
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 10pt;
        border: 1px solid #d9e2ec;
        border-radius: 12px;
        background: #ffffff !important;
        box-shadow: none !important;
    }

    .report {
        display: block !important;
    }

    .report-banner,
    .highlights-panel,
    .stats-panel,
    .chart-panel {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .samples-panel {
        break-before: page;
        page-break-before: always;
    }

    .table-shell,
    .table-shell--tall {
        overflow: visible;
        max-height: none !important;
    }

    .chart-image {
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
    }

    [data-reveal] {
        opacity: 1 !important;
        transform: none !important;
    }

    .btn {
        display: none !important;
    }
}
