/* UI-1: the unified page template (hasm/cloud/pagetpl.py, docs/GUIDE/UI-TEMPLATE.md). Hasm's own variables from app.css;
   mobile first (390 px), wider grid from 1200 px (1440 px), print without the export bar. Colour only on a state (.pill). */
/* UI-1 fix M1 (eval-product UI-3): state colours ≥ 4.5:1 (WCAG AA) in light and dark; same meanings (green ok, amber
   warn, red bad, indigo link). Tokens tested by tests/features/test_UI-1_fix.py. */
.tpl{--tpl-surface:#FFFFFF;--tpl-ok:#067647;--tpl-ok-bg:#DFF5EA;--tpl-warn:#93370D;--tpl-warn-bg:#FDEEDD;--tpl-bad:#B42318;--tpl-bad-bg:#FDE6EA;--tpl-link:#4338CA}
:root[data-theme="dark"] .tpl{--tpl-surface:#0F1F38;--tpl-ok:#3DD68C;--tpl-ok-bg:#0F2E24;--tpl-warn:#FFA45C;--tpl-warn-bg:#33220F;--tpl-bad:#FF6B81;--tpl-bad-bg:#3A1520;--tpl-link:#A9A4FF}
.tpl .pill.ok{color:var(--tpl-ok);background:var(--tpl-ok-bg)}
.tpl .pill.warn{color:var(--tpl-warn);background:var(--tpl-warn-bg)}
.tpl .pill.bad{color:var(--tpl-bad);background:var(--tpl-bad-bg)}
.tpl .pill.neutral{color:inherit;background:transparent;border:1px solid var(--line-2)}  /* fix8 (UI-5 r2 L6): a stated fact, no state colour */
.tpl details>summary,.tpl a:not(.btn){color:var(--tpl-link)}
/* fix3 (eval-product UI-3 r2 N3, UI-2 L3): a fold a page puts outside .tpl (risk «Every detail of this run») had app.css
   details>summary = var(--acc) at 4.45:1; --acc is the brand token, so on template pages every summary takes the link token. */
:root{--tpl-link:#4338CA}
:root[data-theme="dark"]{--tpl-link:#A9A4FF}
html details>summary{color:var(--tpl-link)}
.tpl code.tpl-name{font-family:inherit;background:none;padding:0;color:inherit}
.tpl-chart-cap{margin:0 0 6px;font-size:13px;color:var(--ink-2)}
.tpl{display:flex;flex-direction:column;gap:14px;max-width:1120px;margin:0 auto}
.tpl .num,.tpl time,.tpl code,.tpl-table td{font-family:var(--f-num);font-variant-numeric:tabular-nums}
.tpl-asof{display:flex;flex-wrap:wrap;gap:4px 16px;font-size:12.5px;color:var(--muted);border-bottom:1px solid var(--line);padding:6px 0}
.tpl-asof code{color:var(--ink-2);background:none;padding:0}
.tpl-title{margin:4px 0 0;font-size:24px;line-height:1.35}
.tpl-example{margin:0;color:var(--muted);font-size:13.5px}
/* UI-5 r3 N1: the card's one track is the card's width (an auto track grew to the range's min-content and the range ran
   out of the card, cut at «9.49» / «.05»); the range may break after its dash, never inside a number. Each side is its
   own isolate: in Arabic the dash and a side's bare number (a <bdi>) were neutrals between two «دولار» and joined an RTL
   run, so the line read «.49 دولار 680.67 – دولار»; now «679.49 دولار – 680.67 دولار» left to right, as the PDF */
.tpl-answer{display:grid;grid-template-columns:minmax(0,1fr);gap:6px}.tpl-answer>*{min-width:0}
.tpl-hl-label{margin:0;color:var(--ink-2);font-size:14px}
.tpl-big{margin:0}.tpl-big b{font:600 44px/1.1 var(--f-num);font-variant-numeric:tabular-nums;color:var(--ink)}
/* UI-5 M4: «unavailable» keeps the headline size in the body font (the mono face spaced Arabic letters apart); its reason
   is a label-sized line under it, never larger than the label it qualifies */
.tpl-big .tpl-na{font-family:var(--f-body)}
.tpl-big .tpl-na-why{display:block;font-family:var(--f-body);font-weight:400;font-size:14px;line-height:1.4;color:var(--ink-2);margin-top:4px}
.tpl-range{unicode-bidi:isolate}.tpl-range .num{white-space:nowrap;unicode-bidi:isolate}.tpl-range-sep{white-space:normal}.tpl-range-dash{white-space:nowrap}
@media (max-width:480px){.tpl-big .tpl-range{font-size:.78em}}
.tpl-bench{margin:0;color:var(--ink-2)}
.tpl-sent{margin:0;font-size:16px}
.tpl-state{margin:0}
.tpl-ico{display:inline-block;flex:0 0 auto;line-height:1;font-style:normal}  /* fix7: the state's icon (x062 #4) */
.tpl-ico[data-icon=warn]::before{content:"\26A0\FE0E"}.tpl-ico[data-icon=ok]::before{content:"\2713"}.tpl-ico[data-icon=bad]::before{content:"\2717"}.tpl-ico[data-icon=neutral]::before{content:"\25C6"}
.tpl-limit{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:0}.tpl-limit input{width:7em;display:inline-block}
.tpl-warn{margin:0;font-size:14px;border-inline-start:3px solid var(--line-2);padding-inline-start:8px}
.tpl-src{margin:0;font-size:12.5px;color:var(--muted)}
.tpl-stale b{color:var(--ink)}
.tpl-term{margin:0;font-size:13px;color:var(--ink-2)}.tpl-term dfn{font-style:normal;font-weight:600}
.tpl-trust h2,.tpl-assumptions h2,.tpl-export h2{font-size:17px;margin:0 0 8px}
.tpl-ck-count{margin:0 0 8px;font-size:13px;color:var(--muted)}
.tpl-checks{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.tpl-check{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px 10px;padding:8px 0;border-bottom:1px solid var(--line)}
.tpl-ck-name{flex:1 1 12em}.tpl-ck-why{flex-basis:100%;color:var(--muted)}
.tpl-chart svg{max-width:100%;height:auto}.tpl-chart-why{margin:0;color:var(--muted)}
.tpl-assume{list-style:none;margin:0 0 10px;padding:0;display:grid;gap:8px}.tpl-assume input{max-width:10em;display:inline-block}
/* fix2 M4 (eval-product UI-4): a portfolio is a multi-line, full-width box (Assumption.input="textarea") */
.tpl-as-wide{display:grid;gap:4px}.tpl-as-box{display:block}.tpl-as-wide textarea{width:100%;max-width:none;box-sizing:border-box;font-family:var(--f-num);font-size:14px;line-height:1.45;resize:vertical}
.tpl-pro-d>summary{cursor:pointer;font-weight:600}
.tpl-scroll{overflow-x:auto}.tpl-table{border-collapse:collapse;width:100%;font-size:13.5px}
.tpl-table th,.tpl-table td{padding:6px 8px;border-bottom:1px solid var(--line);text-align:start;overflow-wrap:break-word}
/* fix10 (eval-product r2 UI-6 N1, DD-4 M1): text cells wrap inside the frame; a number keeps its line. An unavailable
   cell is the word and a mark; the reasons are listed once under the table (.tpl-notes) */
.tpl-table td.num{white-space:nowrap;overflow-wrap:normal}.tpl-fn{font-size:.85em;margin-inline-start:1px}
.tpl-notes{list-style:none;margin:4px 0 0;padding:0;font-size:12.5px;color:var(--ink-2)}
.tpl-source{font-size:12.5px;color:var(--muted)}
.tpl-ex-row{display:flex;flex-wrap:wrap;gap:8px;margin:0}
@media (max-width:480px){.tpl{gap:10px}.tpl-title{font-size:20px}.tpl-big b{font-size:36px}
  .tpl-ex-row .btn{flex:1 1 100%}.tpl-check{padding:6px 0}.tpl-table{font-size:12.5px}}
/* fix3 (UI-2 L3): align-items:start — the answer card is not stretched to the taller trust block (no empty band) */
@media (min-width:1200px){.tpl{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);column-gap:24px;align-items:start}
  .tpl-asof,.tpl-title,.tpl-example,.tpl-chart,.tpl-pro,.tpl-source,.tpl-export{grid-column:1/-1}
  .tpl-big b{font-size:52px}}
@media print{.tpl-export,.tpl-limit button,.tpl-assumptions button{display:none!important}
  .tpl{display:block;max-width:none}.tpl .card{box-shadow:none;break-inside:avoid;border:1px solid #CDD7E2}
  .tpl .pill{border:1px solid currentColor}
  .tpl details>summary{display:block!important}}
