:root {
    --pine: #1a4d45;
    --pine-2: #245e54;
    --olive: #6f6844;
    --cream: #f7f6f1;
    --page: #f2f3f5;
    --ink: #1d2b27;
    --muted: #5e6a64;
    --line: #e3e0d6;
    --card: #f7f6f1;
    --white: #ffffff;
    --danger: #8d3b32;
    --shadow: 0 10px 30px rgba(26, 45, 40, .06);
    font-family: "Segoe UI", Candara, sans-serif;
    color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); }
a { color: var(--pine); text-decoration: none; }
a.party { font-weight: 650; border-bottom: 1px dashed #8aa39b; }
button.contract { background: none; border: 0; padding: 0; color: #1a4d45; font: inherit; font-weight: 650; cursor: pointer; border-bottom: 1px dashed #8aa39b; }
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(22, 40, 36, .46); }
.modal[hidden] { display: none; }
.modal-card { position: relative; width: min(760px, 100%); max-height: min(82vh, 820px); overflow: auto; background: #f7f6f1; border-radius: 16px; padding: 22px 22px 18px; box-shadow: 0 18px 50px rgba(22, 40, 36, .28); }
.modal-x { position: absolute; top: 14px; right: 14px; border: 0; background: #e7e4da; color: #1a4d45; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 650; }
.sheet-kind { color: #6f6844; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; font-weight: 700; }
.sheet h2 { margin: 4px 0 14px; color: #163832; }
.sheet-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 0; }
.sheet-fields div { background: #fff; border-radius: 10px; padding: 8px 12px; }
.sheet-fields dt { color: #6d746f; font-size: 12px; }
.sheet-fields dd { margin: 2px 0 0; color: #163832; font-weight: 650; }
.sheet-link { display: inline-block; margin-top: 14px; color: #1a4d45; font-weight: 700; }
@media (max-width: 700px) { .sheet-fields { grid-template-columns: 1fr; } }
a.party:hover { text-decoration: none; border-bottom-color: var(--pine); }
.active-filter { display: flex; gap: 12px; align-items: center; background: #e7f2ee; border: 1px solid #c5ddd4; border-radius: 10px; padding: 8px 12px; margin: -4px 0 14px; }
a:hover { text-decoration: underline; }
h1, h2 { font-weight: 650; letter-spacing: -.02em; }
h1 { margin: 0; font-size: 1.7rem; }
h2 { margin: 0; font-size: 1.05rem; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--pine); color: #e7f2ee; display: flex; flex-direction: column; padding: 22px 14px 16px; position: sticky; top: 0; height: 100vh; }
.menu-btn, .menu-shade { display: none; }
.brand { color: inherit; text-decoration: none; padding: 0 10px 18px; }
.wordmark { display: flex; align-items: center; gap: 10px; font-size: 1.7rem; letter-spacing: -.03em; color: var(--pine); }
.wordmark b { font-weight: 650; }
.wordmark span { width: 1px; height: 28px; background: currentColor; opacity: .7; }
.wordmark.light { color: #f4f7f5; font-size: 1.35rem; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow: auto; }
.nav .group { margin: 16px 10px 6px; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #b7cdc6; }
.nav a { color: #e7f2ee; text-decoration: none; border-radius: 8px; padding: 9px 12px; }
.nav a.active, .nav a:hover { background: var(--pine-2); text-decoration: none; }
.logout { margin-top: auto; }
.logout button { width: 100%; background: transparent; color: #e7f2ee; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 9px 12px; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 16px 28px; background: var(--white); border-bottom: 1px solid #e6e8ea; }
.crumb { font-weight: 650; flex: 1; min-width: 0; }
.who { color: var(--muted); font-size: .92rem; }
.content { padding: 26px 28px 48px; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.lead, .muted { color: var(--muted); }
.lead { margin: 6px 0 0; max-width: 760px; }
.back { align-self: center; }

.filters, .sheet .filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.filters label, .sheet .filters label { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; color: var(--muted); min-width: 140px; }
.filters input, .filters select, .sheet .filters input, .sheet .filters select, .filters-row input { background: var(--white); border: 1px solid #d5d8dc; border-radius: 8px; padding: 8px 10px; }
.filters .check, .sheet .filters .check { flex-direction: row; align-items: center; min-width: unset; padding-bottom: 8px; color: var(--ink); }
.filters .check input { width: auto; }
button.primary, a.primary { background: var(--pine); color: white; border: 0; border-radius: 8px; padding: 9px 16px; text-decoration: none; }
button.olive, a.olive { background: var(--olive); color: white; border: 0; border-radius: 8px; padding: 9px 16px; }
button.ghost, a.ghost { background: var(--cream); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 9px 16px; text-decoration: none; }
a.olive { text-decoration: none; display: inline-block; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
button.primary:hover, button.olive:hover { filter: brightness(1.08); }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 14px; box-shadow: var(--shadow); text-decoration: none; color: inherit; min-height: 118px; }
.kpi span { color: var(--muted); font-size: .84rem; }
.kpi b { font-size: 1.35rem; letter-spacing: -.03em; }
.kpi small { color: var(--muted); }
.kpi:hover { text-decoration: none; border-color: #c9d5cf; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 0 0 14px; box-shadow: var(--shadow); }
.card.slim { background: var(--cream); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.catalog .card, a.card.link { display: flex; flex-direction: column; gap: 4px; margin: 0; text-decoration: none; color: inherit; }
.catalog a.card:hover { border-color: #1a4d45; }
.table-wrap { overflow: auto; max-height: 70vh; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eeeae2; white-space: nowrap; }
th { position: sticky; top: 0; background: #fbfaf6; z-index: 1; }
.filters-row th { top: 34px; background: var(--white); font-weight: 400; }
.filters-row input { width: 100%; min-width: 88px; padding: 6px 8px; }
.chart-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.chart-row > .card { margin: 0; min-width: 0; }
.chart-row > :nth-child(3n+2) .bar i { background: var(--olive); }
.chart-row > :nth-child(3n) .bar i { background: #3d6a58; }
.bars { display: flex; align-items: end; gap: 6px; height: 188px; padding-top: 34px; overflow-x: auto; overflow-y: hidden; }
.bar { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: end; min-width: 42px; height: 100%; }
.bar i { display: block; width: 18px; background: var(--pine); border-radius: 6px 6px 0 0; }
.bar span { font-size: .68rem; color: var(--muted); margin-top: 4px; max-width: 64px; overflow: hidden; text-overflow: ellipsis; }
.bar .tip { position: absolute; left: 50%; bottom: calc(100% - 30px); transform: translateX(-50%); background: #163832; color: #fff; font-size: .75rem; font-weight: 650; line-height: 1.3; padding: 5px 8px; border-radius: 7px; white-space: nowrap; opacity: 0; pointer-events: none; z-index: 5; box-shadow: 0 8px 18px rgba(22, 56, 50, .2); }
.bar:hover .tip { opacity: 1; }
@media (max-width: 1100px) { .chart-row { grid-template-columns: 1fr; } }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 16px; }
.fields span { display: block; color: var(--muted); font-size: .78rem; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: var(--cream); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; }
.pager { display: flex; gap: 12px; align-items: center; margin-top: 14px; }
.count { margin: 0 0 10px; }
.alert { background: #fdecea; color: var(--danger); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }

.login-body { background: #dfe7e3; }
.login-split { min-height: 100vh; display: grid; grid-template-columns: 1.3fr .7fr; }
.login-photo { background: #143f39 url("/img/strawberries.jpg") center/cover no-repeat; }
.login-panel { background: #f7f6f1; display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.login { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login-logo { width: min(220px, 78%); height: auto; display: block; }
.login .muted { margin: 0; }
.login label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); }
.login input { border: 1px solid #d5d8dc; border-radius: 8px; padding: 11px 12px; background: white; width: 100%; }
.login > button { margin-top: 6px; }
.password { position: relative; display: block; }
.password input { padding-right: 42px; }
.password .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); margin: 0; padding: 4px; border: 0; background: transparent; color: #5e6a64; cursor: pointer; line-height: 0; }
.password .eye svg { width: 20px; height: 20px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password .eye:hover { color: #1a4d45; }

@media (max-width: 980px) {
    .shell { grid-template-columns: 1fr; }
    .menu-btn { display: inline-flex; position: relative; width: 40px; height: 40px; flex: none; border: 0; border-radius: 8px; background: transparent; padding: 0; }
    .menu-btn span { position: absolute; left: 11px; width: 18px; height: 2px; border-radius: 2px; background: var(--pine); transition: transform .18s ease, top .18s ease, opacity .18s ease; }
    .menu-btn span:nth-child(1) { top: 13px; }
    .menu-btn span:nth-child(2) { top: 19px; }
    .menu-btn span:nth-child(3) { top: 25px; }
    body.menu-open .menu-btn span:nth-child(1) { top: 19px; transform: rotate(45deg); }
    body.menu-open .menu-btn span:nth-child(2) { opacity: 0; }
    body.menu-open .menu-btn span:nth-child(3) { top: 19px; transform: rotate(-45deg); }
    .menu-shade { display: block; position: fixed; left: 0; right: 0; bottom: 0; top: var(--topbar, 57px); z-index: 30; background: rgba(22, 40, 36, .46); opacity: 0; pointer-events: none; }
    body.menu-open .menu-shade { opacity: 1; pointer-events: auto; }
    .sidebar { position: fixed; z-index: 40; top: var(--topbar, 57px); left: 0; width: min(288px, 86vw); height: calc(100dvh - var(--topbar, 57px)); transform: translateX(-105%); transition: transform .2s ease; box-shadow: none; }
    body.menu-open .sidebar { transform: none; box-shadow: 12px 0 32px rgba(22, 40, 36, .28); }
    body.menu-open { overflow: hidden; }
    .topbar { position: sticky; top: 0; z-index: 50; }
    .login-split { grid-template-columns: 1fr; }
    .login-photo { min-height: 240px; }
    .content, .topbar { padding-left: 16px; padding-right: 16px; }
    .crumb, .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .who { max-width: 42%; }
}
