:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #637083;
  --line: #d8dee8;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --blue: #175cd3;
  --blue-dark: #1449a0;
  --green: #18794e;
  --green-bg: #eaf7f0;
  --amber: #8b5b00;
  --amber-bg: #fff7df;
  --red: #b42318;
  --red-bg: #fff0ee;
  --shadow: 0 14px 36px rgba(25, 41, 65, 0.08);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 15px; line-height: 1.55; letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
a { color: inherit; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.site-header { background: #102a43; color: #fff; border-bottom: 3px solid #2f80ed; }
.header-inner { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { color: #fff; font-size: 18px; font-weight: 700; text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-actions form { margin: 0; }
.page-content { padding: 38px 0 64px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 30px; line-height: 1.25; }
h2 { margin-bottom: 5px; font-size: 20px; line-height: 1.35; }
.eyebrow { margin-bottom: 6px; color: var(--blue); font-size: 13px; font-weight: 700; text-transform: uppercase; }
.auth-layout { min-height: calc(100vh - 164px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 430px); align-items: center; gap: 76px; }
.auth-heading { max-width: 560px; }
.auth-heading h1 { font-size: 38px; }
.auth-heading p:last-child { color: var(--muted); font-size: 17px; }
.form-panel { display: grid; gap: 10px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
label { font-weight: 650; }
input, select { width: 100%; min-height: 44px; padding: 9px 12px; color: var(--ink); background: #fff; border: 1px solid #aeb8c7; border-radius: 5px; outline: none; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 92, 211, 0.14); }
small, .privacy-note { color: var(--muted); font-size: 13px; }
.privacy-note { margin: 8px 0 0; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 15px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; font-weight: 700; text-decoration: none; white-space: nowrap; }
.button-primary { color: #fff; background: var(--blue); }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { color: #153a66; background: #e8f1fd; border-color: #b8d2f6; }
.button-danger { color: var(--red); background: #fff; border-color: #e8a39d; }
.button-quiet { min-height: 34px; padding: 6px 10px; color: #fff; background: transparent; border-color: rgba(255, 255, 255, 0.35); }
.button-wide { width: 100%; margin-top: 12px; }
.notice { margin-bottom: 20px; padding: 12px 14px; border-radius: 5px; font-weight: 650; }
.form-panel .notice { margin-bottom: 6px; }
.notice-error { color: #8d1d14; background: var(--red-bg); border: 1px solid #f2bbb5; }
.notice-success { color: #11613d; background: var(--green-bg); border: 1px solid #a9ddc2; }
.page-heading { margin-bottom: 26px; padding-bottom: 20px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.page-heading h1 { margin-bottom: 0; }
.section-block, .entry-section, .admin-controls, .roster-section, .archive-section { margin-top: 28px; }
.section-heading { margin-bottom: 15px; }
.section-heading p { margin-bottom: 0; color: var(--muted); }
.detail-grid { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--surface); }
.detail-item { min-width: 0; padding: 15px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-item dt { color: var(--muted); font-size: 13px; }
.detail-item dd { margin: 5px 0 0; overflow-wrap: anywhere; font-weight: 650; }
.entry-section { padding: 24px; background: var(--amber-bg); border: 2px solid #e5b94d; border-radius: 8px; }
.entry-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.field-group { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.field-group label span { display: block; color: var(--amber); font-size: 12px; }
.field-group strong { color: #714900; font-size: 13px; }
.money-input { display: flex; align-items: center; background: #fff; border: 1px solid #aeb8c7; border-radius: 5px; }
.money-input span { padding-left: 12px; color: var(--muted); }
.money-input input { border: 0; box-shadow: none; }
.confirm-row { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: 10px; font-weight: 500; }
.confirm-row input { width: 18px; min-height: 18px; margin-top: 3px; }
.entry-form > .button { justify-self: start; min-width: 130px; }
.closed-state { padding: 18px; color: var(--amber); background: #fff; border: 1px solid #e4ca83; border-radius: 5px; }
.status-pill { flex: 0 0 auto; padding: 5px 10px; border-radius: 999px; font-weight: 700; }
.status-complete { color: var(--green); background: var(--green-bg); }
.status-pending { color: var(--amber); background: var(--amber-bg); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: var(--surface); }
.metric { padding: 18px 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { display: block; color: var(--muted); }
.metric strong { display: block; margin-top: 3px; font-size: 26px; }
.admin-controls { padding: 20px 0; border-bottom: 1px solid var(--line); }
.control-row, .filters { display: grid; grid-template-columns: 180px 210px auto auto; align-items: end; gap: 12px; }
.control-row label, .filters label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
.roster-section { background: var(--surface); border: 1px solid var(--line); }
.roster-section > .section-heading { padding: 18px 20px 0; display: flex; justify-content: space-between; gap: 15px; }
.filters { padding: 0 20px 18px; grid-template-columns: 1fr 180px 230px auto; }
.table-wrap { width: 100%; overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid #e7ebf0; white-space: nowrap; }
th { color: #fff; background: #2d3f54; font-size: 13px; }
tbody tr:hover { background: #f6f9fc; }
.text-complete { color: var(--green); font-weight: 700; }
.text-pending { color: var(--amber); font-weight: 700; }
.loading-cell, .empty-cell { height: 100px; color: var(--muted); text-align: center; }
.archive-section { padding: 16px 0; border-top: 1px solid var(--line); }
.archive-section summary { cursor: pointer; font-weight: 700; }
.archive-section p { margin: 12px 0; color: var(--muted); }
.archive-section form { margin-bottom: 18px; }
.purge-form { max-width: 480px; display: grid; gap: 10px; padding: 18px; background: var(--red-bg); border: 1px solid #efb4ae; }
.purge-form label { display: grid; gap: 5px; }
.narrow-page { width: min(520px, 100%); margin: 30px auto; }

@media (max-width: 820px) {
  .shell { width: min(100% - 28px, 1180px); }
  .page-content { padding-top: 26px; }
  .auth-layout { min-height: auto; grid-template-columns: 1fr; gap: 24px; }
  .auth-heading h1 { font-size: 30px; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-form { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .control-row, .filters { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 20px, 1180px); }
  .site-header { min-height: 58px; }
  .brand { max-width: 220px; font-size: 16px; line-height: 1.25; }
  .header-inner { min-height: 58px; }
  h1 { font-size: 25px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .admin-heading .button { width: 100%; }
  .form-panel, .entry-section { padding: 20px 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { padding: 14px; }
  .metric strong { font-size: 22px; }
  .control-row, .filters { grid-template-columns: 1fr; }
  .control-row .button, .filters .button { width: 100%; }
}
