:root {
    color-scheme: light;
    --green: #14372d;
    --green-light: #e9f1ed;
    --lime: #d2ee9a;
    --ink: #1d2924;
    --muted: #728078;
    --line: #e5ebe7;
    --paper: #ffffff;
    --canvas: #f5f7f5;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 15px max(28px, calc((100vw - 1120px) / 2)); background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; font-size: 17px; font-weight: 800; letter-spacing: -.5px; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; background: var(--green); color: var(--lime); border-radius: 12px; font-size: 21px; }
.brand-accent { color: #67914e; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: 1px; }
.navigation { display: flex; align-items: center; gap: 7px; }
.navigation a { padding: 9px 12px; border-radius: 8px; color: #56625b; font-size: 13px; font-weight: 600; }
.navigation a:hover, .navigation a.active { color: var(--green); background: var(--green-light); }
.account { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; font-weight: 650; }
.account form { margin: 0; }
.container { width: min(1120px, calc(100% - 48px)); margin: 40px auto 64px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 24px; }
.page-heading h1, .auth-card h1 { margin: 3px 0 7px; font-size: clamp(27px, 4vw, 36px); letter-spacing: -1.2px; }
.eyebrow { margin: 0; color: #708b68; font-size: 10px; font-weight: 800; letter-spacing: 1.5px; }
.muted { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 3px 10px #17352806; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border: 1px solid transparent; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s, transform .15s; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover { background: #205440; }
.button-secondary { background: var(--green-light); color: var(--green); }
.button-outline { background: #fff; color: var(--green); border-color: #dce5df; }
.button-outline:hover { background: #f5f8f5; }
.filter-card { padding: 14px 18px; margin-bottom: 18px; }
.month-filter { display: flex; align-items: center; gap: 12px; }
.month-filter label { margin-right: auto; font-size: 13px; font-weight: 700; }
.month-filter input { width: 165px; }
input, select { width: 100%; min-height: 43px; padding: 10px 12px; color: var(--ink); background: #fff; border: 1px solid #dce4df; border-radius: 8px; font: inherit; font-size: 14px; }
input:focus, select:focus { outline: 3px solid #d7e9d8; border-color: #639576; }
label { display: flex; flex-direction: column; gap: 7px; color: #34463c; font-size: 13px; font-weight: 650; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.summary-card { display: flex; flex-direction: column; gap: 9px; padding: 20px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.summary-card > span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .9px; }
.summary-card strong { font-size: clamp(23px, 3vw, 31px); letter-spacing: -.8px; }
.summary-card small { color: var(--muted); font-size: 12px; }
.summary-due { color: white; background: var(--green); border-color: var(--green); }
.summary-due > span, .summary-due small { color: #d3e6d8; }
.stats-summary .summary-due { background: #f2f6f2; color: var(--ink); border-color: var(--line); }
.stats-summary .summary-due > span, .stats-summary .summary-due small { color: var(--muted); }
.table-card { padding: 21px 22px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
h2 { margin: 0; font-size: 19px; letter-spacing: -.35px; }
.section-heading .muted { margin-top: 5px; font-size: 12px; }
.stats-table td { min-width: 145px; }
.stats-table td:first-child { min-width: 100px; font-weight: 700; white-space: nowrap; }
.stats-bar { width: 100%; height: 6px; margin-top: 8px; overflow: hidden; background: #edf1ee; border-radius: 999px; }
.stats-bar-fill { display: block; height: 100%; border-radius: inherit; }
.rewards-bar { background: #74945c; }
.clients-bar { background: #6d9c94; }
.stats-warning { color: #95662a; }
.stats-note { margin: 16px 0 0; padding: 12px 14px; color: #785623; background: #fbf6e9; border: 1px solid #eee1be; border-radius: 9px; font-size: 12px; line-height: 1.5; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 12px 10px; color: #77847b; border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 800; letter-spacing: .65px; text-transform: uppercase; }
td { padding: 14px 10px; border-bottom: 1px solid #eff2ef; font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
.cell-subtitle { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.link-button { padding: 0; color: #52665a; background: transparent; border: 0; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.link-button:hover { color: var(--green); text-decoration: underline; }
.danger-text { color: #a34c40; }
.empty-state { padding: 30px 12px 32px; text-align: center; }
.empty-state p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.form-card { width: min(680px, 100%); padding: 27px; }
.form-card > h2, .form-card form > h2 { margin: 0 0 4px; }
.stack { display: flex; flex-direction: column; gap: 17px; }
.stack > h2:not(:first-child) { margin-top: 12px; }
.kind-fields { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 18px; border: 1px solid var(--line); border-radius: 11px; }
.kind-fields legend { padding: 0 6px; font-size: 12px; font-weight: 750; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.hint { margin: -7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-footer { display: flex; justify-content: flex-end; margin-top: 4px; }
.align-start { align-self: flex-start; }
.notice { margin-bottom: 18px; padding: 12px 15px; border: 1px solid; border-radius: 9px; font-size: 13px; }
.notice.success { color: #285e3c; background: #edf7ef; border-color: #cee8d4; }
.notice.error { color: #8d3d34; background: #fff0ee; border-color: #f2d0ca; }
.rules-list { display: flex; flex-direction: column; gap: 9px; }
.rule-row { display: grid; grid-template-columns: 1fr 1fr 1.25fr 36px; align-items: end; gap: 10px; padding: 11px; background: #f8faf8; border: 1px solid var(--line); border-radius: 9px; }
.rule-row label { font-size: 11px; }
.rule-row input { min-height: 39px; }
.icon-button { width: 34px; height: 39px; color: #976159; background: white; border: 1px solid var(--line); border-radius: 7px; font-size: 20px; cursor: pointer; }
.site-footer { padding: 18px 24px 28px; color: #8a968e; font-size: 11px; text-align: center; }
.auth-wrap { display: flex; min-height: 100vh; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 28px 20px; background: radial-gradient(ellipse at 50% 0%, #e5eee7 0%, #f5f7f5 65%); }
.auth-card { width: min(430px, 100%); padding: 30px; }
.auth-card .muted { margin-bottom: 23px; }
.auth-card .notice { margin-bottom: 18px; }

@media (max-width: 850px) {
    .topbar { flex-wrap: wrap; justify-content: space-between; gap: 11px 16px; padding: 12px 20px; }
    .navigation { order: 3; width: 100%; overflow-x: auto; }
    .navigation a { padding: 8px 10px; white-space: nowrap; font-size: 12px; }
    .account { margin-left: auto; }
    .container { margin-top: 29px; }
}
@media (max-width: 620px) {
    .topbar { gap: 11px; padding: 11px 14px; }
    .brand { font-size: 15px; }
    .brand-mark { width: 34px; height: 34px; }
    .account { font-size: 11px; }
    .container { width: calc(100% - 28px); margin: 25px auto 42px; }
    .page-heading { align-items: flex-start; flex-direction: column; gap: 15px; }
    .page-heading > .button, .page-heading > div + .button { width: 100%; }
    .filter-card { padding: 14px; }
    .month-filter { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .month-filter label { grid-column: 1 / -1; }
    .month-filter input { width: 100%; }
    .month-filter .button { padding-inline: 9px; font-size: 12px; }
    .summary-grid { grid-template-columns: 1fr; gap: 9px; }
    .summary-card { gap: 6px; padding: 15px 17px; }
    .summary-card strong { font-size: 24px; }
    .table-card { padding: 18px 14px; }
    .table-scroll { overflow: visible; }
    table, tbody, tr, td { display: block; width: 100%; }
    thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
    tbody { display: grid; gap: 10px; }
    tbody tr { padding: 8px 11px; background: #fafbfa; border: 1px solid var(--line); border-radius: 10px; }
    td { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px solid #edf0ed; text-align: right; }
    td:last-child { border: 0; }
    td::before { flex-shrink: 0; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .5px; text-align: left; text-transform: uppercase; }
    td[data-label]::before { content: attr(data-label); }
    td .cell-subtitle { display: inline; margin-left: 4px; }
    .form-card { padding: 20px 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .rule-row { grid-template-columns: 1fr 1fr 36px; }
    .rule-row label:nth-child(3) { grid-column: 1 / 3; }
    .rule-row .icon-button { grid-column: 3; grid-row: 1 / 3; }
}
