:root {
    --bg: #f4f1ea;
    --surface: rgba(255, 255, 255, 0.86);
    --surface-strong: #ffffff;
    --text: #1b1d1f;
    --muted: #66707a;
    --line: rgba(27, 29, 31, 0.09);
    --primary: #0e6b5c;
    --primary-strong: #0b4d43;
    --accent: #c98332;
    --danger: #ac3434;
    --shadow: 0 18px 50px rgba(27, 29, 31, 0.08);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --background-layer-1: rgba(201, 131, 50, 0.16);
    --background-layer-2: rgba(14, 107, 92, 0.22);
    --background-base-top: #f8f4ee;
    --background-base-bottom: #f4f1ea;
}

:root[data-theme="dark"] {
    --bg: #11161a;
    --surface: rgba(21, 29, 34, 0.88);
    --surface-strong: #172127;
    --text: #edf4f2;
    --muted: #a5b2b7;
    --line: rgba(237, 244, 242, 0.1);
    --primary: #5cc3ad;
    --primary-strong: #8ee0cf;
    --accent: #e3a356;
    --danger: #e48383;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    --background-layer-1: rgba(227, 163, 86, 0.12);
    --background-layer-2: rgba(92, 195, 173, 0.14);
    --background-base-top: #12191d;
    --background-base-bottom: #0e1418;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, var(--background-layer-1), transparent 28%),
        radial-gradient(circle at top right, var(--background-layer-2), transparent 32%),
        linear-gradient(180deg, var(--background-base-top) 0%, var(--background-base-bottom) 100%);
    min-height: 100vh;
}

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

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto;
}

.site-header,
.card,
.table-wrap,
.hero {
    backdrop-filter: blur(16px);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 22px;
    border-radius: var(--radius-xl);
    position: sticky;
    top: 16px;
    z-index: 10;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-mark {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 0.92rem;
}

.logo-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.partner-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.top-nav a,
.nav-user {
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 600;
}

.top-nav a:hover {
    background: rgba(14, 107, 92, 0.08);
}

:root[data-theme="dark"] .top-nav a:hover {
    background: rgba(92, 195, 173, 0.12);
}

.nav-cta {
    background: var(--primary);
    color: #fff;
}

.theme-toggle {
    background: rgba(14, 107, 92, 0.12);
    color: var(--primary-strong);
    padding: 0;
    width: 54px;
    height: 30px;
    position: relative;
    border-radius: 999px;
    flex: 0 0 auto;
}

:root[data-theme="dark"] .theme-toggle {
    background: rgba(92, 195, 173, 0.12);
    color: var(--primary-strong);
}

.theme-toggle::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    transition: transform 0.2s ease, background 0.2s ease;
}

:root[data-theme="dark"] .theme-toggle::before {
    transform: translateX(24px);
    background: var(--primary-strong);
}

.menu-toggle {
    display: none;
}

.content {
    padding: 28px 0 48px;
}

.hero {
    border-radius: var(--radius-xl);
    padding: 28px;
    margin-bottom: 22px;
    overflow: hidden;
    position: relative;
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto -60px -90px auto;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(201, 131, 50, 0.25), transparent 70%);
}

.hero h1,
.hero h2,
.section-title {
    margin: 0 0 10px;
}

.hero p,
.muted {
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 18px;
}

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

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

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

.card {
    border-radius: var(--radius-lg);
    padding: 22px;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
}

.metric-label {
    color: var(--muted);
    font-size: 0.95rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.form-row-full {
    grid-column: 1 / -1;
}

label {
    font-weight: 700;
    font-size: 0.95rem;
}

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

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--text);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

button,
.button {
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

button:hover,
.button:hover {
    transform: translateY(-1px);
    background: var(--primary-strong);
}

.button-secondary {
    background: rgba(14, 107, 92, 0.12);
    color: var(--primary-strong);
}

:root[data-theme="dark"] .button-secondary {
    background: rgba(92, 195, 173, 0.12);
}

.filters {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.table-wrap {
    border-radius: var(--radius-lg);
    overflow: auto;
    margin-top: 18px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
    color: var(--text);
}

th,
td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(27, 29, 31, 0.08);
}

th a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.data-table thead th {
    background: rgba(14, 107, 92, 0.14);
    color: var(--primary-strong);
    font-weight: 800;
}

:root[data-theme="dark"] .data-table thead th {
    background: rgba(92, 195, 173, 0.14);
}

.data-table tbody tr {
    background: var(--surface-strong);
}

.data-table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--surface-strong) 88%, var(--bg) 12%);
}

.data-table tbody tr:hover {
    background: rgba(201, 131, 50, 0.12);
}

:root[data-theme="dark"] .data-table tbody tr:hover {
    background: rgba(227, 163, 86, 0.12);
}

.data-table td,
.data-table th {
    color: var(--text);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    background: rgba(14, 107, 92, 0.12);
    color: var(--primary-strong);
}

.badge-warning {
    background: rgba(201, 131, 50, 0.16);
    color: #8a550f;
}

.badge-danger {
    background: rgba(172, 52, 52, 0.14);
    color: #8b2020;
}

.flash {
    margin-bottom: 18px;
    padding: 14px 18px;
    border-radius: 16px;
    font-weight: 700;
}

.flash-success {
    background: rgba(14, 107, 92, 0.1);
    color: var(--primary-strong);
}

.flash-error {
    background: rgba(172, 52, 52, 0.1);
    color: var(--danger);
}

.pagination {
    margin-top: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
    padding-top: 8px;
}

.pagination-info {
    color: var(--muted);
    font-weight: 700;
}

.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.auth-shell {
    min-height: calc(100vh - 48px);
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(560px, 100%);
}

.range-output {
    font-weight: 800;
    color: var(--accent);
}

.empty {
    padding: 20px;
    color: var(--muted);
}

.js-enhanced [data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.js-enhanced [data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 980px) {
    .grid-4,
    .grid-3,
    .grid-2,
    .filters,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .site-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .menu-toggle {
        display: inline-flex;
        align-self: flex-end;
        background: rgba(14, 107, 92, 0.12);
        color: var(--primary-strong);
    }

    .top-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .top-nav.is-open {
        display: flex;
    }

    .top-nav a,
    .nav-user {
        width: 100%;
        text-align: center;
    }

}
