:root {
    --bg: #f5f7f8;
    --panel: #ffffff;
    --ink: #172026;
    --muted: #68747d;
    --line: #d9e0e4;
    --accent: #176b5d;
    --accent-strong: #0f5146;
    --warn: #9a3412;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

a {
    color: var(--accent-strong);
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 220px;
    background: #15201f;
    color: #fff;
    padding: 24px;
}

.brand {
    display: block;
    margin-bottom: 24px;
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    text-decoration: none;
}

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

.profile-switcher {
    margin-bottom: 18px;
}

.profile-switcher select {
    border-color: #31413f;
    background: #22302e;
    color: #fff;
}

.sidebar nav a {
    color: #dfe8e5;
    padding: 10px 0;
    text-decoration: none;
}

.app-main {
    margin-left: 220px;
    padding: 32px;
}

.auth-main,
.setup-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card,
.setup-panel,
.panel,
.block {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
}

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

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

.page-header h1,
.panel h2,
.block h2 {
    margin: 0;
}

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

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

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 14px;
    background: #fff;
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.button.primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.stack {
    display: grid;
    gap: 16px;
}

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

.stats-grid div {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.stats-grid span {
    display: block;
    font-size: 30px;
    font-weight: 800;
}

.stats-grid small {
    color: var(--muted);
}

.split,
.editor-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    gap: 20px;
}

.editor-layout {
    grid-template-columns: minmax(0, 1fr) 330px;
}

.editor-main,
.editor-side,
.plan-list {
    display: grid;
    gap: 16px;
    align-content: start;
}

.plan-item,
.toolbar,
.inline-form,
.export-actions,
.block-heading,
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

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

.check-row {
    display: flex;
    grid-template-columns: auto 1fr;
    align-items: center;
    justify-content: start;
    gap: 10px;
    font-weight: 700;
}

.check-row input {
    width: auto;
}

.plan-item {
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
}

.plan-item h3,
.plan-item p {
    margin: 0;
}

.status {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 9px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.alert,
.notice {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.alert {
    background: #fff3ed;
    color: var(--warn);
}

.notice {
    background: #eaf7f2;
    color: var(--accent-strong);
}

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

.settings-form label:has(textarea),
.settings-form .button {
    grid-column: 1 / -1;
}

@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: auto;
    }

    .app-main {
        margin-left: 0;
        padding: 20px;
    }

    .split,
    .editor-layout,
    .stats-grid,
    .settings-form {
        grid-template-columns: 1fr;
    }

    .page-header,
    .plan-item,
    .toolbar,
    .inline-form,
    .export-actions,
    .row-actions {
        align-items: stretch;
        flex-direction: column;
    }
}
