:root {
    --bg: #f3f5f7;
    --bg-accent: #e9eef3;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #ffffff;
    --surface-soft: rgba(245, 248, 251, 0.92);
    --ink: #17202a;
    --muted: #5f6d7a;
    --line: rgba(23, 32, 42, 0.1);
    --brand: #0f766e;
    --brand-dark: #115e59;
    --brand-soft: rgba(15, 118, 110, 0.14);
    --ok: #0f766e;
    --error: #b42318;
    --shadow: 0 24px 64px rgba(17, 24, 39, 0.12);
    --hero-glow: rgba(15, 118, 110, 0.14);
    --hero-glow-secondary: rgba(59, 130, 246, 0.14);
    --table-head: #f4f7fa;
    --toggle-surface: rgba(255, 255, 255, 0.7);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

body[data-theme="dark"] {
    --bg: #09111d;
    --bg-accent: #101a27;
    --surface: rgba(14, 23, 36, 0.82);
    --surface-strong: #0f1b2a;
    --surface-soft: rgba(19, 30, 46, 0.92);
    --ink: #edf2f7;
    --muted: #9fb0c1;
    --line: rgba(203, 213, 225, 0.12);
    --brand: #34d399;
    --brand-dark: #10b981;
    --brand-soft: rgba(52, 211, 153, 0.16);
    --ok: #34d399;
    --error: #fda29b;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
    --hero-glow: rgba(16, 185, 129, 0.16);
    --hero-glow-secondary: rgba(59, 130, 246, 0.2);
    --table-head: #132133;
    --toggle-surface: rgba(15, 27, 42, 0.9);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body[data-theme="dark"] {
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Aptos", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, var(--hero-glow), transparent 30%),
        radial-gradient(circle at top right, var(--hero-glow-secondary), transparent 22%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
    transition: background 180ms ease, color 180ms ease;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.34), transparent 85%);
    pointer-events: none;
}

.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.hero-card,
.panel-card,
.message-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero-card {
    padding: 26px;
    margin-bottom: 20px;
}

.hero-card::after,
.panel-card::after {
    content: "";
    position: absolute;
    inset: auto -80px -100px auto;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, var(--brand-soft), transparent 70%);
    pointer-events: none;
}

.hero-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
    gap: 24px;
    align-items: end;
}

.hero-copy {
    display: grid;
    gap: 14px;
}

.eyebrow,
.section-tag {
    margin: 0;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--brand);
}

h1,
h2 {
    margin: 0;
    font-family: "Georgia", "Times New Roman", serif;
    line-height: 1.06;
}

h1 {
    max-width: 14ch;
    font-size: clamp(1.95rem, 4vw, 3.1rem);
    letter-spacing: -0.03em;
}

h2 {
    font-size: clamp(1.4rem, 2.5vw, 1.9rem);
}

.hero-text,
.preview-meta,
.secondary-link,
.field span,
.summary-chip,
.message-card span {
    color: var(--muted);
}

.hero-text {
    max-width: 58ch;
    margin: 0;
    font-size: 1rem;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

.theme-toggle,
.secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--toggle-surface);
    color: var(--ink);
    text-decoration: none;
    font: inherit;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.theme-toggle {
    cursor: pointer;
}

.theme-toggle:hover,
.secondary-link:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.36);
}

.secondary-link--disabled {
    opacity: 0.72;
}

.panel-card,
.message-card {
    padding: 24px;
    margin-bottom: 20px;
}

.message-card {
    display: flex;
    gap: 12px;
    align-items: center;
    border-color: rgba(180, 35, 24, 0.24);
    background: color-mix(in srgb, var(--surface-strong) 72%, rgba(180, 35, 24, 0.08));
    color: var(--error);
}

.section-heading {
    margin-bottom: 20px;
}

.section-heading--split {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.upload-form {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(170px, 220px) auto;
    gap: 16px;
    align-items: end;
}

.field {
    display: grid;
    gap: 8px;
}

.field span {
    font-size: 0.93rem;
}

.field input[type="file"],
.field input[type="text"] {
    width: 100%;
    min-height: 50px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    color: var(--ink);
    font: inherit;
}

.field input[type="file"] {
    padding: 11px 16px;
}

.primary-button {
    min-height: 50px;
    padding: 0 20px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #f7fffd;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease;
    box-shadow: 0 14px 30px color-mix(in srgb, var(--brand) 30%, transparent);
}

.primary-button:hover {
    transform: translateY(-1px);
}

.summary-chip {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 11px 15px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
}

.preview-meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    font-size: 0.95rem;
}

.preview-form {
    display: grid;
    gap: 16px;
}

.table-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.checkbox-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-soft);
}

.contacts-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

.contacts-table th,
.contacts-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.contacts-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--table-head);
    font-size: 0.84rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.contacts-table tbody tr:hover {
    background: color-mix(in srgb, var(--brand-soft) 72%, transparent);
}

.contacts-table tbody tr:last-child td {
    border-bottom: 0;
}

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

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

    .hero-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 760px) {
    .section-heading--split,
    .table-actions {
        align-items: stretch;
    }

    .summary-chip,
    .checkbox-pill,
    .primary-button {
        width: 100%;
        justify-content: center;
    }

    .preview-meta {
        display: grid;
        gap: 8px;
    }
}

@media (max-width: 560px) {
    .page-shell {
        width: min(100% - 20px, 1120px);
        padding-top: 18px;
        padding-bottom: 28px;
    }

    .hero-card,
    .panel-card,
    .message-card {
        padding: 18px;
        border-radius: 22px;
    }

    .hero-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .theme-toggle {
        width: 100%;
    }

    h1 {
        max-width: none;
        font-size: clamp(1.75rem, 8vw, 2.35rem);
    }

    .contacts-table {
        min-width: 600px;
    }
}
