/* Turning Point Toolkit: calm dawn, liquid-glass panels over the shader gradient (fx.js). System fonts only (CSP).
   Every color is a variable set from DESIGN.colors in toolkit.js (light and dark); no color values live here. */
:root {
  --radius: 18px;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; font: 17px/1.55 var(--font); color: var(--text); background: var(--bg);
  overflow-x: hidden; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .4em; }
h2 { font-size: 1.4rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 10; background: var(--surface); color: var(--text);
  padding: 8px 12px; border-radius: 10px; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.topbar { position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line); background: var(--surface); }
.top-in { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 8px 12px; align-items: center;
  flex-wrap: wrap; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; font-weight: 700; font-family: var(--serif);
  font-size: 1.1rem; margin-right: auto; }
nav { display: flex; gap: 4px; flex-wrap: wrap; order: 3; width: 100%; }
nav a { text-decoration: none; padding: 6px 11px; border-radius: 999px; font-size: .95rem; }
nav a[aria-current="page"] { background: var(--primary); color: var(--primary-ink); }
nav a.help-link { margin-left: auto; border: 1px solid var(--line); font-weight: 700; }
.fx-toggle { font: inherit; font-size: .82rem; color: inherit; background: transparent; border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; cursor: pointer; min-height: 34px; }
@media (min-width: 860px) { nav { order: 0; width: auto; } nav a.help-link { margin-left: 6px; } }

main { max-width: 980px; margin: 0 auto; padding: 18px 16px 40px; outline: none; }
#banners { max-width: 980px; margin: 0 auto; padding: 12px 16px 0; }
#banners:empty { display: none; }
.banner { margin: 0 0 8px; padding: 10px 14px; border-radius: 14px; background: var(--surface); color: var(--text);
  border: 2px dashed var(--accent); font-size: .95rem; }
.banner.warn { border-style: solid; border-color: var(--red); }
footer.site { max-width: 980px; margin: 0 auto; padding: 0 16px 28px; font-size: .88rem; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  margin: 0 0 16px; min-width: 0; }
.card.note { font-size: .98rem; }
.card.calm { border: 2px solid var(--accent); }
.card.urgent { border: 2px solid var(--red); }
.big-text { font-size: 1.2rem; font-family: var(--serif); }
.btn { font: inherit; font-weight: 700; border: 0; border-radius: 999px; padding: 11px 20px; cursor: pointer;
  background: var(--primary); color: var(--primary-ink); min-height: 44px; text-decoration: none; display: inline-block; }
.btn.secondary { background: transparent; color: inherit; border: 1px solid var(--line); }
.btn.danger { background: var(--red); color: var(--surface); }
.btn.small { padding: 6px 14px; min-height: 36px; font-size: .9rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.msg { margin: 10px 0 0; font-weight: 600; min-height: 1.5em; }
.result { font-family: var(--serif); font-size: 1.2rem; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--soft); font-size: .85rem; margin-bottom: 6px; }
.label { font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .05em; font-size: .78rem;
  margin: 18px 0 4px; }
.tag { display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; padding: 1px 8px;
  border-radius: 99px; background: var(--soft); color: var(--primary); margin-right: 4px; }
.bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 4px 0 8px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .3s ease; }

/* forms */
form, fieldset { margin: 0; }
label.field, div.field { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; margin: 0 0 14px; }
label.field.narrow { max-width: 240px; }
input[type=number], input[type=text], input[type=date], input[type=file], select, textarea { font: inherit; font-weight: 400;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  min-height: 44px; width: 100%; max-width: 100%; }
textarea { resize: vertical; }
.fields { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin: 10px 0 4px; }
.range { display: flex; gap: 12px; align-items: center; }
.range input { flex: 1; accent-color: var(--primary); min-height: 44px; min-width: 0; }
.range output { font-family: var(--serif); font-size: 1.2rem; min-width: 4.5em; text-align: right; }
.ends { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); font-weight: 400; }
fieldset.scale, fieldset.q-set { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
fieldset legend { font-weight: 600; font-size: .95rem; padding: 0; margin-bottom: 6px; }
fieldset.q-set legend { font-weight: 500; font-size: 1rem; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg label { flex: 1 1 0; min-width: 44px; position: relative; }
.seg.answers label { flex: 0 1 auto; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px; font-weight: 600; background: transparent; }
.seg input:checked + span { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; cursor: pointer; border-bottom: 1px solid var(--line); }
.check input { margin-top: 4px; width: 22px; height: 22px; flex: none; accent-color: var(--primary); }
.check input:checked + span { color: var(--muted); }
.done-date { display: block; color: var(--ok); font-weight: 600; }
.done-date:empty { display: none; }
ul.checks, ul.entries, ul.items { list-style: none; padding: 0; margin: 0; }
ul.entries li, ul.items li { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 8px 0;
  border-bottom: 1px solid var(--line); }
ul.entries li > span, ul.items li > span { min-width: 0; overflow-wrap: anywhere; }

/* chart */
.chart { width: 100%; height: auto; display: block; margin: 6px 0 8px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--line); stroke-width: 1.5; }
.chart .tick { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart .empty { fill: var(--muted); font-size: 15px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--chart); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--chart); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: default; }
.chart g:hover .dot { r: 6.5; }
.table-view summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.table-view table { width: 100%; border-collapse: collapse; font-size: .92rem; margin-top: 8px; }
.table-view th, .table-view td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }

/* decide */
.tally { display: grid; gap: 4px; margin: 8px 0 12px; }
.tally-row p { margin: 0; }

/* protect */
.level h2 { display: flex; align-items: center; gap: 10px; }
.lvl-dot { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.level.yellow .lvl-dot { background: var(--yellow); }
.level.orange .lvl-dot { background: var(--orange); }
.level.red .lvl-dot { background: var(--red); }
.level.yellow { border-top: 4px solid var(--yellow); }
.level.orange { border-top: 4px solid var(--orange); }
.level.red { border-top: 4px solid var(--red); }
.two-col { display: grid; gap: 8px 24px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.wl { min-width: 0; }
.x { font: inherit; font-size: .82rem; background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 99px; padding: 4px 10px; cursor: pointer; min-height: 32px; flex: none; }
form.add { display: flex; gap: 8px; margin: 10px 0; }
form.add input { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { font: inherit; font-size: .88rem; text-align: left; color: inherit; background: var(--soft); border: 1px dashed var(--line);
  border-radius: 99px; padding: 6px 12px; cursor: pointer; min-height: 36px; max-width: 100%; overflow-wrap: anywhere; }
.safety { margin-top: 12px; font-weight: 600; }
.print-only { display: none; }
.print-row { margin-bottom: 16px; justify-content: center; }
.empty-list { font-size: .92rem; }

/* ---------- shader gradient, liquid glass, liquid logo (fx.js) */
.fx-bg { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1; display: block; pointer-events: none; }
.fx-bg.hidden { display: none; }
body.fx-on { background: transparent; }
body.fx-on.fx-nogl { background: radial-gradient(120% 80% at 10% 0%, var(--primary) 0%, transparent 60%),
  radial-gradient(90% 70% at 100% 30%, var(--amber) 0%, transparent 55%), var(--bg); }
body:not(.fx-on) .hero h1 { color: var(--text); }
body.fx-on .card, body.fx-on .topbar, body.fx-on .banner {
  position: relative; background: var(--glass); border-color: var(--edge);
  -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%);
  box-shadow: inset 0 1px 0 var(--edge), 0 10px 34px var(--shadow);
}
body.fx-on .card { border-radius: 22px; overflow: hidden; }
body.fx-on .card.calm { border-color: var(--accent); }
body.fx-on .card.urgent { border-color: var(--red); }
body.fx-on .banner { border-color: var(--accent); }
body.fx-on .banner.warn { border-color: var(--red); }
body.fx-on.fx-refract .card.glass-hero { backdrop-filter: url(#fx-liquid) blur(16px) saturate(170%); }
body.fx-on .card::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(125deg, var(--sheen) 0%, transparent 38%, transparent 70%, var(--sheen) 100%); opacity: .8; }
body.fx-on .card > * { position: relative; }
body.fx-on .topbar { border-width: 0 0 1px; }
.hero { text-align: center; padding: 22px 0 18px; }
.hero h1 { font-size: 2.4rem; letter-spacing: -.02em; }
.hero p { font-size: 1.08rem; max-width: 580px; margin: 0 auto; }
body.fx-on .hero h1 { color: var(--hero-ink); text-shadow: 0 2px 22px rgba(0, 0, 0, .3); }
body.fx-on .hero p { color: var(--hero-ink); opacity: .95; text-shadow: 0 1px 12px rgba(0, 0, 0, .3); }
body.fx-on footer.site { color: var(--hero-ink); opacity: .9; text-shadow: 0 1px 8px rgba(0, 0, 0, .35); }
.liquid-logo { display: block; width: 112px; height: 112px; margin: 0 auto 10px; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .3)); }
img.liquid-logo { border-radius: 28px; }
@media (max-width: 720px) {
  .hero h1 { font-size: 1.85rem; } .liquid-logo { width: 88px; height: 88px; }
  nav a { padding: 6px 8px; font-size: .9rem; } .card { padding: 16px; }
}
@media (prefers-color-scheme: dark) { .label, .tag { color: var(--accent); } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- print: the early-warning plan on plain paper */
@media print {
  @page { margin: 16mm; }
  body, body.fx-on { background: #fff !important; color: #000; font-size: 12pt; }
  .fx-bg, .topbar, #banners, .no-print, .hero, .skip, footer.site { display: none !important; }
  .print-only { display: block; }
  .print-only h1 { font-size: 20pt; margin-bottom: 4pt; }
  main { padding: 0; max-width: none; }
  body.fx-on .card, .card { background: #fff !important; color: #000; box-shadow: none !important; backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important; border: 1px solid #999; border-top-width: 4px; break-inside: avoid; overflow: visible; }
  body.fx-on .card::before { display: none; }
  .level.yellow { border-top-color: var(--yellow) !important; } .level.orange { border-top-color: var(--orange) !important; }
  .level.red { border-top-color: var(--red) !important; }
  .muted, .empty-list { color: #444; }
  ul.items li { border-bottom: 1px solid #ccc; }
  .safety a { text-decoration: none; }
}
