:root {
    --bg: #04050c;
    --bg-elevated: #10162e;
    --bg-elevated-soft: #192042;
    --page-bg: radial-gradient(circle at 20% 0%, #252b4e 0%, #04050c 60%);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --text-main: #f8f9ff;
    --text-muted: #9298b6;
    --accent: #f4c77d;
    --accent-strong: #ffb649;
    --accent-soft: rgba(244, 199, 125, 0.18);
    --danger: #ff6b6b;
    --header-bg: linear-gradient(135deg, rgba(23, 27, 56, 0.96), rgba(5, 6, 10, 0.98));
    --header-border: rgba(255, 255, 255, 0.12);
    --card-bg: linear-gradient(145deg, rgba(16, 20, 46, 0.98), rgba(6, 8, 18, 0.98));
    --card-border: rgba(255, 255, 255, 0.12);
    --table-head-bg: rgba(2, 3, 10, 0.92);
    --table-border: rgba(255, 255, 255, 0.14);
    --table-row-base: rgba(255, 255, 255, 0.01);
    --table-row-alt: rgba(255, 255, 255, 0.04);
    --table-surface: rgba(10, 13, 30, 0.88);
    --ideal-bg: rgba(8, 11, 28, 0.78);
    --ideal-border: rgba(255, 255, 255, 0.16);
    --ideal-item-bg: rgba(255, 255, 255, 0.04);
    --ideal-item-border: rgba(255, 255, 255, 0.12);
    --input-bg: #222a4b;
    --input-border: rgba(255, 255, 255, 0.14);
    --input-placeholder: rgba(180, 184, 207, 0.7);
    --radius-card: 18px;
    --radius-pill: 999px;
    --shadow-soft: 0 24px 60px rgba(1, 3, 9, 0.7);
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "Segoe UI", sans-serif;
}

html[data-theme="light"] {
    --bg: #f6f7fb;
    --bg-elevated: #ffffff;
    --bg-elevated-soft: #f4f6ff;
    --page-bg: radial-gradient(circle at 10% -15%, #ffffff 0%, #dde2fb 70%);
    --border-subtle: rgba(15, 22, 58, 0.08);
    --text-main: #0b1027;
    --text-muted: #5b6287;
    --accent: #eea74f;
    --accent-strong: #e58a2f;
    --accent-soft: rgba(238, 167, 79, 0.16);
    --header-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(235, 239, 255, 0.98));
    --header-border: rgba(15, 22, 58, 0.12);
    --card-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(239, 242, 255, 0.96));
    --card-border: rgba(15, 22, 58, 0.08);
    --table-head-bg: rgba(255, 255, 255, 0.94);
    --table-border: rgba(15, 22, 58, 0.12);
    --table-row-base: rgba(0, 0, 0, 0.015);
    --table-row-alt: rgba(15, 22, 58, 0.05);
    --table-surface: rgba(255, 255, 255, 0.96);
    --ideal-bg: rgba(255, 255, 255, 0.88);
    --ideal-border: rgba(15, 22, 58, 0.14);
    --ideal-item-bg: rgba(255, 255, 255, 0.96);
    --ideal-item-border: rgba(15, 22, 58, 0.08);
    --input-bg: #dfe3f2;
    --input-border: rgba(15, 22, 58, 0.16);
    --input-placeholder: rgba(91, 98, 135, 0.75);
    --shadow-soft: 0 18px 46px rgba(12, 17, 44, 0.12);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    background: var(--page-bg);
    min-height: 100%;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background: var(--page-bg);
    color: var(--text-main);
    min-height: 100vh;
}

html, body {
    background-color: #04050c;
    width: 100%;
    min-height: 100%;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--page-bg);
    background-attachment: fixed;
    pointer-events: none;
}

.page {
    max-width: 1320px;
    margin: 0 auto;
    padding: 20px 20px 40px;
}

/* Header */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 24px;
    border-radius: var(--radius-card);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

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

.logo-text h1 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.logo-text p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

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

.logo-text .logo-pill {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    background: radial-gradient(circle at 20% 0%, #fff3dc, var(--accent) 45%, var(--accent-strong));
    color: #221205;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.logo-description {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Toggles */

.toggle-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.toggle-pill {
    display: inline-flex;
    border-radius: var(--radius-pill);
    padding: 2px;
    background: var(--accent-soft);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.toggle-option {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    transition: all 0.18s ease-out;
}

.toggle-option.active {
    background: radial-gradient(circle at 20% 0%, #fff1db, var(--accent) 45%, var(--accent-strong));
    color: #1d1308;
}

.theme-toggle {
    border-radius: var(--radius-pill);
    border: 1px solid var(--header-border);
    background: var(--accent-soft);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    color: var(--accent-strong);
    cursor: pointer;
    font-size: 11px;
}

.theme-icon {
    font-size: 12px;
}

html[data-theme="dark"] .theme-icon.moon {
    opacity: 1;
}

html[data-theme="dark"] .theme-icon.sun {
    opacity: 0.2;
}

html[data-theme="light"] .theme-icon.moon {
    opacity: 0.2;
}

html[data-theme="light"] .theme-icon.sun {
    opacity: 1;
}

/* Layout */

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.3fr);
    gap: 22px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius-card);
    padding: 18px 18px 20px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: -20%;
    opacity: 0.08;
    background: radial-gradient(circle at 10% -10%, var(--accent), transparent 65%);
    pointer-events: none;
}

.card h2 {
    margin: 0 0 14px;
    font-size: 18px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.card-form .hint {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.ideal-section {
    margin-top: 45px;
    padding: 14px 12px;
    border-radius: 12px;
    background: var(--ideal-bg);
    border: 1px solid var(--ideal-border);
    backdrop-filter: blur(12px);
}

.ideal-section h3 {
    margin: 0 0 10px;
    font-size: 16px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
}

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

.ideal-item {
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--ideal-item-bg);
    border: 1px solid var(--ideal-item-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ideal-item .label {
    display: block;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.ideal-item .value {
    display: block;
    margin-top: 4px;
    font-size: 20px;
    font-weight: 650;
}

.ideal-item .sub {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Form */

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

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field label {
    font-size: 13px;
    color: var(--text-muted);
}

input,
select {
    border-radius: 10px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 14px;
    padding: 9px 10px;
    outline: none;
    transition: border 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input::placeholder {
    color: var(--input-placeholder);
}

input:focus,
select:focus {
    border-color: rgba(246, 196, 83, 0.8);
    box-shadow: 0 0 0 1px rgba(246, 196, 83, 0.25);
}

/* Summary */

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

.summary-item {
    background: var(--bg-elevated-soft);
    border-radius: 12px;
    padding: 10px 10px 9px;
    border: 1px solid var(--card-border);
}

.summary-item .label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    font-weight: 600;
}

.summary-item .value {
    display: block;
    margin-top: 4px;
    font-size: 18px;
    font-weight: 650;
}

.summary-item .sub {
    display: block;
    margin-top: 1px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Message */

.message {
    font-size: 13px;
    margin-bottom: 10px;
    color: var(--danger);
}

/* Table */

.table-wrapper {
    max-height: 342px;
    overflow: auto;
    border-radius: 14px;
    border: 1px solid var(--table-border);
    background: var(--table-surface);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    background: transparent;
}

thead {
    position: sticky;
    top: 0;
    background: var(--table-head-bg);
    backdrop-filter: blur(12px);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}

th,
td {
    padding: 6px 8px;
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

th:first-child,
td:first-child {
    text-align: left;
}

th {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: normal;
    line-height: 1.3;
}

tbody tr {
    background: var(--table-row-base);
    transition: background 0.2s ease;
}

tbody tr:nth-child(even) {
    background: var(--table-row-alt);
}

tbody tr:hover {
    background: rgba(244, 199, 125, 0.12);
}

/* Footer */

.site-footer {
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.site-footer .sep {
    opacity: 0.6;
}

/* Responsive */

@media (max-width: 900px) {
    .layout {
        grid-template-columns: minmax(0, 1fr);
    }

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

@media (max-width: 600px) {
    .page {
        padding: 18px 14px 32px;
    }

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

    .header-controls {
        width: 100%;
        justify-content: space-between;
    }

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

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

    th,
    td {
        padding: 7px 8px;
    }
}
