:root {
    --bg: #f3f5f9;
    --bg-accent: radial-gradient(circle at 10% 10%, #d2f8df 0%, transparent 35%),
        radial-gradient(circle at 90% 20%, #c2e5ff 0%, transparent 28%),
        radial-gradient(circle at 20% 80%, #fff0c2 0%, transparent 30%);
    --surface: rgba(255, 255, 255, 0.86);
    --surface-2: rgba(255, 255, 255, 0.65);
    --text: #121826;
    --muted: #5d6472;
    --primary: #007f5f;
    --primary-2: #1b9a7d;
    --danger: #b42318;
    --border: rgba(17, 24, 39, 0.1);
    --shadow: 0 14px 36px rgba(21, 35, 55, 0.12);
}

[data-theme="dark"] {
    --bg: #091019;
    --bg-accent: radial-gradient(circle at 15% 10%, #1a4b3f 0%, transparent 30%),
        radial-gradient(circle at 88% 12%, #123e61 0%, transparent 28%),
        radial-gradient(circle at 20% 80%, #503f12 0%, transparent 30%);
    --surface: rgba(15, 24, 36, 0.88);
    --surface-2: rgba(15, 24, 36, 0.7);
    --text: #ecf2ff;
    --muted: #98a4ba;
    --primary: #2dcc9f;
    --primary-2: #58dfb7;
    --danger: #ff7368;
    --border: rgba(255, 255, 255, 0.12);
    --shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Manrope", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--bg-accent);
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    backdrop-filter: blur(10px);
}

.brand-title {
    font-weight: 800;
    letter-spacing: 0.03em;
}

.brand-subtitle {
    font-size: 13px;
    color: var(--muted);
}

.status-pill {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
}

.topbar-actions {
    display: flex;
    gap: 8px;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 18px;
}

.nav-grid a {
    padding: 10px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    text-align: center;
    font-size: 13px;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.nav-grid a:hover {
    transform: translateY(-1px);
    background: rgba(0, 127, 95, 0.1);
}

.container {
    width: min(1200px, 96%);
    margin: 16px auto 40px;
    display: grid;
    gap: 14px;
}

.card {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.narrow {
    width: min(560px, 100%);
    margin: 20px auto;
}

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

.kpi {
    font-size: 42px;
    font-weight: 800;
    margin: 6px 0 14px;
}

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

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

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

label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.6);
    color: var(--text);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: rgba(5, 10, 18, 0.5);
}

.primary-btn,
.ghost-btn,
.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 700;
}

.primary-btn {
    background: linear-gradient(120deg, var(--primary), var(--primary-2));
    color: #fff;
}

.ghost-btn {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.danger-btn {
    background: var(--danger);
    color: #fff;
}

.inline-form {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.action-row {
    display: flex;
    gap: 8px;
}

.clean-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.clean-list li {
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.4);
}

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

.small {
    font-size: 12px;
}

.info-banner {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(0, 127, 95, 0.15);
    border: 1px solid rgba(0, 127, 95, 0.3);
    margin-bottom: 10px;
}

.mono {
    font-family: "JetBrains Mono", "Consolas", monospace;
    font-size: 12px;
}

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

.toggle input {
    width: auto;
}

.toast-root {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: grid;
    gap: 8px;
    z-index: 200;
}

.toast {
    padding: 10px 12px;
    border-radius: 12px;
    color: #fff;
    box-shadow: var(--shadow);
    animation: slideIn 0.2s ease;
}

.toast-success {
    background: #0b8f66;
}

.toast-error {
    background: #bf2828;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

    .status-pill {
        flex-wrap: wrap;
    }

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

    .kpi-grid,
    .split-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    table {
        min-width: 520px;
    }
}

