/* ============================================================================
   Pediatras — design system.

   Hand-written, no build step, no Tailwind. DosiPed shipped a Tailwind build
   artifact (app.built.css) that had to be regenerated with npx every time a
   class changed, which is a toolchain in front of a 2.000-line app. The warm
   pediatric look this brand needs is a dozen custom properties and about six
   components, so it is written once, here, and read directly by the browser.

   Tone: warm and welcoming, because the audience spends its day with children
   and their parents. NOT childish: the numbers on these screens are drug doses,
   so type stays large and legible, contrast stays high, and the playful part is
   colour and roundness, never the data.

   SHAPE: a workspace, not a phone column. DosiPed was 620px centred on a
   27-inch screen with an iOS tabbar pinned to the bottom of a desktop browser.
   The clinical views here are three regions - rail, work, evidence - and the
   evidence column is the product claim "con la fonte sempre in vista" taken
   literally: the derivation is a permanent column, not a tooltip and not a
   12px footnote. Below 1024px the three regions stack and the rail becomes the
   bottom tabbar, so the phone layout is earned rather than assumed.
   ========================================================================= */

/* ------------------------------------------------------------------ tokens */
:root {
  /* Brand palette. Plum carries authority, lavender carries warmth, yellow
     carries the joy, and the ground is cream rather than white so nothing on
     the page is ever pure #fff against pure #fff. */
  --cream:      #fffcf7;
  --cream-deep: #fff4ea;
  --surface:    #ffffff;
  --line:       #ece3f2;
  --line-soft:  #f6f1f9;
  --ink:        #39204f;
  --body:       #60506e;
  --muted:      #9a8aa8;

  /* pillar colours, one per tool, used as the only wayfinding device.
     All five are drawn from the brand family so the app reads as one thing,
     with two deliberate exceptions: emergenze stays red because red means
     emergency everywhere in medicine and a house style is not worth a moment's
     hesitation at a resuscitation, and strumenti's yellow needs --sole-deep for
     text because #ffbd59 on cream is about 1.7:1 and fails every contrast bar. */
  --plum:       #39204f;   --plum-deep:  #2a1739;  --plum-soft:  #efe9f4;
  --lav:        #9672b8;   --lav-deep:   #7a58a0;  --lav-soft:   #f1eaf8;
  --acqua:      #5f7fc9;   --acqua-deep: #42609f;  --acqua-soft: #e9eefa;
  --rosso:      #d1495b;   --rosso-deep: #ad3448;  --rosso-soft: #fbe6e9;
  --sole:       #ffbd59;   --sole-deep:  #a9711a;  --sole-soft:  #fff3df;
  --pesca:      #ffe2d1;   --pesca-deep: #b2663c;  --pesca-soft: #fff1e7;

  --primary:      var(--plum);
  --primary-deep: var(--plum-deep);
  --primary-soft: var(--plum-soft);

  --radius:    18px;
  --radius-lg: 26px;
  --radius-pill: 999px;

  /* Filled-button ink. In dark --primary becomes the LIGHTEST plum, so white
     on it is unreadable and a filled button has to go dark-on-light. Every
     `color: #fff` that sat on a filled surface is this token now. */
  --btn-fg: #fff;

  /* The translucent surfaces, which cannot be derived from --surface because
     they are deliberately letting the ground through. */
  --veil:        rgba(255,255,255,.5);
  --veil-strong: rgba(255,255,255,.95);
  --head-bg:     rgba(255,252,247,.94);
  --head-bg-soft:rgba(255,252,247,.9);
  --scrim:       rgba(57,32,79,.45);
  --scrim-soft:  rgba(57,32,79,.34);
  --sole-line:   rgba(255,189,89,.45);

  /* The three lights behind the page. */
  --glow-sole: rgba(255,189,89,.13);
  --glow-lav:  rgba(150,114,184,.11);
  --glow-ink:  rgba(57,32,79,.10);

  --shadow-sm: 0 1px 2px rgba(57,32,79,.05);
  --shadow:    0 2px 4px rgba(57,32,79,.04), 0 12px 28px -16px rgba(57,32,79,.22);
  --shadow-lg: 0 4px 8px rgba(57,32,79,.06), 0 28px 56px -24px rgba(57,32,79,.28);

  --font-display: "Baloo 2", "Nunito Sans", system-ui, sans-serif;
  --font-body:    "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* The faintest tint, for the inside of things: a code span, a callout's
     ground, a table head, a hovered rail row. The reference-library block
     below reached for --bg four times before it existed, which resolved to
     nothing and rendered those four surfaces transparent. */
  --bg: var(--line-soft);

  /* height of the sticky header, so the rail and the evidence column know
     where they are allowed to stick. One place to change it. */
  --chrome: 66px;

  /* So form controls, scrollbars and the UA's own widgets follow the theme. */
  color-scheme: light;
}


/* ======================================================================= dark
   Only the tokens are redefined. Not one rule below this point knows which
   theme it is in, which is why dark mode is a colour change and not a second
   stylesheet: the 1.500 lines of layout, type and interaction are shared.

   THREE SELECTORS, NOT ONE, because the theme has three states: the OS
   default, with nothing stamped on <html>, and the two explicit choices the
   account menu writes to localStorage. The media query is guarded against
   [data-theme="light"] so that choosing light on a dark OS actually wins,
   which a bare @media cannot do.

   The two blocks are identical by construction - if you change one, change
   the other, or the toggle and the OS will disagree about the same colour.
   ========================================================================= */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  /* The ground stops being cream and becomes a warm near-black plum, so the
     family still reads as plum-and-lavender rather than as a grey app with
     the lights off. */
  --cream:      #1a1222;
  --cream-deep: #211829;
  --surface:    #272033;
  --line:       rgba(201,180,221,.18);
  --line-soft:  #2a2135;
  --ink:        #f1e9f6;
  --body:       #b1a4bd;
  --muted:      #8e7f9c;

  /* Every pillar inverts: the mid tone lightens enough to sit on the dark
     ground, --*-deep becomes the LIGHTEST of the three because it carries
     text and headings, and --*-soft becomes a dark tint because it is a
     ground. Emergenze stays red and strumenti stays yellow - the wayfinding
     survives the theme, which is the whole point of having it. */
  --plum:       #c9b4dd;   --plum-deep:  #e2d6ee;  --plum-soft:  #322840;
  --lav:        #a98fc8;   --lav-deep:   #c3abdd;  --lav-soft:   #2f2740;
  --acqua:      #8aa6e6;   --acqua-deep: #aabff0;  --acqua-soft: #242b40;
  --rosso:      #e58c8c;   --rosso-deep: #f0a8a8;  --rosso-soft: #3a2229;
  --sole:       #ffbd59;   --sole-deep:  #e0b067;  --sole-soft:  #352b1c;
  --pesca:      #e8b89c;   --pesca-deep: #d9a184;  --pesca-soft: #332520;

  /* Dark-on-light, because --primary is now the light plum above. */
  --btn-fg: #1a1520;

  --veil:        rgba(255,255,255,.03);
  --veil-strong: rgba(39,32,51,.95);
  --head-bg:     rgba(26,18,34,.94);
  --head-bg-soft:rgba(26,18,34,.9);
  --scrim:       rgba(0,0,0,.65);
  --scrim-soft:  rgba(0,0,0,.5);
  --sole-line:   rgba(255,189,89,.28);

  --glow-sole: rgba(255,189,89,.07);
  --glow-lav:  rgba(150,114,184,.13);
  --glow-ink:  rgba(0,0,0,.4);

  /* A plum shadow is invisible on a plum-black ground, so shadows go black
     and lean harder on the long soft one to keep cards lifting. */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.40);
  --shadow:    0 2px 4px rgba(0,0,0,.32), 0 12px 28px -16px rgba(0,0,0,.70);
  --shadow-lg: 0 4px 8px rgba(0,0,0,.36), 0 28px 56px -24px rgba(0,0,0,.80);

  color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  /* The ground stops being cream and becomes a warm near-black plum, so the
     family still reads as plum-and-lavender rather than as a grey app with
     the lights off. */
  --cream:      #1a1222;
  --cream-deep: #211829;
  --surface:    #272033;
  --line:       rgba(201,180,221,.18);
  --line-soft:  #2a2135;
  --ink:        #f1e9f6;
  --body:       #b1a4bd;
  --muted:      #8e7f9c;

  /* Every pillar inverts: the mid tone lightens enough to sit on the dark
     ground, --*-deep becomes the LIGHTEST of the three because it carries
     text and headings, and --*-soft becomes a dark tint because it is a
     ground. Emergenze stays red and strumenti stays yellow - the wayfinding
     survives the theme, which is the whole point of having it. */
  --plum:       #c9b4dd;   --plum-deep:  #e2d6ee;  --plum-soft:  #322840;
  --lav:        #a98fc8;   --lav-deep:   #c3abdd;  --lav-soft:   #2f2740;
  --acqua:      #8aa6e6;   --acqua-deep: #aabff0;  --acqua-soft: #242b40;
  --rosso:      #e58c8c;   --rosso-deep: #f0a8a8;  --rosso-soft: #3a2229;
  --sole:       #ffbd59;   --sole-deep:  #e0b067;  --sole-soft:  #352b1c;
  --pesca:      #e8b89c;   --pesca-deep: #d9a184;  --pesca-soft: #332520;

  /* Dark-on-light, because --primary is now the light plum above. */
  --btn-fg: #1a1520;

  --veil:        rgba(255,255,255,.03);
  --veil-strong: rgba(39,32,51,.95);
  --head-bg:     rgba(26,18,34,.94);
  --head-bg-soft:rgba(26,18,34,.9);
  --scrim:       rgba(0,0,0,.65);
  --scrim-soft:  rgba(0,0,0,.5);
  --sole-line:   rgba(255,189,89,.28);

  --glow-sole: rgba(255,189,89,.07);
  --glow-lav:  rgba(150,114,184,.13);
  --glow-ink:  rgba(0,0,0,.4);

  /* A plum shadow is invisible on a plum-black ground, so shadows go black
     and lean harder on the long soft one to keep cards lifting. */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.40);
  --shadow:    0 2px 4px rgba(0,0,0,.32), 0 12px 28px -16px rgba(0,0,0,.70);
  --shadow-lg: 0 4px 8px rgba(0,0,0,.36), 0 28px 56px -24px rgba(0,0,0,.80);

  color-scheme: dark;
}

/* The brand lockup is a transparent PNG drawn in plum ink: on the dark ground
   it is a dark smudge, so it is LIFTED rather than replaced - one asset, both
   themes, and no second file to keep in step.

   Brightness and not invert(): the lockup is two children with white faces
   inside a plum outline, and inverting turns those faces black, which is a
   worse logo than a dim one. Lifting keeps the drawing and only moves the
   plum up into lavender; the gold underline goes pale, which is the price. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand img { filter: brightness(3.1) saturate(.6); }
}
:root[data-theme="dark"] .brand img { filter: brightness(3.1) saturate(.6); }


/* ------------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--body);
  background: var(--cream);
  background-image:
    radial-gradient(1100px 520px at 12% -8%,  var(--glow-sole), transparent 62%),
    radial-gradient(900px 480px at 92% 2%,   var(--glow-lav),  transparent 60%),
    radial-gradient(800px 520px at 50% 108%, var(--glow-ink),  transparent 62%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.15;
  margin: 0 0 .4em;
  font-weight: 700;
  letter-spacing: -.01em;
}
p { margin: 0 0 1em; }
a { color: var(--primary-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
/* Scrollbars are hidden on the page, but NOT inside the rail list or the
   evidence column: those two scroll independently, and a scrolling region with
   no visible bar is a region you cannot tell is scrolling. */
::-webkit-scrollbar { width: 0; height: 0; }
.scroller { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.scroller::-webkit-scrollbar { width: 7px; height: 7px; }
.scroller::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

/* ------------------------------------------------------------------ layout */
.wrap      { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.wrap-mid  { max-width: 820px;  margin: 0 auto; padding: 0 20px; }
/* the header on a clinical view lines up with the shell beneath it, not with
   the narrower marketing measure */
.head-wide  { max-width: 1620px; margin: 0 auto; padding: 0 22px; }
.head-sheet { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
/* staff views: rows to read, so a reading measure rather than a workspace */
.sheet    { max-width: 1040px; margin: 0 auto; padding: 26px 24px 70px; }
.stack > * + * { margin-top: 1rem; }
.center   { text-align: center; }
.muted    { color: var(--muted); }
.small    { font-size: .86rem; }
.tiny     { font-size: .76rem; }
.nums     { font-variant-numeric: tabular-nums; }
.kicker {
  font-size: .72rem; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: var(--primary-deep);
}
.grid { display: grid; gap: 18px; }
@media (min-width: 680px)  { .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
/* Inside the shell a media query is the wrong instrument: the work column is
   about 700px at a 1400px viewport, so "two columns above 680px" puts two
   half-width cards in a column narrower than one. auto-fit measures the
   container instead, which is what these three do. */
.grid-auto    { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-auto-s  { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-auto-xs { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }

/* ---- the clinical shell: rail | work | evidence -------------------------- */
.shell {
  max-width: 1620px; margin: 0 auto;
  padding: 22px 22px 120px;           /* bottom clears the phone tabbar */
  display: grid; gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
/* 1024px: the rail becomes a real column and the evidence sits under the work
   area, still full-height and still permanent. */
@media (min-width: 1024px) {
  .shell {
    grid-template-columns: 244px minmax(0, 1fr);
    padding-bottom: 56px; gap: 22px;
  }
  .shell > .rail { grid-row: 1 / span 2; }
}
/* 1380px: the third column appears and the answer and its derivation are side
   by side, which is the layout this app is actually for. */
@media (min-width: 1380px) {
  .shell { grid-template-columns: 252px minmax(0, 1fr) 356px; gap: 26px; }
  .shell > .rail { grid-row: 1; }
  .shell > .evidence { grid-column: 3; grid-row: 1; }
}
@media (min-width: 1024px) {
  .rail {
    position: sticky; top: calc(var(--chrome) + 20px);
    max-height: calc(100vh - var(--chrome) - 44px); overflow-y: auto;
  }
}
@media (min-width: 1380px) {
  .evidence {
    position: sticky; top: calc(var(--chrome) + 20px);
    max-height: calc(100vh - var(--chrome) - 44px); overflow-y: auto;
  }
}

.work { display: grid; gap: 18px; align-content: start; min-width: 0; }
/* the rail's tool links are in-page anchors, and the header is sticky: without
   this the target lands underneath it */
.work section[id] { scroll-margin-top: calc(var(--chrome) + 18px); }
.work-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.work-head h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); margin: 0; }
.work-head .meta { font-size: .84rem; color: var(--muted); margin: 0; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-tight { padding: 16px; border-radius: var(--radius); }
.card-flat  { box-shadow: var(--shadow-sm); }

/* a feature card carries its pillar colour as a top rule and a soft icon chip */
.feature { position: relative; overflow: hidden; }
.feature::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 5px;
  background: var(--accent, var(--primary));
}
.feature .chip-icon {
  width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center; color: var(--accent-ink, var(--primary));
  background: var(--accent-soft, var(--primary-soft));
  margin-bottom: 14px;
}
.feature h3 { font-size: 1.4rem; margin-bottom: .25em; }
.feature .lead { color: var(--ink); font-weight: 600; margin-bottom: .8em; }
.feature ul { margin: 0; padding: 0; list-style: none; }
.feature li {
  position: relative; padding-left: 26px; margin-bottom: .45em;
  font-size: .93rem; line-height: 1.5;
}
.feature li::before {
  content: ""; position: absolute; left: 6px; top: .62em;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent, var(--primary));
}

/* Pillar accents, applied on the element. --accent-ink is the text-safe
   variant: yellow at #ffbd59 is about 1.7:1 on cream, so anything that sets
   type or an icon in the pillar colour reads --accent-ink, never --accent. */
.a-plum  { --accent: var(--plum);  --accent-soft: var(--plum-soft);  --accent-ink: var(--plum-deep); }
.a-lav   { --accent: var(--lav);   --accent-soft: var(--lav-soft);   --accent-ink: var(--lav-deep); }
.a-acqua { --accent: var(--acqua); --accent-soft: var(--acqua-soft); --accent-ink: var(--acqua-deep); }
.a-rosso { --accent: var(--rosso); --accent-soft: var(--rosso-soft); --accent-ink: var(--rosso-deep); }
.a-sole  { --accent: var(--sole);  --accent-soft: var(--sole-soft);  --accent-ink: var(--sole-deep); }
.a-pesca { --accent: var(--pesca); --accent-soft: var(--pesca-soft); --accent-ink: var(--pesca-deep); }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  padding: 13px 26px; border-radius: var(--radius-pill);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--primary); color: var(--btn-fg); box-shadow: var(--shadow);
}
.btn-primary:hover { background: var(--primary-deep); }
.btn-ghost {
  background: var(--surface); color: var(--ink); border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-deep); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: .88rem; }
.btn-danger { background: var(--rosso); color: var(--btn-fg); }
.btn-ok     { background: var(--lav);  color: var(--btn-fg); }

/* ------------------------------------------------------------------ forms */
label.lbl {
  display: block; font-size: .78rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.input, select.input, textarea.input {
  width: 100%; font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.input::placeholder { color: var(--muted); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a28d82' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.field + .field { margin-top: 14px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 6px; }
/* a numeric input is read back and checked, so it is centred and tabular */
.input.num { text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ chips / badges */
.chip {
  display: inline-flex; align-items: center; gap: .4em;
  font-size: .82rem; font-weight: 700; padding: 6px 14px;
  border-radius: var(--radius-pill); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--body); cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.chip:hover { text-decoration: none; border-color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--btn-fg); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }

.badge {
  display: inline-block; font-size: .7rem; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; padding: 3px 10px; border-radius: var(--radius-pill);
  /* A badge is a flex child of .readout in the review queue, where the default
     stretch turned the pill into a tall oval. */
  align-self: center;
}
.badge-draft    { background: var(--pesca-soft);  color: var(--sole-deep); }
.badge-approved { background: var(--lav-soft);  color: var(--lav-deep); }
.badge-rejected { background: var(--rosso-soft); color: var(--rosso-deep); }
.badge-pending  { background: var(--line-soft);  color: var(--body); }

/* ------------------------------------------------------------------ header
   Three groups, left to right: who we are, who the patient is, who you are.
   The third used to be six unlabelled 19px glyphs, where the review queue and
   "segnala un errore" were the same grey square and nothing said which page
   you were on. Now the staff destinations carry their names while there is
   room for them, and everything personal is behind one avatar. */
.site-head {
  position: sticky; top: 0; z-index: 30;
  background: var(--head-bg-soft); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
/* A 2px rule in the pillar's own accent, so the header agrees with the rail
   about which pillar you are in. Only on the clinical views: on a marketing
   or staff page it would be colour standing for nothing. */
.site-head.tinted::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--accent);
}
.site-head .bar {
  display: flex; align-items: center; gap: 16px;
  min-height: var(--chrome); flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand:hover { text-decoration: none; }
/* The logo is one image, not type plus an emoji. Width is left to the aspect
   ratio so the intrinsic 938x240 in the markup reserves the right box and the
   header does not jump while the PNG loads. */
.brand img { height: 34px; width: auto; display: block; }
@media (max-width: 560px) { .brand img { height: 29px; } }

/* ---- patient context, in the header rather than in a bar of its own.
   DosiPed had a second sticky strip under the header holding two inputs,
   which on a desktop browser is a 52px band of nothing. Here the two fields
   are one bordered instrument that lights up as a whole, and each keeps a
   caption after it is filled - a placeholder is a label that disappears
   exactly when you have numbers on screen to misread. */
.patient { display: flex; align-items: center; gap: 11px; }
.patient-lbl {
  font-size: .62rem; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted); flex: 0 0 auto;
}
.patient-box {
  display: flex; align-items: stretch;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius-pill); padding: 3px 2px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.patient-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.pfield { display: flex; flex-direction: column; justify-content: center; padding: 2px 14px; cursor: text; }
.pfield .cap {
  font-size: .57rem; font-weight: 800; letter-spacing: .11em;
  text-transform: uppercase; color: var(--muted); line-height: 1.1;
}
.pfield .val { display: flex; align-items: baseline; gap: 4px; }
.pfield input {
  width: 3.6ch; padding: 0; border: 0; outline: none; background: none;
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 800;
  color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.2;
  appearance: textfield; -moz-appearance: textfield;
}
.pfield input::-webkit-outer-spin-button,
.pfield input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pfield input::placeholder { color: var(--line); font-weight: 800; }
.pfield i { font-style: normal; font-size: .72rem; font-weight: 700; color: var(--muted); }
.pdiv { width: 1px; background: var(--line); margin: 6px 0; flex: 0 0 1px; }
@media (max-width: 899px) {
  .site-head .bar { padding-bottom: 10px; row-gap: 0; }
  .patient { order: 3; flex: 1 0 100%; padding-top: 10px; border-top: 1px solid var(--line); }
  .patient-box { flex: 1; }
  .pfield { flex: 1; }
  .pfield input { width: 100%; }
}

/* ---- the right-hand group */
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav-link { color: var(--body); font-weight: 600; font-size: .95rem; padding: 0 6px; }
.nav-link:hover { color: var(--primary-deep); text-decoration: none; }
.head-link {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 7px 13px; border-radius: var(--radius-pill);
  font-size: .86rem; font-weight: 700; color: var(--body); text-decoration: none;
}
.head-link:hover { background: var(--line-soft); color: var(--primary-deep); text-decoration: none; }
.head-link.on { background: var(--primary-soft); color: var(--primary-deep); }
.head-link .icn { color: var(--muted); }
.head-link:hover .icn, .head-link.on .icn { color: var(--primary); }
/* Below this the words do not fit, and the same destinations are already in
   the account menu - so they go there rather than becoming glyphs again. */
@media (max-width: 1099px) { .head-link { display: none; } }
@media (min-width: 1100px) { .menu .narrow-only { display: none; } }

/* ---- the family switcher
   Two apps, one login, so moving between them is a control and not a
   bookmark. A segmented pill rather than two links, because the point is
   that these are the two halves of one thing and you are in one of them.
   The words go below 760px; the icons alone still say which is which. */
.appsw {
  display: inline-flex; align-items: center; gap: 2px; margin-right: 6px;
  padding: 2px; border-radius: var(--radius-pill);
  background: var(--line-soft); border: 1px solid var(--line);
}
.appsw-i {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 5px 11px; border-radius: var(--radius-pill);
  font-size: .8rem; font-weight: 700; color: var(--muted); text-decoration: none;
}
.appsw-i:hover { color: var(--primary-deep); text-decoration: none; }
.appsw-i.on {
  background: var(--surface); color: var(--primary-deep);
  box-shadow: var(--shadow-sm);
}
.appsw-i .icn { flex: 0 0 auto; }
@media (max-width: 759px) {
  .appsw-i span { display: none; }
  .appsw-i { padding: 5px 9px; }
}

.acct { position: relative; margin-left: 4px; }
.acct-btn {
  display: inline-flex; align-items: center; gap: 3px; cursor: pointer;
  background: none; border: 0; padding: 3px 4px 3px 3px;
  border-radius: var(--radius-pill); color: var(--muted);
}
.acct-btn:hover { background: var(--line-soft); }
.acct-btn .icn { transition: transform .16s ease; }
.acct-btn[aria-expanded="true"] .icn { transform: rotate(180deg); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--btn-fg);
  font-family: var(--font-display); font-size: .84rem; font-weight: 800;
}
.menu {
  position: absolute; right: 0; top: calc(100% + 11px); width: 262px; z-index: 40;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px;
}
.menu[hidden] { display: none; }
.menu-head {
  display: grid; gap: 1px; padding: 9px 12px 12px;
  border-bottom: 1px solid var(--line-soft); margin-bottom: 6px;
}
.menu-head b { font-size: .95rem; color: var(--ink); }
.role-tag {
  justify-self: start; margin-top: 8px; padding: 3px 10px;
  border-radius: var(--radius-pill); background: var(--lav-soft); color: var(--lav-deep);
  font-size: .64rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 0; background: none; cursor: pointer; text-align: left;
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--body);
  border-radius: 12px; text-decoration: none;
}
/* display:flex would otherwise beat the UA's [hidden] rule, and the install
   item - hidden until the browser offers beforeinstallprompt - would show on
   every browser that never fires it. */
.menu-item[hidden] { display: none; }
.menu-item:hover { background: var(--line-soft); color: var(--primary-deep); text-decoration: none; }
.menu-item .icn { color: var(--muted); flex: 0 0 auto; }
.menu-item:hover .icn { color: var(--primary); }
.menu-item.danger:hover { background: var(--rosso-soft); color: var(--rosso-deep); }
.menu-item.danger:hover .icn { color: var(--rosso-deep); }

/* The theme control. Two shapes, one id: a labelled row inside the account
   menu for a signed-in doctor, and a bare icon button in the bar for a
   visitor who has no account menu to open. .th-ico is a flex box so the SVG
   inside it does not sit on a text baseline and push the row 3px taller. */
.th-ico { display: flex; align-items: center; }
.th-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--muted); cursor: pointer;
}
.th-btn:hover { color: var(--primary); border-color: var(--lav); }
.th-btn[hidden] { display: none; }

/* ------------------------------------------------------------------ rail */
.rail { display: grid; gap: 14px; align-content: start; min-width: 0; }
.rail-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 9px;
}
.rail-head {
  font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); padding: 7px 10px 9px; margin: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.pill-link {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 9px 10px; border-radius: 14px; color: var(--body); text-decoration: none;
}
.pill-link + .pill-link { margin-top: 2px; }
.pill-link:hover { background: var(--line-soft); text-decoration: none; }
.pill-link .ico { color: var(--muted); margin-top: 1px; }
.pill-link b {
  display: block; font-family: var(--font-display); font-weight: 700;
  font-size: .97rem; color: var(--ink); line-height: 1.2;
}
.pill-link .d { display: block; font-size: .73rem; color: var(--muted); line-height: 1.35; }
.pill-link.on { background: var(--accent-soft, var(--primary-soft)); }
.pill-link.on b, .pill-link.on .ico { color: var(--accent-ink, var(--primary-deep)); }

/* the pillar's own index: the drug list, the protocol list. On a phone it is
   a 44vh scroller above the answer; on a desktop it fills the rail. */
.rail-list { overflow-y: auto; max-height: 30vh; }
@media (min-width: 1024px) { .rail-list { max-height: calc(100vh - var(--chrome) - 300px); } }
/* The pillar list and the bottom tabbar are the same navigation in two
   shapes. Showing both at once is how an app ends up with two of everything,
   so below 1024px the rail keeps only the pillar's own index. */
@media (max-width: 1023px) { .rail-nav { display: none; } }
.idx-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 10px; border-radius: 12px; cursor: pointer;
  border: 0; background: none; width: 100%; text-align: left; font: inherit;
}
.idx-row:hover { background: var(--line-soft); text-decoration: none; }
.idx-row.on { background: var(--primary-soft); }
a.idx-row { text-decoration: none; }
/* The name and its indication share one flex item next to the star, and a flex
   item's min-width is auto, so a long parenthetical ("Ketamina (Sedazione
   procedurale)") sized the item past the rail. .rail-list scrolls vertically,
   which makes its overflow-x auto as well, so the overflow was clipped at the
   rail's edge rather than wrapped: a drug name cut mid-word. */
.idx-row > span { min-width: 0; overflow-wrap: anywhere; }
.idx-row .n { display: block; font-weight: 700; color: var(--ink); font-size: .92rem; line-height: 1.25; }
.idx-row .s { display: block; font-size: .72rem; color: var(--muted); line-height: 1.3; }
.idx-cat {
  font-size: .66rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); padding: 13px 10px 4px; margin: 0;
}
.star { background: none; border: 0; cursor: pointer; color: var(--line); padding: 1px 0 0; line-height: 1; flex: 0 0 auto; }
.star:hover { color: var(--sole); }
.star.on { color: var(--sole); }

/* ------------------------------------------------------------------ bottom nav
   Phone only. A fixed bar across the bottom of a desktop browser window is the
   single clearest tell that an app was designed for an iPhone and then widened,
   which is exactly what this redesign is undoing. */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--veil-strong); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
/* Six pillars, not five: /guida was added and the sixth tab wrapped onto a
   second row, which pushed the bar up over the content it sits under. */
.tabbar .inner { max-width: 680px; margin: 0 auto; display: grid; grid-template-columns: repeat(6, 1fr); }
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 0 8px; color: var(--muted); font-size: .68rem; font-weight: 700;
  text-decoration: none;
}
.tab:hover { text-decoration: none; }
.tab .ico { display: grid; place-items: center; line-height: 1; }
.tab.on { color: var(--accent-ink, var(--primary)); }
.tab.on .ico { transform: translateY(-1px); }
.tab .dotmark { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
@media (min-width: 1024px) { .tabbar { display: none; } }

/* ------------------------------------------------------------------ results
   The answer slab. Left-aligned, not centred: it is read in sequence with the
   derivation beside it, and a centred number next to a left-aligned column of
   steps has no shared baseline to read along. */
.result {
  background: linear-gradient(135deg, var(--accent-soft, var(--primary-soft)), var(--surface) 64%);
  border: 1.5px solid var(--accent, var(--primary));
  border-radius: var(--radius-lg); padding: 22px 26px;
}
.result .big {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2.6rem, 5.4vw, 3.8rem); color: var(--ink); line-height: 1.02;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.result .unit-lg { font-size: 1.15rem; color: var(--body); font-weight: 700; }
.result .sub { font-size: .92rem; color: var(--body); margin-top: 8px; font-variant-numeric: tabular-nums; }
.result-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* the emergency row whose derivation is currently in the evidence column */
.proto-row.on { box-shadow: 0 0 0 3px var(--rosso-soft), var(--shadow); }
.readout { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.readout:last-child { border-bottom: 0; }
.readout .k { color: var(--muted); font-size: .9rem; }
.readout .v { color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.source {
  margin-top: 12px; font-size: .78rem; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 10px;
}
.warnbox {
  background: var(--rosso-soft); border: 1px solid var(--rosso);
  color: var(--rosso-deep); border-radius: var(--radius);
  padding: 11px 14px; font-size: .88rem; font-weight: 700;
}
.notice {
  background: var(--pesca-soft); border: 1px solid var(--sole-line);
  border-radius: var(--radius); padding: 14px 16px; font-size: .92rem; color: var(--sole-deep);
}
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
/* Icons are SVG now, not glyphs: they take their colour from the element they
   sit in, which is what lets one <svg> serve all six pillar accents. */
.icn { display: block; flex: 0 0 auto; }
.empty .ico, .mark-lg { color: var(--accent-ink, var(--muted)); display: grid; place-items: center; }
.empty .ico { margin-bottom: 10px; justify-content: center; }
.mark-lg { color: var(--primary); margin-bottom: 4px; justify-content: center; }
/* The only one left is the modal's close button: the header's row of them
   became the account menu. */
.icon-btn {
  background: none; border: 0; cursor: pointer; font-size: 1.05rem; line-height: 1;
  color: var(--muted); padding: 5px; border-radius: 10px; text-decoration: none;
}
.icon-btn:hover { color: var(--primary); background: var(--line-soft); text-decoration: none; }
.icon-btn .icn { display: inline-block; vertical-align: -3px; }
.chip .icn, .kicker .icn { display: inline-block; vertical-align: -2px; }

/* ------------------------------------------------------------------ evidence
   "Come si ottiene". One substitution per row: the operator, the quantity it
   is applied to, and what the step produced. A doctor checking a dose by hand
   does exactly these steps in this order, so the column is the check, printed.
   The rows are written by setEvidence() in app.js from the SAME PedCalc result
   that produced the number in the answer slab - never re-derived, because a
   derivation that can disagree with its own answer is worse than none. */
.evidence { display: grid; gap: 14px; align-content: start; min-width: 0; }
.ev-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px;
}
.ev-card.lede { border-left: 4px solid var(--accent, var(--primary)); }
.ev-head {
  font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--primary-deep); margin: 0 0 4px; display: flex; align-items: center; gap: 8px;
}
.ev-sub { font-size: .8rem; color: var(--muted); margin: 0 0 12px; }
.ev-step {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 0 10px;
  padding: 7px 0; border-bottom: 1px dashed var(--line-soft);
}
.ev-step:last-child { border-bottom: 0; }
.ev-step .op {
  font-family: var(--font-display); font-weight: 800; color: var(--lav);
  text-align: center; font-size: 1.1rem; line-height: 1.25;
}
.ev-step .ex { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 700; font-size: .95rem; }
.ev-step .lb { grid-column: 2; font-size: .72rem; color: var(--muted); line-height: 1.3; }
.ev-step.total { border-top: 1px solid var(--line); border-bottom: 0; margin-top: 2px; padding-top: 10px; }
.ev-step.total .op, .ev-step.total .ex { color: var(--primary-deep); }
.ev-step.total .ex { font-family: var(--font-display); font-size: 1.22rem; font-weight: 800; }
.ev-note {
  background: var(--rosso-soft); color: var(--rosso-deep);
  border-radius: 12px; padding: 8px 11px; font-size: .78rem; font-weight: 700;
  display: flex; gap: 7px; align-items: flex-start;
}
.ev-note.soft { background: var(--pesca-soft); color: var(--sole-deep); }
.ev-notes { display: grid; gap: 6px; margin-top: 12px; }
.ev-meta { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 7px; }
.ev-meta > div { display: flex; gap: 8px; font-size: .77rem; color: var(--body); line-height: 1.4; }
.ev-meta b { color: var(--muted); font-weight: 800; flex: 0 0 74px; text-transform: uppercase; letter-spacing: .06em; font-size: .66rem; padding-top: 2px; }
.ev-empty { font-size: .83rem; color: var(--muted); margin: 0; }

/* ------------------------------------------------------------------ hero */
.hero { padding: 72px 0 56px; text-align: center; position: relative; }
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.3rem);
  line-height: 1.05; margin: 18px 0 0;
}
.hero h1 em { font-style: normal; color: var(--primary); }
.hero .sub {
  font-size: clamp(1.05rem, 2.3vw, 1.25rem);
  max-width: 640px; margin: 22px auto 0; color: var(--body);
}
.hero .cta { margin-top: 32px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .note { margin-top: 18px; font-size: .88rem; color: var(--muted); }
.trust {
  margin-top: 34px; display: inline-flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-pill); padding: 9px 20px;
  font-size: .84rem; font-weight: 600; color: var(--body);
  box-shadow: var(--shadow-sm);
}
.trust .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lav); }

/* section headings */
.section { padding: 56px 0; }
.section-head { text-align: center; max-width: 660px; margin: 0 auto 36px; }
.section-head h2 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.section-head p  { font-size: 1.05rem; color: var(--body); margin: 0; }

/* numbered steps */
.steps { counter-reset: step; }
.step { position: relative; padding-left: 62px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 1.25rem;
  background: var(--primary-soft); color: var(--primary-deep);
}
.step h3 { font-size: 1.2rem; margin-bottom: .2em; }
.step p  { margin: 0; font-size: .95rem; }

/* why list */
.why-item { display: flex; gap: 14px; }
.why-item .ico {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center; color: var(--accent-ink, var(--primary));
  background: var(--accent-soft, var(--primary-soft));
}
.why-item h3 { font-size: 1.08rem; margin-bottom: .15em; }
.why-item p  { margin: 0; font-size: .93rem; }

/* ------------------------------------------------------------------ tables */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th {
  text-align: left; font-size: .72rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); padding: 8px 10px; border-bottom: 1.5px solid var(--line);
}
.table td { padding: 10px; border-bottom: 1px solid var(--line-soft); color: var(--ink); }
.table tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; }

/* ------------------------------------------------------------------ modals / toast */
.modal {
  position: fixed; inset: 0; z-index: 60; display: none;
  align-items: center; justify-content: center; padding: 18px;
  background: var(--scrim); backdrop-filter: blur(4px);
}
.modal.open { display: flex; }
.modal .panel {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); max-width: 420px; width: 100%; padding: 28px;
}
.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%);
  z-index: 70; background: var(--ink); color: var(--cream);
  border-radius: var(--radius-pill); padding: 10px 20px;
  font-size: .9rem; font-weight: 700; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.toast.show { opacity: 1; }
@media (min-width: 1024px) { .toast { bottom: 32px; } }

/* ------------------------------------------------------------------ auth pages */
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 48px 20px 80px; }
.auth-wrap .card { padding: 30px; }
.auth-wrap h1 { font-size: 2rem; text-align: center; }
.auth-wrap .intro { text-align: center; color: var(--body); font-size: .95rem; }
.alert {
  border-radius: var(--radius); padding: 11px 14px; font-size: .9rem;
  font-weight: 600; margin-bottom: 16px;
}
.alert-bad { background: var(--rosso-soft); color: var(--rosso-deep); }
.alert-ok  { background: var(--lav-soft);  color: var(--lav-deep); }

/* ------------------------------------------------------------------ footer */
.site-foot { border-top: 1px solid var(--line); margin-top: 40px; background: var(--veil); }
.site-foot .inner {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  justify-content: space-between; padding: 30px 0;
}
.site-foot .disclaimer { font-size: .8rem; color: var(--muted); max-width: 520px; margin: 0; }

/* ------------------------------------------------------------------ a11y */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------- the reference library
   Three shapes the calculator pillars never needed: a clickable card in the
   area index, a compact rail list (the pillar rail's own .pill-link is too
   tall for 25 sections), and the prose block a scheda's body renders into. */
.card-link { display: block; text-decoration: none; color: inherit; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg, 0 8px 24px rgba(57,32,79,.10)); border-color: var(--accent, var(--line)); }
.card-link .kicker { display: flex; align-items: center; gap: 7px; }

.rail-mini { display: flex; flex-direction: column; gap: 1px; }
.rail-mini a {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
  padding: 6px 9px; border-radius: var(--radius); font-size: .84rem;
  color: var(--body); text-decoration: none; line-height: 1.3;
}
.rail-mini a:hover { background: var(--bg); color: var(--ink); }
.rail-mini a.on { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.rail-mini a span { color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; flex: 0 0 auto; }

.alert-warn { background: var(--sole-soft); color: var(--sole-deep); }

.prose { line-height: 1.62; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h3 { font-size: 1.12rem; margin: 22px 0 8px; }
.prose h4 { font-size: .98rem; margin: 18px 0 6px; color: var(--body); }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 20px; }
.prose li { margin: 3px 0; }
.prose code { background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: .88em; }
.prose .md-note {
  border-left: 3px solid var(--accent, var(--primary)); background: var(--bg);
  padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0; margin: 0 0 14px;
}
/* A clinical table is often wider than the work column, and the page body must
   never scroll sideways, so each table gets its own scroller. */
.tbl-wrap { overflow-x: auto; margin: 0 0 14px; }
.prose table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.prose th, .prose td { text-align: left; padding: 7px 11px; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 700; color: var(--ink); white-space: nowrap; background: var(--bg); }
.prose tbody tr:last-child td { border-bottom: 0; }
/* A badge inside the evidence column's label/value row is a value, not a bar:
   .ev-meta b is a flex child and would otherwise stretch the full column. */
.ev-meta b.badge { flex: 0 0 auto; align-self: center; }


/* ============================================================================
   v2 — IL BAMBINO, POI LA DOMANDA
   ============================================================================

   Everything below is scoped under html[data-v2], stamped by _layout.php when
   UI_V2 is true. Nothing above it was edited apart from two defect fixes, so
   flipping UI_V2 to false restores the tool-first shell exactly: the rail, the
   evidence column and the bottom tabbar are still in this file and still work.

   THE DESIGN TARGET IS 390px, at the bedside, one-handed. The desktop is this
   opened out - the derivation moves beside the number instead of under it, the
   browse index becomes a real column - and never the other way round, which is
   how v1 ended up with a 356px evidence column that simply vanished on a phone
   and took the product's own claim with it.

   WHAT CHANGED, AND WHY

   The patient is the entry. Every pillar's compute() prints an em dash with no
   weight, and a chip in the header never said so. Now it is a bar you cannot
   miss, open by default when nothing is stored, and it never scrolls away.

   One search, not six tabs. Searching existed only inside Farmaci and matched
   drug names. The sheet below searches drugs, protocols, formulas, reference
   cards and the pillars themselves, from one static index.

   One answer surface with THREE HONEST STATES. 227 approved drugs, 68 with a
   per-kg rule, 8 with a mg/ml formulation: 70% of the catalogue can never
   produce a number. v1 showed those as an em dash in a slab labelled "dose
   calcolata", which reads as a broken calculator rather than as the reference
   entry it is. Here a volume, a dose in mg and a scheda are three shapes of the
   same card, each labelled, and only one of them is a number.

   The palette and the logo are untouched, deliberately. Plum carries the
   authority, --sole carries the warmth, cream is the ground, yellow never
   carries text. This is a layout, type and interaction change.
   ========================================================================= */

[data-v2] {
  --chrome: 56px;          /* the compact bar: brand and account, nothing else */
  --pbar: 48px;            /* the patient bar under it */
  /* What is ACTUALLY fixed at the top of the viewport, which is what every
     scroll-margin and sticky offset below is really asking for. On a phone
     only one of the two bars stays (see "the phone bar" at the end of this
     file), so the sum is wrong there and every anchored heading would land
     56px under the chrome. */
  --stuck: calc(var(--chrome) + var(--pbar));
  --sos: 62px;             /* the emergency button's footprint, for bottom padding */
  --ans-pad: 20px;
}

/* ---------------------------------------------------------------- the header
   Three groups became two. Patient context moved out into its own bar, where
   it is a subject and not an accessory, so what is left is who we are and who
   you are - and that fits 56px with room for a thumb. */
[data-v2] .site-head .bar { min-height: var(--chrome); flex-wrap: nowrap; gap: 10px; }
[data-v2] .brand img { height: 27px; }
[data-v2] .head-wide { padding: 0 14px; }
@media (min-width: 900px) {
  [data-v2] .head-wide { padding: 0 22px; }
  [data-v2] .brand img { height: 31px; }
}

/* ------------------------------------------------------------ patient bar */
.v2-bar {
  position: sticky; top: var(--chrome); z-index: 29;
  background: var(--head-bg); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.v2-bar-in {
  max-width: 1180px; margin: 0 auto; padding: 7px 14px;
  display: flex; align-items: center; gap: 9px;
}

/* The collapsed summary: "9,2 kg · 14 mesi", with a pencil so the tap target
   reads as editable without a word spent on saying so. */
.pbar {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
  max-width: 54%;
  padding: 6px 13px 6px 10px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--line); background: var(--surface);
  font: inherit; font-size: .92rem; font-weight: 800; color: var(--ink);
  font-variant-numeric: tabular-nums; cursor: pointer; text-align: left;
  white-space: nowrap; overflow: hidden;
}
.pbar:hover { border-color: var(--primary); }
.pbar .pbar-ico { color: var(--lav); flex: 0 0 auto; }
.pbar .pbar-txt { overflow: hidden; text-overflow: ellipsis; }
.pbar .pbar-pen { color: var(--muted); flex: 0 0 auto; }
/* Nothing entered yet: the bar says so in words rather than showing two dashes,
   and it reads as an instruction instead of as a readout that failed. */
.pbar.empty { border-style: dashed; border-color: var(--lav); color: var(--lav-deep); font-weight: 700; }
.pbar[aria-expanded="true"] { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }

/* the search trigger. A button, not the field itself: the field lives in the
   sheet, so there is exactly one of it and one place that owns the results. */
.v2-sbtn {
  display: flex; align-items: center; gap: 9px; flex: 1 1 auto; min-width: 0;
  padding: 8px 12px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--line); background: var(--surface);
  font: inherit; font-size: .9rem; color: var(--muted); cursor: pointer; text-align: left;
}
.v2-sbtn:hover { border-color: var(--primary); color: var(--body); }
.v2-sbtn .icn { color: var(--lav); flex: 0 0 auto; }
.v2-sbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-sbtn kbd {
  margin-left: auto; flex: 0 0 auto; display: none;
  font-family: var(--font-body); font-size: .7rem; font-weight: 800;
  background: var(--line-soft); color: var(--muted);
  border-radius: 7px; padding: 2px 7px;
}
@media (min-width: 1024px) { .v2-sbtn kbd { display: block; } }

/* ---- the patient editor, which is the first screen with nothing stored ---- */
.pedit {
  max-width: 1180px; margin: 0 auto; padding: 4px 14px 16px;
  border-top: 1px dashed var(--line);
}
.pedit[hidden] { display: none; }
.pedit-h {
  font-family: var(--font-display); font-weight: 800; font-size: 1.12rem;
  color: var(--ink); margin: 12px 0 12px;
}
.pedit-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; align-items: start; }
.pedit-f {
  display: block; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 10px 13px 11px; cursor: text;
}
.pedit-f:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.pedit-c {
  display: block; font-size: .6rem; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 2px;
}
.pedit-v { display: flex; align-items: baseline; gap: 5px; }
.pedit-v input {
  width: 100%; min-width: 0; padding: 0; border: 0; outline: none; background: none;
  font-family: var(--font-display); font-size: 1.85rem; font-weight: 800;
  color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1;
  appearance: textfield; -moz-appearance: textfield;
}
.pedit-v input::-webkit-outer-spin-button,
.pedit-v input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pedit-v input::placeholder { color: var(--line); }
.pedit-v i { font-style: normal; font-size: .9rem; font-weight: 800; color: var(--muted); flex: 0 0 auto; }

/* giorni / mesi / anni. A pediatra thinks "3 anni"; the LMS tables think 36
   months. The toggle is the translation, and #gpAge keeps the months so
   getAge() and hasAge() in app.js never learn that units exist. */
.pedit-units { display: flex; gap: 3px; margin-top: 9px; }
.ageu {
  flex: 1 1 0; padding: 5px 0; border: 1px solid var(--line); background: var(--cream);
  border-radius: 9px; font: inherit; font-size: .72rem; font-weight: 800;
  color: var(--muted); cursor: pointer;
}
.ageu:hover { border-color: var(--lav); color: var(--lav-deep); }
.ageu.on { background: var(--lav-soft); border-color: var(--lav); color: var(--lav-deep); }
.pedit-foot { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.pedit-foot .btn { flex: 0 0 auto; }
.pedit-foot p { flex: 1 1 180px; min-width: 0; }

/* ------------------------------------------------------------------ shell */
.v2-shell {
  max-width: 1180px; margin: 0 auto;
  padding: 16px 14px calc(var(--sos) + 26px);
  display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start;
}
.v2-work { display: grid; gap: 14px; align-content: start; min-width: 0; }
/* Grid items are min-width:auto, so one child with a wide max-content - the
   emergency jump bar, a long table - stretches the track past the viewport
   and the whole page scrolls sideways at 390px instead of that one strip. */
.v2-work > * { min-width: 0; }
.v2-work > .work-head h1 { font-size: clamp(1.5rem, 6vw, 2rem); }
[data-v2] .work section[id], [data-v2] .v2-work section[id] {
  scroll-margin-top: calc(var(--stuck) + 14px);
}
@media (min-width: 760px) { .v2-shell { padding: 20px 22px calc(var(--sos) + 26px); gap: 18px; } }
@media (min-width: 1024px) { .v2-shell { padding-bottom: 42px; } }

/* browse, shut on a phone and a column from 1240px */
.v2-index {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 4px 6px; min-width: 0;
}
.v2-index > summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  padding: 9px 9px; border-radius: 12px;
  font-size: .7rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted);
}
.v2-index > summary::-webkit-details-marker { display: none; }
.v2-index > summary:hover { background: var(--line-soft); color: var(--primary-deep); }
.v2-index[open] > summary { color: var(--primary-deep); }
.v2-index-in { max-height: 62vh; overflow-y: auto; padding: 0 2px 6px; }
/* the rail markup these views already produce, re-laid for a narrow column */
.v2-index .rail-head { padding: 10px 8px 6px; }
.v2-index .rail-list { max-height: none; overflow: visible; }

@media (min-width: 1240px) {
  .v2-shell.has-index { grid-template-columns: minmax(0, 1fr) 272px; }
  .v2-shell.has-index > .v2-work { grid-column: 1; }
  .v2-shell.has-index > .v2-index {
    grid-column: 2; grid-row: 1;
    position: sticky; top: calc(var(--stuck) + 18px);
    max-height: calc(100vh - var(--stuck) - 40px); overflow: hidden;
    display: flex; flex-direction: column;
  }
  .v2-index-in { max-height: none; flex: 1 1 auto; }
}

/* ============================================================== THE ANSWER
   One card, three states, same shape. The state is named on the card, because
   a number and a scheda are different kinds of claim and the difference has to
   be visible: ans--vol has a volume to administer, ans--mg has milligrams and
   deliberately no phantom ml, ans--ref has no number at all and does not
   pretend one is missing. */
.ans {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 5px solid var(--accent, var(--primary));
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: var(--ans-pad); min-width: 0;
}
.ans[hidden] { display: none; }
.ans-tagrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 9px; }
.ans-state {
  font-size: .64rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--accent-soft, var(--primary-soft)); color: var(--accent-ink, var(--primary-deep));
}
.ans--ref .ans-state { background: var(--line-soft); color: var(--body); }
.ans-cat { font-size: .72rem; font-weight: 700; color: var(--muted); }
.ans-name {
  font-family: var(--font-display); font-weight: 800; color: var(--ink);
  font-size: clamp(1.5rem, 6.4vw, 2.1rem); line-height: 1.08; margin: 0;
  letter-spacing: -.015em; overflow-wrap: anywhere;
}
.ans-sub { font-size: .88rem; color: var(--body); margin: 5px 0 0; line-height: 1.45; }
.ans-pick { margin-top: 15px; display: grid; gap: 11px; }
.ans-pick .kicker { margin: 0 0 6px; }
.ans-pick > div[hidden] { display: none; }

/* the figure. The biggest thing on the screen, and the only thing allowed to
   be: everything else on this card exists to let you check it. */
.ans-figure {
  margin-top: 16px; padding: 16px 18px 15px;
  background: linear-gradient(142deg, var(--accent-soft, var(--primary-soft)), var(--surface) 72%);
  border: 1.5px solid var(--accent, var(--primary)); border-radius: var(--radius);
}
.ans-figure[hidden] { display: none; }
.ans-lbl {
  font-size: .64rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-ink, var(--primary-deep)); margin: 0 0 6px;
  display: flex; align-items: center; gap: 7px;
}
.ans-num {
  margin: 0; font-family: var(--font-display); font-weight: 800; color: var(--ink);
  font-size: clamp(2.9rem, 15vw, 4.1rem); line-height: .98; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: .22em;
  flex-wrap: wrap;
}
.ans-num .ans-unit {
  font-size: clamp(1.05rem, 4vw, 1.45rem); font-weight: 800; color: var(--body);
  letter-spacing: 0;
}
.ans-second {
  margin: 9px 0 0; font-size: 1rem; font-weight: 700; color: var(--body);
  font-variant-numeric: tabular-nums;
}
/* the dash state: no weight yet. It is a prompt with a button on it, not a
   number that failed to arrive. .is-wait is the same state arrived at from the
   other direction - app.js marks any figure whose number holds no digit, so a
   placeholder em dash reads as hairline rather than as a 4rem block. */
.ans--wait .ans-num, .ans-figure.is-wait .ans-num { color: var(--line); }
.ans-figure.is-wait .ans-unit, .ans-figure.is-wait .ans-second { color: var(--muted); }
.ans-need {
  margin: 12px 0 0; display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  font-size: .86rem; color: var(--body);
}
.ans-need[hidden] { display: none; }

/* the reference state. No figure, no em dash: the facts the entry does carry,
   as a definition list, which is what a scheda is. */
.ans-ref { margin-top: 16px; }
.ans-ref[hidden] { display: none; }
.ans-facts { margin: 0; display: grid; gap: 0; }
.ans-facts > div {
  display: grid; grid-template-columns: 94px minmax(0, 1fr); gap: 4px 12px;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.ans-facts > div:last-child { border-bottom: 0; }
.ans-facts dt {
  font-size: .64rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); padding-top: 3px;
}
.ans-facts dd { margin: 0; font-size: .93rem; color: var(--ink); line-height: 1.5; overflow-wrap: anywhere; }
.ans-refnote {
  margin: 14px 0 0; padding: 11px 14px; border-radius: var(--radius);
  background: var(--sole-soft); color: var(--sole-deep);
  font-size: .84rem; font-weight: 600; line-height: 1.5;
}

/* "Come si ottiene". This is where the evidence column went: it is attached to
   the answer now, so the derivation exists at 390px, which it never did. */
.ans-how { margin-top: 15px; border-top: 1px solid var(--line); padding-top: 4px; }
.ans-how > summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  padding: 10px 2px; margin: 0;
  font-size: .7rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase;
  color: var(--primary-deep);
}
.ans-how > summary::-webkit-details-marker { display: none; }
.ans-how > summary::after {
  content: ''; margin-left: auto; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px); transition: transform .16s ease;
}
.ans-how[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.ans-how > summary:hover { color: var(--primary); }
.ans-how-in { padding: 2px 2px 8px; }

/* the source line, which never collapses: it is the product claim */
.ans-foot { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.ans-src {
  margin: 0; font-size: .79rem; color: var(--body); line-height: 1.5;
  display: flex; gap: 8px; align-items: flex-start;
}
.ans-src b {
  flex: 0 0 auto; font-size: .64rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); padding-top: 2px;
}
.ans-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ans-dis { margin: 11px 0 0; }

/* Opened out. From 1100px the derivation sits BESIDE the number instead of
   under it, which is the one thing the old three-column shell got right, and
   it is open by default because there is room for it to be. */
@media (min-width: 1100px) {
  [data-v2] { --ans-pad: 26px; }
  .ans-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
  .ans-body > .ans-side { grid-column: 2; grid-row: 1 / span 2; }
  .ans-body .ans-how { margin-top: 0; border-top: 0; padding-top: 0; }
  /* Only the dosing card drops the summary: there the block is boxed with its
     own printed heading (::before, below). Everywhere else the disclosure
     keeps its control, so a card opened out beside the number can still be
     shut - and a label-less panel of steps cannot appear. */
  .ans-body .ans-side .ans-how > summary { display: none; }
  .ans-side .ans-how-in {
    background: var(--cream); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 15px 16px;
  }
  .ans-side .ans-how-in::before {
    content: 'Come si ottiene'; display: block; margin-bottom: 9px;
    font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
    color: var(--primary-deep);
  }
  .ans-name { font-size: 2.3rem; }
}

/* ========================================================== THE SEARCH SHEET
   Full-screen on a phone, a panel under the bar on a desktop. One field, one
   result list, each row tagged by kind AND by whether it computes - so the 159
   reference-only drugs announce themselves in the list instead of
   disappointing you after the tap. */
.v2-sheet {
  position: fixed; inset: 0; z-index: 55; display: flex;
  align-items: flex-start; justify-content: center;
  background: var(--scrim-soft); backdrop-filter: blur(3px);
}
.v2-sheet[hidden] { display: none; }
.v2-sheet-card {
  background: var(--surface); width: 100%; max-width: 680px;
  display: flex; flex-direction: column; max-height: 100%;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 760px) {
  .v2-sheet { padding: 76px 20px 20px; align-items: flex-start; }
  .v2-sheet-card { border-radius: var(--radius-lg); max-height: calc(100vh - 110px); overflow: hidden; }
}
.v2-sheet-head {
  display: flex; align-items: center; gap: 10px; flex: 0 0 auto;
  padding: 12px 12px 12px 15px; border-bottom: 1px solid var(--line);
  padding-top: max(12px, env(safe-area-inset-top));
}
.v2-sheet-ico { color: var(--lav); flex: 0 0 auto; }
.v2-q {
  flex: 1 1 auto; min-width: 0; border: 0; outline: none; background: none;
  font-family: var(--font-body); font-size: 1.05rem; font-weight: 600; color: var(--ink);
  padding: 8px 0;
}
.v2-q::placeholder { color: var(--muted); font-weight: 400; }
.v2-q::-webkit-search-cancel-button { display: none; }
.v2-sheet-body { flex: 1 1 auto; overflow-y: auto; padding: 6px 6px 10px; min-height: 180px; }
.v2-sheet-foot {
  flex: 0 0 auto; margin: 0; padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-soft); background: var(--cream);
  font-size: .72rem; color: var(--muted);
}

.v2-group {
  font-size: .64rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); padding: 13px 11px 5px; margin: 0;
}
.v2-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; border-radius: 13px; text-decoration: none; color: inherit;
}
.v2-row:hover, .v2-row.on { background: var(--primary-soft); text-decoration: none; }
.v2-row .v2-ico {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-soft, var(--line-soft)); color: var(--accent-ink, var(--muted));
}
.v2-row .v2-txt { min-width: 0; flex: 1 1 auto; }
.v2-row .v2-n {
  display: block; font-weight: 700; color: var(--ink); font-size: .95rem; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.v2-row .v2-s {
  display: block; font-size: .76rem; color: var(--muted); line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* the honest tag: `dose` computes, `scheda` never will */
.v2-row .v2-t {
  flex: 0 0 auto; font-size: .6rem; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase; padding: 3px 9px; border-radius: var(--radius-pill);
  background: var(--line-soft); color: var(--muted);
}
.v2-row .v2-t.is-dose { background: var(--lav-soft); color: var(--lav-deep); }
.v2-row .v2-t.is-proto { background: var(--rosso-soft); color: var(--rosso-deep); }
.v2-row .v2-t.is-formula { background: var(--sole-soft); color: var(--sole-deep); }
.v2-row .v2-t.is-guida { background: var(--pesca-soft); color: var(--pesca-deep); }
.v2-empty { text-align: center; padding: 38px 18px; color: var(--muted); font-size: .9rem; }

/* ====================================================== the emergency button
   The only fixed element left at the bottom of the screen, in thumb reach,
   where the tabbar's six equal choices used to be. */
.v2-sos {
  position: fixed; z-index: 28;
  right: 14px; bottom: calc(14px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 20px 13px 17px; border-radius: var(--radius-pill);
  background: var(--rosso); color: var(--btn-fg); text-decoration: none;
  font-family: var(--font-display); font-weight: 800; font-size: .95rem;
  box-shadow: 0 6px 20px -6px rgba(173,52,72,.62), var(--shadow);
  transition: transform .12s ease, background .12s ease;
}
.v2-sos:hover { background: var(--rosso-deep); text-decoration: none; transform: translateY(-1px); }
.v2-sos:active { transform: translateY(0); }
@media (min-width: 1024px) { .v2-sos { right: 26px; bottom: 26px; } }

/* ========================================================== EMERGENCY MODE
   A mode, not a page. No browse index, no search bar in the way, every
   protocol already computed for this weight, grouped by scenario with the
   scenario headings sticky so you always know where in the list you are.
   Scroll replaces navigate, filter, pick. */
[data-mode="emergency"] .v2-sbtn { display: none; }
[data-mode="emergency"] .v2-bar { background: var(--rosso-soft); border-bottom-color: var(--rosso); }
[data-mode="emergency"] .pbar { border-color: var(--rosso); color: var(--rosso-deep); }
[data-mode="emergency"] .pbar .pbar-ico { color: var(--rosso); }
/* Emergency mode is a column you scroll, not a dashboard you scan: most
   scenarios hold one protocol, so a full 1180px shell gave a 1140px-wide card
   carrying four short lines and a number. Capped, the page reads the same at
   390px and at 1440px, which is the point of a mode you enter mid-crisis. */
[data-mode="emergency"] .v2-shell { padding-bottom: 42px; max-width: 860px; }
[data-mode="emergency"] .site-head.tinted::after { height: 3px; }

/* Title and provenance sit on one line when there is room and stack when
   there is not: at 390px "18 protocolli - ERC - EAACI - PALS" beside
   "Emergenze" loses its last source off the right edge. */
.emg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 4px 14px; flex-wrap: wrap; }
.emg-head .meta { flex: 1 0 100%; }
@media (min-width: 560px) { .emg-head .meta { flex: 0 1 auto; } }
.emg-head h1 { font-size: clamp(1.6rem, 6.4vw, 2.2rem); margin: 0; color: var(--rosso-deep); }
.emg-head .meta { margin: 0; font-size: .8rem; color: var(--muted); }
.emg-jump {
  display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 6px; margin: 0;
  min-width: 0; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.emg-jump::-webkit-scrollbar { display: none; }
.emg-jump a {
  flex: 0 0 auto; padding: 6px 13px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--rosso-soft); background: var(--surface);
  font-size: .78rem; font-weight: 700; color: var(--rosso-deep); text-decoration: none; white-space: nowrap;
}
.emg-jump a:hover { border-color: var(--rosso); text-decoration: none; }

.emg-scen { margin: 0; }
.emg-scen > h2 {
  position: sticky; top: var(--stuck);
  z-index: 10; margin: 0 0 10px;
  padding: 9px 12px; border-radius: 0 var(--radius) var(--radius) 0;
  border-left: 4px solid var(--rosso);
  background: var(--cream-deep); color: var(--rosso-deep);
  font-size: .92rem; font-weight: 800; letter-spacing: .02em;
  scroll-margin-top: var(--stuck);
}
.emg-list { display: grid; gap: 11px; }
@media (min-width: 820px) { .emg-list { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); } }
.emg-card {
  background: var(--surface); border: 1px solid var(--rosso-soft);
  border-left: 5px solid var(--rosso); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 15px 17px;
  scroll-margin-top: calc(var(--stuck) + 52px);
}
.emg-card.on { box-shadow: 0 0 0 3px var(--rosso-soft), var(--shadow); }
.emg-item {
  font-family: var(--font-display); font-weight: 800; font-size: 1.05rem;
  color: var(--ink); margin: 0; line-height: 1.2;
}
.emg-route { margin: 3px 0 0; font-size: .76rem; color: var(--muted); }
.emg-num {
  margin: 10px 0 0; font-family: var(--font-display); font-weight: 800;
  font-size: 2.3rem; line-height: 1; color: var(--rosso-deep);
  font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: .22em; flex-wrap: wrap;
}
.emg-num .u { font-size: .95rem; font-weight: 800; color: var(--body); }
.emg-mg { margin: 5px 0 0; font-size: .88rem; font-weight: 700; color: var(--body); font-variant-numeric: tabular-nums; }
.emg-note { margin: 9px 0 0; font-size: .82rem; line-height: 1.45; color: var(--body); }
.emg-src {
  margin: 9px 0 0; padding-top: 8px; border-top: 1px dashed var(--line);
  font-size: .72rem; color: var(--muted);
}
.emg-cap { color: var(--rosso-deep); font-weight: 800; }
.emg-wait { color: var(--line); }

/* the derivation, inline under the row you tapped: same single writer */
.emg-deriv { margin: 11px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.emg-deriv[hidden] { display: none; }

/* ---------------------------------------------------------------- shared
   v1 components that v2 keeps but has to re-measure for a 390px column. */
[data-v2] .work-head { gap: 8px; }
[data-v2] .card { padding: 18px; border-radius: var(--radius); }
@media (min-width: 760px) { [data-v2] .card { padding: 22px; } }
[data-v2] .result { padding: 17px 18px; }
[data-v2] .result .big { font-size: clamp(2.5rem, 13vw, 3.4rem); }
[data-v2] .toast { bottom: calc(var(--sos) + 26px); }
@media (min-width: 1024px) { [data-v2] .toast { bottom: 32px; } }
/* The evidence steps are the same rows in both shells: .ev-step is not scoped
   to the old column, so the card's disclosure inherits it unchanged. */
[data-v2] .ans-how-in .ev-empty, [data-v2] .emg-deriv .ev-empty { margin: 4px 0; }

/* ------------------------------------------------- v2 — /cerca, the home
   One search instead of six guesses, so the field has to read as the main
   thing on the screen rather than a 36px box in a corner. It is a button, not
   an input: tapping it opens the same sheet the bar opens, which keeps one
   field, one ranking and one result list in the app. */
[data-v2] .v2-hero {
  -webkit-appearance: none; appearance: none; width: 100%; cursor: pointer;
  display: flex; align-items: center; gap: 13px; text-align: left;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius-lg); padding: 17px 18px;
  box-shadow: var(--shadow); color: var(--ink);
  transition: border-color .14s, box-shadow .14s, transform .14s;
}
[data-v2] .v2-hero:hover { border-color: var(--lav); box-shadow: var(--shadow-lg); }
[data-v2] .v2-hero:active { transform: translateY(1px); }
[data-v2] .v2-hero-ico {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--plum-soft); color: var(--plum);
}
[data-v2] .v2-hero-txt { min-width: 0; display: grid; gap: 2px; }
[data-v2] .v2-hero-txt b {
  font-family: var(--font-display); font-size: 1.22rem; font-weight: 800;
  line-height: 1.15;
}
[data-v2] .v2-hero-txt span { font-size: .85rem; color: var(--muted); }
[data-v2] .v2-hero kbd {
  margin-left: auto; flex: 0 0 auto; display: none;
  font-family: var(--font-body); font-size: .75rem; font-weight: 800;
  background: var(--line-soft); color: var(--muted);
  border-radius: 8px; padding: 3px 9px;
}
@media (min-width: 1024px) { [data-v2] .v2-hero kbd { display: block; } }

/* The six pillars, kept as a browse floor under the search. They are the
   Italian URLs - the product, per the front controller - so they are still a
   tap away; they are just no longer the question the app opens with. */
/* Six tiles, so the row count is set rather than measured: auto-fit put five
   on one row at 1440 and left the sixth alone underneath. Two rows of three. */
[data-v2] .v2-tiles { gap: 11px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 520px) { [data-v2] .v2-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { [data-v2] .v2-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
[data-v2] .v2-tile {
  display: grid; gap: 3px; align-content: start; text-decoration: none;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 14px 15px 15px;
  color: var(--ink); transition: border-color .14s, transform .14s;
}
[data-v2] .v2-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
[data-v2] .v2-tile-ico {
  width: 34px; height: 34px; border-radius: 11px; margin-bottom: 6px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink);
}
[data-v2] .v2-tile b {
  font-family: var(--font-display); font-size: 1.04rem; font-weight: 800;
}
[data-v2] .v2-tile-d { font-size: .82rem; color: var(--body); line-height: 1.4; }

/* The five formula tools wear the answer card too, but five of them share one
   screen, so the title is a heading inside a card rather than the card's whole
   top half. */
[data-v2] .ans--tool { --ans-pad: 17px; }
[data-v2] .ans--tool .ans-name { font-size: 1.14rem; letter-spacing: 0; }
[data-v2] .ans--tool .ans-state { display: inline-flex; align-items: center; gap: 5px; }
[data-v2] .ans--tool .ans-num { font-size: clamp(2.1rem, 9vw, 2.6rem); }
[data-v2] .ans--tool .ans-figure { margin-top: 14px; }
[data-v2] .ans--tool .ans-second { font-size: .84rem; font-weight: 600; }
/* the shared derivation panel has no figure, so its padding is its own */
[data-v2] #toolHow .ans-how-in { padding: 4px 0 0; }

/* ---------------------------------------------------- v2 — opened out
   On a phone the derivation sits under the number, because there is nowhere
   else for it to be. From 1100px it moves beside it, which is the one thing
   the pre-v2 three-column shell got right - and it is the same markup, re-laid
   rather than re-rendered, so there is still exactly one [data-ev] sink.

   /dosaggi does this with its own .ans-body wrapper (it has a reference state
   with no figure to balance). /crescita and /liquidi have no wrapper, so the
   card itself becomes the grid and the children are placed by column. */
@media (min-width: 1100px) {
  [data-v2] .ans--wide {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);
    column-gap: 30px; align-content: start;
  }
  [data-v2] .ans--wide > * { grid-column: 1; min-width: 0; }
  [data-v2] .ans--wide > .ans-tagrow { grid-column: 1 / -1; }
  [data-v2] .ans--wide > .ans-how {
    grid-column: 2; grid-row: 2 / span 20; align-self: start;
    margin-top: 0; padding-top: 0;
    border-top: 0; border-left: 1px solid var(--line); padding-left: 22px;
  }
  [data-v2] .ans--wide > .ans-how > summary { padding-top: 0; }
}

/* ------------------------------------------- IN COMMERCIO COME + ESEMPIO
   The commercial names, and the prescription computed from one of them.

   A brand row is a BUTTON when it states a concentration, because tapping it
   makes it the formulation the dose card divides by - which is the whole point
   of parsing mg and ml out of AIFA's pack text rather than storing the text
   alone. A row with a strength and no volume (a 250 mg supposta) is a div: it
   is information, not a choice the app is allowed to make.

   Three columns rather than a table: the name, what is in the bottle, and the
   ricetta. At 390px the first two stack and the ricetta stays on the right, so
   the regime di fornitura is never the thing that falls off the screen.

   Not scoped under [data-v2]: UI_V2 is a revert path, and a revert that lost
   the brands would lose the only thing that makes "tachipirina" findable. */
.brands { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 13px; }
.brands-k { display: flex; align-items: baseline; gap: 8px; margin: 0 0 4px; }
.brands-k .muted { font-size: .72rem; font-weight: 600; letter-spacing: .02em; }
.brands-pick { margin: 0 0 9px; line-height: 1.45; }
.brand-list { display: grid; gap: 1px; background: var(--line-soft); border-radius: 12px; overflow: hidden; }

 /* .bnd, NOT .brand: the header's logo link is .brand and this block comes
    later in the file, so a commercial-name row was quietly handing the
    lockup display:grid, a surface-coloured plate and 9px of padding. On
    cream that plate was white on near-white and nobody saw it; the first
    dark-mode screenshot showed a pale box stretched across the header. */
.bnd {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px; align-items: baseline;
  width: 100%; margin: 0; padding: 9px 12px;
  background: var(--surface); border: 0; border-radius: 0;
  font: inherit; text-align: left; color: var(--ink);
}
.brand-n {
  grid-column: 1; font-family: var(--font-display); font-weight: 800;
  font-size: .95rem; line-height: 1.25; overflow-wrap: anywhere;
}
.brand-f {
  grid-column: 1; font-size: .8rem; color: var(--body); line-height: 1.4;
  overflow-wrap: anywhere;
}
.brand-rx {
  grid-column: 2; grid-row: 1 / span 2; align-self: center;
  font-size: .66rem; font-weight: 800; letter-spacing: .04em;
  color: var(--muted); white-space: nowrap;
}
/* The two levels: a brand name, and under it the formulations it is sold in.
   Paracetamolo is 41 names and 103 formulations, so a flat list buried
   Tachipirina after Acetamol; grouping also lets the order be a published
   fact - how many authorised formulations each name has - rather than a guess
   at which brand a pharmacy stocks. */
.brand-g { cursor: pointer; transition: background .14s ease; }
.brand-g:hover { background: var(--lav-soft); }
.brand-g .brand-f { color: var(--muted); font-weight: 600; }
.brand-g.is-open { background: var(--plum-soft); }
.brand-g.is-open .brand-n { color: var(--plum-deep); }
.brand-g::after {
  content: ''; position: absolute; right: 12px; top: 14px;
  width: 7px; height: 7px; border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted); transform: rotate(45deg);
  transition: transform .16s ease;
}
.brand-g { position: relative; padding-right: 30px; }
.brand-g.is-open::after { transform: rotate(-135deg); }
.brand-g .brand-rx { grid-column: 1; grid-row: 3; }
.brand-sub { background: var(--cream-deep); padding: 2px 0; display: grid; gap: 1px; }
.brand-r { padding-left: 22px; background: var(--surface); }
.brand-r .brand-f { grid-column: 1; grid-row: 1; font-size: .86rem; color: var(--ink); }
.brand-r .brand-rx { grid-row: 1; font-weight: 600; letter-spacing: 0; text-transform: none; }
/* A formulation with no volume cannot set the dose, so it reads as a reference
   line rather than as a disabled button. It is still here because the strength
   on the box is what a pediatra compares the computed mg against. */
.brand-r:not(.is-pick) { background: var(--cream); }
.brand-r:not(.is-pick) .brand-f { color: var(--body); }

.bnd.is-pick { cursor: pointer; transition: background .14s ease; }
.bnd.is-pick:hover { background: var(--lav-soft); }
.bnd.is-pick.on { background: var(--plum-soft); box-shadow: inset 3px 0 0 var(--lav); }
.bnd.is-pick.on .brand-f { color: var(--plum-deep); font-weight: 800; }
.bnd.is-pick:focus-visible { outline: 2px solid var(--lav); outline-offset: -2px; }

.brand-none { margin: 0; padding: 11px 12px; background: var(--surface); font-size: .86rem; color: var(--body); line-height: 1.5; }
.brands-more { margin-top: 9px; }
.brands-note { margin: 9px 0 0; line-height: 1.45; }

/* The example. Yellow carries the "this is a worked example" signal, and
   --sole-deep carries the text, because #ffbd59 on cream fails every contrast
   bar - the one rule the palette has never been allowed to break. */
.rxbox {
  margin-top: 14px; padding: 13px 15px 11px;
  background: var(--sole-soft); border: 1px solid var(--sole-line); border-radius: 14px;
}
.rx-k { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin: 0 0 7px; color: var(--sole-deep); }
.rx-k .muted { font-size: .72rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--sole-deep); opacity: .8; }
.rx-line {
  margin: 0; font-family: var(--font-display); font-weight: 800;
  font-size: 1.04rem; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere;
}
.rx-sub { margin: 3px 0 0; font-size: .9rem; font-weight: 700; color: var(--body); line-height: 1.45; }
.rx-need { margin: 0; line-height: 1.45; }
.rx-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.rx-dis { margin: 0; flex: 1 1 220px; min-width: 0; line-height: 1.4; }

/* Opened out, .ans-body becomes two columns and the derivation moves beside
   the number; the brands and the example are siblings of that wrapper, so they
   run the full width underneath. A brand row is two short strings and a code,
   and stretched to 1000px it reads as a line of unrelated words - so the list
   keeps the measure the rest of the card has. */
@media (min-width: 1100px) {
  .brands, .rxbox { max-width: 720px; }
  .bnd { grid-template-columns: minmax(0, 15em) minmax(0, 1fr) auto; }
  .brand-n { grid-column: 1; }
  .brand-f { grid-column: 2; grid-row: 1; }
  .brand-rx { grid-column: 3; grid-row: 1; }
  .brand-g .brand-rx { grid-column: 3; grid-row: 1; }
  .brand-r .brand-f { grid-column: 1 / 3; }

}


/* ======================================================== THE PHONE BAR
   Two sticky bars cost 104px of an 844px screen - an eighth of the phone -
   and the upper one carries a wordmark and an avatar, neither of which is
   touched while a dose is being answered. So under 760px only the patient bar
   stays: the brand and the account are there on arrival, scroll away while
   working, and come back with a flick to the top. What stays is the bar that
   carries the subject and the search, which is the whole of v2's claim.

   The header is made static rather than hidden: hiding it would take the
   account menu off the phone entirely, and the staff destinations live in it. */
@media (max-width: 759px) {
  [data-v2] { --stuck: var(--pbar); }
  [data-v2] .site-head { position: static; }
  [data-v2] .v2-bar { top: 0; }
  /* Opaque, not translucent: with nothing sticky above it this bar is the top
     of the window, and cream content sliding under 94% cream reads as a smear. */
  [data-v2] .v2-bar { background: var(--cream); }
}

/* The search is the surface; the patient chip is a readout. Under 560px the
   chip was taking 54% and the search label ellipsed mid-word ("Cerca farmaco,
   ..."), which reads as a bug rather than as a field. The short label is a
   second span, not a JS swap, so it costs nothing and cannot desynchronise. */
.v2-sbtn .sb-short { display: none; }
@media (max-width: 560px) {
  [data-v2] .pbar { max-width: 48%; }
  .v2-sbtn .sb-long { display: none; }
  .v2-sbtn .sb-short { display: block; }
}

/* ========================================================== 404
   The one page nobody chose to open. It carries a single piece of motion -
   a balloon that drifts off between the two fours - and everything in it is
   CSS, because this page has to render out of the service worker's cache
   with no JavaScript at all.

   The whole motion layer is switched off under prefers-reduced-motion at the
   end of the block: a drifting balloon is charm, not information, and
   charm is exactly what someone who asked not to see movement is asking to
   be spared. Nothing below it moves position, so with motion off the page
   is the same page, still.
   ========================================================= */

.nf { padding-top: clamp(28px, 7vw, 62px); }

.nf-art {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  gap: clamp(4px, 2vw, 18px);
  margin: 0 auto clamp(10px, 3vw, 22px);
  animation: nf-drift 9s ease-in-out infinite alternate;
}
.nf-d {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(5rem, 22vw, 10rem); line-height: .9;
  color: var(--primary);
  /* The two digits breathe out of phase, so the group never reads as one
     block sliding about. */
  animation: nf-breathe 6s ease-in-out infinite alternate;
}
.nf-d:last-of-type { animation-delay: -3s; }

.nf-balloon {
  display: block; color: var(--lav-deep);
  animation: nf-float 5.5s ease-in-out infinite alternate;
  transform-origin: 50% 100%;
}
.nf-balloon svg { width: clamp(72px, 19vw, 120px); height: auto; display: block; }
.nf-body  { fill: var(--lav); }
.nf-knot  { fill: var(--lav-deep); }
/* White, not --surface: the balloon body is a LIGHT lavender in both themes,
   so the highlight has to be lighter than it in both - and in dark --surface
   is a near-black that painted a dark streak across the balloon. */
.nf-shine { stroke: #fff; opacity: .5; }
.nf-string { color: var(--lav-deep); opacity: .75; }

/* Three sparkles in the brand's gold, twinkling out of step. --sole never
   carries text, and here it carries nothing but itself. */
.nf-sp {
  position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: var(--sole); opacity: 0;
  animation: nf-twinkle 3.4s ease-in-out infinite;
}
.nf-sp1 { top: 12%;  left: 27%; animation-delay: .2s; }
.nf-sp2 { top: 62%;  right: 24%; width: 7px; height: 7px; animation-delay: 1.3s; }
.nf-sp3 { top: 30%;  right: 31%; width: 5px; height: 5px; animation-delay: 2.4s; }

.nf-h { font-size: clamp(1.7rem, 5vw, 2.6rem); margin-bottom: .3em; }
.nf-p { max-width: 460px; margin: 0 auto 26px; }
.nf-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

@keyframes nf-float {
  from { transform: translateY(6px)  rotate(-3deg); }
  to   { transform: translateY(-14px) rotate(3deg); }
}
@keyframes nf-drift {
  from { transform: translateX(-6px); }
  to   { transform: translateX(6px); }
}
@keyframes nf-breathe {
  from { transform: translateY(0)    scale(1); }
  to   { transform: translateY(-5px) scale(1.02); }
}
@keyframes nf-twinkle {
  0%, 100%   { opacity: 0; transform: scale(.5); }
  12%, 26%   { opacity: 1; transform: scale(1); }
  45%        { opacity: 0; transform: scale(.5); }
}

@media (prefers-reduced-motion: reduce) {
  .nf-art, .nf-d, .nf-balloon { animation: none; }
  /* The sparkles exist to twinkle; held still at full opacity they are three
     gold dots nobody asked for, so they go rather than freeze. */
  .nf-sp { display: none; }
}

/* ============================================================== THE ACCOUNT
   account.pediatras.it: the hub, the profile, the security page and the app
   list. Four bare pages, so they share one wrapper rather than one layout.

   Tokens only, no literal colours: the identity host is the one surface every
   app in the family sends people to, and it has to survive the theme switch
   in both directions like everything else. */
.acct-page   { max-width: 760px; margin: 0 auto; padding: 40px 20px 80px; }
.acct-narrow { max-width: 480px; }
.acct-page h1 { font-size: 1.9rem; margin: 0 0 4px; }

.acct-hero { display: flex; align-items: center; gap: 15px; margin-bottom: 10px; }
.acct-hero > div { min-width: 0; }
.acct-hero p { margin: 0; overflow-wrap: anywhere; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.3rem; flex: 0 0 auto; }

.acct-lead { color: var(--body); font-size: .95rem; margin: 0 0 26px; max-width: 54ch; }

.acct-h {
  font-size: .78rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin: 30px 0 11px;
}

/* ------------------------------------------------------- the family tiles */
.acct-apps { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.acct-app {
  display: grid; gap: 5px; align-content: start;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--ink);
  transition: border-color .14s, transform .14s;
}
.acct-app b { font-family: var(--font-display); font-size: 1.1rem; }
.acct-app .small { line-height: 1.45; }
a.acct-app:hover { border-color: var(--primary); transform: translateY(-2px); }
.acct-app-i {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-deep); margin-bottom: 6px;
}
.acct-app-go { font-size: .85rem; font-weight: 700; color: var(--primary-deep); margin-top: 7px; }

/* A locked tile is drawn, not hidden, and it is quiet rather than alarming:
   "not yet" and "not yours" are both ordinary states, not errors. */
.acct-app.is-locked { background: var(--veil); border-style: dashed; }
.acct-app.is-locked .acct-app-i { background: var(--line-soft); color: var(--muted); }
.acct-app.is-locked b { color: var(--body); }
.acct-app-why {
  display: flex; align-items: center; gap: 6px; margin-top: 7px;
  font-size: .8rem; font-weight: 600; color: var(--muted);
}
.acct-app-why svg { flex: 0 0 auto; }

/* ------------------------------------------------------------- the rows */
.acct-rows {
  display: grid; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.acct-row {
  display: flex; align-items: center; gap: 13px; padding: 15px 17px;
  text-decoration: none; color: var(--ink); border-top: 1px solid var(--line-soft);
}
.acct-row:first-child { border-top: 0; }
.acct-row:hover { background: var(--veil); }
.acct-row > svg:first-child { color: var(--primary); flex: 0 0 auto; }
.acct-row > svg:last-child  { color: var(--muted); flex: 0 0 auto; }
.acct-row-t { display: grid; gap: 1px; flex: 1 1 auto; min-width: 0; }
.acct-row-t b { font-size: .97rem; }
.acct-row-t .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The verification light. A dot and a sentence, never the dot alone: colour
   is the fast read and the words are the one that works. */
.lic-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.lic-ok   { background: var(--lav); }
.lic-wait { background: var(--sole); }
.lic-bad  { background: var(--rosso); }
.lic-none { background: var(--line); }

/* ------------------------------------------------- profile and security */
.acct-page .card { padding: 22px; margin-bottom: 14px; }
.acct-page .card .kicker { margin-top: 0; }
.acct-form { margin-top: 13px; }
.acct-form .btn { margin-top: 15px; }
.acct-current {
  font-size: 1rem; margin: 6px 0 0; overflow-wrap: anywhere;
}
.acct-dl { display: grid; gap: 2px; margin: 12px 0 0; font-size: .92rem; }
.acct-dl dt { color: var(--muted); font-size: .8rem; font-weight: 700; margin-top: 9px; }
.acct-dl dt:first-child { margin-top: 0; }
.acct-dl dd { margin: 0; overflow-wrap: anywhere; }

.acct-foot { margin-top: 32px; }

@media (max-width: 560px) {
  .acct-page { padding: 26px 16px 70px; }
  .acct-page h1 { font-size: 1.6rem; }
  .acct-hero { gap: 12px; }
  .avatar-lg { width: 44px; height: 44px; font-size: 1.1rem; }
}
