:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --panel-soft: #eef4ff;
    --text: #172033;
    --muted: #66738a;
    --line: #dfe6f2;
    --primary: #1463ff;
    --primary-dark: #0d47bd;
    --accent: #18a879;
    --danger: #d92d20;
    --warning: #b7791f;
    --shadow: 0 18px 45px rgba(24, 42, 68, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px;
    background: #101827;
    color: #f7fbff;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

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

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #2dd4bf;
    color: #06131f;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand small,
.sidebar-footer,
.eyebrow,
.muted {
    color: var(--muted);
}

.sidebar .brand small,
.sidebar-footer {
    color: #aeb9cc;
}

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

.nav a {
    padding: 12px 14px;
    border-radius: 8px;
    color: #dbe7ff;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 255, 255, 0.11);
    color: #ffffff;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 14px;
}

.sidebar-footer a {
    color: #7dd3fc;
}

.main {
    padding: 28px;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

.topbar h1,
.topbar p {
    margin: 0;
}

.topbar h1 {
    font-size: 30px;
    letter-spacing: 0;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
}

.menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
}

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

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

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

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 22px;
}

.card.compact {
    padding: 16px;
}

.card h2,
.card h3 {
    margin: 0 0 14px;
    letter-spacing: 0;
}

.card h2 {
    font-size: 20px;
}

.card h3 {
    font-size: 16px;
}

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

.stat strong {
    display: block;
    font-size: 32px;
    line-height: 1;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--panel-soft);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 12px;
}

.badge.success {
    background: #e8f8f1;
    color: #087452;
}

.badge.danger {
    background: #fff0ee;
    color: var(--danger);
}

.badge.warning {
    background: #fff7e8;
    color: var(--warning);
}

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

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

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

label {
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    padding: 11px 12px;
    outline: none;
}

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

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(20, 99, 255, 0.12);
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.switch-row:last-child {
    border-bottom: 0;
}

.switch-row input {
    width: 22px;
    height: 22px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 15px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--primary);
    color: #ffffff;
    cursor: pointer;
    font-weight: 800;
}

.btn:hover {
    background: var(--primary-dark);
}

.btn.secondary {
    background: #ffffff;
    border-color: var(--line);
    color: var(--text);
}

.btn.secondary:hover {
    background: #f8fbff;
}

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

.btn.ghost {
    background: transparent;
    color: var(--primary-dark);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: #ffffff;
}

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

th {
    background: #f8fbff;
    color: #475467;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
}

tr:last-child td {
    border-bottom: 0;
}

.inline-form {
    display: inline;
}

.mini-input {
    min-width: 120px;
    padding: 8px 9px;
}

.alert {
    border-radius: 8px;
    padding: 13px 15px;
    margin-bottom: 18px;
    background: #eef6ff;
    border: 1px solid #b9d7ff;
    color: #0d3d82;
}

.alert.success {
    background: #e8f8f1;
    border-color: #abe7ce;
    color: #075e44;
}

.alert.error {
    background: #fff0ee;
    border-color: #ffd1cc;
    color: #9b1c12;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
    background:
        radial-gradient(circle at 20% 12%, rgba(45, 212, 191, 0.20), transparent 28%),
        linear-gradient(135deg, #f5f9ff, #eef3f8 58%, #e9f7f2);
}

.login-card {
    width: min(430px, 100%);
}

.login-card .brand {
    color: var(--text);
    margin-bottom: 20px;
}

.help-text {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.page-targets {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
}

.page-targets summary {
    cursor: pointer;
    font-weight: 700;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 8px 12px;
    margin-top: 12px;
}

.checkbox-grid label {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.25;
}

.checkbox-grid input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    justify-self: start;
    align-self: center;
    box-shadow: none;
}

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

    .sidebar {
        position: fixed;
        z-index: 20;
        inset: 0 auto 0 0;
        width: min(310px, 86vw);
        transform: translateX(-105%);
        transition: transform 180ms ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-toggle {
        display: inline-grid;
        place-items: center;
    }

    .main {
        padding: 20px;
    }

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

    .topbar h1 {
        font-size: 24px;
    }
}

@media (max-width: 560px) {
    .main {
        padding: 16px;
    }

    .card {
        padding: 16px;
    }

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

    .btn {
        width: 100%;
    }
}
