:root {
    color-scheme: light;
    --bg: #eef5ff;
    --surface: #ffffff;
    --surface-strong: #f7fbff;
    --line: #cfe0f5;
    --line-strong: #9ebde3;
    --text: #102033;
    --muted: #61748c;
    --blue: #0f64d8;
    --blue-strong: #074fb3;
    --blue-soft: #dcecff;
    --green: #0b7f5f;
    --red: #be3a45;
    --shadow: 0 16px 38px rgba(18, 78, 151, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #e8f2ff 0%, #f9fbff 55%, #eef5ff 100%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

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

button {
    border: 0;
    cursor: pointer;
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 18px;
    background: #082d66;
    color: #fff;
}

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

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #33a3ff;
    font-weight: 800;
}

.brand strong {
    display: block;
    font-size: 18px;
}

.brand span {
    display: block;
    color: #b9d5f7;
    font-size: 13px;
    margin-top: 3px;
}

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

.nav-button {
    min-height: 42px;
    padding: 0 12px;
    border-radius: 8px;
    background: transparent;
    color: #d9eaff;
    text-align: left;
}

.nav-button:hover,
.nav-button.active {
    background: #0f64d8;
    color: #fff;
}

.main {
    min-width: 0;
    padding: 26px;
}

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

.eyebrow {
    margin: 0 0 4px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 28px;
}

h2 {
    margin-bottom: 16px;
    font-size: 18px;
}

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

.icon-button,
.primary,
.secondary {
    min-height: 40px;
    border-radius: 8px;
    padding: 0 14px;
    font-weight: 700;
}

.icon-button {
    width: 42px;
    background: var(--surface);
    color: var(--blue);
    border: 1px solid var(--line);
}

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

.primary:hover {
    background: var(--blue-strong);
}

.secondary {
    background: var(--blue-soft);
    color: var(--blue-strong);
}

.full {
    width: 100%;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric,
.panel,
.item,
.notice {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metric {
    padding: 18px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.metric strong {
    font-size: 30px;
}

.split {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
    gap: 18px;
}

.split.wide {
    grid-template-columns: minmax(320px, 520px) minmax(0, 1fr);
}

.panel {
    padding: 18px;
    min-width: 0;
}

.stack,
.grid-form {
    display: grid;
    gap: 12px;
}

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

.span-2 {
    grid-column: span 2;
}

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

.checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
}

.checkbox input {
    width: 18px;
    height: 18px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 11px;
    background: #fbfdff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #96c9ff;
    border-color: #50a7ff;
}

.actions {
    display: flex;
    gap: 10px;
}

.form-subtitle {
    color: var(--blue-strong);
    font-size: 13px;
    font-weight: 800;
    margin-top: 2px;
}

.list {
    display: grid;
    gap: 10px;
}

.list.compact {
    gap: 8px;
}

.item {
    padding: 14px;
    box-shadow: none;
}

.item-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.item-title {
    font-weight: 800;
}

.item-meta {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue-strong);
    font-size: 12px;
    font-weight: 800;
}

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

.item-actions button {
    min-height: 32px;
    border-radius: 8px;
    padding: 0 10px;
    color: var(--blue-strong);
    background: var(--surface-strong);
    border: 1px solid var(--line);
}

.danger {
    color: var(--red) !important;
}

.notice {
    margin-top: 12px;
    padding: 12px;
    color: var(--blue-strong);
    background: #eef7ff;
    box-shadow: none;
}

.hidden {
    display: none !important;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 20;
    max-width: min(420px, calc(100vw - 36px));
    padding: 12px 14px;
    border-radius: 8px;
    background: #082d66;
    color: #fff;
    box-shadow: var(--shadow);
}

.check-list {
    display: grid;
    gap: 8px;
    max-height: 300px;
    overflow: auto;
    padding-right: 4px;
    margin-bottom: 12px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-strong);
}

.check-row input {
    width: 18px;
    min-height: 18px;
}

.separator {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.empty {
    padding: 16px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    color: var(--muted);
    background: var(--surface-strong);
}

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

    .sidebar {
        position: static;
        height: auto;
        padding: 14px;
    }

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

    .nav-button {
        text-align: center;
    }

    .main {
        padding: 18px;
    }

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

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

@media (max-width: 560px) {
    .topbar {
        align-items: stretch;
        flex-direction: column;
    }

    .top-actions {
        width: 100%;
    }

    .top-actions input {
        flex: 1;
    }

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

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

    .span-2 {
        grid-column: span 1;
    }

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