:root {
  color-scheme: light;
  --paper: #f3f6f3; --surface: #fff; --ink: #182923; --muted: #51675f;
  --line: #d8e3db; --brand: #146248; --mast: #12352e; --late: #9d3c24; --radius: 12px;
  font: 16px/1.45 system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
[hidden] { display: none !important; }
.wrap { width: min(1100px, 100% - 36px); margin: auto; }
.mast { background: var(--mast); color: #f5faf5; border-bottom: 4px solid #6cb591; }
.mast-inner, .section-head, .dialog-head, .actions {
  display: flex; justify-content: space-between; align-items: center; gap: .65rem;
}
.mast-inner { padding: 1.15rem 0; }
.eyebrow { display: block; color: var(--muted); font-size: .73rem; font-weight: 750; letter-spacing: .08em; }
.mast .eyebrow { color: #a7d2bf; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.2rem,4vw,1.85rem); }
h2 { font-size: 1.35rem; }
h3 { margin: 0 0 .6rem; font-size: 1rem; }
main { padding: 1.25rem 0 2rem; }
button, input, select, textarea { font: inherit; }
button {
  border: 1px solid transparent; border-radius: 8px; padding: .56rem .85rem; cursor: pointer;
  font-weight: 670; color: white; background: var(--brand); min-height: 42px;
}
button:hover { filter: brightness(.94); }
button:disabled { opacity: .58; cursor: default; }
:focus-visible { outline: 3px solid #41916c; outline-offset: 2px; }
.secondary { color: var(--brand); background: var(--surface); border-color: var(--line); }
.link { background: transparent; color: var(--brand); }
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.gate { max-width: 440px; margin: 1rem auto; padding: 1.35rem; }
.gate form { display: grid; gap: 1rem; margin-top: 1rem; }
.muted { color: var(--muted); }
.notice { background: #e6f2e8; padding: .7rem .85rem; margin-bottom: .85rem; border-radius: 7px; }
.error, .notice.error { color: var(--late); background: #fbebe6; padding: .65rem; border-radius: 6px; }
.overview { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .65rem; margin: .9rem 0; }
.metric {
  display: grid; justify-items: start; gap: .15rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); text-align: left; font-size: .85rem;
}
.metric strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.metric[aria-pressed="true"] { border-color: var(--brand); background: #e6f3eb; box-shadow: inset 0 0 0 1px var(--brand); }
.late { color: var(--late); }
.filters { padding: .9rem; }
details { margin-top: .6rem; }
summary { color: var(--brand); cursor: pointer; }
#filters, .fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
#filters { margin: .6rem 0 0; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); }
.fields .full { grid-column: 1/-1; }
label { display: grid; gap: .22rem; color: var(--muted); font-size: .87rem; min-width: 0; }
input, select, textarea {
  width: 100%; min-width: 0; min-height: 40px; border: 1px solid #bfcfc6; border-radius: 7px;
  color: var(--ink); background: var(--surface); padding: .42rem .58rem; font-size: 1rem;
}
textarea { resize: vertical; }
.count { padding: 0 .9rem .55rem; font-size: .84rem; }
.task-line {
  width: 100%; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: .7rem .9rem;
  display: grid; grid-template-columns: 3.5rem minmax(0,1fr) 8rem; align-items: start; gap: .65rem;
  text-align: left; color: var(--ink); background: var(--surface);
}
.task-line:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.task-line:hover { background: #edf5ef; filter: none; }
.task-line small { display: block; color: var(--muted); font-weight: 450; overflow-wrap: anywhere; }
.task-line .title { overflow-wrap: anywhere; }
.status { justify-self: end; text-align: right; font-size: .83rem; }
footer { margin-top: .65rem; }
dialog { width: min(680px,100% - 20px); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; color: var(--ink); }
dialog::backdrop { background: #12352e80; }
.dialog-head { align-items: flex-start; margin-bottom: 1rem; }
#task-form { display: grid; gap: .85rem; }
#task-form .actions { justify-content: flex-end; }
#history { margin-top: 1.1rem; }
.entry { border-top: 1px solid var(--line); padding: .55rem 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.entry strong { font-size: .85rem; }
.entry p { margin-top: .25rem; }
@media(max-width: 520px) {
  .wrap { width: calc(100% - 20px); }
  .mast-inner { align-items: flex-start; }
  .mast .actions { flex-wrap: wrap; justify-content: flex-end; }
  .mast button { font-size: .81rem; padding: .35rem .5rem; }
  .task-line { grid-template-columns: 2.8rem minmax(0,1fr); gap: .3rem .42rem; }
  .status { grid-column: 2; justify-self: start; text-align: left; }
}
