/* Evergreen Tools - calm, system fonts only, no external requests. Phone first. */
:root {
  --cream: #FBF8F1; --paper: #ffffff; --ink: #1d2a25; --muted: #475a52;
  --green: #1F4E3D; --sage: #5E7F72; --mint: #DDEBE4; --line: #cfd9d3;
  --clay: #E07A5F; --sand: #F2CC8F; --warn-bg: #fff3e3; --warn-ink: #6b3b00; --bad: #8f2a14;
  --r: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: anywhere;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; color: var(--green); line-height: 1.2; margin: 1.2em 0 .45em; }
h1 { font-size: 1.85rem; margin-top: .3em; } h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 .9em; } a { color: var(--green); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--clay); outline-offset: 2px;
}
.skip { position: absolute; left: -999px; top: 0; background: var(--green); color: #fff; padding: 12px 16px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 16px; }

/* header + nav */
.site-head { background: var(--green); color: #fff; }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding-top: 6px; padding-bottom: 6px; }
.brand { color: #fff; font-family: Georgia, serif; font-weight: bold; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; font-size: 1.1rem; margin-right: auto; }
.site-head nav { display: flex; flex-wrap: wrap; gap: 0 4px; width: 100%; }
.site-head nav a { color: #fff; text-decoration: none; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 8px; font-size: .95rem; }
.site-head nav a:hover, .site-head nav a[aria-current] { background: rgba(255,255,255,.16); }
.site-head nav a[aria-current] { text-decoration: underline; text-underline-offset: 4px; }
@media (min-width: 760px) { .site-head nav { width: auto; } }

main { padding: 8px 0 32px; }
.lead { font-size: 1.1rem; color: var(--muted); }
.card, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 14px 0; }
.panel h2:first-child, .card h2:first-child { margin-top: 0; }

/* home cards */
.tools { display: grid; gap: 12px; grid-template-columns: 1fr; padding: 0; list-style: none; margin: 14px 0; }
@media (min-width: 640px) { .tools { grid-template-columns: 1fr 1fr; } }
.tools a.tile { display: block; height: 100%; background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--sage); border-radius: var(--r); padding: 14px 16px; text-decoration: none; color: var(--ink); min-height: 44px; }
.tools a.tile:hover { background: var(--mint); }
.tools a.tile strong { display: block; font-family: Georgia, serif; color: var(--green); font-size: 1.1rem; margin-bottom: 2px; }
.tools a.tile span { color: var(--muted); font-size: .95rem; }

/* forms */
label { display: block; font-weight: 600; margin: 0 0 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: .9rem; display: block; }
input, select, textarea, button { font: inherit; font-size: 16px; color: var(--ink); }
input[type=text], input[type=number], input[type=month], select, textarea {
  width: 100%; min-height: 48px; padding: 8px 12px; border: 1.5px solid #8ea39a; border-radius: 10px; background: #fff;
}
textarea { min-height: 120px; line-height: 1.4; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: 1fr 1fr 1fr; } }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn, button {
  min-height: 48px; min-width: 48px; padding: 8px 18px; border-radius: 10px; border: 1.5px solid var(--green);
  background: var(--green); color: #fff; font-weight: 600; cursor: pointer;
}
.btn.ghost, button.ghost { background: #fff; color: var(--green); }
.btn.danger, button.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
button:hover { filter: brightness(1.08); }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border: 1.5px solid #8ea39a; border-radius: 10px; background: #fff; font-weight: 600; margin: 0; cursor: pointer; }
.seg input { width: 22px; height: 22px; margin: 0; accent-color: var(--green); }
.seg label:has(input:checked) { background: var(--mint); border-color: var(--green); }

/* messages */
.note { background: var(--mint); border-left: 5px solid var(--sage); padding: 10px 14px; border-radius: 8px; font-size: .95rem; margin: 12px 0; }
.warn { background: var(--warn-bg); border-left: 5px solid var(--clay); color: var(--warn-ink); padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.err { color: var(--bad); font-weight: 600; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* results */
.result h2 { margin-top: 0; }
.big { font-family: Georgia, serif; font-size: 1.5rem; color: var(--green); font-weight: bold; }
.stats { display: grid; gap: 10px; grid-template-columns: 1fr; margin: 10px 0; }
@media (min-width: 560px) { .stats { grid-template-columns: 1fr 1fr; } }
.stat { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: #fcfdfc; }
.stat h3 { margin: 0 0 4px; font-size: 1rem; }
.stat p { margin: 2px 0; }
.tw { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child, th[scope=row] { text-align: left; }
thead th { background: var(--mint); color: var(--green); position: sticky; top: 0; }
tfoot td, tfoot th { font-weight: bold; background: #f4f8f6; }

/* debts */
.debt { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; background: #fcfdfc; }
.debt .grid { grid-template-columns: 1fr 1fr; }
.debt .grid .full { grid-column: 1 / -1; }
@media (min-width: 640px) { .debt .grid { grid-template-columns: 2fr 1fr 1fr 1fr; } .debt .grid .full { grid-column: auto; } }
.debt .remove { margin-top: 10px; }

/* savings tracker */
.cells { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); padding: 0; margin: 12px 0; list-style: none; }
label.tick { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 10px; border: 1.5px solid #8ea39a; border-radius: 10px; background: #fff; font-weight: 400; margin: 0; cursor: pointer; }
label.tick input { width: 24px; height: 24px; flex: none; margin: 0; accent-color: var(--green); }
label.tick span { display: block; line-height: 1.2; font-size: .9rem; }
label.tick b { display: block; font-size: 1rem; }
label.tick:has(input:checked) { background: var(--mint); border-color: var(--green); }

/* meals */
.day { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; background: #fff; }
.day legend { font-family: Georgia, serif; font-weight: bold; color: var(--green); padding: 0 6px; }
.day .grid { grid-template-columns: 1fr; }
@media (min-width: 640px) { .day .grid { grid-template-columns: 1fr 1fr; } }
.shop { columns: 1; }
@media (min-width: 640px) { .shop { columns: 2; column-gap: 24px; } }
.shop section { break-inside: avoid; margin-bottom: 14px; }
.shop h3 { margin: 0 0 4px; border-bottom: 2px solid var(--sage); }
.shop ul { list-style: none; margin: 0; padding: 0; }
.shop li { padding: 3px 0 3px 30px; position: relative; min-height: 28px; }
.shop li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 16px; height: 16px; border: 1.5px solid var(--green); border-radius: 3px; }

/* habits */
.habit-grid td, .habit-grid th { padding: 0; text-align: center; font-size: .78rem; min-width: 26px; height: 32px; border: 1px solid #9fb1a8; }
.habit-grid th.name, .habit-grid td.name { text-align: left; padding: 0 8px; min-width: 130px; white-space: normal; font-size: .9rem; position: static; }
.habit-grid th small { display: block; font-weight: 400; color: var(--muted); }
.habit-grid .wk { border-left: 3px solid var(--green); }
.habit-grid thead th { position: static; }
.habit-title { font-family: Georgia, serif; color: var(--green); font-size: 1.3rem; margin: 0 0 8px; }

/* product box (only rendered when live) */
.product { background: #fff; border: 1.5px solid var(--sage); border-radius: var(--r); padding: 14px 16px; margin: 18px 0; }
.product h2 { margin: 0 0 4px; font-size: 1.1rem; }
.product p { margin: 0 0 10px; }
.product .tag { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 4px; }

.site-foot { border-top: 1px solid var(--line); padding: 14px 0 28px; color: var(--muted); font-size: .92rem; }
.site-foot .row { margin: 8px 0; }
.site-foot a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }
details > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--green); }

/* print: each result becomes a clean sheet (long tables and lists may run over one page) */
.print-only { display: none; }
@media print {
  body { background: #fff; font-size: 12pt; }
  .site-head, .site-foot, .no-print, .skip, .product, .panel.inputs, form, details:not(.keep-print), button, .note, .warn.no-print { display: none !important; }
  .print-only { display: block; }
  main { padding: 0; } .wrap { max-width: none; padding: 0; }
  .card, .panel { border: none; padding: 0; margin: 0 0 10px; }
  .tw { overflow: visible; border: none; }
  th, td { white-space: normal; }
  thead th { position: static; background: #eee; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  h1, h2, h3, .big, .habit-title { color: #000; }
  label.tick { border: 1.5px solid #000; break-inside: avoid; background: #fff !important; }
  label.tick input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border: 1.5px solid #000; border-radius: 3px; background: #fff; }
  label.tick input:checked { background: #000; }
  .cells { grid-template-columns: repeat(5, 1fr); }
  .shop li::before { border-color: #000; }
  .habit-grid td, .habit-grid th { border-color: #000; }
  .habit-grid td { height: 9mm; }
  a { color: #000; text-decoration: none; }
  .print-foot { display: block; margin-top: 10px; font-size: 9pt; color: #444; }
}
.print-foot { display: none; }
@media print { .print-foot { display: block; } }
