:root {
    --ink: #17211c;
    --muted: #5c6b62;
    --line: #d5ddd6;
    --bg: #e4ebe6;
    --paper: #f6f8f6;
    --rail: #14211b;
    --rail-text: #d5e3da;
    --accent: #1e6b45;
    --accent-ink: #f4faf6;
    --danger: #8d2e2e;
    --danger-bg: #f8ecec;
    --ok-bg: #e5f2ea;
    --shadow: 0 1px 0 rgba(20, 33, 27, 0.04);
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: "Golos Text", "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.45;
}

a { color: var(--accent); }

button, input, select, textarea { font: inherit; color: inherit; }

.app {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.rail {
    background: var(--rail);
    color: var(--rail-text);
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

.brand svg { color: #b7d7c4; flex: none; }

.brand strong { display: block; font-size: 18px; font-weight: 600; color: #f4faf6; }

.brand small { color: #8ea497; }

.rail nav { display: flex; flex-direction: column; gap: 4px; }

.rail nav a {
    color: var(--rail-text);
    text-decoration: none;
    padding: 8px 10px;
    border-left: 2px solid transparent;
}

.rail nav a.is-on,
.rail nav a:hover { border-left-color: #8fbf7a; color: #fff; }

.rail-foot { margin-top: auto; }

.rail-foot p { margin: 0 0 12px; color: #8ea497; font-size: 13px; }

.rail-foot button {
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--rail-text);
    cursor: pointer;
}

.main { padding: 36px 40px 72px; }

.wrap { max-width: 1080px; }

.page-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-end;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

h1 { margin: 0; font-size: 34px; line-height: 1.15; font-weight: 600; }

h2 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
}

h2 span {
    display: inline-block;
    width: 1.8em;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.lede { color: var(--muted); max-width: 68ch; }

.panel {
    background: var(--paper);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 20px;
}

.stack { display: flex; flex-direction: column; gap: 16px; }

.fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 16px;
}

.fields .wide { grid-column: 1 / -1; }

label, .check { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

.check {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    margin: 6px 0;
}

.check em { color: var(--muted); font-style: normal; font-variant-numeric: tabular-nums; }

input, select, textarea {
    width: 100%;
    background: #fff;
    border: 1px solid #c5cfc8;
    border-radius: 2px;
    padding: 9px 10px;
    outline: none;
}

input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.hint { color: var(--muted); font-size: 14px; }

fieldset.plain { border: 0; padding: 12px 0 0; margin: 0; }

fieldset.plain legend { padding: 0; font-size: 14px; font-weight: 600; }

.system-block { border-top: 1px solid var(--line); margin-top: 8px; }

.sashes { display: flex; flex-direction: column; gap: 10px; }

.sash {
    display: grid;
    grid-template-columns: 36px 1fr 1fr;
    gap: 12px;
    align-items: end;
}

.sash-n {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    padding-bottom: 10px;
}

.btn, button.btn, a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--accent-ink);
    text-decoration: none;
    border: 1px solid var(--accent);
    border-radius: 2px;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 600;
}

.btn.ghost, a.btn.ghost {
    background: transparent;
    color: var(--ink);
    border-color: #b7c4bb;
}

.example-actions, .actions { display: flex; flex-wrap: wrap; gap: 8px; }

.errors {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #e3c4c4;
    padding: 12px 14px;
}

.errors p { margin: 0 0 6px; font-weight: 600; }

.errors ul { margin: 0; padding-left: 18px; }

.flash {
    background: var(--ok-bg);
    border: 1px solid #c5dfd0;
    padding: 10px 12px;
}

.total-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    background: var(--rail);
    color: #f4faf6;
    padding: 16px 18px;
}

.total-line span { color: #b7c9be; }

.total-line strong { font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }

th, td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th { font-size: 13px; font-weight: 600; color: var(--muted); }

td.num, th.num { text-align: right; white-space: nowrap; }

tr.is-total td { font-weight: 700; }

td .links, td.links { white-space: nowrap; }

td.links a + a { margin-left: 10px; }

table input, table select { min-width: 88px; }

.add-line { margin-top: 14px; }

.login-body {
    display: grid;
    place-items: center;
    padding: 32px 16px;
    background:
        linear-gradient(180deg, rgba(20, 33, 27, 0.04), transparent 180px),
        var(--bg);
}

.login-card {
    width: min(440px, 100%);
    background: var(--paper);
    border: 1px solid var(--line);
    padding: 32px 28px;
}

.login-card h1 { margin-bottom: 8px; }

@media (max-width: 980px) {
    .fields { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 800px) {
    .app { grid-template-columns: 1fr; }
    .rail { padding: 16px; gap: 14px; }
    .rail nav { flex-direction: row; flex-wrap: wrap; }
    .rail-foot { margin-top: 0; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
    .rail-foot p { margin: 0; }
    .main { padding: 20px 16px 48px; }
    h1 { font-size: 28px; }
    .page-head, .fields, .sash { grid-template-columns: 1fr; display: flex; flex-direction: column; align-items: stretch; }
    .total-line strong { font-size: 26px; }
}
