:root {
  --bg: #f4f4f6;
  --card: #ffffff;
  --text: #1b1b1f;
  --muted: #50545c;
  --line: #e1e1e6;
  --accent: #1b7a4a;
  --accent-ink: #ffffff;
  --danger: #b3261e;
  --sec: #e2e4ea;
  --sec-line: #c7cad3;
  --ix: #4a3f9f;
  --ix-ink: #ffffff;
  --nc: #d9a514;
  --nc-ink: #2b1d00;
  --chip: #ebebf0;
  --chip-on: #1b7a4a;
  --alert-bg: #fdecea;
  --alert-ink: #7a1510;
  --radius: 14px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e0f11;
  --card: #1a1b1f;
  --text: #ececef;
  --muted: #b0b4bb;
  --line: #2c2e33;
  --accent: #5fd08f;
  --accent-ink: #06210f;
  --danger: #ff6b61;
  --sec: #26282d;
  --sec-line: #3b3e45;
  --ix: #b3a8ff;
  --ix-ink: #1a1440;
  --nc: #f2c14e;
  --nc-ink: #2b1d00;
  --chip: #2a2c31;
  --chip-on: #5fd08f;
  --alert-bg: #3a1512;
  --alert-ink: #ffb4ab;
  color-scheme: dark;
}

:root[data-theme="night"] {
  --bg: #000000;
  --card: #0b0b0d;
  --text: #b9bdc4;
  --muted: #8f939a;
  --line: #1c1d21;
  --accent: #46ad74;
  --accent-ink: #03150b;
  --danger: #e0675d;
  --sec: #131418;
  --sec-line: #26282d;
  --ix: #6a5fc0;
  --ix-ink: #ffffff;
  --nc: #c99a2e;
  --nc-ink: #1f1500;
  --chip: #17181c;
  --chip-on: #46ad74;
  --alert-bg: #1f0b09;
  --alert-ink: #e6a59e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: calc(16px * var(--fs, 1)); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top) 12px 8px;
}
.bar { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding-top: 8px; }
.bar h1 { min-width: 0; text-align: center; }
.home-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; background: var(--chip); color: var(--accent); border: 1px solid var(--line); text-decoration: none; }
.back { display: none !important; }
.bar h1 { margin: 0; font-size: 1.3rem; line-height: 1.2; font-weight: 800; text-transform: none; letter-spacing: .01em; color: var(--accent); }
.icon-btn {
  border: 1px solid var(--line); background: var(--chip); color: var(--text);
  width: 42px; height: 42px; border-radius: 50%; font-size: 1.15rem; cursor: pointer;
}
.sbar { display: flex; gap: 8px; margin-top: 8px; align-items: stretch; }
#q {
  flex: 1; min-width: 0; padding: 12px 14px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text);
}
#q:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--chip); color: var(--text);
  padding: 7px 13px; border-radius: 999px; font-size: .88rem; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--chip-on); border-color: var(--chip-on); color: var(--accent-ink); font-weight: 600; }
body.detail #listTools { display: none; }

/* List */
main { max-width: 760px; margin: 0 auto; padding: 12px; }
.count { color: var(--muted); font-size: .85rem; margin: 2px 4px 8px; }
.group h2 {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  margin: 18px 4px 6px;
}
.item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 14px; margin-bottom: 6px; color: inherit; text-decoration: none;
  min-height: 46px;
}
.item:active { background: var(--chip); }
.item .name { font-weight: 600; }
.item .alias { color: var(--muted); font-size: .82rem; }
.item .go { color: var(--muted); font-size: 1.3rem; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.tag {
  font-size: .68rem; font-weight: 600; padding: 1px 7px; border-radius: 6px;
  background: var(--chip); color: var(--muted);
}
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* Detail */
.back {
  display: inline-flex; align-items: center; justify-content: center; margin: 2px 0 10px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--chip); color: var(--text); text-decoration: none; border: 1px solid var(--line);
}
.dhead h2 { margin: 0; font-size: 1.5rem; line-height: 1.2; }
.dhead .cat { color: var(--accent); font-weight: 600; font-size: .9rem; margin-top: 2px; }
.dhead .alias { color: var(--muted); font-size: .85rem; }
.alert {
  background: var(--alert-bg); color: var(--alert-ink);
  border-left: 5px solid var(--danger); border-radius: 10px;
  padding: 10px 12px; margin: 12px 0; font-weight: 600;
}
.sec {
  background: var(--card); border: 1px solid var(--sec-line); border-radius: var(--radius);
  padding: 12px 14px; margin: 10px 0;
}
.sec h3 {
  margin: 0 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.txt { overflow-wrap: anywhere; }
.tabs { display: flex; gap: 6px; margin: 4px 0 10px; }
.tab {
  flex: 1; padding: 9px 4px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--chip); color: var(--text); font-size: .9rem; cursor: pointer;
}
.tab.on { background: var(--chip-on); border-color: var(--chip-on); color: var(--accent-ink); font-weight: 700; }
.na { color: var(--muted); font-style: italic; }

/* Indice A–Z */
.item .sub { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.az {
  position: fixed; right: 3px; top: calc(var(--hdr, 200px) + 8px); bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 8; display: flex; flex-direction: column; justify-content: space-between; align-items: stretch;
  width: 26px; padding: 3px 0; border-radius: 13px; margin: 0;
  background: color-mix(in srgb, var(--card) 88%, transparent); border: 1px solid var(--line);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.azb {
  flex: 1 1 0; min-height: 0; width: 100%; max-height: 26px; padding: 0; border: 0; background: none;
  color: var(--accent); font-weight: 700; font-size: .72rem; line-height: 1; cursor: pointer;
}
.azb:active, .azb.on { background: var(--chip-on); color: var(--accent-ink); border-radius: 8px; }
main:has(.az) { padding-right: 38px; }

/* Navigazione sezioni e nomi commerciali */
.navrow { display: flex; justify-content: center; padding-top: 6px; }
.navrow .pill { flex: 0 1 360px; justify-content: center; height: 32px; padding: 0 8px; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 800; }
.pill.ix { background: var(--ix); color: var(--ix-ink); border: 2px solid var(--ix); }
.pill.alt { background: var(--nc); color: var(--nc-ink); border: 2px solid var(--nc); }
.brands { display: flex; flex-wrap: wrap; gap: 6px; }
.brand {
  display: inline-block; padding: 5px 11px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  background: var(--chip); border: 1px solid var(--line);
}

/* Interazioni */
.actions { display: flex; align-items: center; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; height: 42px; padding: 0 14px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .9rem; text-decoration: none; white-space: nowrap;
}
.ptitle { margin: 4px 0 4px; font-size: 1.4rem; }
#iq, #bq, #cq {
  width: 100%; margin-top: 8px; padding: 12px 14px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text);
}
#iq:focus, #bq:focus, #cq:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.sug, .selchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ilist { list-style: none; margin: 8px 0 0; padding: 0; }
.ilist li { padding: 10px 0; border-top: 1px solid var(--line); }
.ilist li:first-child { border-top: 0; }
.ilist a { color: inherit; }
.itxt { margin-top: 4px; font-size: .92rem; color: var(--text); }
.sev {
  display: inline-block; min-width: 54px; text-align: center; font-size: .68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 6px; margin-right: 4px;
}
.sev.alta { background: #b3261e; color: #fff; }
.sev.media { background: #f2a60d; color: #2b1d00; }
.sev.bassa { background: #d9d9e0; color: #2b2b30; }
.sev.info { background: #1f7a4d; color: #fff; }
:root[data-theme="dark"] .sev.alta, :root[data-theme="night"] .sev.alta { background: #ff6b61; color: #220604; }
:root[data-theme="dark"] .sev.bassa, :root[data-theme="night"] .sev.bassa { background: #3a3c42; color: #ececef; }
:root[data-theme="dark"] .sev.info, :root[data-theme="night"] .sev.info { background: #4fc58a; color: #06210f; }
.hi { color: var(--danger); font-weight: 700; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▸ '; color: var(--muted); }
details[open] > summary::before { content: '▾ '; }
.inl { display: inline; }
.okbox { background: var(--chip); border-radius: 12px; padding: 12px 14px; font-size: .92rem; }

.foot { max-width: 760px; margin: 0 auto; padding: 8px 16px 28px; color: var(--muted); font-size: .76rem; text-align: center; }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal[hidden] { display: none; }
.modal-box { background: var(--card); color: var(--text); border-radius: 18px; max-width: 460px; padding: 20px; max-height: 90vh; overflow: auto; }
.modal-box h2 { margin-top: 0; }
.modal-box ul { padding-left: 20px; }
.primary {
  width: 100%; margin-top: 8px; padding: 13px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font-size: 1rem; font-weight: 700; cursor: pointer;
}

@media (min-width: 700px) {
  .bar h1 { font-size: 1.5rem; }
}

.small { color: var(--muted); font-size: .8rem; }

/* Sezioni a tendina nella scheda */
.acc { padding: 0; overflow: hidden; }
.acc > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 13px 14px; min-height: 48px; cursor: pointer; list-style: none; }
.acc > summary::before { content: none !important; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after { content: '▾'; color: var(--muted); font-size: 1rem; transition: transform .15s; transform: rotate(-90deg); flex: 0 0 auto; }
.acc[open] > summary::after { transform: rotate(0deg); }
.acc > summary h3 { margin: 0; }
.acc > summary { background: var(--sec); }
.acc[open] > summary { border-bottom: 1px solid var(--sec-line); }
.acc > .accb { padding: 12px 14px 14px; }

/* Sigle e fonti */
.gl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; }
.gl dt { font-weight: 700; color: var(--accent); }
.gl dd { margin: 0; overflow-wrap: anywhere; }
.foot a { color: var(--accent); font-weight: 600; }
@media (max-width: 420px) { .gl { grid-template-columns: 1fr; gap: 0; } .gl dd { margin-bottom: 10px; } }
.sec .small a { color: var(--accent); font-weight: 700; text-decoration: underline; }


/* Avvisi: rischio grave / attenzione */
.alert { padding: 0; overflow: hidden; border-left-width: 6px; font-weight: 500; }
.alert .alert-h { display: flex; align-items: center; gap: 7px; padding: 8px 12px; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.alert .alert-t { padding: 9px 12px 11px; font-weight: 600; white-space: pre-line; }
.alert.crit { border-left-color: var(--danger); }
.alert.crit .alert-h { background: var(--danger); color: var(--alert-bg); }
.alert.warn { border-left-color: var(--danger); border: 1px solid var(--danger); border-left-width: 6px; }
.alert.warn .alert-h { color: var(--danger); }
:root:not([data-theme="dark"]):not([data-theme="night"]) .alert.crit .alert-h { color: #fff; }

/* Note sulla fonte */
.notes .nb { margin-bottom: 12px; }
.notes .nh { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); margin-bottom: 2px; }
.notes .np { color: var(--muted); font-size: .9rem; }

/* Etichette ambito e filtri */
.item .tags { margin-top: 5px; }
.item .tag { font-size: .68rem; font-weight: 700; letter-spacing: .04em; padding: 1px 7px; }
.chips.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 34px), transparent); }
.chips.fade-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 34px), transparent); }
.chips.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 34px, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(to right, transparent, #000 34px, #000 calc(100% - 34px), transparent); }
:root[data-theme="night"] .sev.alta { background: #cc4f46; color: #fff; }
:root[data-theme="night"] .sev.bassa { background: #1f2024; color: #b9bdc4; }
:root[data-theme="night"] .sev.info { background: #2f8a5b; color: #fff; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0; }

/* Compatibilità Y-site */
.src { color: var(--muted); font-size: .8rem; }
.ph { margin: 18px 0 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 800; }
.cnotes { margin-bottom: 10px; }
.cnotes .nh { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); margin-bottom: 2px; }
.cdet { margin-top: 12px; }

.bar-r { display: flex; gap: 4px; justify-content: flex-end; }
.info-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 800; font-size: 1.1rem; color: var(--accent); }
.sec ul.dis { margin: 6px 0 0; padding-left: 18px; }
.sec ul.dis li { margin-bottom: 6px; }
.credit { margin: 0 4px 12px; font-style: italic; font-weight: 600; color: var(--accent); }
.chip.on .src { color: inherit; opacity: .85; }
.chips[hidden] { display: none; }

/* Cartelli di compatibilità */
.csg { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; margin-right: 4px; }
.cic { flex: none; }
.cic .bg { fill: var(--c-bg); }
.cic .fg { fill: var(--c-fg); }
.cic .fgt { fill: #fff; font: 900 7.4px/1 system-ui, sans-serif; letter-spacing: .02em; }
.cic .fgt.q { font-size: 18px; }
.cic.c-cond .bg { stroke: var(--c-bg); }
.cic.c-ok { --c-bg: #1f7a4d; }
.cic.c-cond { --c-bg: #f2a60d; --c-fg: #2b1d00; }
.cic.c-inc { --c-bg: #b3261e; }
.cic.c-nd { --c-bg: #8b8f98; }
:root[data-theme="dark"] .cic.c-ok, :root[data-theme="night"] .cic.c-ok { --c-bg: #2f9e68; }
:root[data-theme="dark"] .cic.c-inc, :root[data-theme="night"] .cic.c-inc { --c-bg: #d9483e; }
:root[data-theme="dark"] .cic.c-nd, :root[data-theme="night"] .cic.c-nd { --c-bg: #5d6068; }
.clegend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 10px; font-size: .8rem; color: var(--muted); }
.clegend span { display: inline-flex; align-items: center; gap: 5px; }
.clegend .cic { width: 18px; height: 18px; }
.ilist li .csg .sev { margin-right: 0; }

/* Preferiti */
.favtog { position: relative; flex: none; width: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.favtog .starp, .favbtn .star path { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; }
.favtog.on { background: var(--chip-on); border-color: var(--chip-on); color: var(--accent-ink); }
.favtog.on .starp { fill: #f5b301; stroke: #f5b301; }
.favn { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: .68rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.dhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dht { min-width: 0; }
.favbtn { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--chip); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.favbtn.on { color: #f5b301; border-color: #f5b301; }
.favbtn.on .star path { fill: #f5b301; }
.fav-ind { color: #e0a100; font-size: .9rem; }
.favempty { padding: 28px 12px; }
.favempty .star { width: 44px; height: 44px; margin-bottom: 8px; }
.favempty .star path { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linejoin: round; }
.favempty p { margin: 6px 0; }
.favn[hidden] { display: none; }
#q::placeholder { font-size: .92rem; }
.favl { margin: 14px 4px 6px; font-size: .95rem; font-weight: 800; color: var(--muted); }
.cv { margin-bottom: 10px; }
.cvl { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); margin-bottom: 2px; }

/* Salto rapido alle sezioni, azione compatibilità, ultimi consultati, ricerca tollerante, avviso di aggiornamento, versione */
details.acc[data-s] { scroll-margin-top: calc(var(--hdr, 0px) + 8px); }
.recent { margin: 2px 0 12px; }
.recent .rh { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.recent h2 { margin: 0; font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rclr { border: 0; background: none; color: var(--accent); font: inherit; font-size: .8rem; font-weight: 700; padding: 6px 4px; cursor: pointer; }
.rrow { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 2px; scrollbar-width: none; }
.rrow::-webkit-scrollbar { display: none; }
.rchip { flex: 0 0 auto; max-width: 70vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; }
.rchip:active { background: var(--chip); }
.fuzzy { margin: 0 4px 8px; padding: 8px 10px; border-radius: 10px; background: var(--chip); color: var(--muted); font-size: .84rem; }
.upd { position: fixed; z-index: 60; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 560px; margin: 0 auto; padding: 10px 12px 10px 16px; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: .92rem; box-shadow: 0 6px 22px rgba(0, 0, 0, .3); }
.upd[hidden] { display: none; }
.upd button { border: 0; border-radius: 10px; padding: 9px 16px; min-height: 40px; background: var(--accent-ink); color: var(--accent); font: inherit; font-weight: 800; cursor: pointer; }
.foot .ver { margin: 2px 0 0; font-size: .72rem; }


/* ---------- Migliorie grafiche (12/11/2026) ---------- */
/* Testata che si riduce scorrendo: nella lista restano fissi la ricerca e i filtri delle sottocategorie */
.top .navrow, .top #viewChips, .top .bar { max-height: 64px; transition: max-height .22s ease, padding .22s ease, opacity .18s ease, visibility 0s; }
.top.compact .navrow, .top.compact #viewChips, body:not(.detail) .top.compact .bar { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; overflow: hidden; visibility: hidden; pointer-events: none; transition: max-height .22s ease, padding .22s ease, opacity .18s ease, visibility 0s .22s; }
body { overflow-anchor: none; }
@media (prefers-reduced-motion: reduce) { .top .navrow, .top #viewChips, .top .bar, .top.compact .navrow, .top.compact #viewChips, body:not(.detail) .top.compact .bar { transition: none; } }
.chips { padding: 6px 0 0; }
.chip { padding: 6px 12px; font-size: .84rem; }
.top { padding-bottom: 7px; }

/* Lista: nome del principio attivo e, sotto, la categoria in piccolo */
.item .sub { margin-top: 1px; }
.dhead .cat { display: flex; align-items: center; gap: 7px; }
.cdot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

/* Avviso compatto */
.alert .alert-head { font-weight: 700; padding-bottom: 10px; }
.alert-more { border-top: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.alert-more > summary { display: flex; align-items: center; gap: 4px; min-height: 42px; padding: 8px 12px; font-size: .86rem; font-weight: 800; color: var(--alert-ink); cursor: pointer; }
.alert-more > summary::before { color: var(--alert-ink); font-size: 1rem; }
.alert .alert-rest { padding: 2px 12px 12px; font-weight: 500; }

/* Intestazioni di sezione compatte ma leggibili */
.sec.acc { margin: 6px 0; }
.acc > summary { min-height: 42px; padding: 8px 12px; background: var(--sec); border-left: 4px solid var(--accent); }
.acc > summary h3 { color: var(--text); font-size: .84rem; font-weight: 800; letter-spacing: .05em; line-height: 1.25; }
.acc > summary::after { font-size: 1.15rem; color: var(--accent); font-weight: 700; }
.acc[open] > summary { background: color-mix(in srgb, var(--accent) 12%, var(--sec)); }
.hi { color: var(--danger); }

/* Posologia: una riga per punto, dosi in evidenza */
.pl { display: flex; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); }
.pl:first-child { border-top: 0; padding-top: 0; }
.pl .bu { flex: none; color: var(--accent); font-weight: 800; }
.pl.pn { display: block; }
.pl > span:last-child { min-width: 0; overflow-wrap: anywhere; }
b.dz { font-weight: 800; color: var(--text); background: color-mix(in srgb, var(--accent) 13%, transparent); border-radius: 4px; padding: 0 3px; }

/* Tema notte: avvisi meno abbaglianti */
:root[data-theme="dark"] .alert.crit .alert-h { background: #b83c33; color: #fff; }
:root[data-theme="night"] .alert.crit .alert-h { background: #6e2520; color: #ffd2cd; }
:root[data-theme="night"] .alert { border-left-color: #a8423a; }
:root[data-theme="night"] .alert.warn { border-color: #7d3630; }
:root[data-theme="night"] .alert.warn .alert-h { color: #e6a59e; }
:root[data-theme="night"] .alert .alert-head { color: #ecc3be; }
:root[data-theme="night"] .acc > summary { border-left-color: #3a8a62; }
:root[data-theme="night"] b.dz { background: rgba(70, 173, 116, .14); color: #d3d6db; }


/* Riga di provenienza nella scheda */
.prov { margin: 6px 2px 10px; font-size: .78rem; line-height: 1.45; color: var(--muted); }
.prov b { color: var(--text); font-weight: 700; }
.plink { border: 0; background: none; padding: 4px 0; font: inherit; font-weight: 700; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.updrow { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; }

/* Preferiti riordinabili */
.favtools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 2px 10px; }
.item.fedit { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: default; }
.fbtns { display: inline-flex; gap: 6px; flex: 0 0 auto; }
.fmv { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--chip); color: var(--accent); font-size: 1rem; font-weight: 800; cursor: pointer; }
.fmv:disabled { opacity: .35; cursor: default; }

/* L'intestazione non segue la dimensione del testo: resta sempre in una riga */
.bar h1 { font-size: 20.8px; }
@media (min-width: 600px) { .bar h1 { font-size: 24px; } }

/* Elenco a due livelli: categorie e procedure */
.sublist { display: flex; flex-direction: column; gap: 8px; }
.subitem { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 10px 14px; text-align: left; font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.subitem:active { background: var(--chip); }
.subn { flex: 1; min-width: 0; font-weight: 600; line-height: 1.3; }
.subc { flex: 0 0 auto; min-width: 28px; padding: 2px 9px; border-radius: 999px; background: var(--chip); color: var(--muted); font-size: .8rem; font-weight: 700; text-align: center; }
.subitem .go { color: var(--muted); font-size: 1.3rem; }
.subbar { position: sticky; top: var(--hdr, 0px); z-index: 6; display: flex; align-items: center; gap: 10px; margin: 0 -2px 8px; padding: 8px 2px; background: var(--bg); border-bottom: 1px solid var(--line); }
.subback { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--chip); color: var(--accent); font-size: 1.6rem; line-height: 1; font-weight: 700; cursor: pointer; }
.subt { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.subk { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.subt b { font-size: 1rem; overflow-wrap: anywhere; }
.subnote { margin: 0 2px 8px; }

/* Pulsante Aa e pannello della dimensione del testo */
.fs-btn { font-size: 15px; font-weight: 800; color: var(--accent); letter-spacing: -.02em; }
.top { position: sticky; }
.fspop { position: absolute; z-index: 30; right: 12px; top: calc(100% + 6px); display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 26px rgba(0, 0, 0, .28); }
.fspop[hidden] { display: none; }
.fscap { font-size: .78rem; font-weight: 700; color: var(--muted); max-width: 84px; line-height: 1.2; }
.fsrow { display: flex; gap: 6px; align-items: center; }
.fsopt { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--chip); color: var(--text); font-family: inherit; font-weight: 800; line-height: 1; cursor: pointer; }
.fsopt.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
@media (max-width: 380px) { .bar h1 { font-size: 18px; } }

/* Testata: titolo in alto e, sotto, quattro strumenti ben distanziati (interazioni, info, testo, tema) */
.bar { grid-template-columns: 40px minmax(0, 1fr) 40px; }
.bar { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; gap: 6px; padding-top: 8px; text-align: center; }
.bar h1 { white-space: nowrap; }

/* Barra di navigazione fissa in basso */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); padding: 0 max(0px, calc((100% - 640px) / 2)) env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0, 0, 0, .06); }
.nvi { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 60px; min-width: 0; padding: 0 2px; border: 0; background: none; color: var(--muted); font: inherit; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.nvi .ti { display: flex; align-items: center; justify-content: center; height: 22px; font-size: 1.2rem; line-height: 1; font-weight: 800; font-style: normal; color: inherit; }
.nvi svg { display: block; }
.nvi span { font-size: .7rem; font-weight: 700; letter-spacing: .01em; line-height: 1.1; }
.nvi.on { color: var(--accent); }
@media (max-width: 345px) { .nvi span { font-size: .64rem; letter-spacing: 0; } }
.nvi:active { background: var(--chip); }
body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
.az { bottom: calc(68px + env(safe-area-inset-bottom)); }
.upd { bottom: calc(72px + env(safe-area-inset-bottom)); }
.fspop .fscap { max-width: none; }
.fspop { position: fixed; left: auto; right: 12px; bottom: auto; top: calc(env(safe-area-inset-top) + 54px); transform: none; z-index: 30; flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; white-space: nowrap; }
.fspop .mrow { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.thbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 128px; height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--chip); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.thbtn .ti { display: flex; color: var(--accent); font-size: 1.1rem; line-height: 1; font-style: normal; }
.thbtn svg { display: block; }
.more { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--chip); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; justify-self: end; }
.more[aria-expanded="true"] { background: var(--chip-on); border-color: var(--chip-on); color: var(--accent-ink); }
.nvi .starp { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; }
.nvi.on .starp { fill: #f5b301; stroke: #f5b301; }
.nvi .favn { position: absolute; top: 5px; left: calc(50% + 6px); right: auto; }
.nvi { position: relative; }

/* Gerarchia delle sezioni: in evidenza Indicazioni, Posologia, Diluizione; più discrete Farmacologia, Note, Nomi commerciali */
.acc[data-s="ind"] > summary, .acc[data-s="pos"] > summary, .acc[data-s="dil"] > summary { min-height: 52px; border-left-width: 6px; }
.acc[data-s="ind"] > summary h3, .acc[data-s="pos"] > summary h3, .acc[data-s="dil"] > summary h3 { font-size: .95rem; }
.acc[data-s="farm"] > summary, .acc[data-s="note"] > summary, .acc[data-s="nomi"] > summary { min-height: 38px; padding-top: 5px; padding-bottom: 5px; background: transparent; border-left-color: var(--line); }
.acc[data-s="farm"] > summary h3, .acc[data-s="note"] > summary h3, .acc[data-s="nomi"] > summary h3 { font-size: .76rem; font-weight: 700; color: var(--muted); }
.acc[data-s="farm"] > summary::after, .acc[data-s="note"] > summary::after, .acc[data-s="nomi"] > summary::after { color: var(--muted); }
.acc[data-s="farm"][open] > summary, .acc[data-s="note"][open] > summary, .acc[data-s="nomi"][open] > summary { background: var(--sec); }

/* Posologia: etichetta (fonte o indicazione) su una riga, testo sotto */
.pl.sub { margin-left: 18px; }
.pk { display: block; font-weight: 800; }
.pk.src { font-weight: 600; font-size: .78rem; color: var(--muted); margin-bottom: 1px; }
.pt { display: block; }
.pt.in { display: inline; }
.pk:has(+ .pt.in), .pk + .pt.in { display: inline; }
.item { padding-top: 7px; padding-bottom: 7px; }
@media (max-width: 380px) { #q { font-size: .88rem; } }

/* Pannello Testo/Tema ridotto: una sola riga compatta */
.fspop { flex-direction: row; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 14px; }
.fspop .mrow { display: contents; }
.fspop .fscap { display: none; }
.fspop .fsrow { gap: 5px; padding-right: 7px; margin-right: 2px; border-right: 1px solid var(--line); }
.fspop .fsopt { width: 36px; height: 36px; border-radius: 10px; }
.fspop .thbtn { min-width: 0; width: 36px; height: 36px; padding: 0; border-radius: 10px; }
.fspop .thbtn .ti { font-size: 1rem; }

/* Tema: tre scelte esplicite (chiaro, scuro, notte) */
.throw { display: flex; gap: 5px; }
.thopt { width: 36px; height: 36px; padding: 0; border-radius: 10px; border: 1px solid var(--line); background: var(--chip); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.thopt svg { display: block; }
.thopt.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.fspop .fsrow { gap: 5px; }
@media (max-width: 345px) { .fspop { padding: 6px; gap: 4px; } .fspop .fsopt, .thopt { width: 33px; height: 33px; } }

/* Testata: tema a sinistra, dimensione del testo a destra, un tocco = passo successivo */
.more.left { justify-self: start; }
.more svg { display: block; }
.more .aa { font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; color: var(--accent); line-height: 1; }
.more#themeBtn { color: var(--accent); }
.more:active { filter: brightness(.94); }

/* ---------- Schede farmaco: sezioni come schede chiare con icona (13/11/2026) ---------- */
.dhead .cat { display: inline-flex; width: fit-content; max-width: 100%; align-items: center; margin-top: 6px; padding: 3px 11px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); font-size: .8rem; font-weight: 700; color: var(--accent); }
.sec.acc { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin: 6px 0; }
.acc > summary { justify-content: flex-start; gap: 10px; min-height: 44px; padding: 5px 12px; background: transparent; border-left: 0; }
.acc > summary h3 { flex: 1; min-width: 0; font-size: .98rem; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--text); line-height: 1.25; }
.acc > summary::after { content: '›'; margin-left: auto; transform: rotate(90deg); font-size: 1.4rem; line-height: 1; font-weight: 400; color: var(--muted); }
.acc[open] > summary::after { transform: rotate(-90deg); }
.acc[open] > summary { background: transparent; border-bottom: 1px solid var(--line); }
.sic { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--accent); }
.sic svg { display: block; }
.acc[data-s="ea"] .sic, .acc[data-s="ci"] .sic { background: color-mix(in srgb, var(--danger) 12%, var(--card)); color: var(--danger); }
.acc[data-s="cons"] .sic, .acc[data-s="compat"] .sic, .acc[data-s="int"] .sic, .acc[data-s="farm"] .sic, .acc[data-s="note"] .sic, .acc[data-s="nomi"] .sic { background: var(--chip); color: var(--muted); }
.acc[data-s="ind"] > summary, .acc[data-s="pos"] > summary, .acc[data-s="dil"] > summary { min-height: 50px; border-left-width: 0; }
.acc[data-s="ind"] > summary h3, .acc[data-s="pos"] > summary h3, .acc[data-s="dil"] > summary h3 { font-size: 1.08rem; font-weight: 800; }
.acc[data-s="farm"] > summary, .acc[data-s="note"] > summary, .acc[data-s="nomi"] > summary { min-height: 40px; padding-top: 3px; padding-bottom: 3px; }
.acc[data-s="farm"] > summary h3, .acc[data-s="note"] > summary h3, .acc[data-s="nomi"] > summary h3 { font-size: .9rem; font-weight: 600; color: var(--muted); }
.acc[data-s="farm"][open] > summary, .acc[data-s="note"][open] > summary, .acc[data-s="nomi"][open] > summary { background: transparent; }
.acc[data-s="farm"] .sic, .acc[data-s="note"] .sic, .acc[data-s="nomi"] .sic { width: 26px; height: 26px; }
.acc > .accb { padding: 12px 14px 14px; }

/* Pagina tecnica: righe compatte chiave / valore */
.trow { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .9rem; line-height: 1.3; }
.trow:last-child { border-bottom: 0; }
.trow span { color: var(--muted); font-weight: 600; min-width: 0; }
.trow b { text-align: right; font-weight: 700; overflow-wrap: anywhere; max-width: 62%; }
