:root {
  color-scheme: light;
  --bg: #f3f1eb;
  --surface: #ffffff;
  --surface-soft: #e9eee8;
  --ink: #1d2a24;
  --muted: #68736d;
  --line: #d8ddd8;
  --accent: #1f6b4f;
  --accent-dark: #154c38;
  --danger: #9b2c2c;
  --success: #17613f;
  --radius: 12px;
  --shadow: 0 12px 32px rgba(29, 42, 36, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

button, input { font: inherit; }
a { color: inherit; }

.site-header {
  min-height: 68px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 241, 235, 0.96);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
}

.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 64px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 6vw, 3.6rem); line-height: 1.03; letter-spacing: -0.045em; }
h2 { margin-bottom: 0; font-size: 1.35rem; }
.eyebrow { margin-bottom: 8px; color: var(--accent); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.total-value { margin: 0; font-size: clamp(2rem, 7vw, 4.4rem); font-weight: 800; line-height: 1; letter-spacing: -0.05em; }

.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.summary-card, .panel, .login-panel { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.summary-card { padding: 24px; }
.card-label { margin-bottom: 22px; color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.card-value { margin-bottom: 6px; font-size: clamp(1.8rem, 5vw, 2.8rem); font-weight: 800; letter-spacing: -0.04em; }
.card-meta { margin-bottom: 0; color: var(--muted); }

.content-grid { display: grid; grid-template-columns: minmax(290px, 0.78fr) minmax(0, 1.6fr); gap: 16px; align-items: start; }
.panel { padding: 24px; }
.panel-heading { display: flex; justify-content: space-between; margin-bottom: 24px; }
.reading-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field-wide { grid-column: 1 / -1; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 0.86rem; font-weight: 700; }
input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #bbc4be;
  border-radius: 8px;
  background: white;
  color: var(--ink);
}
input:focus { outline: 3px solid rgba(31, 107, 79, 0.2); border-color: var(--accent); }

.button {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { color: white; background: var(--accent); }
.button-primary:hover { background: var(--accent-dark); }
.button-quiet { border-color: var(--line); background: transparent; color: var(--ink); }
.button:focus-visible { outline: 3px solid rgba(31, 107, 79, 0.3); outline-offset: 2px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; text-align: left; }
th:last-child, td:last-child { padding-right: 0; }
th { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.table-total { font-weight: 800; }

.login-panel { width: min(440px, 100%); margin: 9vh auto 0; padding: clamp(24px, 6vw, 42px); }
.login-panel h1 { margin-bottom: 14px; font-size: clamp(2rem, 8vw, 3rem); }
.form-stack { display: grid; gap: 18px; margin-top: 28px; }
.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.message { padding: 12px 14px; border: 1px solid; border-radius: 8px; }
.message-error { color: var(--danger); border-color: #e7b7b7; background: #fff1f1; }
.message-success { color: var(--success); border-color: #b9ddca; background: #eff9f3; }

@media (max-width: 860px) {
  .content-grid { grid-template-columns: 1fr; }
  .history-panel { grid-row: 1; }
}

@media (max-width: 620px) {
  .site-header { min-height: 60px; padding: 0 16px; }
  .page-shell { width: min(100% - 24px, 1180px); padding-top: 28px; }
  .page-heading { align-items: start; flex-direction: column; gap: 12px; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card, .panel { padding: 18px; }
  .reading-form { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  tr { padding: 14px 0; border-bottom: 1px solid var(--line); }
  tbody tr:last-child { border-bottom: 0; }
  td, td:first-child, td:last-child { padding: 5px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; white-space: normal; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 0.82rem; font-weight: 700; text-align: left; }
}

