:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #172535;
  background: #f2f5f8;
  font-synthesis: none;
  line-height: 1.48;
  --muted: #4b5b6c;
  --line: #d7e0e8;
  --accent: #9a2e27;
  --dark: #1e344a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
#fieldline { max-width: 1320px; margin: 0 auto; padding: 1.5rem clamp(.9rem, 3vw, 3rem) 4rem; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 3.7vw, 2.5rem); line-height: 1.12; }
h2 { font-size: 1.17rem; line-height: 1.25; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea { border: 1px solid var(--line); border-radius: .45rem; }
button, input, select { min-height: 2.55rem; }
button { cursor: pointer; padding: .5rem .8rem; color: var(--dark); background: #fff; font-weight: 600; }
button:hover:not(:disabled) { background: #edf3f9; border-color: #9bafc4; }
button:disabled { opacity: .58; cursor: default; }
:focus-visible { outline: 3px solid #1b67b0; outline-offset: 2px; }
input, select, textarea { min-width: 0; width: 100%; color: inherit; background: #fff; padding: .52rem .62rem; }
input[type="checkbox"] { width: 1.05rem; height: 1.05rem; min-height: 0; flex: none; accent-color: var(--accent); }
textarea { resize: vertical; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:hover:not(:disabled) { color: #fff; background: #7f241e; border-color: #7f241e; }

.masthead, .toolbar, .day-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .85rem; }
.masthead { padding: 1.2rem 0 1.3rem; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--accent); font-size: .77rem; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; margin-bottom: .35rem; }
.member { color: var(--muted); font-size: .87rem; overflow-wrap: anywhere; }
.tabs { display: flex; flex-wrap: wrap; gap: .42rem; padding: 1rem 0; }
.tabs button[aria-current] { background: var(--dark); color: #fff; border-color: var(--dark); }
.tabs button[aria-current]:hover { background: #29465e; }
.toolbar { margin: 0 0 .85rem; }
.toolbar-actions, .date-control, .row-actions, .form-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.date-control input { width: auto; min-width: 8.25rem; }
.date-control button { min-width: 2.6rem; }
.content { display: grid; gap: 1rem; }
.day-heading p, .hint, .empty { color: var(--muted); }
.hint { margin-top: .34rem; font-size: .89rem; }
.empty { padding: .9rem 0 0; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.metric, .panel, .entry-screen { background: #fff; border: 1px solid var(--line); border-radius: .65rem; }
.metric { padding: .8rem 1rem; }
.metric strong { display: block; color: var(--dark); font-size: 1.7rem; line-height: 1.18; }
.metric span { display: block; margin-top: .2rem; color: var(--muted); font-size: .86rem; }
.panel { padding: clamp(.85rem, 2.25vw, 1.35rem); min-width: 0; }
.notice { margin: .75rem 0 1rem; padding: .65rem .85rem; border: 1px solid #a5b7ca; border-radius: .5rem; background: #f1f7ff; }
.notice[data-kind="error"] { color: #73251f; border-color: #e2a59d; background: #fff3f0; }
.notice[data-kind="success"] { color: #224938; border-color: #a0c9b5; background: #eef8f2; }
.entry-screen { max-width: 35rem; margin: clamp(1rem, 12vh, 9rem) auto; padding: clamp(1rem, 4vw, 2rem); }
.entry-screen p[role="status"] { margin: .8rem 0; color: var(--muted); }

.table-wrap { width: 100%; overflow: auto; margin-top: .85rem; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; text-align: left; }
th, td { padding: .56rem .65rem; border-bottom: 1px solid #e4e9ee; vertical-align: top; }
th { background: #f1f5f8; color: #33495e; }
td { overflow-wrap: anywhere; }
.row-actions { flex-wrap: nowrap; }
.row-actions button { min-height: 2.15rem; padding: .24rem .55rem; font-size: .84rem; }

.entry-form { margin-top: .8rem; }
.form-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .75rem; align-items: start; }
.field { display: grid; gap: .24rem; align-content: start; }
.field > span { color: var(--dark); font-weight: 600; font-size: .86rem; }
.wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: .45rem; min-width: 0; padding: .6rem .8rem .8rem; }
legend { color: var(--dark); font-weight: 650; }
.filters { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: .55rem; }
.filters .field { flex: 1 1 12rem; }
.form-actions { margin-top: .85rem; }
.worker-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: .4rem; max-height: 18rem; overflow-y: auto; margin-top: .45rem; }
.worker-option { display: grid; grid-template-columns: 1.15rem 1fr; gap: .05rem .4rem; align-items: center; padding: .37rem .45rem; border: 1px solid #e4e9ee; border-radius: .35rem; cursor: pointer; }
.worker-option input { grid-row: 1 / 3; margin: 0; }
.worker-option span, .worker-option small { overflow-wrap: anywhere; }
.worker-option small { color: var(--muted); grid-column: 2; }
.check-label { display: flex; align-items: center; gap: .4rem; min-height: 2.6rem; color: var(--dark); }
#fieldline-editor { scroll-margin: 1rem; }

@media (max-width: 600px) {
  #fieldline { padding-top: .65rem; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .tabs button, .toolbar button { min-height: 2.75rem; }
}

@media print {
  html:not([data-fieldline-print="ready"]) #fieldline { display: none; }
  :root { color: #111; background: #fff; }
  #fieldline { max-width: none; margin: 0; padding: 0; }
  .no-print, table:has(td .row-actions) th:last-child, table:has(td .row-actions) td:last-child { display: none !important; }
  .panel, .metric { border-color: #aaa; }
  .metric { break-inside: avoid; }
  .table-wrap { overflow: visible; }
  th, td { padding: .25rem .35rem; }
  tr { break-inside: avoid; }
}

.member-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.entry-screen a { display: inline-block; margin: .75rem 0 0 .75rem; color: var(--dark); }
.credential-panel { border-color: #8dafa3; background: #f6fbf8; }
.access-code { display: block; margin-top: .8rem; padding: .85rem; border: 1px solid #a7c3b7; border-radius: .4rem; background: #fff; font-size: 1.05rem; overflow-wrap: anywhere; user-select: all; }
.fieldline-auth { min-height: 100vh; padding: clamp(1rem, 4vw, 3rem); }
.auth-card { max-width: 31rem; margin: min(9vh, 6rem) auto; padding: clamp(1.2rem, 4vw, 2rem); background: #fff; border: 1px solid var(--line); border-radius: .7rem; }
.auth-card h1 { font-size: clamp(1.7rem, 4vw, 2.15rem); }
.auth-card p { margin-top: .75rem; }
.auth-card a { color: var(--dark); }
.auth-form { display: grid; gap: 1rem; margin-top: 1.3rem; }
.auth-form label { display: grid; gap: .3rem; color: var(--dark); font-weight: 600; }
.auth-form input { font-weight: 400; }
.auth-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .25rem; }
.auth-actions button { flex: 1 1 auto; }
.auth-message { margin-top: 1rem; padding: .7rem .85rem; border: 1px solid #a5b7ca; border-radius: .45rem; background: #f1f7ff; overflow-wrap: anywhere; }
.auth-message[role="alert"], .auth-message[data-kind="error"] { color: #73251f; border-color: #e2a59d; background: #fff3f0; }
@media print { .fieldline-auth, .credential-panel { display: none !important; } }

.cross-verification { margin-top: 1rem; }
.verification-facts { margin-top: .65rem; padding: .6rem .75rem; background: #f1f5f8; border-left: 3px solid var(--dark); color: var(--dark); font-size: .9rem; font-weight: 600; }
.review-history { margin-top: .85rem; border-top: 1px solid var(--line); padding-top: .65rem; }
.review-history summary { color: var(--dark); font-weight: 600; cursor: pointer; }
.review-history summary:focus-visible { outline: 3px solid #1b67b0; outline-offset: 2px; }
