:root {
  color-scheme: light;
  --ink: #182b3a;
  --muted: #5d6c77;
  --brand: #174f75;
  --brand-dark: #103a57;
  --line: #d7e0e6;
  --surface: #ffffff;
  --page: #f3f7f9;
  --soft: #eaf3f8;
  --green: #1f6b46;
  --red: #a33131;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-size: 16px; line-height: 1.45; }
a { color: var(--brand); }
.topbar { min-height: 62px; padding: 10px clamp(16px, 4vw, 42px); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { color: var(--brand-dark); text-decoration: none; font-size: 1.08rem; font-weight: 750; }
nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); }
nav a, .link-button { font-size: .95rem; font-weight: 650; text-decoration: none; color: var(--brand); }
.logout-form { margin: 0; }
.link-button { border: 0; padding: 7px 0; background: none; cursor: pointer; }
.container { width: min(100% - 28px, 1000px); margin: 28px auto 60px; }
.page-heading { margin: 0 0 22px; }
.eyebrow { margin: 0 0 6px; color: var(--brand); font-size: .76rem; font-weight: 800; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(1.7rem, 6vw, 2.25rem); line-height: 1.15; letter-spacing: -.025em; }
h2 { margin: 0; font-size: 1.3rem; }
.lead { color: var(--muted); margin: 8px 0 0; }
.date-picker, .entry-card, .login-card, .report-section { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 3px 14px #102b3a0a; }
.date-picker { padding: 16px 18px; margin: 0 0 16px; }
label { display: block; font-weight: 700; margin-bottom: 8px; }
input[type="date"], input[type="month"], input[type="number"], input[type="password"] { width: 100%; min-height: 52px; border: 1px solid #aebdc7; border-radius: 10px; background: #fff; color: var(--ink); padding: 10px 12px; font: inherit; font-size: 1.05rem; }
input:focus { outline: 3px solid #64a7cc55; border-color: var(--brand); }
.inline-controls { display: flex; gap: 10px; align-items: center; }
.inline-controls input { max-width: 280px; }
.entry-card { padding: clamp(18px, 4vw, 30px); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field-group input { font-size: 1.35rem; font-weight: 700; }
.special-field label { color: #425f71; }
.derived-box { margin: 20px 0; border-radius: 12px; background: var(--soft); padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.derived-box span { color: var(--muted); }
.derived-box strong { text-align: right; }
.check-row { display: flex; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); cursor: pointer; }
.check-row input { width: 22px; height: 22px; accent-color: var(--brand); }
.check-row span { margin: 0; }
.primary-button, .secondary-button { min-height: 48px; border-radius: 10px; padding: 12px 18px; display: inline-flex; justify-content: center; align-items: center; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
.primary-button { background: var(--brand); border: 1px solid var(--brand); color: #fff; }
.primary-button:hover { background: var(--brand-dark); }
.secondary-button { background: #fff; border: 1px solid #9eb3c0; color: var(--brand-dark); }
.save-button { width: 100%; min-height: 58px; font-size: 1.12rem; }
.form-note { margin: 12px 0 0; color: var(--muted); font-size: .9rem; }
.unsaved-notice { margin: 0 0 18px; padding: 12px 14px; border: 1px solid #efd06d; border-radius: 10px; color: #705000; background: #fff5d6; font-weight: 700; }
.quick-links { margin-top: 18px; }
.messages { margin: 0 0 16px; }
.message { padding: 12px 14px; margin: 8px 0; border-radius: 10px; background: var(--soft); }
.message.success { color: var(--green); background: #e9f6ef; }
.message.error { color: var(--red); background: #fff0ef; }
.login-card { max-width: 440px; margin: 8vh auto; padding: clamp(22px, 6vw, 38px); }
.login-card h1 { font-size: 1.8rem; }
.stack-form { margin-top: 24px; display: grid; gap: 12px; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.summary-card { min-height: 122px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 5px; }
.summary-card span { color: var(--muted); font-weight: 650; }
.summary-card strong { font-size: clamp(1.5rem, 5vw, 2rem); color: var(--brand-dark); }
.summary-card small { color: var(--muted); }
.summary-card.highlight { border-color: #a5c8dc; background: #eef7fb; }
.summary-card.net-card { border-color: #a9d2b8; background: #f0f8f2; }
.report-section { padding: 18px; margin: 18px 0; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading span { color: var(--muted); font-size: .9rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { padding: 10px 9px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .82rem; }
.total-row { font-weight: 800; background: #f5f8fa; }
.empty-row { text-align: center; color: var(--muted); padding: 26px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 6px; }
  nav { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .container { margin-top: 20px; }
  .inline-controls { align-items: stretch; flex-direction: column; }
  .inline-controls input { max-width: none; }
  .inline-controls button { width: 100%; }
  .form-grid, .summary-grid { grid-template-columns: 1fr; gap: 13px; }
  .derived-box { align-items: flex-start; flex-direction: column; }
  .derived-box strong { text-align: left; }
  .report-section { padding: 14px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
}
@media print {
  body { background: white; font-size: 11pt; }
  .topbar, .no-print, .messages, .quick-links { display: none !important; }
  .container { width: 100%; margin: 0; }
  .report-section, .summary-card { box-shadow: none; break-inside: avoid; }
  .report-section { border: 1px solid #999; }
  a { color: inherit; text-decoration: none; }
}
