:root {
  /* Universal Credit section: colours, type, header, footer and buttons come from /ds.css */
  --bg: var(--linen); --brand-ink: #fff; --brand-soft: var(--tint-sage);  /* --brand: the site's green from ds.css (21 Nov 2026, warm look) */
  --radius: 10px; --max: var(--max-text); font-size: 100%;
}
body { overflow-wrap: anywhere; }
img { max-width: 100%; height: auto; }


.wrap { max-width: var(--max); margin: 0 auto; padding-left: 1rem; padding-right: 1rem; }
main { padding-top: 1.25rem; padding-bottom: 2.5rem; }
h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); letter-spacing: var(--h-track); margin: .5rem 0 .75rem; }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--h-track); margin: 2rem 0 .5rem; }
h3 { font-weight: 600; font-size: 1.1rem; margin: 1.25rem 0 .4rem; }
p, ul, ol { margin: 0 0 .9rem; }
li { margin-bottom: .3rem; }
.lead { font-size: 1.15rem; color: var(--muted); }
.small { font-size: .92rem; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.card > :first-child { margin-top: 0; }
.notice { border-left: 5px solid var(--brand); background: var(--brand-soft); padding: .75rem 1rem; border-radius: 6px; margin: 1rem 0; }
.warn { border-left: 5px solid var(--warn); background: var(--warn-bg); padding: .75rem 1rem; border-radius: 6px; margin: 1rem 0; }
.bad { border-left: 5px solid var(--bad); background: var(--bad-bg); padding: .75rem 1rem; border-radius: 6px; margin: 1rem 0; }
.good { border-left: 5px solid var(--good); background: var(--good-bg); padding: .75rem 1rem; border-radius: 6px; margin: 1rem 0; }
.disclaimer { font-size: .92rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: .75rem; margin-top: 2rem; }

form .field, .field { margin: 0 0 1rem; }
label, .label { display: block; font-weight: 600; margin-bottom: .25rem; }
input:not([type]), input[type="text"], input[type="number"], input[type="date"], input[type="email"], input[type="search"], select, textarea {
  font: inherit; font-size: 1rem; min-height: 2.75rem; width: 100%; max-width: 100%;
  padding: .5rem .6rem; border: 2px solid var(--field-line); border-radius: 6px; background: #fff; color: var(--ink);
}
input.narrow, select.narrow { max-width: 12rem; }
input[type="checkbox"], input[type="radio"] { width: 1.3rem; height: 1.3rem; margin: 0 .5rem 0 0; vertical-align: middle; accent-color: var(--brand); }
.check { display: flex; align-items: flex-start; gap: .25rem; font-weight: 400; margin-bottom: .5rem; }
.check input { flex: none; margin-top: .2rem; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .25rem; }
.row { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 560px) { .row.two { grid-template-columns: 1fr 1fr; } .row.three { grid-template-columns: 1fr 1fr 1fr; } }

button {
  font: 700 1rem/1.2 var(--font-ui); min-height: var(--tap); padding: .7rem 1.1rem;
  border-radius: var(--btn-r); border: 1.5px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  cursor: pointer; display: inline-block; text-decoration: none; text-align: center;
}
button:hover { background: var(--brand-d); border-color: var(--brand-d); color: #fff; }
button.secondary { background: transparent; color: var(--brand); }
button.secondary:hover { background: var(--soft); color: var(--ink); }
button.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
button.link { background: none; border: none; color: var(--brand); text-decoration: underline; padding: 0 .375rem; min-height: 44px; display: inline-flex; align-items: center; font-weight: 400; }
button[disabled] { opacity: .55; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }

table { border-collapse: collapse; width: 100%; font-size: .97rem; }
th, td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
/* Narrow phones (320–430 px): first column keeps a readable width, other columns may wrap; the wrapper scrolls if still too wide. */
.table-wrap table th:first-child, .table-wrap table td:first-child { min-width: 7.5rem; }
@media (max-width: 430px) { .table-wrap table { font-size: .9rem; } .table-wrap th, .table-wrap td { padding: .4rem .3rem; } }
/* Month-by-month input tables (losses): a grid of inputs on wider screens, one labelled group per month on phones */
table.months td label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 600px) {
  .table-wrap table.months, .table-wrap table.months tbody, .table-wrap table.months th, .table-wrap table.months td { display: block; min-width: 0; }
  table.months thead { display: none; }
  .table-wrap table.months tr { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .75rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
  table.months th[scope="row"] { grid-column: 1 / -1; border: 0; padding: 0; font-weight: 700; }
  table.months td { border: 0; padding: 0; }
  table.months td label { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; display: block; font-size: .92rem; margin-bottom: .2rem; }
}
.figures td:first-child { width: 65%; }
.figures tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
.figures tr.key td { background: var(--brand-soft); font-weight: 700; font-size: 1.05rem; }
.result { font-size: 1.05rem; }
.result .big { font-size: 1.6rem; font-weight: 700; display: block; }
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .85rem; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.pill.locked { background: var(--paper); color: var(--text-2); }
details { margin: .5rem 0 1rem; }
summary { cursor: pointer; font-weight: 600; }
.cols { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .cols.two { grid-template-columns: 1fr 1fr; } }
.tile { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: var(--ink); }
.tile:hover { border-color: var(--brand); }
.tile strong { color: var(--brand); display: block; font-size: 1.08rem; margin-bottom: .25rem; }
.price { font-size: 1.5rem; font-weight: 700; }
.tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.tabs button { background: #fff; color: var(--brand); padding: .4rem .8rem; }
.tabs button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.entry-list li { list-style: none; border-bottom: 1px solid var(--line); padding: .5rem 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; }
.entry-list { padding: 0; margin: 0; }
.entry-list .amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.entry-list .meta { color: var(--muted); font-size: .9rem; display: block; }
.hidden { display: none !important; }
/* The app fills in its screens after load; reserving a screen height keeps the disclaimer and footer from jumping (CLS). */
.app-area { min-height: 100vh; }
.toast { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 8px; z-index: 20; max-width: 92vw; }


#print-area { display: none; }
@media print {
  body { background: #fff; font-size: 11pt; }
    #print-area { display: block !important; }
  #print-area table { font-size: 10pt; }
  #print-area h1 { font-size: 16pt; }
  a { color: #000; text-decoration: none; }
  .card { border: none; padding: 0; }
  .app-area { min-height: 0; }
}
.mt { margin-top: .5rem; }
.error { color: var(--bad); }
dialog { max-width: min(92vw, 720px); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
dialog::backdrop { background: rgba(0,0,0,.5); }
#care section { margin: 1rem 0; }
#care .actions { margin: .5rem 0 0; }
