/*
 * The kit of app replicas (D-SITE-5 SITE5-1): the app's screens as HTML, from the owner-approved B2
 * mockup (docs/plans/2026-10-11-site-redesign/b2/ui.css). Every colour, radius, space and size is a
 * tokens.css variable (D-DES-1, INV-205); the few bare numbers are the renderer's constants, named after
 * their Compose home. No shadow, no gradient. Icons: the app's own SVGs as ONE sprite in the page
 * (site/web/site/src/lib/sprite.ts, <use href="#i-NAME">, currentColor). The six sections' own rules live in
 * replicas.css under a `.s<n>` prefix - this file is the kit alone.
 *
 * Contents: 1 face + metrics · 2 phases (the one clock) · 3 phone + header · 4 canvas + chips · 5 result
 * line · 6 strip · 7 «123» keys · 8 units keyboard · 9 panels (x=, f) · 10 window page + calculations list ·
 * 11 share page · 12 settings cards · 13 bottom sheet + fields · 14 the classes the states emit.
 */

/* ---- 1. the math face (D-FONT-2: Inter for the math, the system face for words) */
@font-face {
  font-family: "Display";
  src: url("/assets/inter.woff2?v=05a83304") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
:root {
  --mathFace: "Display", system-ui, sans-serif;
  --wordFace: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;  /* D-FONT-2: the app draws words in Roboto; no web font is fetched */
  /* MathMetrics.kt: CHIP_FONT_RATIO, CANVAS_UNIT_LABEL_RATIO, CHIP_AIR_H / CHIP_AIR_V, CHIP_OUTER_AIR */
  --chipFontRatio: 0.82;
  --canvasUnitLabelRatio: 0.6;
  --chipAirH: 8px;
  --chipAirV: 2px;
  --chipOuterAir: 2px;
  /* ResultLine.kt: RESULT_AIR, RESULT_BREATH, the line factor */
  --resultAir: 4px;
  --resultBreath: 3px;
  --resultLine: 1.4545;
  /* the phase motion: b.html's roll, 350 ms */
  --roll: 350ms;
  --rollEase: cubic-bezier(0.22, 0.61, 0.36, 1);
}
.nn-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.nn-icon {
  width: var(--chromeIcon);
  height: var(--chromeIcon);
  flex: none;
  fill: none;
  stroke: currentColor;
}

/* ---- 2. phases — ONE clock (the page's script) sets data-phase / data-prev on every [data-phases] root.
   A state child carries data-k="n" (or several: data-k="1 2"). Three ways a state shows:
   ROLL  — inside .nn-term: the new one rises from below, the old one leaves upward, the term's width
           glides (the script sets it in em from the active child);
   FADE  — inside .nn-stack: the states share one cell and cross-fade;
   SWAP  — anywhere else: only the active state is displayed (its own display kept).
   [data-press="n"] marks a key tapped in phase n. Never nest one [data-phases] root in another. */
.nn-term {
  display: inline-grid;
  overflow: clip;
  vertical-align: bottom;
  padding-block: 0.04em;
  transition: width var(--roll) var(--rollEase);
}
.nn-term > [data-k] {
  grid-area: 1 / 1;
  justify-self: start;
  white-space: nowrap;
  transform: translateY(110%);
}
.nn-stack { display: grid; }
.nn-stack > [data-k] {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--roll) var(--rollEase), visibility 0s linear var(--roll);
}
/* phases:start — generated for k = 0..7 */
/* the leaving state (data-prev): rolls up and out */
[data-prev="0"] .nn-term > [data-k~="0"],
[data-prev="1"] .nn-term > [data-k~="1"],
[data-prev="2"] .nn-term > [data-k~="2"],
[data-prev="3"] .nn-term > [data-k~="3"],
[data-prev="4"] .nn-term > [data-k~="4"],
[data-prev="5"] .nn-term > [data-k~="5"],
[data-prev="6"] .nn-term > [data-k~="6"],
[data-prev="7"] .nn-term > [data-k~="7"] {
  transform: translateY(-110%);
  transition: transform var(--roll) var(--rollEase);
}
/* the active state (data-phase; written after, so it wins over a state that is both) */
[data-phase="0"] .nn-term > [data-k~="0"],
[data-phase="1"] .nn-term > [data-k~="1"],
[data-phase="2"] .nn-term > [data-k~="2"],
[data-phase="3"] .nn-term > [data-k~="3"],
[data-phase="4"] .nn-term > [data-k~="4"],
[data-phase="5"] .nn-term > [data-k~="5"],
[data-phase="6"] .nn-term > [data-k~="6"],
[data-phase="7"] .nn-term > [data-k~="7"] {
  transform: none;
  transition: transform var(--roll) var(--rollEase);
}
[data-phase="0"] .nn-stack > [data-k~="0"],
[data-phase="1"] .nn-stack > [data-k~="1"],
[data-phase="2"] .nn-stack > [data-k~="2"],
[data-phase="3"] .nn-stack > [data-k~="3"],
[data-phase="4"] .nn-stack > [data-k~="4"],
[data-phase="5"] .nn-stack > [data-k~="5"],
[data-phase="6"] .nn-stack > [data-k~="6"],
[data-phase="7"] .nn-stack > [data-k~="7"] {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--roll) var(--rollEase), visibility 0s;
}
/* SWAP: outside a term or a stack only the active state is displayed */
[data-phase="0"] [data-k]:not([data-k~="0"]):not(.nn-term > *):not(.nn-stack > *),
[data-phase="1"] [data-k]:not([data-k~="1"]):not(.nn-term > *):not(.nn-stack > *),
[data-phase="2"] [data-k]:not([data-k~="2"]):not(.nn-term > *):not(.nn-stack > *),
[data-phase="3"] [data-k]:not([data-k~="3"]):not(.nn-term > *):not(.nn-stack > *),
[data-phase="4"] [data-k]:not([data-k~="4"]):not(.nn-term > *):not(.nn-stack > *),
[data-phase="5"] [data-k]:not([data-k~="5"]):not(.nn-term > *):not(.nn-stack > *),
[data-phase="6"] [data-k]:not([data-k~="6"]):not(.nn-term > *):not(.nn-stack > *),
[data-phase="7"] [data-k]:not([data-k~="7"]):not(.nn-term > *):not(.nn-stack > *) {
  display: none;
}
/* a key tapped in this phase */
[data-phase="0"] [data-press~="0"],
[data-phase="1"] [data-press~="1"],
[data-phase="2"] [data-press~="2"],
[data-phase="3"] [data-press~="3"],
[data-phase="4"] [data-press~="4"],
[data-phase="5"] [data-press~="5"],
[data-phase="6"] [data-press~="6"],
[data-phase="7"] [data-press~="7"] {
  background: var(--ink);
  color: var(--ground);
  border-color: var(--ink);
}
/* phases:end */
html[data-still] [data-phases] *, html[data-still] [data-phases] { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  /* the states still switch (they carry the meaning), only the motion goes */
  [data-phases] *, [data-phases] { transition: none !important; }
}

/* ---- 3. the phone: a frame of the app's screen, 360 × 800 CSS px, the 1 px rim, no bezel, no status bar.
   W, the one width (D-KB-25/26, Scale.kt gridCell): the keys' row less two insets and three gaps, / 8. */
.nn-phone {
  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 360px;
  max-width: 100%;
  height: var(--phoneH, 800px);
  overflow: hidden;
  background: var(--ground);
  color: var(--ink);
  border: 1px solid var(--outline);
  border-radius: 24px;
  font-family: var(--wordFace);
  font-size: var(--bodyFont);
  line-height: 1.3;
  text-align: start;
}
.nn-phone.nn-fit { height: auto; }
.nn-phone > * {
  --W: calc((100cqw - 2 * var(--keyboardInset) - 3 * var(--keyGap)) / 8);
  --key: calc(2 * var(--W));
  --stripHeight: calc(var(--W) + var(--space8));     /* door top -> first key row 49.6, the app's 50 (frames/formulas.png) */
  /* DockStrip.kt stripDoorTone: onSurfaceVariant at Alpha.wash over the strip well (surfaceVariant) */
  --doorTone: color-mix(in srgb, var(--onSurfaceLow) calc(var(--alpha-wash) * 100%), var(--surfaceLow));
  /* the app's key row = Dimens.keyRowHeight x the «Висота клавіш» factor; --keyHeightFactor is
     tokens.css's «standard» (tokens/keyboard.height.tokens.json, CalcSettings.DEFAULT_KEY_HEIGHT),
     the default every first-time user sees. */
  --keyPitch: calc(var(--keyRowHeight) * var(--keyHeightFactor));
  --keyFace: calc(var(--keyPitch) - var(--keyGap));
  flex: none;
}
.nn-foot { height: calc(var(--space16) + var(--space4)); }            /* the gesture bar's air, no bar drawn */

/* the calculator's header (D-KB-26): two W circles on the keys' edges, the name pill between them */
.nn-bar {
  display: flex;
  align-items: center;
  gap: var(--keyGap);
  height: calc(var(--headerButton) + 2 * var(--headerAirVertical));
  padding-inline: var(--keyboardInset);
}
.nn-round {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--W, var(--headerButton));
  height: var(--W, var(--headerButton));
  border-radius: 50%;
  background: var(--surfaceLow);
  color: var(--ink);
  border: var(--border-pill) solid var(--outline);
}
.nn-round.is-action { background: var(--accent2); color: var(--onAccent2); border-color: var(--accent2); }
.nn-round.is-calc { background: var(--calculationContainer); color: var(--calculationContent); }
.nn-round.is-soft { background: var(--accentContainer); color: var(--onAccentContainer); }
.nn-round.is-bare { background: none; border-color: transparent; }
.nn-pill {
  display: flex;
  align-items: center;
  gap: var(--space6);
  flex: 1;
  min-width: 0;
  height: var(--W);
  padding-inline: var(--space6);                 /* the rows mark sits 6 from the rim (measured on the app frame) */
  background: var(--doorTone);
  border: var(--border-pill) solid var(--outline);
  border-radius: calc(var(--W) / 2);
  font-weight: var(--weight-title);
  font-size: var(--bodyFont);
  white-space: nowrap;
}
.nn-pill .nn-icon { width: var(--inlineIcon); height: var(--inlineIcon); }
.nn-pill > span { overflow: hidden; text-overflow: ellipsis; }

/* ---- 4. the canvas (the /calc/ page's classes, D-SITE-3): read-only, anchored top-left, only the
   top row wraps (INV-45). .is-end anchors it bottom-right (the «справа знизу» preference, D-CANVAS-2). */
.nn-canvas {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space16);
  font-family: var(--mathFace);
  font-size: var(--canvasFontLarge);
  --mathSize: var(--canvasFontLarge);
  line-height: 1.25;
  color: var(--ink);
  overflow: hidden;
}
.nn-canvas.is-medium, .nn-canvas .is-medium { font-size: var(--canvasFontMedium); --mathSize: var(--canvasFontMedium); }
.nn-canvas .is-large { font-size: var(--canvasFontLarge); --mathSize: var(--canvasFontLarge); }
.nn-canvas.is-small { font-size: var(--editorMathFont); --mathSize: var(--editorMathFont); }
.nn-canvas.is-end { justify-content: flex-end; }
.nn-canvas.is-end .nn-lines { justify-content: flex-end; }
.nn-lines { display: flex; flex-wrap: wrap; align-items: center; row-gap: var(--space8); }
.nn-lines > * { white-space: nowrap; }
.nn-digit, .nn-op, .nn-op-paren { color: var(--ink); }
.nn-op { padding: 0 0.07em; }   /* MathMetrics.OPERATOR_PADDING_EM 0.14, half on each side (MathText) */
.nn-lines .nn-row, .nn-group, .nn-fn { display: inline-flex; align-items: center; }
/* AtomViews.UnitLabel, the ONE look of a unit worn after a figure: the unit ink a step lighter
   (unitOutline), UNIT_LABEL_GAP_EM 0.16 of the FIGURE's size before it (the tag's own em is smaller) */
.nn-unit-tag { color: var(--unitOutline); margin-inline-start: calc(0.16em / var(--chipFontRatio)); font-size: calc(1em * var(--chipFontRatio)); }
/* the canvas, where the list's 0.82 is not the phone's (DEF-SITE-04): the tag at the canvas ratio, a
   number WEARING a unit (nn-measured) or a chip wearing its variable's unit (nn-worn) one figure on one
   baseline, the number's digits in the unit ink (MathRowView) */
.nn-canvas .nn-unit-tag { font-size: calc(1em * var(--canvasUnitLabelRatio)); margin-inline-start: calc(0.16em / var(--canvasUnitLabelRatio)); }
.nn-canvas .nn-measured, .nn-canvas .nn-worn { display: inline-flex; align-items: baseline; }
.nn-canvas .nn-measured .nn-digit { color: var(--unitContent); }
/* AtomViews.BracketLayout: the rounding brackets are two drawn stems the content's height, the feet
   BRACKET_FOOT_EM 0.16 inwards, ABS_PADDING_EM 0.22 of air, the stroke ABS_STROKE_RATIO 0.045 of the height */
.nn-canvas .nn-ceil { position: relative; display: inline-flex; align-items: center; padding: 0 0.22em; line-height: normal; }
.nn-canvas .nn-ceil > .nn-br { position: absolute; top: 0.027em; bottom: 0.027em; width: 0.16em; overflow: hidden; color: transparent; border: 0 solid var(--ink); }
.nn-canvas .nn-ceil > .nn-br:first-child { inset-inline-start: 0; border-width: max(2px, 0.054em) 0 0 max(2px, 0.054em); }
.nn-canvas .nn-ceil > .nn-br:last-child { inset-inline-end: 0; border-width: max(2px, 0.054em) max(2px, 0.054em) 0 0; }
.nn-sel { background: var(--unitContainer); border-radius: var(--chipRadius); }   /* the number a unit will land on */
.nn-pct { color: var(--ink); }   /* AtomViews: PercentAtom -> MathText("%", style) — the digits' ink, no air */
.nn-caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-inline-start: 1px;
  background: var(--ink);
  vertical-align: -0.15em;
}
/* both rows stretch so the bar spans the WIDER one; it keeps air from each row and overhangs them
   by the app's MathMetrics: FRACTION_GAP_EM 0.12 above and below, FRACTION_PADDING_EM 0.12 less its 0.25 inset aside */
.nn-frac { display: inline-flex; flex-direction: column; align-items: stretch; text-align: center; font-size: 0.8em; }
/* each row a flex row of its own, so a power inside it rises (.nn-sup's align-self) as on the top row */
.nn-num, .nn-den { display: flex; justify-content: center; align-items: center; }
.nn-num { border-bottom: 1px solid var(--ink); padding: 0 0.09em 0.12em; }
.nn-den { padding: 0.12em 0.09em 0; }
.nn-sup { font-size: 0.66em; align-self: flex-start; }
.nn-root { display: inline-flex; align-items: flex-end; }
.nn-root-degree { font-size: 0.5em; align-self: flex-start; }
.nn-radicand { display: inline-flex; align-items: center; border-top: 1px solid var(--ink); }   /* a flex row, so a power under the root rises */

/* chips: a kind = a colour (D-PAL-4 PAL4-2), the face a step smaller than the line */
.nn-chip {
  display: inline-flex;
  align-items: center;
  margin: 0 var(--chipOuterAir);
  padding: var(--chipAirV) var(--chipAirH);
  border: var(--chipBorderWidth) solid transparent;
  border-radius: var(--chipRadius);
  font-family: var(--mathFace);
  font-size: calc(var(--mathSize, 1em) * var(--chipFontRatio));
  line-height: 1.2;
  white-space: nowrap;
}
/* a chip longer than the line is capped with the ink-mask fade (D-CANVAS-5) */
.nn-lines > .nn-chip { max-width: 100%; overflow: hidden; }
.nn-chip.is-capped { -webkit-mask-image: linear-gradient(90deg, black 85%, transparent); mask-image: linear-gradient(90deg, black 85%, transparent); }
.nn-param { background: var(--paramChipContainer); border-color: var(--paramChipOutline); color: var(--paramChipContent); }
.nn-param .nn-unit { color: var(--unitOutline); margin-inline-start: var(--space4); }
.nn-param-run { display: inline-flex; align-items: center; }   /* D-SITE-17: the unit after the chip, the chip's size */
.nn-canvas .nn-param-run > .nn-unit-tag { color: var(--unitContent); font-size: calc(var(--mathSize, 1em) * var(--chipFontRatio)); margin-inline-start: var(--space2); }
.nn-param.is-empty { background: none; border-style: dashed; border-color: var(--slotBorder); }
.nn-number { background: var(--numberContainer); color: var(--numberContent); }
.nn-formula { background: var(--formulaContainer); color: var(--formulaContent); }
.nn-calculation { background: var(--calculationContainer); color: var(--calculationContent); }
.nn-chip.nn-unit { background: var(--unitContainer); color: var(--unitContent); }
.nn-chip.is-small { --mathSize: var(--panelFont); padding: 1px var(--space6); font-size: var(--panelFont); border-width: 1px; }
.nn-formula .nn-args { display: inline-flex; align-items: center; margin-inline-start: 0.2em; color: var(--formulaContent); }
.nn-formula .nn-args .nn-chip { font-size: 0.9em; margin: 0 1px; }
.nn-empty {
  display: inline-block;
  width: 0.66em;
  height: 1.15em;
  --dash: repeating-linear-gradient(90deg, var(--slotBorder) 0 7.7px, transparent 7.7px 9.7px);
  --dashV: repeating-linear-gradient(0deg, var(--slotBorder) 0 7.7px, transparent 7.7px 9.7px);
  background:
    var(--dash) top / 100% 1.5px no-repeat,
    var(--dash) bottom / 100% 1.5px no-repeat,
    var(--dashV) left / 1.5px 100% no-repeat,
    var(--dashV) right / 1.5px 100% no-repeat;
  vertical-align: -0.25em;
}
.nn-tag {            /* a calculation's tag word (the list's outlined pill) */
  display: inline-flex;
  align-items: center;
  padding: var(--space4) var(--space6);
  border: 1px solid var(--outline);
  border-radius: var(--pillRadius);
  background: var(--surfaceLow);
  color: var(--onSurfaceLow);
  font-size: var(--captionFont);
  line-height: 1.25;
  white-space: nowrap;
}

/* ---- 5. the result line: right-aligned, the figure in the result weight, the rung beneath (a second unit) */
.nn-result-line {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-height: calc(2 * var(--resultAir) + 2 * var(--resultBreath) + (var(--resultFont) + var(--captionFont)) * var(--resultLine));
  padding: var(--resultAir) var(--space16);
  font-family: var(--mathFace);
}
/* ResultLine: ONE text in SemiBold — the relation, a space (Inter's 0.2812 em), the value, a THIN_SPACE
   (0.1816 em; the site's font cut has no U+2009, so it is the unit's margin) and the unit */
.nn-result {
  display: flex;
  align-items: baseline;
  font-size: var(--resultFont);
  font-weight: var(--weight-title);
  white-space: nowrap;
  color: var(--onAccentContainer);
}
.nn-result-unit { color: var(--unitContent); margin-inline-start: 0.1816em; }
.nn-rel { color: var(--onAccentContainer); margin-inline-end: 0.2812em; }
.nn-rung { font-size: var(--captionFont); color: var(--onSurfaceLow); white-space: nowrap; }
.nn-rung .nn-result-unit { margin-inline-start: 0.1816em; color: inherit; }
.nn-result.is-error { color: var(--error); font-family: var(--wordFace); font-size: var(--bodyFont); font-weight: var(--weight-body); }

/* ---- 6. the strip (DockStrip.kt): the mode door 2W on the keys' left edge, f · x · ≔ 3W floating in the
   middle, ← → 2W on the right edge; cells are W, short dividers between them */
.nn-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--stripHeight);
  padding: var(--stripBandTop, 2px) var(--keyboardInset) 0;
}
.nn-door {
  display: flex;
  align-items: center;
  height: var(--dockPillHeight);
  padding: 0 1px;
  background: var(--doorTone);
  border: var(--border-pill) solid var(--outline);
  border-radius: var(--pillRadius);
}
.nn-cell {
  position: relative;
  display: grid;
  place-items: center;
  width: calc(var(--W) - 1px);
  height: calc(var(--dockPillHeight) - 8px);
  border-radius: calc(var(--pillRadius) - 3px);
  color: var(--ink);
}
.nn-door:last-child { background: var(--surfaceLow); }              /* the arrows door keeps the neutral face */
.nn-door:last-child .nn-cell { color: var(--onSurfaceLow); }
.nn-cell + .nn-cell::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  height: calc(var(--dockPillHeight) / 2);
  transform: translateY(-50%);
  border-inline-start: 1px solid var(--outline);
}
/* a lit f / x / units cell: a flat fill over the door's whole inner height, no rim; the mode knob keeps the
   white raised face with its rim, a little narrower than its cell (DockStrip.kt) */
.nn-cell.is-lit { height: 100%; border-radius: calc(var(--pillRadius) - var(--border-pill)); }
.nn-cell.is-mode.is-lit { background: var(--surfaceHigh); box-sizing: border-box; border: 1px solid var(--outline); height: calc(var(--dockPillHeight) - 7px); width: calc(var(--W) * 0.85); margin-inline: calc(var(--W) * 0.075 - 0.5px); color: var(--ink); }
.nn-cell.is-lit::before, .nn-cell.is-lit + .nn-cell::before { display: none; }
.nn-cell.is-mode { color: var(--accent2); }
.nn-cell.is-units { color: var(--unitOutline); }
.nn-cell.is-f { color: var(--formulaContent); }
.nn-cell.is-x { color: var(--numberContent); }
.nn-cell.is-f.is-lit { background: var(--formulaContainer); }
.nn-cell.is-x.is-lit { background: var(--numberContainer); }
.nn-cell.is-units.is-lit { background: var(--unitContainer); }
.nn-cell.is-off { color: var(--ghostContent); opacity: var(--alpha-subtle); }

/* ---- 7. the «123» grid (KeyboardLayouts.kt): four columns of 2W, rows at --keyRowHeight pitch */
.nn-keys {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: var(--keyFace);
  gap: var(--keyGap);
  padding: calc(var(--keyGap) + var(--keyboardInsetVertical)) var(--keyboardInset) var(--keyboardInsetVertical);
}
.nn-key {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  background: var(--surfaceHigh);
  color: var(--ink);
  border: var(--border-key) solid var(--outline);
  border-radius: var(--keyRadius);
  font-family: var(--mathFace);
  font-size: calc(20px * var(--glyphScale));      /* Glyph.TEXT_SP x glyphScale (the icons scale the same way) */
  line-height: 1;
  transition: background-color var(--roll) var(--rollEase);
}
.nn-key .nn-icon { width: var(--keyIcon); height: var(--keyIcon); }
.nn-key.is-neutral { background: var(--surfaceLow); color: var(--onSurfaceLow); }
.nn-key.is-scarlet { color: var(--error); }
.nn-key.is-op { background: var(--operatorFill); color: var(--operatorInk); }
.nn-key.is-eq { background: var(--equalsFill); color: var(--equalsInk); border-color: var(--equalsFill); }
.nn-key.is-word { font-family: var(--wordFace); }
.nn-key[data-hold]::after {   /* the hold mark: a key with variants (D-KB-6) */
  content: "";
  position: absolute;
  top: 6px;
  inset-inline-end: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: var(--alpha-subtle);
}
.nn-key.is-pressed { background: var(--ink); color: var(--ground); border-color: var(--ink); }

/* ---- 8. the units keyboard (D-SITE-2 SITE2-3): the top row search · tag · no tag · category, then
   three columns of units and the categories column on the right */
.nn-unitkb {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: var(--dockPillHeight);
  grid-auto-rows: var(--keyFace);
  gap: var(--keyGap);
  padding: calc(var(--keyGap) + var(--keyboardInsetVertical)) var(--keyboardInset) var(--keyboardInsetVertical);
}
.nn-ukey, .nn-cat, .nn-utop {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  min-width: 0;
  background: var(--surfaceHigh);
  color: var(--ink);
  border: var(--border-key) solid var(--outline);
  border-radius: var(--keyRadius);
  text-align: center;
  transition: background-color var(--roll) var(--rollEase), color var(--roll) var(--rollEase);
}
.nn-ukey { font-family: var(--mathFace); font-size: var(--rowTitleFont); }
.nn-ukey small { font-family: var(--wordFace); font-size: var(--panelCaptionFont); color: var(--ghostContent); }
.nn-utop { background: var(--surfaceLow); }
.nn-utop.is-on { background: var(--unitContainer); color: var(--unitContent); }
.nn-utop.is-off { color: var(--ghostContent); }
.nn-cat { background: var(--surfaceLow); font-size: var(--panelCaptionFont); color: var(--onSurfaceLow); }
.nn-cat .nn-icon, .nn-utop .nn-icon { width: var(--inlineIcon); height: var(--inlineIcon); }
.nn-cat.is-on, .nn-utop.is-cat { background: var(--unitContainer); color: var(--unitContent); }
.nn-ukey.is-on { background: var(--unitContainer); color: var(--unitContent); border-color: var(--unitOutline); }
.nn-ukey.is-page { background: var(--surfaceLow); font-family: var(--wordFace); font-size: var(--captionFont); grid-auto-flow: column; }

/* ---- 9. panels over the keyboard's place (x=, f): the list in three columns, the shelf column right */
.nn-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--keyGap);
  align-items: start;
  padding: calc(var(--keyGap) + var(--keyboardInsetVertical)) var(--keyboardInset) var(--keyboardInsetVertical);
  min-height: calc(5 * var(--keyPitch) + var(--keyGap));
  --shelfOn: var(--surfaceLow);
}
.nn-panel.is-x { --shelfOn: var(--numberContainer); --shelfInk: var(--numberContent); }
.nn-panel.is-f { --shelfOn: var(--formulaContainer); --shelfInk: var(--formulaContent); }
.nn-panel > .nn-list { grid-column: 1 / span 3; display: grid; gap: var(--keyGap); }
.nn-panel > .nn-shelves { grid-column: 4; display: grid; gap: var(--keyGap); }
.nn-prow {                       /* one record: mark · name, the value (or the parameters) beneath */
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: var(--space6);
  align-items: center;
  min-height: var(--keyFace);
  padding: var(--space4) var(--space10);
  background: var(--surfaceHigh);
  border: var(--border-key) solid var(--outline);
  border-radius: var(--keyRadius);
}
.nn-prow > .nn-icon { grid-row: 1 / span 2; width: var(--inlineIcon); height: var(--inlineIcon); color: var(--onSurfaceLow); }
.nn-prow > .nn-name { font-size: var(--rowTitleFont); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nn-prow .nn-val {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: var(--space6);
  font-family: var(--mathFace);
  font-size: var(--panelFont);
  white-space: nowrap;
}
.nn-prow .nn-params {
  display: flex;
  align-items: center;
  gap: var(--space4);
  overflow: hidden;
  white-space: nowrap;
  font-size: var(--panelFont);
  color: var(--ghostContent);
  -webkit-mask-image: linear-gradient(90deg, black 85%, transparent);   /* the ink-mask fade of a capped line (D-CANVAS-5) */
          mask-image: linear-gradient(90deg, black 85%, transparent);
}
.nn-prow .nn-chip { --mathSize: var(--panelCaptionFont); font-size: var(--panelCaptionFont); padding: 1px var(--space4); margin: 0; border-width: 1px; }
.nn-shelf {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  min-height: var(--keyFace);
  padding: var(--space4);
  background: var(--surfaceHigh);
  border: var(--border-key) solid var(--outline);
  border-radius: var(--keyRadius);
  font-size: var(--panelCaptionFont);
  color: var(--ink);
  text-align: center;
  transition: background-color var(--roll) var(--rollEase);
}
.nn-shelf .nn-icon { width: var(--inlineIcon); height: var(--inlineIcon); }
.nn-shelf.is-on { background: var(--shelfOn); color: var(--shelfInk, var(--ink)); }

/* ---- 10. a window page (the calculations list, D-NAV-1): back sign · title · actions, then the list
   and its shelf column */
.nn-wbar {
  display: flex;
  align-items: center;
  gap: var(--space4);
  height: calc(var(--headerButton) + 2 * var(--headerAirVertical));
  padding-inline: var(--space4);
}
.nn-wbar .nn-btn.is-quiet, .nn-wbar .nn-back { color: var(--onSurfaceLow); }
.nn-wbar .nn-btn { display: grid; place-items: center; width: var(--headerButton); height: var(--headerButton); flex: none; color: var(--ink); }
.nn-wbar .nn-back { display: flex; align-items: center; gap: 2px; padding-inline: var(--space8); height: var(--headerButton); }
.nn-wbar h3, .nn-wtitle {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: var(--windowTitleFont);
  font-weight: var(--weight-emphasis);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nn-body { flex: 1 1 auto; min-height: 0; overflow: hidden; padding: 0 var(--space16); }
.nn-caption { padding-block: var(--space4) var(--space8); }
.nn-caption b { display: block; font-size: var(--rowTitleFont); font-weight: var(--weight-title); }
.nn-caption span { font-size: var(--captionFont); color: var(--onSurfaceLow); }
.nn-split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); column-gap: var(--space8); align-items: start; }
.nn-split > div:first-child { display: contents; }                      /* the caption is the list's, the shelves start at the first row */
.nn-split > div > .nn-caption { grid-column: 1; }
.nn-split > div > .nn-list { grid-column: 1; grid-row: 2; }
.nn-split > .nn-shelves { grid-column: 2; grid-row: 2; }
.nn-split > .nn-shelves { display: grid; gap: var(--keyGap); --shelfOn: var(--calculationContainer); }
.nn-list { margin: 0; padding: 0; list-style: none; }
.nn-list > .nn-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: var(--space12);
  align-items: center;
  min-height: calc(var(--keyRowHeight) - var(--keyGap));   /* the unfactored row face: 50.3 */
  padding-block: var(--space6);
  border-bottom: var(--border-row) solid color-mix(in srgb, var(--outline) calc(var(--border-rowAlpha) * 100%), transparent);
  transition: background-color var(--roll) var(--rollEase);
}
.nn-list > .nn-row > .nn-icon { color: var(--calculationContent); }
.nn-row .nn-title { font-size: var(--rowTitleFont); font-weight: var(--weight-title); line-height: 1.1; }
.nn-row .nn-sub { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space4); font-size: var(--captionFont); color: var(--onSurfaceLow); }
.nn-row.is-on .nn-title { color: var(--ink); }

/* ---- 11. the share page (D-SHR-5, D-LE-3): the document preview, then the pill «Картка · PDF · Excel»
   with the signature circle, the «Вигляд» drawer, the «Поділитися» deed */
.nn-preview { flex: 1 1 auto; min-height: 0; overflow: hidden; padding: var(--space8) var(--space16) 0; background: var(--surfaceLow); }
.nn-doc {
  padding: var(--space16);
  background: var(--surfaceHigh);
  border: 1px solid var(--ghostOutline);
  border-radius: 2px;
  font-size: var(--panelCaptionFont);
  line-height: 1.35;
}
.nn-doc .nn-brand { color: var(--ghostContent); font-size: 8px; }
.nn-doc h4 { margin: var(--space8) 0 0; font-size: var(--rowTitleFont); font-weight: var(--weight-emphasis); display: flex; justify-content: space-between; align-items: baseline; }
.nn-doc h4 small { font-size: 8px; font-weight: var(--weight-body); color: var(--ghostContent); }
.nn-doc p { margin: 2px 0 var(--space8); color: var(--onSurfaceLow); }
.nn-doc dl { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.nn-doc dt, .nn-doc dd { margin: 0; padding: 5px 0; border-bottom: 1px solid var(--ghostOutline); }
.nn-doc dt { font-weight: var(--weight-title); }
.nn-doc dd { text-align: end; font-family: var(--mathFace); font-weight: var(--weight-title); }
.nn-doc dd .nn-result-unit { color: var(--unitContent); margin-inline-start: 0.2em; }
.nn-doc dl > div { display: contents; }
.nn-doc .nn-total dt, .nn-doc .nn-total dd { border-bottom: 0; font-weight: var(--weight-emphasis); }
.nn-sharebar { display: grid; gap: var(--space8); padding: var(--space10) var(--space16) var(--space8); background: var(--ground); border-top: 1px solid var(--ghostOutline); }
.nn-seg-row { display: flex; align-items: center; gap: var(--space8); }
.nn-seg-row .nn-round { width: var(--roundButton); height: var(--roundButton); }
.nn-seg {
  flex: 1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  height: var(--roundButton);
  padding: 3px;
  background: var(--surfaceLow);
  border: var(--border-pill) solid var(--outline);
  border-radius: var(--pillRadius);
}
.nn-seg > span {
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: calc(var(--pillRadius) - 3px);
  font-size: var(--rowTitleFont);
  color: var(--onSurfaceLow);
  transition: background-color var(--roll) var(--rollEase), border-color var(--roll) var(--rollEase), color var(--roll) var(--rollEase);
}
.nn-seg > .is-on { background: var(--surfaceHigh); border-color: var(--outline); color: var(--ink); font-weight: var(--weight-title); }
.nn-seg > .is-off { color: var(--ghostContent); opacity: var(--alpha-subtle); }
.nn-drawer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space8);
  min-height: var(--roundButton);
  padding-inline: var(--space16) var(--space12);
  background: var(--surfaceHigh);
  border: var(--border-card) solid var(--outline);
  border-radius: var(--cardRadius);
  font-size: var(--rowTitleFont);
}
.nn-drawer > span:last-child { display: inline-flex; align-items: center; gap: var(--space4); font-weight: var(--weight-title); }
.nn-deed {
  display: grid;
  place-items: center;
  min-height: var(--bottomDeedHeight);
  background: var(--accent);
  color: var(--onAccent);
  border-radius: var(--pillRadius);
  font-size: var(--rowTitleFont);
  font-weight: var(--weight-title);
}

/* ---- 12. settings: cards of rows under a caps caption; a row = icon · title · subtitle · its control */
.nn-card {
  margin-bottom: var(--space12);
  padding: var(--space6) var(--space12);
  background: var(--surfaceHighest);
  border: var(--border-card) solid var(--outline);
  border-radius: var(--panelRadius);
}
.nn-card > h5 {
  margin: var(--space8) 0 var(--space4);
  font-size: var(--panelCaptionFont);
  font-weight: var(--weight-emphasis);
  letter-spacing: var(--type-labelBold-tracking);
  text-transform: uppercase;
  color: var(--onSurfaceLow);
}
.nn-srow {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: var(--space12);
  align-items: center;
  min-height: var(--rowHeight);
  padding-block: var(--space6);
}
.nn-srow + .nn-srow { border-top: var(--border-row) solid var(--ghostOutline); }
.nn-srow > .nn-icon { color: var(--ink); }
.nn-srow .nn-title { font-size: var(--rowTitleFont); }
.nn-srow .nn-sub { font-size: var(--captionFont); color: var(--onSurfaceLow); }
.nn-srow .nn-value { display: inline-flex; align-items: center; gap: var(--space4); font-size: var(--bodyFont); font-weight: var(--weight-title); color: var(--ink); }
.nn-kind {                         /* a kind's tinted disc behind a library icon (73-menu) */
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
}
.nn-kind .nn-icon { width: var(--inlineIcon); height: var(--inlineIcon); }
.nn-kind.is-f { background: var(--formulaContainer); color: var(--formulaContent); }
.nn-kind.is-x { background: var(--numberContainer); color: var(--numberContent); }
.nn-kind.is-u { background: var(--unitContainer); color: var(--unitContent); }
.nn-switch {                       /* the iOS switch (D-KB-20) */
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--surfaceLow);
  border: 1px solid var(--outline);
  transition: background-color var(--roll) var(--rollEase);
}
.nn-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surfaceHigh);
  border: 1px solid var(--outline);
  box-sizing: border-box;
  transition: transform var(--roll) var(--rollEase);
}
.nn-switch.is-on { background: var(--accent2); border-color: var(--accent2); }
.nn-switch.is-on::after { transform: translateX(18px); }
.nn-swatches { display: flex; gap: var(--space6); }
.nn-swatch { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--outline); }

/* ---- 13. a bottom sheet over the screen (no shadow, D-ELEV-2) and its outlined fields */
.nn-sheet {
  position: absolute;
  inset: auto 0 0 0;
  display: grid;
  gap: var(--space12);
  padding: var(--space4) var(--space16) var(--space24);
  background: var(--surfaceHigh);
  border-top: 1px solid var(--outline);
  border-radius: var(--panelRadius) var(--panelRadius) 0 0;
}
.nn-sheet.is-inline { position: static; }
.nn-sheet-grip { justify-self: center; color: var(--onSurfaceLow); }
.nn-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space8); }
.nn-sheet-head b { font-size: var(--headingFont); font-weight: var(--weight-title); }
.nn-sheet-head span { display: inline-flex; gap: var(--space16); color: var(--ink); }
.nn-field {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space8);
  min-height: var(--rowHeight);
  padding-inline: var(--space12);
  border: 1px solid var(--outline);
  border-radius: var(--cardRadius);
  font-size: var(--rowTitleFont);
}
.nn-field > label {
  position: absolute;
  top: -0.7em;
  inset-inline-start: var(--space8);
  padding-inline: var(--space4);
  background: var(--surfaceHigh);
  font-size: var(--panelCaptionFont);
  color: var(--onSurfaceLow);
}
.nn-field.is-math { font-family: var(--mathFace); }
.nn-field .is-hint { color: var(--ghostContent); }

/* ---- 14. the classes the states emit (sitegen LandingStates.kt, SITE5-5): a formula chip's slots,
   the words of a formula line (FormulaLine: name = parameters -> unit) */
.nn-formula > .nn-name { margin-inline-end: 0.1em; color: var(--formulaContent); }
/* inside the chip the words (the name, a place's name) are a step below the chip's face, the digits and the
   brackets stand at the canvas size (frames/formulas.png: name 21.8 · digits 32.4 at the medium canvas) */
.nn-formula > .nn-name, .nn-formula .nn-slot > i, .nn-formula .nn-pname, .nn-formula .nn-peq { font-size: calc(1em * var(--chipFontRatio)); }
.nn-formula .nn-digit, .nn-formula > .nn-op, .nn-formula > .nn-op-paren { font-size: var(--mathSize); line-height: 1; }
.nn-formula > * { flex: none; }
.nn-formula > .nn-op, .nn-formula > .nn-op-paren { color: var(--formulaContent); }
.nn-formula > .nn-slot {
  display: inline-flex;
  align-items: baseline;
  min-width: 0;
  color: var(--ghostContent);                   /* the name and the «=» of a filled place; the value is .nn-digit (ink) */
}
.nn-formula > .nn-slot.is-empty {              /* an empty place: a dashed pill carrying the parameter's name */
  align-items: center;
  margin-inline: 1px;
  padding-inline: var(--space8);
  border: 1px dashed var(--ghostOutline);
  border-radius: 999px;
  line-height: 1.12;
}
.nn-formula > .nn-slot.is-empty > i { font-style: italic; color: var(--ghostContent); }
.nn-slot .nn-pname, .nn-slot .nn-peq { color: var(--ghostContent); }
.nn-slot .nn-peq { margin-inline: 0.3em; }
.nn-w-name { color: var(--ink); }
.nn-w-op { color: var(--ghostContent); margin: 0 0.25em; }
.nn-w-unit { color: var(--unitContent); }
