/* Mechanical & Thermal Engineering Tool - CADatum dark brand (DESIGN.md), Heebo, RTL first */
@font-face { font-family: "Heebo"; font-weight: 100 900; font-display: swap;
  src: url(vendor/fonts/heebo-hebrew-wght-normal.woff2) format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: "Heebo"; font-weight: 100 900; font-display: swap;
  src: url(vendor/fonts/heebo-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --canvas: #01081A; --recess: #0C1424; --panel: #182230; --panel-2: #1E2A3A;
  --line: #374D65; --field-line: #5A7591;
  --blue: #2A8BFF; --blue-h: #1B6FD6;
  --fill: #1B6FD6; --fill-h: #1559AE;   /* white text on a filled control: 4.68:1 (WCAG 1.4.3); #2A8BFF is 3.22:1 */ --logo-blue: #4BB7FF;
  --frost: #E2EBF4; --paper: #F8FAFD; --body: #C5D3E0; --steel: #A6BBD0; --muted: rgba(197,211,224,.72);
  --ok: #34D399; --warn: #F5A524; --bad: #FF5A6A;
  --cat: #2A8BFF;               /* set per category by app.js */
  --r: 1.25rem; --r-sm: .75rem;
  --ease: cubic-bezier(.22,1,.36,1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--canvas); color: var(--body);
  font: 400 1rem/1.6 "Heebo", Arial, sans-serif; font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.ltr, bdi { unicode-bidi: isolate; }

/* ---------- aurora background (slow, low intensity, category tinted) */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora span { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .16;
  background: radial-gradient(circle, var(--blue) 0%, transparent 65%); animation: drift 26s var(--ease) infinite alternate; }
.aurora span:nth-child(1) { top: -25vmax; inset-inline-end: -15vmax; }
.aurora span:nth-child(2) { bottom: -30vmax; inset-inline-start: -20vmax; background: radial-gradient(circle, var(--cat) 0%, transparent 65%); animation-duration: 32s; opacity: .14; transition: background 1s; }
.aurora span:nth-child(3) { top: 30vh; inset-inline-start: 35vw; width: 35vmax; height: 35vmax; opacity: .08; animation-duration: 40s; }
@keyframes drift { to { transform: translate3d(6vw, 4vh, 0) scale(1.12); } }

/* ---------- top bar */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem;
  padding: .7rem clamp(1rem, 2.5vw, 1.75rem); background: rgba(1,8,26,.78); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(55,77,101,.55); }
.brand-title { display: flex; flex-direction: column; min-width: 0; }
/* DESIGN.md: no gradient text - the title gets a moving light line underneath instead */
.brand-title h1 { position: relative; margin: 0; padding-bottom: 3px; font-size: clamp(1.05rem, 1.9vw, 1.45rem); font-weight: 800; letter-spacing: -.015em; color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-title h1::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--logo-blue), transparent) 0 0 / 40% 100% no-repeat; animation: sweep 5s ease-in-out infinite; }
@keyframes sweep { 0% { background-position: -60% 0; } 60%, 100% { background-position: 160% 0; } }
.status { display: inline-flex; align-items: center; gap: .45rem; font-size: .78rem; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.dot.ok { background: var(--ok); animation: pulse 2.4s ease-in-out infinite; } .dot.err { background: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }
.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: .6rem; }
.logo { height: 30px; width: auto; flex: none; opacity: .95; }
.search-btn { display: inline-flex; align-items: center; gap: .55rem; min-height: 40px; padding: 0 .8rem; border-radius: 999px;
  background: var(--recess); border: 1px solid var(--line); color: var(--steel); cursor: pointer; transition: border-color .25s, color .25s; }
.search-btn:hover { border-color: var(--blue); color: var(--frost); }
kbd { font: 600 .7rem "Heebo", Arial; padding: .1rem .4rem; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); direction: ltr; }
.toggle { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--recess); border: 1px solid var(--line); position: relative; }
.toggle button { min-height: 32px; padding: 0 .75rem; border: 0; border-radius: 999px; background: transparent; color: var(--steel); cursor: pointer; font-weight: 600; font-size: .85rem; transition: background .3s var(--ease), color .3s; }
.toggle button.on { background: var(--fill); color: var(--paper); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--recess); color: var(--steel); cursor: pointer; transition: color .2s, border-color .2s, transform .2s; }
.icon-btn:hover { color: var(--frost); border-color: var(--blue); transform: rotate(-12deg); }
.menu-btn { display: none; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: calc(100dvh - 64px); }
.nav { position: sticky; top: 64px; height: calc(100dvh - 64px); overflow-y: auto; padding: 1rem .75rem 2rem; border-inline-end: 1px solid rgba(55,77,101,.45); scrollbar-width: thin; }
.nav-group { margin-bottom: .35rem; }
.nav-cat { width: 100%; display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem; border: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer; color: var(--frost); font-weight: 700; font-size: .95rem; text-align: start; transition: background .2s; }
.nav-cat:hover { background: var(--recess); }
.nav-cat .swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.nav-cat .count { margin-inline-start: auto; font-size: .75rem; color: var(--muted); font-weight: 500; }
.nav-cat .chev { transition: transform .35s var(--ease); color: var(--muted); }
.nav-group.open .chev { transform: rotate(90deg); }
[dir="rtl"] .nav-group.open .chev { transform: rotate(-90deg); }
.nav-items { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s var(--ease); }
.nav-group.open .nav-items { grid-template-rows: 1fr; }
.nav-items > ul { overflow: hidden; list-style: none; margin: 0; padding: 0 .2rem; }
.nav-item { position: relative; display: flex; align-items: center; gap: .5rem; width: 100%; min-height: 40px; padding: .4rem .9rem; margin: 2px 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--steel); text-align: start; cursor: pointer; font-size: .93rem;
  transition: background .25s, color .25s, padding .35s var(--ease); opacity: 0; transform: translateX(var(--from, 12px)); }
[dir="ltr"] .nav-item { --from: -12px; }
.nav-group.open .nav-item { animation: slidein .45s var(--ease) forwards; animation-delay: calc(var(--i) * 45ms); }
@keyframes slidein { to { opacity: 1; transform: none; } }
.nav-item::before { content: ""; position: absolute; inset-inline-start: 0; top: 22%; bottom: 22%; width: 3px; border-radius: 3px; background: var(--c); transform: scaleY(0); transition: transform .35s var(--ease); }
.nav-item:hover { background: var(--recess); color: var(--frost); padding-inline-start: 1.15rem; }
.nav-item.active { background: color-mix(in srgb, var(--c) 14%, var(--recess)); color: var(--paper); font-weight: 600; }
.nav-item.active::before { transform: scaleY(1); }
.nav-item .star { margin-inline-start: auto; color: var(--warn); font-size: .8rem; }
.nav-fav-title { font-size: .75rem; letter-spacing: .02em; color: var(--muted); padding: .25rem .8rem; }

.main { min-width: 0; padding: 1.25rem clamp(1rem, 2.5vw, 2rem) 2rem; }

/* ---------- hero */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: end; gap: 1.25rem;
  min-height: 250px; padding: clamp(1.25rem, 3vw, 2rem); border-radius: 1.5rem; overflow: hidden; background: var(--recess);
  border: 1px solid color-mix(in srgb, var(--cat) 35%, var(--line)); transition: border-color .6s; }
.hero-img, .hero-img img { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-img img { object-fit: cover; opacity: 0; transform: scale(1.08); transition: opacity 1s var(--ease), transform 7s ease-out; }
.hero-img img.show { opacity: .62; transform: scale(1); }
.hero-img img.blank { display: none; }
.hero-shade { position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(1,8,26,.94) 8%, rgba(1,8,26,.45) 60%, rgba(1,8,26,.2)),
              radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--cat) 30%, transparent), transparent 60%); }
[dir="ltr"] .hero-shade { background: linear-gradient(to top, rgba(1,8,26,.94) 8%, rgba(1,8,26,.45) 60%, rgba(1,8,26,.2)),
              radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--cat) 30%, transparent), transparent 60%); }
.hero-text, .formula { position: relative; z-index: 1; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 700;
  color: var(--cat); background: color-mix(in srgb, var(--cat) 16%, transparent); border: 1px solid color-mix(in srgb, var(--cat) 45%, transparent); }
.hero h2 { margin: .5rem 0 .35rem; color: var(--paper); font-weight: 800; line-height: 1.08; letter-spacing: -.025em; font-size: clamp(1.7rem, 3.6vw, 2.9rem); }
.hero h2 .w { display: inline-block; opacity: 0; transform: translateY(.45em); filter: blur(6px); animation: word .7s var(--ease) forwards; animation-delay: calc(var(--i) * 70ms + 80ms); }
@keyframes word { to { opacity: 1; transform: none; filter: none; } }
.hero p { margin: 0; max-width: 52ch; color: var(--body); font-size: 1.05rem; opacity: 0; animation: fadeup .7s .35s var(--ease) forwards; }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.formula { justify-self: end; max-width: 100%; overflow-x: auto; padding: 1rem 1.25rem; border-radius: var(--r); background: rgba(12,20,36,.78);
  border: 1px solid rgba(90,117,145,.5); backdrop-filter: blur(6px); color: var(--paper); font-size: 1.15rem; direction: ltr;
  opacity: 0; animation: fadeup .7s .25s var(--ease) forwards; }
[dir="ltr"] .formula { justify-self: start; }
.formula .katex { font-size: 1.15em; }
.formula [class*="v-"], .formula .enclosing { transition: color .25s, text-shadow .25s; cursor: help; }
.formula .hl { color: var(--cat) !important; text-shadow: 0 0 18px color-mix(in srgb, var(--cat) 70%, transparent); }

/* ---------- work area */
.work { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 1.25rem; margin-top: 1.25rem; align-items: start; }
.card { background: var(--recess); border-radius: var(--r); padding: 1.1rem 1.2rem; border: 1px solid rgba(55,77,101,.45); }
.card-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.card-head h3 { margin: 0; font-size: 1.05rem; color: var(--frost); font-weight: 700; }
.card-head > :last-child:not(h3) { margin-inline-start: auto; }
.inputs { position: sticky; top: 80px; max-height: calc(100dvh - 96px); overflow-y: auto; scrollbar-width: thin; }
.link { border: 0; background: none; color: var(--steel); cursor: pointer; padding: .2rem; border-bottom: 1px solid var(--line); font-size: .85rem; }
.link:hover { color: var(--frost); border-color: var(--blue); }

.field { margin-bottom: .85rem; opacity: 0; animation: fadeup .5s var(--ease) forwards; animation-delay: calc(var(--i) * 35ms); }
.field > label, .field > .lbl { display: flex; align-items: baseline; gap: .4rem; font-size: .9rem; font-weight: 600; color: var(--frost); margin-bottom: .3rem; }
.field .opt { font-weight: 400; font-size: .75rem; color: var(--muted); }
.field.hl > label { color: var(--cat); }
.help { margin: .25rem 0 0; font-size: .8rem; color: var(--muted); }
.row { display: flex; align-items: stretch; border-radius: var(--r-sm); background: var(--panel); border: 1px solid var(--field-line); transition: border-color .2s, box-shadow .2s; }
.row:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(42,139,255,.18); }
.field.hl .row { border-color: var(--cat); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat) 22%, transparent); }
.row input, .row select, select.full { flex: 1; min-width: 0; min-height: 44px; padding: 0 .8rem; border: 0; background: transparent; outline: none; }
.row input { direction: ltr; text-align: end; }
[dir="ltr"] .row input { text-align: start; }
.row .unit { flex: none; min-width: 74px; max-width: 120px; padding: 0 .5rem; border: 0; border-inline-start: 1px solid var(--line); background: var(--recess);
  border-start-end-radius: var(--r-sm); border-end-end-radius: var(--r-sm); font-size: .85rem; color: var(--steel); cursor: pointer; direction: ltr; }
.row .suffix { display: grid; place-items: center; padding: 0 .8rem; color: var(--muted); font-size: .85rem; border-inline-start: 1px solid var(--line); }
select { background: var(--panel); }
select option { background: var(--panel); color: var(--frost); }
select.full { width: 100%; border-radius: var(--r-sm); border: 1px solid var(--field-line); background: var(--panel); cursor: pointer; }
.seg { display: flex; flex-wrap: wrap; gap: .3rem; padding: .25rem; border-radius: var(--r-sm); background: var(--panel); border: 1px solid var(--field-line); }
.seg label { flex: 1 1 auto; position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: grid; place-items: center; min-height: 36px; padding: 0 .7rem; border-radius: 9px; font-size: .86rem; color: var(--steel); transition: background .3s var(--ease), color .2s; white-space: nowrap; }
.seg input:checked + span { background: var(--cat); color: var(--canvas); font-weight: 700; }
.seg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 1px; }
.chk { display: flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .92rem; color: var(--frost); min-height: 40px; }
.chk input { width: 18px; height: 18px; accent-color: var(--cat); }
.sub { margin: .4rem 0 .9rem; padding: .7rem .8rem .1rem; border-radius: var(--r-sm); border: 1px dashed var(--line); }
.error { color: var(--bad); font-size: .88rem; min-height: 1.2em; margin: .3rem 0 0; }

/* tolerance table */
.ttable { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: .82rem; }
.ttable th { font-weight: 600; color: var(--muted); text-align: start; padding: 0 .2rem; }
.ttable input, .ttable select { width: 100%; min-height: 34px; padding: 0 .35rem; border-radius: 8px; border: 1px solid var(--field-line); background: var(--panel); direction: ltr; }
.ttable td { padding: 0 .15rem; }
.tbtns { display: flex; gap: .5rem; margin-top: .4rem; flex-wrap: wrap; }
.mini { min-height: 32px; padding: 0 .7rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: .82rem; color: var(--steel); }
.mini:hover { border-color: var(--blue); color: var(--frost); }
.x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; }

/* ---------- KPIs */
.out { display: grid; gap: 1.1rem; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.kpi { position: relative; padding: .9rem 1rem; border-radius: var(--r); background: var(--recess); border: 1px solid rgba(55,77,101,.45); overflow: hidden;
  opacity: 0; animation: pop .55s var(--ease) forwards; animation-delay: calc(var(--i) * 60ms); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.kpi.main { background: linear-gradient(160deg, color-mix(in srgb, var(--cat) 18%, var(--panel)), var(--recess) 70%); border-color: color-mix(in srgb, var(--cat) 45%, transparent); }
.kpi .lab { font-size: .82rem; color: var(--steel); }
.kpi .val { display: flex; align-items: baseline; gap: .4rem; margin-top: .25rem; direction: ltr; justify-content: flex-end; }
[dir="ltr"] .kpi .val { justify-content: flex-start; }
.kpi .num { font-size: clamp(1.35rem, 2.2vw, 1.85rem); font-weight: 800; color: var(--paper); letter-spacing: -.02em; }
.kpi.main .num { color: var(--paper); }
.kpi .u { font-size: .85rem; color: var(--steel); border: 0; background: none; padding: 0; cursor: pointer; border-bottom: 1px dotted var(--line); }
.kpi .u:hover { color: var(--cat); }
.kpi.flash::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--cat) 35%, transparent), transparent 70%); animation: flash .8s ease-out forwards; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.kpis.loading .kpi { opacity: .55; }
.skeleton { height: 92px; border-radius: var(--r); background: linear-gradient(90deg, var(--recess), var(--panel), var(--recess)) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- schematic */
.viz { width: 100%; aspect-ratio: 16 / 7; min-height: 200px; display: grid; place-items: center; }
.viz svg { width: 100%; height: 100%; stroke-width: 1.6; }
.viz text { font-family: "Heebo", Arial, sans-serif; stroke: none; fill: var(--steel); font-size: 13px; }
.viz .lbl-strong { fill: var(--paper); font-weight: 700; }
.viz .accent { stroke: var(--cat); } .viz .accent-f { fill: var(--cat); stroke: none; }
.viz .body { stroke: var(--frost); } .viz .dim { stroke: var(--field-line); stroke-dasharray: 3 4; }
.viz .flow { stroke: var(--cat); stroke-dasharray: 10 12; animation: flow 1.2s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -44; } }
.viz .spin { transform-box: fill-box; transform-origin: center; animation: spin var(--dur, 6s) linear infinite; }
.viz .spin.rev { animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.viz .grow { transition: all .6s var(--ease); }
.viz .fadein { animation: fadeup .6s var(--ease) both; }
.viz .heat { animation: heat 2.4s ease-in-out infinite; }
@keyframes heat { 50% { opacity: .45; } }

/* ---------- checks */
.checks { display: grid; gap: .6rem; }
.chk-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .3rem .9rem; padding: .8rem 1rem; border-radius: var(--r); background: var(--recess); border: 1px solid rgba(55,77,101,.45);
  opacity: 0; animation: fadeup .5s var(--ease) forwards; animation-delay: calc(var(--i) * 80ms + 150ms); }
.chk-card .badge { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 800; font-size: 1rem; }
.chk-card.ok .badge { background: rgba(52,211,153,.16); color: var(--ok); } .chk-card.bad .badge { background: rgba(255,90,106,.16); color: var(--bad); }
.chk-card .t { color: var(--frost); font-weight: 600; font-size: .92rem; }
.chk-card .pct { font-weight: 800; color: var(--paper); direction: ltr; }
.bar { grid-column: 2 / 4; height: 8px; border-radius: 99px; background: var(--panel); overflow: hidden; position: relative; }
.bar i { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; border-radius: 99px; transition: width 1.1s var(--ease); }
.chk-card.ok .bar i { background: linear-gradient(90deg, var(--ok), #6EE7B7); } .chk-card.bad .bar i { background: linear-gradient(90deg, var(--warn), var(--bad)); }
.bar .lim { position: absolute; inset-block: -3px; width: 2px; background: var(--frost); opacity: .7; }
.chk-card .txt { grid-column: 2 / 4; font-size: .8rem; color: var(--muted); }

/* ---------- actions */
.actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.btn { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 1.1rem; border-radius: var(--r-sm); border: 0; cursor: pointer; font-weight: 600; font-size: .92rem;
  background: var(--fill); color: var(--paper); transition: background .2s, transform .1s, border-color .2s, color .2s; position: relative; overflow: hidden; text-decoration: none; }
.btn:hover { background: var(--fill-h); } .btn:active { transform: translateY(1px); }
.btn::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%); transform: translateX(-120%); }
.btn:not(.ghost):hover::after { transform: translateX(120%); transition: transform .8s var(--ease); }
.btn.ghost { background: var(--recess); color: var(--frost); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--cat); color: var(--paper); }
.btn.ghost.on { border-color: var(--cat); color: var(--cat); }
.btn[disabled] { opacity: .5; cursor: progress; }

/* ---------- compare / sensitivity */
.cmp { width: 100%; border-collapse: collapse; font-size: .9rem; }
.cmp th, .cmp td { padding: .5rem .4rem; text-align: start; border-bottom: 1px solid rgba(55,77,101,.5); }
.cmp th { color: var(--muted); font-weight: 600; }
.cmp td.n { direction: ltr; text-align: end; color: var(--paper); font-weight: 600; }
.cmp td.up { color: var(--ok); } .cmp td.down { color: var(--warn); }
.sens-ctl { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: .6rem; }
.sens-ctl label { display: grid; gap: .2rem; font-size: .8rem; color: var(--muted); }
.sens-ctl select { min-height: 38px; border-radius: 9px; border: 1px solid var(--field-line); padding: 0 .5rem; }
.sens-chart svg { width: 100%; height: auto; stroke-width: 1.5; }
.sens-chart text { fill: var(--steel); stroke: none; font: 12px "Heebo", Arial; }
.sens-chart .ln { stroke: var(--cat); stroke-width: 2.6; stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.4s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- insights, steps, notes */
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .7rem; }
.ins { padding: .9rem 1rem; border-radius: var(--r); background: linear-gradient(150deg, color-mix(in srgb, var(--cat) 10%, var(--recess)), var(--recess)); border: 1px solid rgba(55,77,101,.45); }
.ins b { display: block; color: var(--cat); margin-bottom: .25rem; }
.ins p { margin: 0; font-size: .88rem; }
.steps { display: grid; gap: .5rem; }
.step { border-radius: var(--r-sm); background: var(--recess); border: 1px solid rgba(55,77,101,.45); overflow: hidden; }
.step summary { display: flex; align-items: center; gap: .7rem; padding: .75rem 1rem; cursor: pointer; list-style: none; color: var(--frost); font-weight: 600; }
.step summary::-webkit-details-marker { display: none; }
.step summary .n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; font-size: .8rem; background: color-mix(in srgb, var(--cat) 18%, transparent); color: var(--cat); }
.step summary .pl { margin-inline-start: auto; transition: transform .35s var(--ease); color: var(--muted); font-size: 1.2rem; line-height: 1; }
.step[open] summary .pl { transform: rotate(45deg); }
.step .body { padding: 0 1rem .9rem; animation: fadeup .4s var(--ease); }
.step .f { direction: ltr; text-align: left; padding: .55rem .8rem; margin-bottom: .5rem; border-radius: 9px; background: var(--panel); color: var(--paper); font-size: .92rem; overflow-x: auto; }
.step table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.step td { padding: .35rem .3rem; border-bottom: 1px solid rgba(55,77,101,.35); vertical-align: top; }
.step td:last-child { direction: ltr; text-align: end; color: var(--paper); }
[dir="ltr"] .step td:last-child { text-align: start; }
.step .tbl-wrap { overflow-x: auto; }
.step .tbl td, .step .tbl th { white-space: nowrap; padding: .3rem .45rem; text-align: start; direction: ltr; }
.step .tbl th { color: var(--muted); font-weight: 600; }
.step .note { margin: .5rem 0 0; font-size: .82rem; color: var(--muted); }
.notes h3 { margin: 0 0 .4rem; font-size: 1rem; color: var(--frost); }
.notes ul { margin: 0; padding-inline-start: 1.1rem; font-size: .88rem; }
.notes li { margin: .25rem 0; }
.research .md { font-size: .93rem; line-height: 1.75; }
.research .md h2 { font-size: 1.1rem; color: var(--frost); }
.research a { color: var(--logo-blue); }
.foot { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid rgba(55,77,101,.4); font-size: .8rem; color: var(--muted); }

/* ---------- palette, drawer, toast */
.palette { position: fixed; inset: 0; z-index: 60; display: grid; justify-items: center; align-items: start; padding-top: 12vh; background: rgba(1,8,26,.6); backdrop-filter: blur(4px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.palette-box { width: min(620px, calc(100vw - 2rem)); border-radius: 1.25rem; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0,4,14,.55); overflow: hidden; animation: zoomin .3s var(--ease); }
@keyframes zoomin { from { opacity: 0; transform: scale(.96) translateY(-8px); } }
.palette-box input { width: 100%; min-height: 56px; padding: 0 1.2rem; border: 0; border-bottom: 1px solid var(--line); background: transparent; font-size: 1.05rem; outline: none; }
.palette-box ul { list-style: none; margin: 0; padding: .4rem; max-height: 50vh; overflow-y: auto; }
.palette-box li { display: flex; align-items: center; gap: .7rem; padding: .65rem .8rem; border-radius: 10px; cursor: pointer; }
.palette-box li .sw { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.palette-box li .alt { margin-inline-start: auto; font-size: .78rem; color: var(--muted); }
.palette-box li.sel, .palette-box li:hover { background: var(--recess); color: var(--paper); }
.palette-hint { margin: 0; padding: .5rem 1rem .8rem; }
.drawer { position: fixed; z-index: 55; top: 72px; inset-inline-end: 1rem; width: min(380px, calc(100vw - 2rem)); max-height: 70vh; overflow-y: auto; padding: 1rem; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0,4,14,.55); animation: zoomin .3s var(--ease); }
.drawer ul { list-style: none; margin: 0; padding: 0; }
.drawer li button { width: 100%; text-align: start; padding: .6rem .7rem; border: 0; border-radius: 10px; background: transparent; cursor: pointer; display: grid; gap: .1rem; }
.drawer li button:hover { background: var(--recess); }
.drawer li b { color: var(--frost); font-size: .9rem; } .drawer li span { font-size: .78rem; color: var(--muted); }
.toast { position: fixed; z-index: 70; bottom: 1.25rem; inset-inline-start: 50%; transform: translate(50%, 150%); padding: .7rem 1.1rem; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--frost); font-size: .9rem; transition: transform .45s var(--ease); box-shadow: 0 12px 30px rgba(0,4,14,.55); }
[dir="ltr"] .toast { transform: translate(-50%, 150%); }
.toast.show { transform: translate(50%, 0); } [dir="ltr"] .toast.show { transform: translate(-50%, 0); }

/* ---------- offline */
.offline { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 1rem; background: var(--canvas); }
.offline-card { max-width: 520px; text-align: center; } .offline h2 { color: var(--frost); }

/* ---------- responsive */
@media (max-width: 1180px) {
  .work { grid-template-columns: 1fr; }
  .inputs { position: static; max-height: none; }
  .hero { grid-template-columns: 1fr; } .formula { justify-self: stretch; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .menu-btn { display: grid; }
  .nav { position: fixed; z-index: 40; top: 64px; inset-inline-start: 0; width: min(320px, 86vw); background: var(--canvas); transform: translateX(105%); transition: transform .45s var(--ease); box-shadow: 0 24px 60px rgba(0,4,14,.55); }
  [dir="ltr"] .nav { transform: translateX(-105%); }
  .nav.open { transform: none !important; }
  .search-btn span, .search-btn kbd { display: none; }
}
@media (max-width: 640px) {
  .top { gap: .5rem; flex-wrap: wrap; } .logo { height: 24px; }
  .brand-title h1 { white-space: normal; font-size: 1rem; }
  .top-actions { order: 3; width: 100%; justify-content: space-between; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .viz { aspect-ratio: 4 / 3; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .aurora { display: none; }
}

/* ---------- print: calculation report (white page, D-31) */
.report { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; color: #182230; font-family: Arial, sans-serif; }
  .aurora, .top, .shell, .palette, .drawer, .toast, .offline { display: none !important; }
  .report { display: block; font-size: 10.5pt; line-height: 1.45; }
  .report .band { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 10px 14px; background: #01081A; color: #fff; border-radius: 6px;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .report .band img { height: 34px; }
  .report .band .meta { font-size: 9pt; color: #E2EBF4; text-align: end; }
  .report h1 { font-size: 17pt; color: #01081A; margin: 12px 0 2px; }
  .report .sub { color: #374D65; font-size: 9.5pt; margin: 0 0 8px; }
  .report h2 { font-size: 12pt; color: #01081A; border-bottom: 2px solid #2A8BFF; padding-bottom: 2px; margin: 12px 0 6px; break-after: avoid; }
  .report table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  .report td, .report th { border: 1px solid #A6BBD0; padding: 3px 6px; text-align: start; vertical-align: top; }
  .report th { background: #E2EBF4; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .report td.n { direction: ltr; text-align: end; font-weight: 700; }
  .report .formula-p { direction: ltr; text-align: center; font-size: 13pt; padding: 6px; border: 1px solid #A6BBD0; border-radius: 6px; }
  .report .schem { border: 1px solid #A6BBD0; border-radius: 6px; padding: 4px; background: #01081A; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .report .schem svg { width: 100%; height: 190px; }
  .report .ok { color: #0f8a5f; font-weight: 700; } .report .bad { color: #c62a3a; font-weight: 700; }
  .report ul { margin: 0; padding-inline-start: 16px; }
  .report .toc { font-size: 9pt; color: #374D65; }
  .report .foot-r { margin-top: 10px; padding-top: 4px; border-top: 1px solid #A6BBD0; font-size: 8.5pt; color: #374D65; text-align: center; }
  .report section { break-inside: avoid; }
}

/* ---------- accessibility and public mode (IS 5568 / WCAG 2.1 AA) */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; z-index: 100; top: .5rem; inset-inline-start: .5rem; padding: .7rem 1rem; border-radius: var(--r-sm); background: var(--fill); color: var(--paper); font-weight: 700; text-decoration: none; transform: translateY(-160%); transition: transform .2s; }
.skip:focus { transform: none; }
html.public .local-only { display: none !important; }
html:not(.public) .public-only { display: none !important; }
.foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; }
.foot-brand { display: inline-flex; min-height: 44px; align-items: center; }
.foot-brand img { height: 40px; width: auto; display: block; }
.foot-links { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.foot-links a { color: var(--frost); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); min-height: 24px; display: inline-flex; align-items: center; }
.foot-links a:hover { text-decoration-color: var(--blue); }
#motion-btn[aria-pressed="true"] { color: var(--paper); border-color: var(--blue); background: var(--fill); }
/* WCAG 2.2.2: everything that moves can be stopped */
html.still *, html.still *::before, html.still *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
html.still .aurora { display: none; }
@media (forced-colors: active) { .seg input:checked + span, .toggle button.on { outline: 2px solid CanvasText; } .bar i { background: Highlight !important; } }

/* ---------- information pages (terms, privacy, accessibility) */
.doc { max-width: 760px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2rem) 4rem; }
.doc h1 { color: var(--paper); font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 1rem 0 .5rem; }
.doc h2 { color: var(--frost); font-size: 1.2rem; margin: 2rem 0 .5rem; }
.doc p, .doc li { font-size: 1.0625rem; line-height: 1.75; max-width: 65ch; }
.doc a { color: var(--frost); text-underline-offset: 3px; }
.doc .back { display: inline-flex; align-items: center; min-height: 44px; }
.doc section[lang="en"] { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
