/* DeepCare 3.0, the web front. Palette, type scale, spacing and component shapes follow Francesco Maringelli's
   prototype (the visual spec); the rules are written for this Elm DOM. Layout states live as classes on the
   root .shell element, which Elm owns: .side-mini (menu reduced to icons), .nav-open (phone panel open). */

/* IBM Plex, self-hosted (SIL OFL 1.1, fonts/LICENSE.txt): Sans 400/500/600/700 from the IBM/plex release
   @ibm/plex-sans@1.1.0, Mono 400/500 from @ibm/plex-mono@2.5.0, the complete woff2 files. No third-party request
   from the page. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap;
             src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap;
             src: url("fonts/IBMPlexSans-Medium.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap;
             src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-style: normal; font-display: swap;
             src: url("fonts/IBMPlexSans-Bold.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap;
             src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap;
             src: url("fonts/IBMPlexMono-Medium.woff2") format("woff2"); }

:root {
    --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f7f9fc; --line: #e2e7ef; --line-strong: #cfd6e2;
    --fg: #0f1b2d; --fg-2: #4a5870; --fg-3: #7d8aa0;
    --accent: #2160e0; --accent-soft: #e8effd; --accent-fg: #ffffff;
    --crit: #d4283a; --crit-soft: #fdecee; --crit-line: #f4bcc3;
    --warn: #b86e00; --warn-soft: #fff4e0; --warn-line: #f5d39a;
    --ok: #1a8a5a; --ok-soft: #e6f5ee;
    --stale: #6b5bd2; --stale-soft: #efedfc;
    --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
    --r: 10px;
    --ab-h: 60px;
    --side-w: 284px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0c121c; --surface: #131b28; --surface-2: #182233; --line: #243045; --line-strong: #2f3d56;
        --fg: #e7edf6; --fg-2: #a6b3c8; --fg-3: #73829b;
        --accent: #5b8cff; --accent-soft: #1b2a4a; --accent-fg: #0b1222;
        --crit: #ff6676; --crit-soft: #3a1a22; --crit-line: #6b2a35;
        --warn: #f0a83a; --warn-soft: #352812; --warn-line: #5e4518;
        --ok: #4cc790; --ok-soft: #14302a;
        --stale: #a99bff; --stale-soft: #25214a;
        color-scheme: dark;
    }
}

/* Brand Centro Cuore (data-brand on <html>, src/Brand.elm): their bordeaux as the accent (the logo's #982849 is the
   wordmark; #8D1C3F the brand colour), their pink #E55A78 on the entry cards' icons, the light pink #FD6D85 as the
   accent in dark mode. The state colours (crit, warn, ok) stay the platform's: they carry meaning, not brand. Their
   fonts (sofia-pro, proxima-nova) are commercial: IBM Plex stays. */
:root[data-brand="centrocuore"] { --accent: #8d1c3f; --accent-soft: #fbe8ee; --accent-fg: #ffffff; --brand-2: #e55a78; }
@media (prefers-color-scheme: dark) {
    :root[data-brand="centrocuore"] { --accent: #fd6d85; --accent-soft: #3d1624; --accent-fg: #1d0710;
                                      --brand-2: #fd6d85; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 14px; line-height: 1.45; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-3); }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
        stroke-linecap: round; stroke-linejoin: round; }
a { color: var(--accent); }

/* Buttons, badges, logo */
.btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 8px; border: 1px solid var(--line-strong);
       background: var(--surface); padding: 7px 12px; cursor: pointer; font-weight: 500; font-size: 13.5px;
       text-decoration: none; color: var(--fg); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: none; color: var(--accent); }
.appbar .btn.ghost { color: var(--fg-2); }
.appbar .btn.ghost:hover, .appbar .btn.ghost[aria-expanded="true"] { background: var(--surface-2); color: var(--fg); }
.icon-btn { padding: 7px; }
.link-btn { background: none; border: 0; color: var(--fg-3); font-size: 12.5px; cursor: pointer; padding: 2px 0; }
.link-btn:hover { color: var(--fg); }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
         padding: 1px 8px; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.badge.muted { background: var(--surface-2); color: var(--fg-2); border: 1px solid var(--line); }
.badge.stale { background: var(--stale-soft); color: var(--stale); }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-fg);
        display: grid; place-items: center; flex: none; }
.logo svg.i { width: 19px; height: 19px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-fg);
          display: grid; place-items: center; font-weight: 600; flex: none; }

/* Landing and the three accesses */
.start { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.start-in { width: 100%; max-width: 1080px; display: flex; flex-direction: column; gap: 24px; align-items: center;
            text-align: center; }
.start-in h1 { margin: 0; font-size: 26px; display: block; }
.start-in > div > p { margin: 0; color: var(--fg-2); }
.start-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; width: 100%; }
.start-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 760px; }
@media (max-width: 900px) { .start-grid, .start-grid.two { grid-template-columns: minmax(0, 1fr); } }
.start-card h2 svg.i { color: var(--brand-2, currentColor); }
/* A brand's logo: the wordmark on the entry page, the same picture framed on its mark in the top bar. The JPG has a
   white ground, so in dark mode it sits on a white plate. */
.brand-mark { display: block; width: min(320px, 80vw); height: auto; background: #fff; border-radius: 12px;
              padding: 10px 14px; }
.brand-heart { width: 44px; height: 34px; flex: none; object-fit: cover; object-position: left center; background: #fff;
               border-radius: 8px; padding: 2px; }
.start-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px;
              text-align: left; cursor: pointer; color: var(--fg); display: flex; flex-direction: column; gap: 10px; }
.start-card:hover, .start-card:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.start-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent);
                                   background: var(--accent-soft); }
.start-card h2 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.start-card p { margin: 0; color: var(--fg-2); font-size: 14px; }
.start-card ul { margin: 0; padding-left: 18px; color: var(--fg-2); font-size: 13.5px; line-height: 1.6; }
.start-acts { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin-top: auto; padding-top: 14px;
              border-top: 1px solid var(--line); }
.start-acts .edsw { justify-content: center; padding: 11px 14px; font-size: 14.5px; font-weight: 600; border-radius: 9px;
                    border: 2px solid var(--accent); color: var(--accent); background: var(--surface); }
.start-acts .edsw:hover { background: var(--accent); color: var(--accent-fg); }
.start-card[aria-pressed="true"] .start-acts .edsw { background: var(--accent); color: var(--accent-fg);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent); }
.start-acts .edsw svg.i { width: 17px; height: 17px; }
.start-acts .link-btn { display: inline-flex; gap: 6px; align-items: center; justify-content: center; color: var(--accent);
                        font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
.start-acts .link-btn svg.i { width: 15px; height: 15px; }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.lg-head { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; margin-bottom: 4px; }
.lg-head h2 { margin: 6px 0 0; font-size: 20px; }
.lg-head p { margin: 0; color: var(--fg-3); font-size: 13.5px; }
.lg-msg { border: 1px solid var(--warn-line); background: var(--warn-soft); border-radius: 8px; padding: 10px 12px;
          font-size: 13px; color: var(--fg); display: flex; flex-direction: column; gap: 8px; text-align: left; }
.lg-msg .row { display: flex; gap: 8px; flex-wrap: wrap; }
.f { min-width: 0; }
.f > label { display: block; font-size: 12.5px; color: var(--fg-2); margin-bottom: 4px; }
.f input, .f select { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px;
                      background: var(--surface); }
.help { font-size: 12px; color: var(--fg-3); margin-top: 4px; }

/* Modals */
.scrim { position: fixed; inset: 0; background: rgba(10, 16, 28, .45); z-index: 50; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100% - 32px));
         max-height: 90vh; background: var(--surface); border-radius: 12px; z-index: 51; display: flex;
         flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); overflow: hidden; }
.modal.terms { width: min(720px, calc(100% - 32px)); max-height: 86vh; }
.drawer-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 22px;
            border-bottom: 1px solid var(--line); }
.drawer-h h2 { margin: 0; font-size: 19px; display: flex; align-items: center; gap: 6px; }
.drawer-h p { margin: 3px 0 0; color: var(--fg-3); font-size: 13px; }
.modal-body { overflow: auto; flex: 1; }
.auth-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.terms-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; font-size: 14px; color: var(--fg-2); }
.terms-body h3 { margin: 6px 0 0; font-size: 15px; color: var(--fg); }
.terms-body p { margin: 0; }
.df-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 14px 22px;
           border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.df-foot .left { margin-right: auto; color: var(--fg-3); font-size: 12.5px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--line);
          border-radius: 8px; background: var(--surface-2); color: var(--fg-2); font-size: 13px; }
.notice svg.i { color: var(--fg-3); margin-top: 1px; }
.acts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
svg.i.warn { color: var(--warn); }
svg.i.faint { color: var(--fg-3); }
.sub-now { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-3); }
.sub-now .badges, .um-subs .badges { display: flex; gap: 4px; }
/* the elevated access of the Direttore sanitario, at the bottom of the side menu while it lasts */
.elev { display: flex; gap: 8px; align-items: center; margin: 0 10px 6px; padding: 6px 10px; border-radius: 8px;
        background: var(--warn-soft); color: var(--warn); font-size: 12.5px; font-weight: 500; }
.elev svg.i { width: 15px; height: 15px; }
.elev button { margin-left: auto; border: 0; background: none; color: inherit; text-decoration: underline; cursor: pointer;
               font-size: 12px; }
.side-mini .side .elev { display: none; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
         background: var(--fg); color: var(--bg); padding: 9px 14px; border-radius: 8px; font-size: 13px; z-index: 60;
         max-width: calc(100% - 32px); }
/* with a side panel or a window open the toast rises above its footer, where the buttons are */
body:has(.drawer) .toast, body:has(.modal) .toast { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }

/* Top bar */
.appbar { position: sticky; top: 0; z-index: 30; height: var(--ab-h); display: flex; align-items: center; gap: 14px;
          padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.ab-brand { display: flex; gap: 10px; align-items: center; flex: none; width: calc(var(--side-w) - 70px); }
.ab-brand b { display: block; font-size: 15px; white-space: nowrap; }
.ab-brand small { color: var(--fg-3); font-size: 11.5px; }
.topnav { display: flex; align-items: stretch; align-self: stretch; gap: 2px; flex: none; }
.topnav a { display: flex; align-items: center; gap: 7px; padding: 0 13px; color: var(--fg-2); text-decoration: none;
            font-weight: 600; font-size: 14px; border-top: 3px solid transparent; border-bottom: 3px solid transparent;
            white-space: nowrap; }
.topnav a:hover { color: var(--fg); background: var(--surface-2); }
.topnav a.on { color: var(--accent); border-bottom-color: var(--accent); }
.topnav svg.i { width: 17px; height: 17px; }
.gsearch { position: relative; flex: 1; max-width: 400px; display: flex; align-items: center; gap: 8px;
           border: 1px solid var(--line-strong); border-radius: 9px; padding: 0 10px; background: var(--surface); }
.gsearch:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gsearch svg.i { color: var(--fg-3); width: 16px; height: 16px; }
/* WHY width 100% and an explicit min-width: an input's intrinsic width (about 20 characters) was the search box's
   minimum, so on a 1300 px screen the box would not shrink and the view tag in .ab-right absorbed the whole
   shortfall («P…» on the Spoke, «F» on the Hub); a percentage width makes the input compressible */
.gsearch { min-width: 140px; }
.gsearch input { flex: 1; width: 100%; border: 0; outline: 0; background: none; padding: 8px 0; min-width: 0;
                 color: var(--fg); }
/* the view tag is the one item of the right group that gives way: it shrinks to an ellipsis, the rest keep size */
.ab-right { margin-left: auto; display: flex; align-items: center; gap: 6px; min-width: 0; }
.ab-right > * { flex: none; }
.ab-right > .role-chip { flex: 0 1 auto; min-width: 0; }
.ab-pop { position: relative; }
.bell { position: relative; }
.dotn { position: absolute; top: 2px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
        background: var(--crit); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center;
        border: 2px solid var(--surface); }
.role-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px;
             border: 1px solid transparent; background: var(--accent-soft); font-size: 12.5px; font-weight: 700;
             color: var(--accent); white-space: nowrap; max-width: 300px; }
.role-chip.home { background: var(--surface-2); color: var(--fg-2); border-color: var(--line); }
.role-chip span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.role-chip svg.i { width: 15px; height: 15px; color: var(--accent); }
.view-sw { white-space: nowrap; }
.userbtn { display: flex; align-items: center; gap: 9px; border: 0; background: none; padding: 5px 8px; border-radius: 9px;
           cursor: pointer; color: var(--fg); }
.userbtn:hover, .userbtn[aria-expanded="true"] { background: var(--surface-2); }
.userbtn .un { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.userbtn .un b { font-size: 13px; }
.userbtn .un small { font-size: 11.5px; color: var(--fg-3); }
.userbtn .chev { width: 14px; height: 14px; color: var(--fg-3); }
.pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 35; background: var(--surface);
       border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .16); min-width: 280px;
       padding: 6px; display: flex; flex-direction: column; }
.pop .ph { padding: 8px 10px 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3);
           display: flex; justify-content: space-between; align-items: center; }
.pop .pi { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; border: 0;
           background: none; color: var(--fg); text-align: left; cursor: pointer; width: 100%; }
.pop .pi:hover, .pop .pi.sel { background: var(--surface-2); }
.pop .pi small { display: block; color: var(--fg-3); font-size: 12px; }
.pop .pfoot { border-top: 1px solid var(--line); margin-top: 4px; padding: 8px 10px 4px; font-size: 13px; }
.pop .pfoot .link-btn { color: var(--accent); }
.pop .pempty { padding: 14px 10px; color: var(--fg-3); font-size: 13px; }
.gres { left: 0; right: auto; width: 100%; max-height: 420px; overflow: auto; }
.umenu { min-width: 300px; max-width: min(360px, calc(100vw - 24px)); }
.um-h { display: flex; gap: 10px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.um-h small { display: block; color: var(--fg-3); font-size: 12px; }
.um-subs { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px 8px;
           border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 12.5px; color: var(--fg-3); }
.um-subs > span:first-child { flex: none; }
.um-subs > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-i { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border: 0; background: none; border-radius: 8px;
        color: var(--fg); cursor: pointer; text-align: left; }
.um-i:hover { background: var(--surface-2); }
.um-i svg.i { width: 16px; height: 16px; color: var(--fg-3); }

/* App grid and side menu: navigation only, by groups; reduced to icons on wide screens, a panel on phones */
.shell { min-height: 100%; }
.shell.side-mini { --side-w: 68px; }
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - var(--ab-h));
       transition: grid-template-columns .18s; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column;
        position: sticky; top: var(--ab-h); height: calc(100vh - var(--ab-h)); }
.side nav { padding: 6px 12px 12px; display: flex; flex-direction: column; gap: 2px; overflow: auto; flex: 1; }
.nav-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); font-weight: 600;
             padding: 16px 10px 6px; }
.nav-a { position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px;
         color: var(--fg-2); text-decoration: none; cursor: pointer; border: 0; background: none; width: 100%;
         text-align: left; font-size: 14px; font-weight: 500; }
.nav-a .t { flex: 1; min-width: 0; }
.nav-a:hover { background: var(--surface-2); color: var(--fg); }
.nav-a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-a.cur { color: var(--accent); font-weight: 600; }
.nav-a .pend { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--warn-soft);
               color: var(--warn); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav-a .pend.ok { background: var(--ok-soft); color: var(--ok); }
.nav-a .count { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--surface-2);
                border: 1px solid var(--line); color: var(--fg-2); border-radius: 999px; padding: 0 7px; }
.nav-a .cnt { margin-left: auto; font-size: 11px; color: var(--fg-3); font-weight: 500; }
.nav-a .cnt.z { opacity: .5; }
.nav-a.on .cnt { color: var(--accent); }
.nav-a .chev { margin-left: auto; width: 14px; height: 14px; transition: transform .15s; }
.nav-a[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px 19px; padding-left: 10px;
       border-left: 1px solid var(--line); }
.sub .nav-a { padding: 6px 10px; font-size: 13.5px; }
.sub .nav-a svg.i { width: 16px; height: 16px; }
.sub.tree { margin-left: 12px; padding-left: 6px; }
.sub.tree .sub.tree { margin-left: 8px; }
.sub.tree .nav-a { gap: 9px; padding: 7px 8px; }
.tree-row { display: flex; align-items: center; gap: 2px; }
.tree-row .nav-a { flex: 1; min-width: 0; }
.tw { border: 0; background: none; padding: 6px; border-radius: 6px; color: var(--fg-3); cursor: pointer; display: grid;
      place-items: center; flex: none; }
.tw:hover { background: var(--surface-2); color: var(--fg); }
.tw svg.i { width: 14px; height: 14px; transition: transform .15s; }
.tw[aria-expanded="false"] svg.i { transform: rotate(-90deg); }
.nav-bottom { border-top: 1px solid var(--line); padding: 10px; }
.mini-t { color: var(--fg-3); }
.mini-t svg.i { transform: rotate(90deg); transition: transform .15s; }
.side-mini .side .t, .side-mini .side .nav-label, .side-mini .side .cnt, .side-mini .side .tw,
.side-mini .side .chev, .side-mini .side .count, .side-mini .side .sub.tree .sub.tree { display: none !important; }
.side-mini .side .nav-a { justify-content: center; padding: 10px 0; }
.side-mini .side nav { padding: 10px 8px; }
.side-mini .side .sub, .side-mini .side .sub.tree { margin: 0; padding: 0; border: 0; }
.side-mini .side .nav-a.cur { background: var(--accent-soft); }
.side-mini .side .pend { position: absolute; top: 4px; right: 6px; }
.side-mini .mini-t svg.i { transform: rotate(-90deg); }
.side-mini .ab-brand { width: auto; }

/* Layers that close what is open when a click lands elsewhere (top bar windows, phone panel) */
.backdrop { position: fixed; inset: 0; background: transparent; }
.backdrop.pops { z-index: 29; }
.backdrop.panel { z-index: 39; }

/* Pages */
main { min-width: 0; padding: 24px max(28px, env(safe-area-inset-right, 0px)) 64px max(28px, env(safe-area-inset-left, 0px));
       display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
h1 { font-size: 26px; line-height: 1.15; margin: 0; text-wrap: balance; display: flex; gap: 8px; align-items: center;
     flex-wrap: wrap; }
.head p { margin: 4px 0 0; color: var(--fg-2); max-width: 72ch; }
.back { color: var(--accent); font-size: 13.5px; display: inline-flex; gap: 4px; align-items: center; cursor: pointer;
        background: none; border: 0; padding: 0; text-decoration: none; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; flex-wrap: wrap; }
.panel-h h2 { font-size: 15px; margin: 0; display: flex; align-items: center; gap: 8px; }

/* The top bar keeps its main items: with little room the user name, the logo text and the search give way first */
/* below 1440 px the view-switch button and the user button keep their icons (labels, name and role stay in the
   button's title and in the user menu), so the view tag «PRO · Spoke · <PdC>» is drawn whole at 1300 px */
@media (max-width: 1440px) { .view-sw span, .userbtn .un { display: none; } }
@media (max-width: 1280px) { .gsearch { max-width: 300px; } }
@media (max-width: 1180px) { .ab-brand { width: auto; } .ab-brand > div:last-child { display: none; }
                             .topnav a { padding: 0 10px; } }
@media (max-width: 1000px) { .gsearch { max-width: 200px; min-width: 120px; } }
@media (max-width: 900px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .side { position: fixed; inset: var(--ab-h) auto 0 0; width: 280px; z-index: 40; transform: translateX(-105%);
            transition: transform .2s; height: auto; }
    .nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
    .mini-t { display: none; }
    .ab-brand { width: auto; }
    .appbar { gap: 10px; padding-left: max(12px, env(safe-area-inset-left, 0px));
              padding-right: max(12px, env(safe-area-inset-right, 0px)); }
    main { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
    .view-sw span, .role-chip span { display: none; }
    .role-chip { padding: 0 8px; }
    /* the phone panel always shows the full menu, whatever the wide-screen preference */
    .side-mini { --side-w: 284px; }
    .side-mini .side .t, .side-mini .side .nav-label, .side-mini .side .cnt, .side-mini .side .tw,
    .side-mini .side .chev, .side-mini .side .count { display: revert !important; }
    .side-mini .side .nav-a { justify-content: flex-start; padding: 9px 10px; }
    .side-mini .side nav { padding: 6px 12px 12px; }
}
@media (max-width: 820px) { .gsearch { display: none; } }
/* the main items turn to icons before the phone width: at 606 px the Hub's bar (more items than Home's) ran 9 px
   past the window with their labels */
@media (max-width: 720px) {
    .topnav a .t { display: none; }
    .topnav a { padding: 0 8px; }
}
/* phone: the compact bar is menu, logo, main items as icons, view tag, bell and user; "Cambia vista" stays in the
   user menu */
@media (max-width: 600px) {
    .appbar { gap: 6px; }
    .view-sw, .userbtn .chev { display: none; }
    .userbtn { padding: 5px 4px; }
}

/* ---- Shared components of the pages (W2): tiles, panels, tables, filters, side panels. Each page's own rules
   follow at the end of the file, one section per page. ---- */

/* Summary tiles; a button tile filters, pressed = the filter in force */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.k5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis.k6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
       display: flex; flex-direction: column; gap: 2px; text-align: left; position: relative; min-width: 0; color: var(--fg); }
button.kpi { cursor: pointer; }
button.kpi:hover { border-color: var(--line-strong); }
.kpi[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.kpi .lbl { font-size: 12px; color: var(--fg-2); display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 28px; font-weight: 600; line-height: 1.1; }
.kpi .val small { font-size: 16px; color: var(--fg-3); font-weight: 500; }
.kpi .sub2 { font-size: 12px; color: var(--fg-3); }
.kpi.crit .val { color: var(--crit); }
.kpi.warn .val { color: var(--warn); }
.kpi.crit .lbl .sw { background: var(--crit); }
.kpi.warn .lbl .sw { background: var(--warn); }
.kpi.stale .lbl .sw { background: var(--stale); }
.kpi.ok .lbl .sw { background: var(--ok); }
.sw { width: 8px; height: 8px; border-radius: 2px; background: var(--fg-3); flex: none; display: inline-block; }

/* Panels */
.panel-h { border-bottom: 1px solid var(--line); }
.panel-h .hint { color: var(--fg-3); font-size: 12.5px; }
.panel-b { padding: 14px 16px; }
.badge.crit { background: var(--crit-soft); color: var(--crit); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

/* Live indicator */
.live { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface);
        border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--fg-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); }
                   70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Toolbars, search boxes, selects, segmented filters */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.toolbar.bare { padding: 0; border: 0; }
.search { position: relative; flex: 1 1 240px; min-width: 0; }
.search svg.i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--fg-3); width: 16px; height: 16px; }
.search input { width: 100%; padding: 8px 10px 8px 34px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
select.sel { padding: 8px 30px 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: var(--surface); padding: 7px 12px; cursor: pointer; font-size: 13px; display: flex; gap: 6px;
              align-items: center; border-right: 1px solid var(--line); white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.seg .n { font-size: 11.5px; color: var(--fg-3); }
.seg button[aria-pressed="true"] .n { color: var(--accent); }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); text-align: left;
     padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
th .u { text-transform: none; letter-spacing: 0; font-weight: 400; }
th button.sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; letter-spacing: inherit;
                 text-transform: inherit; cursor: pointer; }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.clk { cursor: pointer; }
tbody tr:hover td { background: var(--surface-2); }
td.sev { width: 6px; padding: 0; }
td.sev i { display: block; width: 4px; height: 44px; border-radius: 0 3px 3px 0; background: transparent; }
tr.crit td.sev i { background: var(--crit); }
tr.warn td.sev i { background: var(--warn); }
.who a { font-weight: 600; color: var(--fg); text-decoration: none; font-size: 14.5px; }
.who a:hover { color: var(--accent); }
.who .meta { color: var(--fg-3); font-size: 12.5px; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 1px; }
.tbl-foot { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; color: var(--fg-3); font-size: 12.5px;
            border-top: 1px solid var(--line); flex-wrap: wrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .02em; }
.meta .sep { opacity: .5; }
.nowrap { white-space: nowrap; }
.on-pill { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 600; padding: 2px 9px;
           border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--fg-2);
           white-space: nowrap; }
.on-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-3); }
.on-pill.on { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.on-pill.on i { background: var(--ok); }

/* last signal: pill, relative time, absolute time; stale = offline for more than 24 hours */
.online { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.online small { color: var(--fg-3); font-size: 12px; }
.online.stale small { color: var(--stale); }
td.no-rows { text-align: center; color: var(--fg-3); padding: 28px; }
.empty { padding: 22px 16px; color: var(--fg-3); display: flex; gap: 8px; align-items: center; }

/* Mini trend */
.spark { width: 56px; height: 22px; overflow: visible; }
.spark path.l { fill: none; stroke: var(--fg-3); stroke-width: 1.4; }
.spark circle { fill: var(--fg-2); }
.spark.crit circle { fill: var(--crit); }
.spark.warn circle { fill: var(--warn); }

/* Side panel (drawer) for create and edit forms */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--surface); z-index: 51;
          display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0, 0, 0, .22); }
.drawer-body { overflow: auto; flex: 1; padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.g2x { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; padding: 16px; margin: 0; }
.fields dt { font-size: 12.5px; color: var(--fg-3); }
.fields dd { margin: 2px 0 0; font-weight: 500; }
.fields dd small { display: block; color: var(--fg-3); font-weight: 400; font-size: 12px; }
textarea.ta, .f textarea { width: 100%; min-height: 86px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px;
                           background: var(--surface); resize: vertical; font: inherit; }
.req::after { content: " *"; color: var(--crit); }
.f .err { color: var(--crit); font-size: 12px; margin-top: 4px; }
.refusal { border: 1px solid var(--crit-line); background: var(--crit-soft); color: var(--crit); border-radius: 8px; padding: 10px 12px;
           font-size: 13px; font-weight: 500; }
/* a refusal in a long form stays in sight: it sticks to the bottom of the scrolling body */
.drawer-body > .refusal { position: sticky; bottom: 0; }
/* a read the server left unanswered: the sentence and its «Riprova» on one line (page banner and panels) */
.refusal.unanswered { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

@media (max-width: 1100px) { .kpis, .kpis.k6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .kpis, .kpis.k4, .kpis.k5, .kpis.k6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .fields, .g2x { grid-template-columns: minmax(0, 1fr); } }


/* ==== Control room (Page.ControlRoom) ==== */
/* The control room (Page/ControlRoom.elm): alarm cards, the table's vital values, last measure, gateways. Values from
   the prototype's control room rules. */
.kpi.bad .val { color: var(--crit); }
svg.i.crit-i { color: var(--crit); }
svg.i.ok-i { color: var(--ok); }
.sw.crit-bg { background: var(--crit); }
.sw.warn-bg { background: var(--warn); }
.sw.stale-bg { background: var(--stale); }

/* Richiedono attenzione */
.alerts { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; padding: 14px 16px; }
.alert { border: 1px solid var(--crit-line); background: var(--crit-soft); border-left: 4px solid var(--crit); border-radius: 8px;
         padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.alert.warn { border-color: var(--warn-line); background: var(--warn-soft); border-left-color: var(--warn); }
.alert.taken { border-color: var(--line); border-left-color: var(--fg-3); background: var(--surface-2); }
.alert-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.alert-top a { font-weight: 600; color: var(--fg); text-decoration: none; font-size: 15px; }
.alert-top a:hover { text-decoration: underline; }
.alert-top time { color: var(--fg-3); font-size: 12px; white-space: nowrap; }
.alert ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.alert li { display: flex; gap: 8px; align-items: baseline; font-size: 13.5px; flex-wrap: wrap; }
.alert li b { color: var(--crit); font-size: 15px; }
.alert li.warn b { color: var(--warn); }
.alert.taken li b { color: var(--fg); }
.alert li span { color: var(--fg-3); font-size: 12.5px; }
.alert-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.alert-actions .btn:disabled { opacity: .55; cursor: default; }
.taken-by { font-size: 12.5px; color: var(--fg-2); display: flex; align-items: center; gap: 6px; }
.taken-by svg.i { width: 15px; height: 15px; }

/* Tutti gli assistiti */
.vital { display: flex; align-items: center; gap: 8px; }
.v { display: inline-flex; align-items: center; gap: 3px; font-weight: 500; font-size: 15px; padding: 2px 7px; border-radius: 6px;
     min-width: 44px; justify-content: center; }
.v.crit { background: var(--crit-soft); color: var(--crit); font-weight: 600; box-shadow: inset 0 0 0 1px var(--crit-line); }
.v.warn { background: var(--warn-soft); color: var(--warn); font-weight: 600; box-shadow: inset 0 0 0 1px var(--warn-line); }
.v .arr { font-size: 11px; }
.v.none { color: var(--fg-3); font-weight: 400; }
.when b { font-weight: 500; display: block; }
.when small { color: var(--fg-3); font-size: 12px; }
.when.stale b { color: var(--stale); }
.gw { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-2); white-space: nowrap; }
.gw i { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-3); }
.gw.on i { background: var(--ok); }
.gw.off i { background: var(--crit); }
.row-go { color: var(--fg-3); }

@media (max-width: 560px) { .alerts { grid-template-columns: minmax(0, 1fr); } }


/* ==== Pazienti (Page.Patients) ==== */
/* The patients list (Page/Patients.elm): contacts, status tags, sortable header, row actions. Values from the prototype. */
.contacts { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.contacts span { display: flex; gap: 6px; align-items: center; color: var(--fg-2); white-space: nowrap; }
.contacts svg.i { width: 13px; height: 13px; color: var(--fg-3); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.th-sort { border: 0; background: none; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit;
           cursor: pointer; padding: 0; display: inline-flex; gap: 4px; align-items: center; }
.th-sort:hover { color: var(--fg); }
td.care { font-size: 13px; }
td.care span { display: block; color: var(--fg-2); }
td.care small { display: block; color: var(--fg-3); font-size: 12px; }
td .acts { gap: 2px; justify-content: flex-start; flex-wrap: nowrap; }
td .acts .btn { padding: 6px; border-color: transparent; background: none; color: var(--fg-2); }
td .acts .btn:hover { background: var(--surface-2); color: var(--accent); }
td .acts .btn svg { width: 17px; height: 17px; }
tr.new td { animation: flash 2.6s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { tr.new td { animation: none; } }


/* ==== Scheda anagrafica, nuovo e modifica (PatientForm) ==== */
/* The patient form (PatientForm.elm): fieldsets in the side panel, values from the prototype's drawer rules. */
.pform { display: flex; flex-direction: column; gap: 24px; padding-bottom: 6px; }
.pform fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.pform legend { font-weight: 600; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--fg-2);
                margin-bottom: 12px; padding: 0; }
.pform .g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.pform .full { grid-column: 1 / -1; }
.pform .mono { font-family: var(--mono); font-size: 12px; letter-spacing: .02em; text-transform: uppercase; }
.pform .f input:disabled, .pform .f select:disabled { opacity: .55; }
.pform .help.good { color: var(--ok); }
.pform .f .msg { color: var(--crit); font-size: 12px; margin-top: 4px; }
.pform .f.err input, .pform .f.err select { border-color: var(--crit); box-shadow: 0 0 0 1px var(--crit); }
.pform .checks { display: flex; flex-direction: column; gap: 8px; }
.pform .check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line);
                border-radius: 8px; cursor: pointer; }
.pform .check input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.pform .check b { display: block; font-weight: 500; }
.pform .check small { color: var(--fg-3); font-size: 12.5px; }
.drawer .btn:disabled { opacity: .55; cursor: default; }
@media (max-width: 560px) { .pform .g2 { grid-template-columns: minmax(0, 1fr); } }


/* ==== Gateway (Page.Gateways) ==== */
/* Registri › Gateway (Page.Gateways). Values from the prototype's CSS (r1.1). The generic .mono, .meta .sep,
   .nowrap, .on-pill and .online are in deepcare.css's shared section. */

/* Wi-Fi signal bars */
.sig { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; margin-right: 6px; vertical-align: -1px; }
.sig i { width: 3px; border-radius: 1px; background: var(--line); }
.sig i:nth-child(1) { height: 4px; }
.sig i:nth-child(2) { height: 7px; }
.sig i:nth-child(3) { height: 10px; }
.sig i:nth-child(4) { height: 12px; }
.sig i.f { background: var(--ok); }
.sig.weak i.f { background: var(--warn); }

td.gw-who { min-width: 170px; }
.gw-who .meta, td .meta.num { color: var(--fg-3); font-size: 12.5px; margin-top: 1px; }
td.gw-none { text-align: center; color: var(--fg-3); padding: 28px; }
.gw-acts { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; white-space: nowrap; }

/* assignment window: the gateway's parked readings of the last 48 hours */
.gw-parked { border: 1px solid var(--line); border-radius: 8px; max-height: 220px; overflow: auto; margin-top: 6px; }
.gw-pk { display: grid; grid-template-columns: auto auto auto minmax(0, 1fr); gap: 10px; align-items: center;
         padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 12.5px; cursor: pointer; }
.gw-pk:last-child { border-bottom: 0; }
.gw-pk:hover { background: var(--surface-2); }
@media (max-width: 600px) {
    .gw-pk { grid-template-columns: auto minmax(0, 1fr); }
    .gw-pk > :nth-child(n+3) { grid-column: 2; }
}


/* ==== Console connessioni (Page.Console) ==== */
/* Registri › Console connessioni (Page.Console). Values from the prototype's CSS (r1.1). */
.con-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
.list { display: flex; flex-direction: column; }
.li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
      padding: 12px 16px; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .ttl { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.li .ttl .gw-name { font-size: 13.5px; }
.li .meta { color: var(--fg-3); font-size: 12.5px; display: flex; gap: 6px; flex-wrap: wrap; }
.li .right { text-align: right; font-size: 12.5px; color: var(--fg-2); }
.li .right small { display: block; color: var(--fg-3); }
.st { width: 10px; height: 10px; border-radius: 50%; background: var(--fg-3); }
.st.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.st.off { background: var(--crit); box-shadow: 0 0 0 3px var(--crit-soft); }
.st.idle { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* the event register: a terminal, dark in both themes */
.term-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 16px;
            border-bottom: 1px solid var(--line); }
.term-bar .search { flex-basis: 200px; }
.term { --term: #0e1622; --term-fg: #cfe0f5; --term-dim: #6f819b;
        background: var(--term); color: var(--term-fg); border-radius: 0 0 var(--r) var(--r); font-family: var(--mono);
        font-size: 12.5px; height: 340px; overflow: auto; padding: 10px 0; }
@media (prefers-color-scheme: dark) { .term { --term: #080d15; --term-dim: #5d6e88; } }
.lg { display: grid; grid-template-columns: 150px 46px 170px minmax(0, 1fr); gap: 12px; padding: 3px 16px;
      white-space: nowrap; }
.lg:hover { background: rgba(255, 255, 255, .04); }
.lg .ts { color: var(--term-dim); }
.lg .src { font-weight: 600; }
.lg .src.GW { color: #7fb2ff; }
.lg .src.APP { color: #7fe0b4; }
.lg .src.SYS { color: #c7b3ff; }
.lg .ent { overflow: hidden; text-overflow: ellipsis; }
.lg .msg { white-space: normal; }
.lg.err .msg { color: #ff8b98; }
.lg.warn .msg { color: #ffc773; }

@media (max-width: 1100px) { .con-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .lg { grid-template-columns: 120px 40px minmax(0, 1fr); } .lg .ent { display: none; } }


/* ==== Dispositivi di misura (Page.Devices) ==== */
/* Registri › Dispositivi di misura (Page.Devices). Values from the prototype's CSS (r1.1); .on-pill and .mono are in
   deepcare.css. */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px;
        display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-h { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-h h3 { margin: 0; font-size: 15.5px; }
.card-h .meta { color: var(--fg-3); font-size: 12.5px; margin-top: 2px; }
.dev-top { display: flex; gap: 12px; align-items: center; min-width: 0; }
.dev-top > div { min-width: 0; }
.dev-ico { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
           display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.dev-ico.unk { background: var(--warn-soft); color: var(--warn); }
.card .kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.card .kv dt { color: var(--fg-3); }
.card .kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.card .kv dd.bat-ok { color: var(--ok); }
.card .kv dd.bat-mid { color: var(--warn); }
.card .kv dd.bat-low { color: var(--crit); }
.docs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line);
        padding-top: 12px; font-size: 13px; }
.docs a { display: inline-flex; gap: 6px; align-items: center; text-decoration: none; font-weight: 500;
          border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; }
.docs a:hover { border-color: var(--accent); background: var(--accent-soft); }
.docs a svg.i { width: 14px; height: 14px; }
.docs .code { margin-left: auto; color: var(--fg-3); font-size: 12px; }
.docs .code a { border: 0; padding: 0; font-weight: 400; }
@media (max-width: 560px) { .cards { grid-template-columns: minmax(0, 1fr); } }


/* ==== Misure da assegnare (Page.Unassigned) ==== */
/* Impostazioni › Misure da assegnare (Page.Unassigned). The patient picker (.pick-*) is also used by the Gateway
   page's assignment window; a shared picker belongs in Ui and deepcare.css (proposed in the W2 report). */
.ua-bar { align-items: flex-start; }
.ua-pick { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ua-pick input { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px;
                 background: var(--surface); }
.ua-refusal { padding: 12px 16px 0; }
.ua-tbl td { vertical-align: top; font-size: 13px; }
.ua-tbl .meta { color: var(--fg-3); font-size: 12px; }
.ua-tbl td.ua-why { white-space: normal; min-width: 13rem; }
.ua-tbl td.ua-none { text-align: center; color: var(--fg-3); padding: 28px; }
.ua-kind { font-weight: 500; }

.pick-chosen { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px;
               border: 1px solid var(--accent); border-radius: 8px; background: var(--accent-soft); font-size: 13.5px; }
.pick-chosen .link-btn { color: var(--accent); }
.pick-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px;
             max-height: 12rem; overflow: auto; margin-top: 4px; }
.pick-list button { border: 0; border-bottom: 1px solid var(--line); background: var(--surface); text-align: left;
                    padding: 7px 10px; cursor: pointer; font-size: 13.5px; }
.pick-list button:last-child { border-bottom: 0; }
.pick-list button:hover { background: var(--surface-2); }


/* ==== Medici (Page.Doctors) ==== */
/* Medici (Page/Doctors.elm): contacts column, the name that opens the form, delete buttons, the three-column form
   row (also used by Messaggi). Values from the prototype. The form takes the .pform rules of the patient form. */
.contacts { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.contacts span { display: flex; gap: 6px; align-items: center; color: var(--fg-2); white-space: nowrap; }
.contacts svg.i { width: 13px; height: 13px; color: var(--fg-3); }
.who button.name { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; font-size: 14.5px;
                   color: var(--fg); cursor: pointer; text-align: left; }
.who button.name:hover { color: var(--accent); }
.pform .g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
@media (max-width: 560px) { .pform .g3 { grid-template-columns: minmax(0, 1fr); } }
.btn.danger { color: var(--crit); }
.df-foot .btn.danger { margin-right: auto; }


/* ==== Reparti (Page.Wards) ==== */
/* Reparti e stanze (Page/Wards.elm): ward cards, the room generator, the ward's threshold table. Values from the
   prototype. */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px;
        display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-h { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-h h3 { margin: 0; font-size: 15.5px; }
.card-h .meta { color: var(--fg-3); font-size: 12.5px; margin-top: 2px; }
.card-h .acts { gap: 2px; flex-wrap: nowrap; }
.card-h .acts .btn { padding: 6px; border-color: transparent; background: none; color: var(--fg-2); }
.card-h .acts .btn:hover { background: var(--surface-2); color: var(--accent); }
.card-h .acts .btn svg { width: 17px; height: 17px; }
.card .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; margin: 0; }
.card .stats dt { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .06em; }
.card .stats dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.rooms { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border-top: 1px solid var(--line);
         padding-top: 12px; }
.room { font-size: 12.5px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px;
        background: var(--surface-2); color: var(--fg-2); }
.room b { color: var(--fg); font-weight: 600; }
.gen { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13.5px; color: var(--fg-2);
       padding: 12px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--surface-2); }
.gen input { width: 70px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 6px;
             background: var(--surface); }
.rooms-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 10px; }
.rooms-list:empty { display: none; }
.room-row { display: flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 8px;
            padding: 6px 6px 6px 10px; font-size: 12.5px; color: var(--fg-3); }
.room-row input { width: 56px; padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 6px;
                  background: var(--surface); min-width: 0; }
.room-row button { margin-left: auto; border: 0; background: none; color: var(--fg-3); cursor: pointer; padding: 4px;
                   border-radius: 6px; display: grid; }
.room-row button svg.i { width: 14px; height: 14px; }
.room-row button:hover { color: var(--crit); background: var(--crit-soft); }
.rooms-sum { font-size: 12.5px; color: var(--fg-2); margin-top: 8px; }
.thr-tbl { min-width: 520px; margin-top: 12px; }
.thr-tbl td, .thr-tbl th { padding: 8px 12px; }
.thr-tbl input { width: 100%; max-width: 120px; padding: 6px 8px; border: 1px solid var(--line-strong);
                 border-radius: 6px; background: var(--surface); }
.thr-tbl input::placeholder { color: var(--fg-3); }
@media (max-width: 560px) {
    .cards { grid-template-columns: minmax(0, 1fr); }
    .card .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ==== Messaggi ai pazienti (Page.Messages) ==== */
/* Messaggi ai pazienti (Page/Messages.elm): answer bars, content tags, the open message, the gateway preview in the
   form. Values from the prototype. */
.rbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); min-width: 110px; }
.rbar i { display: block; height: 100%; }
.rbar .yes, .msg-legend .sw.yes { background: var(--ok); }
.rbar .no, .msg-legend .sw.no { background: var(--crit); }
.rbar .none, .msg-legend .sw.none { background: var(--warn); }
.rbar .undelivered, .msg-legend .sw.undelivered { background: var(--fg-3); }
.ctags { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { font-size: 11.5px; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--line); color: var(--fg-2);
        white-space: nowrap; }
tbody tr.sel td { background: var(--accent-soft); }
.msg-detail .panel-h h2 { flex-wrap: wrap; }
.msg-detail .panel-h .acts { align-items: center; }
.msg-body { display: flex; flex-direction: column; gap: 10px; }
.msg-body p { margin: 0; }
.msg-body .quote { color: var(--fg); }
.msg-body .quote.en { color: var(--fg-2); }
.msg-body .counts { display: flex; flex-wrap: wrap; gap: 8px; }
.msg-body .counts .badge { font-size: 12.5px; padding: 3px 10px; }
.msg-detail tr.yes td { background: var(--ok-soft); }
.pform textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px;
                  background: var(--surface); resize: vertical; font: inherit; }
.form-problems { margin: 0; padding-left: 18px; color: var(--crit); font-size: 13px; }
.send-problem { color: var(--warn); font-size: 13px; }
.gwprev { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.gwprev .help { max-width: 240px; margin: 0 0 8px; }
.gwscreen { width: 250px; max-width: 100%; background: #0b1220; color: #e9eef6; border-radius: 16px;
            border: 6px solid #1f2937; padding: 12px; display: flex; flex-direction: column; gap: 8px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.gwscreen .media { height: 96px; border-radius: 8px; background: #1b2536; display: grid; place-items: center;
                   color: #7f8ea5; font-size: 12px; overflow: hidden; }
.gwscreen .media img { height: 100%; width: auto; object-fit: contain; }
.gwscreen .txt { font-size: 13px; line-height: 1.35; min-height: 36px; overflow-wrap: anywhere; }
.gwscreen .snd { font-size: 11px; color: #9fb0c8; }
.gwscreen .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gwscreen .btns span { border-radius: 8px; text-align: center; padding: 6px; font-weight: 700; font-size: 13px; }
.gwscreen .ok { background: #16a34a; }
.gwscreen .no { background: #dc2626; }
.msg-img-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.msg-body .msg-img { width: 96px; height: 96px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
                     object-fit: contain; }


/* ==== Tassonomia (Page.Taxonomy) ==== */
/* Tassonomia della rete (Page/Taxonomy.elm): eight indicators, the network map drawn as one SVG, the measure's
   flow, the detail of the selection. Values from the prototype's .net and .node rules, restated for SVG. */
.kpis.k8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.net-wrap { overflow-x: auto; padding: 6px 18px 12px; }
.net-map { display: block; width: 100%; min-width: 640px; height: auto; font-family: var(--font); }
.net-map .col-h { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; fill: var(--fg-3);
                  font-weight: 600; }
.net-map .edges path { fill: none; stroke: var(--line-strong); stroke-width: 1.6; transition: stroke .2s, opacity .2s; }
.net-map .edges path.hot { stroke: var(--accent); stroke-width: 2.2; }
.net-map.focus .edges path:not(.hot) { opacity: .25; }
.net-map .node { cursor: pointer; transition: opacity .2s; }
.net-map .node:focus { outline: none; }
.net-map .node .box { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; transition: stroke .15s; }
.net-map .node:hover .box, .net-map .node:focus-visible .box { stroke: var(--accent); }
.net-map .node .strip { fill: var(--accent); }
.net-map .node.off { opacity: .6; }
.net-map .node.off .strip { fill: var(--line-strong); }
.net-map .node.sel .box { stroke: var(--accent); stroke-width: 2.5; }
.net-map .node.dim { opacity: .4; }
.net-map .node.pro .box { stroke-dasharray: 5 4; }
.net-map.focus .node:not(.hot):not(.struct) { opacity: .45; }
.net-map .node .ic { fill: none; stroke: var(--fg-3); stroke-width: 1.8; stroke-linecap: round;
                     stroke-linejoin: round; }
.net-map .node .nk { font-size: 12.5px; fill: var(--fg-2); font-weight: 500; }
.net-map .node .nv { font-size: 21px; font-weight: 600; fill: var(--fg); font-variant-numeric: tabular-nums; }
.net-map .node .nv-small { font-size: 13px; fill: var(--fg-3); font-weight: 500; }
.net-map .node.alarm .nv { fill: var(--crit); }
.net-map .node .ns { font-size: 12px; fill: var(--fg-3); }
.flow { display: flex; gap: 0; overflow-x: auto; padding: 14px 16px; }
.step { flex: 1 0 140px; display: flex; flex-direction: column; gap: 2px; padding: 10px 14px 10px 22px;
        border: 1px solid var(--line); background: var(--surface-2); position: relative; cursor: default;
        clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%); }
.step:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%);
                    padding-left: 14px; }
.step:hover, .step:focus-visible { background: var(--accent-soft); }
.step b { font-size: 13px; }
.step .t { font-size: 18px; font-weight: 600; }
.step small { color: var(--fg-3); font-size: 11.5px; }
.detail { padding: 16px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr); gap: 18px;
          border-top: 1px solid var(--line); }
.detail h3 { margin: 0 0 4px; font-size: 16px; }
.detail p { margin: 0; color: var(--fg-2); font-size: 13.5px; max-width: 60ch; }
.detail .stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px 12px;
                 margin: 0; }
.detail .stats dt { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .06em; }
.detail .stats dd { margin: 2px 0 0; font-weight: 500; font-size: 18px; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .detail { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .kpis.k8 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }


/* ==== Scheda paziente (Page.Patient, Chart) ==== */
/* The patient card (Page/Patient.elm) and its trend charts (Chart.elm). Values from the prototype's "Scheda paziente"
   rules; .on-pill and .online are shared (deepcare.css). */
.sk-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.sk-head h1 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sk-head .sk-meta { margin: 4px 0 0; }
.sk-head .live .online { align-items: flex-end; }
.qr-miss { font-size: 12px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.sec-title { font-size: 13px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--fg-3);
             margin: 8px 0 -6px; display: flex; align-items: center; gap: 8px; }
svg.i.ok { color: var(--ok); }
svg.i.crit { color: var(--crit); }
.btn.danger, .link-btn.danger { color: var(--crit); }
.wrap { white-space: normal; }

/* Gateways */
.gw-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 16px; }
.gw-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column;
           gap: 3px; }
.gw-card .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.gw-card .gw-name { font-size: 13.5px; }
.gw-card .gw-since { font-size: 12.5px; }
.gw-pick { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 300px; overflow: auto; }
.gw-opt { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line);
          border-radius: 8px;
          background: var(--surface); cursor: pointer; text-align: left; color: var(--fg); }
.gw-opt:hover { border-color: var(--line-strong); background: var(--surface-2); }
.gw-opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.gw-opt .badge { margin-left: auto; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.qr-box patient-qr { display: block; width: 288px; max-width: 100%; aspect-ratio: 1; }
.qr-box .qr-text { word-break: break-all; }

/* Monitor: deliberately dark in both themes */
.mon { --m-bg: #04070c; --m-tile: #0d141f; --m-line: #1c2636; --m-fg: #e9eef6; --m-dim: #7f8ea5;
       --m-nibp: #f2f5fa; --m-spo2: #38d1ff; --m-temp: #ff8d3a; --m-hr: #36e27b; --m-ews: #ffd23f; --m-alarm: #ff4d5e;
       background: var(--m-bg); color: var(--m-fg); border-radius: 12px; padding: 8px; border: 1px solid var(--m-line);
       display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; max-width: 920px;
       grid-template-areas: "top top top top top" "nibp spo2 hr temp ews" "ecg ecg ecg ecg ecg" "bot bot bot bot bot"; }
.mon-top { grid-area: top; display: flex; gap: 10px; align-items: center; justify-content: space-between;
           flex-wrap: wrap;
           padding: 2px 4px; }
.mon-top .who2 { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.mon-top b { font-size: 14.5px; }
.mon-top .d { color: var(--m-dim); font-size: 12.5px; }
.mon-alarm { background: rgba(255, 77, 94, .15); border: 1px solid var(--m-alarm); color: #ffb3bb; border-radius: 6px;
             padding: 4px 10px; font-size: 12.5px; font-weight: 600; }
.mt { background: var(--m-tile); border: 1px solid var(--m-line); border-radius: 7px; padding: 6px 9px;
      position: relative;
      min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 2px; color: var(--c); }
.mt .lab { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 600;
           letter-spacing: .05em; }
.mt .lab small { color: var(--m-dim); font-weight: 400; letter-spacing: 0; }
.mt .big { font-size: clamp(22px, 2.1vw, 30px); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums;
           letter-spacing: -.01em; }
.mt .big.sm { font-size: 19px; }
.mt .big .unit { font-size: 12px; color: var(--m-dim); font-weight: 400; }
.mt .big.none { color: var(--m-dim); font-weight: 400; }
.mt .mrow { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.mt .aux { font-size: 12px; color: var(--m-dim); }
.mt .aux b { color: var(--c); font-size: 16px; }
.mt .age { font-size: 10.5px; color: var(--m-dim); }
.mt .age.old { color: #c9b8ff; }
.mt.alarm { border-color: var(--m-alarm); box-shadow: inset 0 0 0 1px var(--m-alarm); }
.mt.alarm .lab::after { content: "ALLARME"; background: var(--m-alarm); color: #fff; border-radius: 4px; padding: 0 6px;
                        font-size: 10.5px; }
.mt.alarm .big { animation: mblink 1.2s steps(2, start) infinite; }
@keyframes mblink { 50% { color: var(--m-alarm); } }
.m-nibp { grid-area: nibp; --c: var(--m-nibp); }
.m-spo2 { grid-area: spo2; --c: var(--m-spo2); }
.m-temp { grid-area: temp; --c: var(--m-temp); }
.m-hr { grid-area: hr; --c: var(--m-hr); }
.m-ews { grid-area: ews; --c: var(--m-ews); }
.m-ecg { grid-area: ecg; --c: var(--m-hr); display: grid !important; grid-template-columns: 120px minmax(0, 1fr);
         grid-template-rows: auto 1fr auto; column-gap: 10px; }
.m-ecg .lab, .m-ecg .note { grid-column: 1 / -1; }
.m-ecg .mrow { flex-direction: column; align-items: flex-start; gap: 2px; }
.m-ecg .note { font-size: 11px; color: var(--m-dim); }
.m-ecg .ecg-link { color: var(--m-hr); font-size: 11px; padding: 0; text-decoration: underline; }
.ecg-run { width: 100%; height: 58px; display: block; border-radius: 6px; overflow: hidden;
           background: repeating-linear-gradient(0deg, transparent 0 19px, rgba(54, 226, 123, .08) 19px 20px),
                       repeating-linear-gradient(90deg, transparent 0 19px, rgba(54, 226, 123, .08) 19px 20px); }
.ecg-run path { fill: none; stroke: #36e27b; stroke-width: 2; stroke-linejoin: round;
                vector-effect: non-scaling-stroke; }
.ecg-run .sweep { animation: ecg-run linear infinite; }
@keyframes ecg-run { to { transform: translateX(calc(-1 * var(--d))); } }
.mon-bot { grid-area: bot; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px;
           background: var(--m-tile);
           border: 1px solid var(--m-line); border-radius: 8px; padding: 4px 6px; }
.mb { text-align: center; padding: 4px; min-width: 0; }
.mb span { display: block; font-size: 10.5px; color: var(--m-dim); }
.mb b { font-size: 15px; font-variant-numeric: tabular-nums; }
.mb small { color: var(--m-dim); font-size: 11px; }
.mb .age { display: block; font-style: normal; font-size: 10px; color: var(--m-dim); }
.mb.alarm b { color: var(--m-alarm); }
.ews-dots { display: flex; gap: 4px; }
.ews-dots i { width: 10px; height: 10px; border-radius: 50%; background: #2a3445; }
.ews-dots i.on0 { background: #36e27b; }
.ews-dots i.on1 { background: #ffd23f; }
.ews-dots i.on2 { background: #ff8d3a; }
.ews-dots i.on3 { background: #ff4d5e; }

/* Trend charts */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px; }
.chart { border: 1px solid var(--line); border-radius: 8px; padding: 12px 12px 6px; min-width: 0; position: relative; }
.chart h4 { margin: 0 0 4px; font-size: 13.5px; display: flex; justify-content: space-between; gap: 8px;
            flex-wrap: wrap; }
.chart h4 span { font-weight: 400; color: var(--fg-3); font-size: 12px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .ax text { fill: var(--fg-3); font-size: 10.5px; font-family: var(--font); }
.chart .thr { stroke: var(--crit); stroke-width: 1; stroke-dasharray: 4 3; opacity: .7; }
.chart .thr-l { fill: var(--crit); font-size: 10px; }
.chart .ser { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { stroke: var(--surface); stroke-width: 2; }
.chart .lbl { font-size: 11px; fill: var(--fg); font-weight: 600; }
.chart .empty-c { display: grid; place-items: center; height: 150px; color: var(--fg-3); font-size: 13px;
                  text-align: center; }
.s1 { --c: #2a78d6; }
.s2 { --c: #eb6834; }
.s3 { --c: #1baf7a; }
.leg { display: flex; gap: 12px; font-size: 12px; color: var(--fg-2); flex-wrap: wrap; }
.leg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 5px;
         vertical-align: -1px; }

/* Data archive and its window */
.archive { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px; }
.arc { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column;
       gap: 4px;
       text-align: left; background: var(--surface); cursor: pointer; min-width: 0; color: var(--fg); }
.arc:hover { border-color: var(--accent); background: var(--accent-soft); }
.arc .h { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.arc .h span { color: var(--fg-3); font-weight: 500; }
.arc .s { color: var(--fg-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
          -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.arc .go { color: var(--accent); font-size: 12.5px; font-weight: 500; margin-top: auto; display: flex; gap: 4px;
           align-items: center; }
.arc .go svg.i { width: 14px; height: 14px; }
.arc-note { margin: 0; padding: 0 16px 14px; }
.modal.dm { width: min(1040px, calc(100% - 32px)); height: min(84vh, 760px); }
.modal.dm .modal-body table { min-width: 640px; }
.modal.dm .modal-body th { position: sticky; top: 0; z-index: 1; }
.modal .btn:disabled { opacity: .55; cursor: default; }
td.dm-empty { text-align: center; color: var(--fg-3); padding: 28px; }

/* "Scarica dati" */
.dl-form { display: flex; flex-direction: column; gap: 14px; }
.dl-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.dl-form legend { font-weight: 600; font-size: 12px; letter-spacing: .07em; text-transform: uppercase;
                  color: var(--fg-2);
                  margin-bottom: 12px; padding: 0; }
.dl-form .g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.dl-form .dl-msg { margin: 0; }
.dl-form .checks { display: flex; flex-direction: column; gap: 8px; }
.dl-form .check, .drawer-body > .check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
                                        border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.dl-form .check input, .drawer-body > .check input { margin-top: 2px; width: 16px; height: 16px;
                                                     accent-color: var(--accent); flex: none; }
.dl-form .check b, .drawer-body > .check b { display: block; font-weight: 500; }
.dl-form .check small { color: var(--fg-3); font-size: 12.5px; }

/* Agenda of measurements and therapy */
.kind-btn { color: var(--c); }
.agenda { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.sync-list { display: flex; flex-direction: column; gap: 6px; }
.sync { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 12px; border-radius: 8px;
        background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.sync.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.sync.bad { background: var(--crit-soft); border-color: var(--crit-line); }
.ag-item { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 14px; border: 1px solid var(--line);
           border-left: 4px solid var(--c); border-radius: 8px; padding: 12px 14px; align-items: start; }
.ag-item.off { opacity: .6; }
.ag-item .pic, .ag-pic-edit .pic { width: 72px; height: 72px; border-radius: 8px; border: 1px solid var(--line);
                                   display: grid;
                                   place-items: center; background: var(--surface-2); color: var(--c); overflow: hidden;
                                   flex: none; }
.ag-item .pic img, .ag-pic-edit .pic img { width: 100%; height: 100%; object-fit: contain; }
.ag-item .kind { font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
                 color: var(--c); }
.ag-item h4 { margin: 2px 0 6px; font-size: 15px; }
.ag-item .acts.confirm { align-items: center; }
.ag-times { font-size: 13px; }
.ag-times b { color: var(--fg); }
.days { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.days span, .days button { font-size: 11.5px; width: 30px; text-align: center; padding: 2px 0; border-radius: 999px;
                           background: var(--surface-2); color: var(--fg-3); border: 1px solid var(--line); }
.days span.on, .days button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.days.pick button { width: 42px; padding: 5px 0; cursor: pointer; font: inherit; font-size: 12.5px; }
.days.pick button:not(.on) { text-decoration: line-through; }
.say { font-style: italic; border-left: 2px solid var(--line-strong); padding-left: 10px; color: var(--fg-2);
       font-size: 13.5px;
       margin-top: 6px; }
.say .say-en { font-style: normal; color: var(--fg-3); font-size: 12px; margin-top: 2px; }
.ag-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.ag-day { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-height: 62px; font-size: 12px;
          min-width: 0; }
.ag-day b { display: block; font-size: 11.5px; color: var(--fg-3); font-weight: 600; text-transform: uppercase;
            letter-spacing: .05em; }
.ag-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ag-ev { display: block; margin-top: 4px; border-radius: 5px; padding: 2px 6px; white-space: nowrap; overflow: hidden;
         text-overflow: ellipsis; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--fg); }
.ag-pic-edit { display: flex; gap: 12px; align-items: center; }
.ag-pic-edit .pic-ctl { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.from-cat { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }
.inline-check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--fg-2); }
.times { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.times .time { display: inline-flex; gap: 2px; align-items: center; }
.times input[type="time"] { width: auto; padding: 6px 8px; font-family: var(--mono); font-size: 12.5px; }
.times input.bad { border-color: var(--crit); }
.times .link-btn { font-size: 15px; padding: 2px 4px; }
.times .link-btn.add { font-size: 13px; color: var(--accent); }
.df-foot .left.err { color: var(--crit); }

/* Adherence */
.adh-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px 16px 0; }
.adh-grid { padding: 16px; overflow-x: auto; }
.adh-grid table { min-width: 720px; }
.adh-grid th, .adh-grid td { padding: 5px 4px; text-align: center; border: 0; background: none; }
.adh-grid th { font-size: 10.5px; text-transform: none; letter-spacing: 0; font-weight: 500; line-height: 1.2; }
.adh-grid th b { font-size: 12px; color: var(--fg); }
.adh-grid td.nm { text-align: left; white-space: nowrap; padding-right: 14px; }
.adh-grid td.nm.off { color: var(--fg-3); text-decoration: line-through; }
.adh-grid td.nm small { display: block; color: var(--fg-3); font-family: var(--mono); font-size: 11.5px; }
.adh-grid tbody tr:hover td { background: none; }
.adh-legend { margin-top: 10px; color: var(--fg-3); font-size: 12.5px; }
.cell { width: 26px; height: 26px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 13px;
        font-weight: 700;
        border: 0; padding: 0; }
.cell.sm { width: 16px; height: 16px; font-size: 10px; }
.cell.ok { background: var(--ok); color: #fff; }
.cell.miss { background: var(--crit-soft); color: var(--crit); box-shadow: inset 0 0 0 1px var(--crit-line); }
.cell.wait { border: 1.5px dashed var(--line-strong); }
.cell.none { background: transparent; }
.cell.ans { cursor: pointer; }
.cell.ans:hover { box-shadow: 0 0 0 2px var(--accent); }
.slot { position: relative; display: inline-block; }
.ans-pop { position: absolute; z-index: 5; top: 30px; left: 50%; transform: translateX(-50%); width: 200px;
           background: var(--surface);
           border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(0, 0, 0, .16); padding: 8px;
           display: flex; flex-direction: column; gap: 8px; text-align: left; font-size: 12px; white-space: normal; }
.ans-pop .acts { justify-content: stretch; }
.ans-pop .acts .btn { flex: 1; justify-content: center; }

/* Thresholds, services, documents */
.thr-tbl, .svc-tbl, .doc-tbl { min-width: 560px; }
.thr-tbl td, .thr-tbl th { padding: 8px 12px; }
.thr-tbl input { width: 100%; max-width: 120px; padding: 6px 8px; border: 1px solid var(--line-strong);
                 border-radius: 6px;
                 background: var(--surface); }
.thr-tbl input::placeholder { color: var(--fg-3); }
.svc-form { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 12px 16px;
            border-bottom: 1px solid var(--line); align-items: center; }
.svc-form input[type="text"], .svc-form input[type="date"] { width: 100%; padding: 7px 9px;
                                                             border: 1px solid var(--line-strong);
                                                            border-radius: 8px; background: var(--surface); }
.svc-form .wide { grid-column: span 2; }
.svc-form .refusal { grid-column: 1 / -1; }
.svc-tbl .small { font-size: 12px; }

@media (max-width: 1100px) {
    .mon { grid-template-columns: repeat(3, minmax(0, 1fr));
           grid-template-areas: "top top top" "nibp nibp spo2" "hr temp ews" "ecg ecg ecg" "bot bot bot"; }
    .svc-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) { .archive { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
    .two, .charts { grid-template-columns: minmax(0, 1fr); }
    .mon-bot { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .adh-kpis { grid-template-columns: minmax(0, 1fr); }
    .ag-item { grid-template-columns: minmax(0, 1fr); }
    .ag-item .pic { display: none; }
    .ag-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .svc-form { grid-template-columns: minmax(0, 1fr); }
    .svc-form .wide { grid-column: auto; }
    .dl-form .g2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .mon { padding: 6px; gap: 5px; border-radius: 10px; grid-template-columns: repeat(2, minmax(0, 1fr));
           grid-template-areas: "top top" "nibp nibp" "spo2 hr" "temp ews" "ecg ecg" "bot bot"; }
    .mon-top { padding: 2px; }
    .mon-top .d { font-size: 11.5px; }
    .mon-alarm { font-size: 11.5px; padding: 3px 8px; }
    .mt .big { font-size: 24px; }
    .mt { padding: 5px 8px; }
    .mt .lab { font-size: 10.5px; }
    .mt .aux { font-size: 11px; }
    .mt .aux b { font-size: 14px; }
    .m-ecg { grid-template-columns: minmax(0, 1fr); }
    .m-ecg .mrow { flex-direction: row; align-items: baseline; gap: 8px; }
    .ecg-run { height: 46px; }
    .mon-bot { display: flex; overflow-x: auto; gap: 4px; }
    .mb { flex: 0 0 auto; min-width: 76px; }
    .mb b { font-size: 14px; }
    .ews-dots i { width: 8px; height: 8px; }
}
@media (prefers-reduced-motion: reduce) { .mt.alarm .big, .ecg-run .sweep { animation: none; } }

/* ==== Referti ricevuti (Page.Spoke.Reports) ==== */
/* PRO · Spoke › Referti ricevuti. Values from the prototype's CSS (3.0): .pro-body, .pro-sub, .opt-list, .sla-c are
   the prototype's generic rules, repeated here with its values; the sr- rules are this page's. */
.pro-body { display: flex; flex-direction: column; gap: 16px; }
.pro-sub { font-size: 12.5px; padding: 8px 12px; margin-top: 16px; }
.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt-list label { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px;
                  padding: 10px 12px; cursor: pointer; font-size: 14px; }
.opt-list label small { display: block; color: var(--fg-3); font-size: 12.5px; }
.opt-list input { margin-top: 3px; }
.sla-c, .sla-c .meta { white-space: nowrap; }
.sr-search { max-width: 460px; }
.kpi.sr-due .val { color: var(--ok); }
.sr-tbl td { vertical-align: top; }
.sr-tbl .meta { color: var(--fg-3); font-size: 12.5px; margin-top: 2px; }
.sr-kv { display: flex; gap: 6px; flex-wrap: wrap; max-width: 260px; }
.sr-warn { color: var(--warn); font-weight: 600; }
.sr-more { color: var(--accent); display: block; margin-top: 2px; }
.sr-acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.sr-acts .btn { white-space: nowrap; }
tr.sr-open td { border-bottom: 0; }
tr.sr-detail td { background: var(--surface-2); }
.sr-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; padding: 4px 0; }
.sr-col { display: flex; flex-direction: column; gap: 12px; }
.sr-cap { font-size: 12px; color: var(--fg-3); font-weight: 600; margin-bottom: 3px; }
.sr-values { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.sr-value { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
            background: var(--surface); }
.sr-value .k { font-size: 12px; color: var(--fg-3); }
.sr-value .v { font-weight: 600; }
.sr-text { white-space: pre-wrap; font-size: 14px; }
.sr-acts-narrow { display: none; }
@media (max-width: 760px) {
    .sr-grid { grid-template-columns: minmax(0, 1fr); }
    .sr-tbl .sr-acts-col { display: none; }
    .sr-acts.sr-acts-narrow { display: flex; justify-content: flex-start; margin-top: 8px; }
}

/* ==== Esami inviati e Pazienti dello Spoke (Page.Spoke.Sent, Page.Spoke.NewExam, Page.Spoke.Patients) ==== */
/* PRO · Spoke. Values from the prototype's CSS (3.0): .nex-*, .opt-list button.res, .ref-paz and .ex-chips are the
   prototype's generic rules with its values; .opt-list and .sla-c are in the Referti ricevuti section; the sp- rules
   are these pages'. */
.modal.nex-modal { width: min(720px, calc(100% - 32px)); height: auto; max-height: 92vh; }
.nex-body { overflow: auto; flex: 1; }
.nex-fs { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column;
          gap: 10px; margin: 0; min-width: 0; }
.nex-fs legend { font-weight: 700; font-size: 13px; padding: 0 6px; }
.nex-fs .search { flex: none; max-width: none; }
.nex-fs textarea { width: 100%; min-height: 0; padding: 8px 10px; border: 1px solid var(--line-strong);
                   border-radius: 8px; background: var(--surface); color: var(--fg); font: inherit; font-size: 14px;
                   resize: vertical; }
.nex-fs input[readonly] { background: var(--surface-2); color: var(--fg-2); }
.nex-fs .f .opt { font-weight: 400; }
.nex-fs .meta { color: var(--fg-3); font-size: 12.5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.nex-fs .cf-dup { color: var(--warn); font-weight: 600; }
.nex-fs .help .link-btn, .nex-fs .meta .link-btn { color: var(--accent); text-decoration: underline; padding: 0; }
.opt-list button.res { display: flex; justify-content: space-between; gap: 10px; align-items: center; text-align: left;
                       border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--surface);
                       cursor: pointer; font-size: 14px; width: 100%; }
.opt-list button.res:hover { border-color: var(--accent); }
.opt-list button.res small { display: block; color: var(--fg-3); font-size: 12.5px; }
.opt-list .btn { align-self: flex-start; }
.ref-paz { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.ex-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.ex-chips button { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 1px 7px;
                   font: inherit; font-size: 12px; cursor: pointer; color: var(--fg-2); white-space: nowrap; }
.ex-chips button:hover { border-color: var(--accent); color: var(--accent); }
.kpi.deliver .val { color: var(--ok); }
.sp-filtered { font-size: 12.5px; }
.sp-toolbar .search { max-width: 460px; }
.sp-exams td .badge + .badge { margin-left: 4px; }
.sp-exams .meta { color: var(--fg-3); font-size: 12.5px; margin-top: 2px; }
.sp-exams .acts .btn { white-space: nowrap; }
.sp-exams .link-btn { padding: 0; }
.sp-none { text-align: center; color: var(--fg-3); padding: 28px; }
@media (max-width: 600px) {
    .modal.nex-modal { max-height: 96vh; }
    .sp-head .live { width: 100%; justify-content: space-between; }
}

/* ==== Metodica dello Spoke (Page.Spoke.Method) ==== */
/* Values from the prototype's CSS (.pro-body, .devbar, .devlist, .reg-*, #ecgv), scoped to the page's .spk-method
   so that another PRO page defining the same names is not affected. .dev-ico and .docs are the Devices section's. */
.spk-method { display: flex; flex-direction: column; gap: 16px; }
.toolbar.bare:has(+ .spk-method) .search { max-width: 460px; }
.spk-method .devlist { display: flex; flex-direction: column; gap: 8px; }
.spk-method .devbar { display: flex; align-items: center; gap: 14px 20px; flex-wrap: wrap; background: var(--surface);
                      border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; }
.spk-method .devbar .nm { display: flex; flex-direction: column; min-width: 0; }
.spk-method .devbar .nm b { font-size: 14.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.spk-method .devbar .nm small { color: var(--fg-3); font-size: 12.5px; }
.spk-method .devbar .use { font-size: 13px; color: var(--fg-2); }
.spk-method .devbar .use b { color: var(--fg); font-weight: 600; }
.spk-method .devbar .docs { border: 0; padding: 0; margin-left: auto; }
.spk-method .devbar .docs .code { margin-left: 4px; }
.spk-method .reg-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
                       font-size: 13px; }
.spk-method .reg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px;
                        padding: 16px; }
.spk-method .reg-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex;
                        flex-direction: column; background: var(--surface); }
.spk-method .reg-thumb { border: 0; padding: 0; margin: 0; background: #fff; cursor: zoom-in; display: block;
                         border-bottom: 1px solid var(--line); aspect-ratio: 2 / 1; overflow: hidden; width: 100%; }
.spk-method .reg-thumb > * { width: 100%; height: 100%; }
.spk-method .reg-thumb canvas, .spk-method .reg-thumb img, .spk-method .reg-thumb svg { width: 100%; height: 100%;
                                                                                       object-fit: cover; display: block; }
/* The ECG thumbnail keeps the top of the sheet, its header (assistito, CF, date, device), and crops the bottom. */
.spk-method .reg-thumb ecg-print canvas { object-position: top; }
.spk-method .reg-thumb:hover, .spk-method .reg-thumb:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.spk-method .reg-info { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.spk-method .reg-info .who b { font-size: 14.5px; }
.spk-method .reg-info time { font-size: 12.5px; color: var(--fg-3); }
.spk-method .reg-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.spk-method .reg-acts .sent-at { font-size: 12.5px; }
.spk-method .reg-info .refusal { font-size: 12.5px; padding: 6px 10px; }
/* A preview not drawn yet, or an image that did not arrive. */
.spk-blank { display: grid; place-items: center; width: 100%; height: 100%; min-height: 120px; color: var(--fg-3);
             font-size: 12.5px; background: var(--surface-2); }
.spk-blank.img { align-content: center; gap: 6px; border: 1px dashed var(--line-strong); }
.spk-blank.img svg.i { width: 22px; height: 22px; }
/* The custom elements of ecg.js: block boxes whose canvas or image fills the width. */
ecg-print, bytes-img { display: block; }
ecg-print canvas, bytes-img img { display: block; width: 100%; height: auto; }
/* The zoom of the Hub's report window (ecg.js, attribute zoomable). */
ecg-print .ecg-zoom-bar { display: flex; gap: 6px; align-items: center; padding: 6px 8px;
                          border-bottom: 1px solid var(--line); background: var(--surface); }
ecg-print .ecg-zoom-bar .btn { min-width: 34px; justify-content: center; }
ecg-print .ecg-zoom-bar .btn:disabled { opacity: .45; cursor: default; }
ecg-print .ecg-zoom-bar .lvl { min-width: 46px; text-align: center; font-weight: 600; font-size: 13px;
                               font-variant-numeric: tabular-nums; color: var(--fg); }
ecg-print .ecg-zoom-view { overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
ecg-print .ecg-zoom-view.zoomed { touch-action: none; cursor: grab; }
ecg-print .ecg-zoom-view.zoomed.dragging { cursor: grabbing; }
ecg-print .ecg-zoom-legend { padding: 5px 10px; font-size: 11.5px; color: var(--fg-3); background: var(--surface);
                             border-top: 1px solid var(--line); }
lazy-ask { display: block; height: 1px; }
.curve-preview { display: block; width: 100%; height: auto; }
/* The window of the enlarged preview (#ecgv): wide, as tall as its content. */
.modal.spk-view { width: min(1040px, calc(100% - 32px)); max-height: 90vh; }
.spk-view-body { padding: 16px; background: var(--surface-2); }
.spk-view-body > ecg-print, .spk-view-body > bytes-img, .spk-view-body > .curve-preview, .spk-view-body > .spk-blank {
    border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.spk-view-body .spk-blank { min-height: 240px; }
.spk-view-body .help { margin: 10px 0 0; }
.spk-view .drawer-h p { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 640px) {
    .spk-method .devbar .docs { margin-left: 0; }
    .spk-method .reg-grid { grid-template-columns: minmax(0, 1fr); padding: 12px; }
    .modal.spk-view { width: calc(100% - 16px); }
    .spk-view-body { padding: 10px; }
}

/* ==== Medici della centrale (Page.Hub.Doctors) ==== */
/* PRO · Hub. The prototype's inline styles of v-medpro: .cards, .card, .dev-*, .card .stats and .ex-chips are generic
   rules in the sections above. On a phone the cards go to one column (Dispositivi di misura section). */
.hd-toolbar { border: 0; }
.hd-cards .card .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hd-lbl { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }

/* ==== Pazienti della centrale (Page.Hub.Patients) ==== */
/* PRO · Hub. The prototype's v-pazpro: .who, .when, .ex-chips and .tbl-wrap (horizontal scroll on a phone) are
   generic rules; the hp- rules are this page's. */
.hp-pdc + .hp-pdc { margin-top: 6px; }
.hp-none { text-align: center; color: var(--fg-3); padding: 28px; }

/* ==== Finestra di refertazione (Page.Hub.ReportWindow) ==== */
/* PRO · Hub. Values from the prototype's CSS (refM: .ref-modal, .ref-grid, .ref-ex, .ref-form, .flow, .sign-box,
   .ref-signed, .ref-ctx, .hl-box, .kvs, .kv, .verdict, .mtiles, dl.vals), scoped to .ref-modal so that the
   Taxonomy's .flow and the Devices' .card .kv are not affected; .ref-paz is the Spoke section's. */
.modal.ref-modal { width: min(1040px, calc(100% - 32px)); height: min(84vh, 760px); max-height: none; }
.ref-modal .ref-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px;
                       padding: 18px 22px; overflow: auto; flex: 1; align-content: start; }
.ref-modal .ref-grid > .refusal { grid-column: 1 / -1; position: sticky; bottom: 0; }
.ref-modal .ref-ex { min-width: 0; }
.ref-modal .ref-form { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ref-modal .ref-form textarea { width: 100%; min-height: 200px; padding: 10px 12px; border-radius: 8px;
                                border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg);
                                font: inherit; font-size: 14px; line-height: 1.45; resize: vertical; }
.ref-modal .ref-form textarea:disabled { background: var(--surface-2); color: var(--fg-2); }
.ref-modal .ref-form input[readonly] { background: var(--surface-2); color: var(--fg-2); }
/* «Assegna» (§8.2): the hub's doctors and the button on one line in the window's «Medico refertante» field */
.ref-modal .rw-assign { display: flex; gap: 8px; align-items: center; }
.ref-modal .rw-assign select { flex: 1; min-width: 0; }
.ref-modal .rw-assign .btn { flex: none; }
.ref-modal .ref-paz .meta { color: var(--fg-3); font-size: 12.5px; display: flex; gap: 6px; flex-wrap: wrap;
                            align-items: center; margin-top: 2px; }
.ref-modal .ref-ctx { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0;
                      font-size: 13px; }
.ref-modal .ref-ctx dt { color: var(--fg-3); }
.ref-modal .ref-ctx dd { margin: 0; }
.ref-modal .ref-ctx .link-btn { color: var(--accent); text-decoration: underline; padding: 0; }
.ref-modal ol.flow { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--fg-3);
                     margin: 0; padding: 0; list-style: none; overflow: visible; }
.ref-modal .flow li { padding: 3px 9px; border-radius: 999px; background: var(--surface-2);
                      border: 1px solid var(--line); }
.ref-modal .flow li small { display: block; font-size: 10.5px; font-weight: 500; opacity: .85; }
.ref-modal .flow li.done { color: var(--ok); border-color: transparent; background: var(--ok-soft); }
.ref-modal .flow li.on { background: var(--accent-soft); color: var(--accent); border-color: transparent;
                         font-weight: 700; }
.ref-modal .flow .arr { border: 0; background: none; padding: 0; color: var(--fg-3); }
.ref-modal dl.vals { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0 0;
                     font-size: 13.5px; align-items: baseline; }
.ref-modal dl.vals dt { color: var(--fg-3); }
.ref-modal dl.vals dd { margin: 0; font-weight: 600; }
.ref-modal dl.rw-times { margin: 0; }
.ref-modal .rw-lim { font-weight: 400; }
.ref-modal .rw-cap { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .06em;
                     margin-bottom: 6px; }
.ref-modal .rw-old .ref-signed { color: var(--fg-2); }
.ref-modal .ref-signed { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap;
                         font-size: 14px; line-height: 1.45; background: var(--surface); }
.ref-modal .sign-box { border: 1px solid var(--accent); border-radius: 10px; padding: 14px;
                       background: var(--accent-soft); display: flex; flex-direction: column; gap: 10px; }
.ref-modal .sign-box b { color: var(--accent); }
.ref-modal .sign-box .meta { color: var(--fg-3); font-size: 12.5px; }
.ref-modal .hl-box { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
                     background: var(--surface); }
.ref-modal .hl-t { font-size: 11.5px; font-weight: 700; color: var(--fg-2); text-transform: uppercase;
                   letter-spacing: .05em; margin-bottom: 4px; }
.ref-modal .kvs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ref-modal .kv { display: inline-flex; flex-direction: column; padding: 3px 9px; border-radius: 8px;
                 background: var(--surface-2); border: 1px solid var(--line); line-height: 1.25; }
.ref-modal .kv small { color: var(--fg-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.ref-modal .kv b { font-size: 13.5px; }
.ref-modal .kv.warn { background: var(--warn-soft); border-color: transparent; }
.ref-modal .kv.warn b { color: var(--warn); }
.ref-modal .rw-trace { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
                       background: #fff; }
.ref-modal .verdict { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border-radius: 8px;
                      margin-top: 10px; background: var(--ok-soft); color: var(--ok); font-weight: 600;
                      font-size: 14px; }
.ref-modal .verdict.warn { background: var(--warn-soft); color: var(--warn); }
.ref-modal .verdict small { display: block; font-size: 11.5px; font-weight: 500; opacity: .8; }
.ref-modal .mtiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0 0; }
.ref-modal .mtile { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
                    min-width: 0; }
.ref-modal .mtile dt { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .05em; }
.ref-modal .mtile dd { margin: 2px 0 0; font-weight: 600; font-size: 17px; white-space: nowrap; }
.ref-modal .mtile dd small { font-size: 12px; color: var(--fg-3); font-weight: 500; margin-left: 2px; }
@media (max-width: 900px) {
    .ref-modal .ref-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .modal.ref-modal { width: calc(100% - 16px); height: calc(100% - 16px); }
    .ref-modal .ref-grid { padding: 14px; }
    .ref-modal .mtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ref-modal .df-foot .left { flex-basis: 100%; }
}

/* ==== Refertazione (Page.Hub.Worklist) ==== */
/* PRO · Hub › Da refertare, Refertati. Values from the prototype's CSS (#v-hub, .kvs, .kv, .bulk, #bulkM, .sign-box,
   .ref-signed, .flow, dl.vals, .hl-box), scoped to the page's .hub-wl and to its two windows (.hw-bulk, .hw-ref) so
   that the Taxonomy's .flow, the Devices' .card .kv and the refertazione window's rules are not affected. */
.hub-wl .toolbar .search { max-width: 380px; }
/* eight columns: 10 px side padding keeps the worklist within the page at 1440 px. WHY the headers and the SLA cell
   wrap here: every column sat at its min-content, set by what never breaks (the nowrap headers, the SLA cell's
   140 px line, badges, buttons), 1089 px against 958 at a 1300 px screen with the menu open, so the actions were cut
   off; «ESAME · ESITO AUTOMATICO» on two lines and the SLA badge under its time free about 150 px */
.hub-wl td { vertical-align: middle; }
.hub-wl th, .hub-wl td { padding-left: 10px; padding-right: 10px; }
.hub-wl th { white-space: normal; }
.hub-wl .sla-c, .hub-wl .sla-c .meta { white-space: normal; }
.hub-wl td .badge + .badge { margin-left: 4px; }
.hub-wl .meta { color: var(--fg-3); font-size: 12.5px; margin-top: 2px; }
.hub-wl .hw-reason { max-width: 240px; }
.hub-wl .hw-check { width: 34px; }
.hub-wl tr.hw-sel td { background: var(--accent-soft); }
/* the actions wrap: on one line they made the worklist 1167 px, wider than the page at 1440 px */
.hub-wl .hw-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.hub-wl .hw-acts .btn { white-space: nowrap; }
.hub-wl .hw-none { text-align: center; color: var(--fg-3); padding: 22px; }
.hub-wl > .refusal { margin: 12px 16px; }
.hub-wl .bulk { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 16px;
                background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: 13.5px; }
.hub-wl .bulk .sp { flex: 1; }
.hub-wl .kvs, .hw-ref .kvs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.hub-wl .kv, .hw-ref .kv { display: inline-flex; flex-direction: column; padding: 3px 9px; border-radius: 8px;
                           background: var(--surface-2); border: 1px solid var(--line); line-height: 1.25; }
.hub-wl .kv small, .hw-ref .kv small { color: var(--fg-3); font-size: 10.5px; text-transform: uppercase;
                                       letter-spacing: .04em; }
.hub-wl .kv b, .hw-ref .kv b { font-size: 13.5px; }
.hub-wl .kv.warn, .hw-ref .kv.warn { background: var(--warn-soft); border-color: transparent; }
.hub-wl .kv.warn b, .hw-ref .kv.warn b { color: var(--warn); }
/* The signature window (#bulkM) and the signed report. */
.modal.hw-bulk, .modal.hw-ref { width: min(720px, calc(100% - 32px)); height: auto; max-height: 90vh; }
.hw-bulk td { vertical-align: top; }
.hw-bulk .meta { color: var(--fg-3); font-size: 12.5px; margin-top: 2px; }
.hw-bulk .hw-excerpt { max-width: 260px; white-space: normal; }
.hw-bulk .sign-box { border: 1px solid var(--accent); border-radius: 10px; padding: 14px; background: var(--accent-soft);
                     display: flex; flex-direction: column; gap: 10px; }
.hw-bulk .sign-box b { color: var(--accent); }
.hw-bulk .hw-confirm { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.hw-ref .ref-paz .meta { color: var(--fg-3); font-size: 12.5px; display: flex; gap: 6px; flex-wrap: wrap; }
.hw-ref .hw-hl { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.hw-ref .hw-lbl { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .06em;
                  margin-bottom: 6px; }
.hw-ref .hw-hl .hw-lbl { font-size: 11.5px; font-weight: 700; color: var(--fg-2); letter-spacing: .05em;
                         margin-bottom: 4px; }
.hw-ref dl.hw-vals { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0 0;
                     font-size: 13.5px; align-items: baseline; }
.hw-ref dl.hw-vals dt { color: var(--fg-3); }
.hw-ref dl.hw-vals dd { margin: 0; font-weight: 600; }
.hw-ref .hw-flow { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--fg-3);
                   margin: 0; padding: 0; list-style: none; }
.hw-ref .hw-flow li { padding: 3px 9px; border-radius: 999px; background: var(--surface-2);
                      border: 1px solid var(--line); }
.hw-ref .hw-flow li.done { color: var(--ok); border-color: transparent; background: var(--ok-soft); }
.hw-ref .hw-flow li.on { background: var(--accent-soft); color: var(--accent); border-color: transparent;
                         font-weight: 700; }
.hw-ref .hw-flow .arr { border: 0; background: none; padding: 0; color: var(--fg-3); }
.hw-ref .ref-signed { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap;
                      font-size: 14px; line-height: 1.45; background: var(--surface); }
@media (max-width: 600px) {
    .hub-wl .toolbar .search { max-width: none; flex: 1 1 100%; }
    .modal.hw-bulk, .modal.hw-ref { width: calc(100% - 16px); max-height: 96vh; }
    .hw-ref .df-foot .left { flex-basis: 100%; }
}


/* ==== Gateway dei punti di cura (Page.Hub.Gateways) ==== */
/* Values from the prototype's renderHubGw: the search box at most 420 px, the device names at most 220 px. */
.hub-gw .toolbar .search { max-width: 420px; }
.hub-gw-devs { max-width: 220px; }


/* ==== Dispositivi di misura PRO (Page.Hub.Devices) ==== */
/* Values from the prototype's CSS (.pro-body, .devlist, .devbar, .hl-t), scoped to the page's .hub-dev as the Spoke's
   methodology page scopes them to .spk-method. .dev-top, .dev-ico and .docs are the Home Devices section's. */
.hub-dev .pro-body { padding: 16px; }
.hub-dev .hl-t { font-size: 11.5px; font-weight: 700; color: var(--fg-2); text-transform: uppercase;
                 letter-spacing: .05em; margin: 4px 0 8px; }
.hub-dev .hl-t a { color: inherit; }
.hub-dev .hl-t a:hover { color: var(--accent); }
.hub-dev .devlist { display: flex; flex-direction: column; gap: 8px; }
.hub-dev .devbar { display: flex; align-items: center; gap: 14px 20px; flex-wrap: wrap; background: var(--surface);
                   border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; }
.hub-dev .devbar .nm { display: flex; flex-direction: column; min-width: 0; }
.hub-dev .devbar .nm b { font-size: 14.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hub-dev .devbar .nm small { color: var(--fg-3); font-size: 12.5px; }
.hub-dev .devbar .use { font-size: 13px; color: var(--fg-2); }
.hub-dev .devbar .use b { color: var(--fg); font-weight: 600; }
.hub-dev .devbar .docs { border: 0; padding: 0; margin-left: auto; }
.hub-dev .devbar .docs .code { margin-left: 4px; }
.hub-dev .devbar .last { font-size: 12.5px; }
@media (max-width: 640px) {
    .hub-dev .pro-body { padding: 12px; }
    .hub-dev .devbar .docs { margin-left: 0; }
}


/* ==== Tassonomia della rete PRO (Page.Hub.Taxonomy, public/flow.js) ==== */
/* The map is the <pro-flow> canvas; .kpis.k8, .net-wrap, .flow, .step and .detail are the Home Tassonomia's. The map
   takes its container's width (flow.js lays it out again on every resize); below 480 px it keeps that width and
   scrolls sideways inside .net-wrap. */
pro-flow { display: block; position: relative; min-width: 480px; border-radius: 10px; }
pro-flow canvas { display: block; }
pro-flow:focus { outline: none; }
pro-flow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==== PdC List (Page.Hub.PdcList) ==== */
/* Values from the prototype's CSS (3.0), view v-puntidicura; scoped to the page's .hub-po panels. .chip, .s1, .when
   and .ex-chips are shared (deepcare.css), as .who .meta. */
.toolbar.hub-po-search { border: 0; }
.toolbar.hub-po-search .hint { font-size: 12.5px; }
.hub-po-todo-i { color: var(--warn); }
.hub-po .hub-po-none { text-align: center; color: var(--fg-3); padding: 22px; }
.hub-po .who .meta { align-items: center; }
.hub-po-kv { font-size: 13px; }
.hub-po-kv .warn { color: var(--warn); font-weight: 600; }
.hub-po-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.hub-po-chips .chip i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: var(--c);
                        margin-right: 5px; }
.hub-po .hub-po-file { font-size: 12px; }
.hub-po .hub-po-why { font-size: 12px; margin-top: 2px; }
.hub-po .hub-po-sub { display: block; color: var(--fg-3); font-size: 12px; margin-top: 2px; font-weight: 400; }

/* ==== Scheda PdC (Page.Hub.PdcCard) ==== */
/* Values from the prototype's CSS (3.0): .pdc-tabs, .devbar, .devlist, .trace, .ecg-thumb, .verdict, .mtiles,
   .ref-line, .trace-acts, .cam-grid, .cam-card and the #ecgv window; the card rules are scoped to the page's .hub-pdc
   so that the refertazione window, which has its own .verdict and .mtiles, is not affected. .dev-ico, .docs,
   .refusal, .spk-blank and the ecg.js elements are shared. */
.pdc-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.pdc-tabs button { border: 0; background: none; padding: 10px 14px; font: inherit; font-size: 14px; color: var(--fg-2);
                   cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 6px;
                   align-items: center; white-space: nowrap; }
.pdc-tabs button:hover { color: var(--fg); }
.pdc-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.pdc-tabs .n { font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
               padding: 0 7px; color: var(--fg-2); }
.pdc-tabs button[aria-selected="true"] .n { background: var(--accent-soft); border-color: transparent;
                                             color: var(--accent); }
.hub-pdc-state { display: inline-flex; gap: 6px; align-items: center; }
.hub-pdc-search .search { max-width: 460px; }
.hub-pdc-filtered { font-size: 12.5px; }
.hub-pdc .notice.hub-pdc-sample { margin: 16px 16px 0; }
.hub-pdc .hub-pdc-none { padding: 16px; margin: 0; }
.hub-pdc .hub-pdc-help { margin: 0; }
.hub-pdc .who .meta { align-items: center; }
.hub-pdc .kpi { text-align: left; font: inherit; cursor: pointer; }
.hub-pdc .devlist { display: flex; flex-direction: column; gap: 8px; }
.hub-pdc .devbar { display: flex; align-items: center; gap: 14px 20px; flex-wrap: wrap; background: var(--surface);
                   border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; }
.hub-pdc .devbar .nm { display: flex; flex-direction: column; min-width: 0; }
.hub-pdc .devbar .nm b { font-size: 14.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hub-pdc .devbar .nm small { color: var(--fg-3); font-size: 12.5px; }
.hub-pdc .devbar .use { font-size: 13px; color: var(--fg-2); }
.hub-pdc .devbar .use b { color: var(--fg); font-weight: 600; }
.hub-pdc .devbar .docs { border: 0; padding: 0; margin-left: auto; }
.hub-pdc .devbar .docs .code { margin-left: 4px; }
.hub-pdc .notice .link-btn { color: var(--accent); text-decoration: underline; padding: 0; font-size: inherit; }
.hub-pdc .trace { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 22px; padding: 18px;
                  border-top: 1px solid var(--line); }
.hub-pdc .trace:first-of-type { border-top: 0; }
.hub-pdc .ecg-thumb { padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: zoom-in;
                      display: block; width: 100%; position: relative; overflow: hidden; align-self: start; }
.hub-pdc .ecg-thumb > ecg-print, .hub-pdc .ecg-thumb > bytes-img, .hub-pdc .ecg-thumb > .curve-preview { width: 100%; }
.hub-pdc .ecg-thumb img { display: block; width: 100%; height: auto; }
.hub-pdc .ecg-thumb .zoom { position: absolute; right: 10px; bottom: 10px; background: rgba(17, 24, 39, .75);
                            color: #fff; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 6px;
                            display: flex; gap: 5px; align-items: center; opacity: 0; transition: opacity .15s; }
.hub-pdc .ecg-thumb .zoom svg.i { width: 14px; height: 14px; }
.hub-pdc .ecg-thumb:hover .zoom, .hub-pdc .ecg-thumb:focus-visible .zoom { opacity: 1; }
.hub-pdc .ecg-thumb:hover, .hub-pdc .ecg-thumb:focus-visible { border-color: var(--accent);
                                                                box-shadow: 0 0 0 1px var(--accent); }
.hub-pdc .trace-info { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hub-pdc .trace-h { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.hub-pdc .trace-h .who b { font-size: 16px; }
.hub-pdc .trace-h time { color: var(--fg-2); font-size: 13px; text-align: right; white-space: nowrap; }
.hub-pdc .trace-h time small { display: block; color: var(--fg-3); font-size: 11.5px; }
.hub-pdc .verdict { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border-radius: 8px;
                    background: var(--ok-soft); color: var(--ok); font-weight: 600; font-size: 14px; }
.hub-pdc .verdict.warn { background: var(--warn-soft); color: var(--warn); }
.hub-pdc .verdict small { display: block; font-size: 11.5px; font-weight: 500; opacity: .8; }
.hub-pdc .mtiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.hub-pdc .mtile { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
                  min-width: 0; }
.hub-pdc .mtile dt { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .05em; }
.hub-pdc .mtile dd { margin: 2px 0 0; font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden;
                     text-overflow: ellipsis; }
.hub-pdc .mtile dd small { font-size: 12px; color: var(--fg-3); font-weight: 500; margin-left: 2px; }
.hub-pdc .mtile.warn dd { color: var(--warn); }
.hub-pdc .ref-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.hub-pdc .ref-line .lbl { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .05em; }
.hub-pdc .hub-pdc-who { font-size: 12.5px; }
.hub-pdc .hub-pdc-draft { font-size: 12.5px; font-style: italic; margin-top: -8px; }
.hub-pdc .link-btn.hub-pdc-pdf { display: inline-flex; gap: 4px; align-items: center; color: var(--accent); }
.hub-pdc .link-btn.hub-pdc-pdf svg.i { width: 14px; height: 14px; }
.hub-pdc .trace-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.hub-pdc .refusal { font-size: 12.5px; padding: 6px 10px; }
.hub-pdc .cam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px;
                     padding: 16px; }
.hub-pdc .cam-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hub-pdc .cam-card .ecg-thumb { background: #000; }
.hub-pdc .cam-info { display: flex; flex-direction: column; gap: 6px; }
.hub-pdc .cam-info .trace-h .who b { font-size: 14.5px; }
.hub-pdc .hub-pdc-dev { font-size: 12.5px; }
/* The window of the enlarged preview (#ecgv): wide, as tall as its content, the download in the footer. */
.modal.hub-pdc-view { width: min(1040px, calc(100% - 32px)); max-height: 90vh; }
.hub-pdc-view .drawer-h p { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hub-pdc-view-body { padding: 16px; background: var(--surface-2); overflow: auto; }
.hub-pdc-view-body > ecg-print, .hub-pdc-view-body > bytes-img, .hub-pdc-view-body > .curve-preview,
.hub-pdc-view-body > .spk-blank {
    border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.hub-pdc-view-body .spk-blank { min-height: 240px; }
.hub-pdc-view-body .help { margin: 10px 0 0; }
@media (max-width: 1000px) {
    .hub-pdc .trace { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .hub-pdc .mtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hub-pdc .devbar .docs { margin-left: 0; }
    .hub-pdc .cam-grid { grid-template-columns: minmax(0, 1fr); padding: 12px; }
    .hub-pdc .trace { padding: 14px; gap: 14px; }
    .modal.hub-pdc-view { width: calc(100% - 16px); }
    .hub-pdc-view-body { padding: 10px; }
}

/* ==== Immagini farmaci (Page.DrugImages) ==== */
/* The catalogue's table (.drug-img) and the window that adds or changes an entry (.drug-img-form). The images are
   the gateway's white squares: shown whole (contain) on white, with a thin border as 2.0 does. */
.drug-img td.thumb { width: 72px; }
.drug-img td.thumb img { display: block; width: 56px; height: 56px; object-fit: contain; background: #fff;
                         border: 1px solid var(--line); border-radius: 8px; }
.drug-img td.who .nm { font-weight: 600; }
.drug-img td.when { color: var(--fg-2); white-space: nowrap; }
.drug-img td.when .meta { color: var(--fg-3); font-size: 12.5px; }
.drug-img-form { display: flex; flex-direction: column; gap: 14px; }
.drug-img-pick { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.drug-img-pick .pic { width: 80px; height: 80px; object-fit: contain; background: #fff;
                      border: 1px solid var(--line); border-radius: 8px; }
.drug-img-pick .pic.none { display: grid; place-items: center; border-style: dashed; color: var(--fg-3);
                           font-size: 12px; }

/* ==== Utenti (Page.Users) ==== */
/* The accounts table (.users-tbl), the grant rows of the drawers (.grant-row) and the OTP window (.usr-otp, on top of
   the shared .qr-box). A Home grant is a .badge.info, a PRO grant a .badge.pro. */
.users-tbl .who .nm { font-weight: 600; font-size: 14.5px; }
.users-tbl tr.off .who .nm { color: var(--fg-3); }
.users-tbl .grants, .users-tbl .states { display: flex; flex-wrap: wrap; gap: 4px; }
/* the actions wrap: four buttons on one line made the table 1167 px, wider than the page at 1440 px */
.users-tbl .acts { justify-content: flex-start; flex-wrap: wrap; }
.users-tbl .acts .btn { white-space: nowrap; }
.badge.pro { background: var(--stale-soft); color: var(--stale); }
.badge svg.i { width: 12px; height: 12px; }
.pform .grant-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px 12px;
                    align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 8px;
                    margin-bottom: 8px; }
.pform .grant-row .wide { grid-column: 1 / -1; }
.pform .grant-row .msg { color: var(--crit); font-size: 12px; }
.pform .grant-row.err { border-color: var(--crit-line); }
.pform .grant-row.err select { border-color: var(--crit); }
.pform fieldset > .help { margin: 0 0 10px; }
.usr-otp patient-qr { width: 240px; }
.usr-otp .qr-text { font-size: 11.5px; }
@media (max-width: 560px) {
    .pform .grant-row { grid-template-columns: minmax(0, 1fr) auto; }
    .pform .grant-row > .f:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
}

/* ==== Cambio password (Main) ==== */
/* The forced change of a temporary password (.pwd-card, the login form on a card, since it stands alone on the
   start page) and its row of buttons: «Esci» on the left, the change on the right. The user menu's window reuses
   .modal and .auth-body. */
.pwd-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.pwd-acts { display: flex; gap: 8px; justify-content: space-between; align-items: center; flex-wrap: wrap;
            margin-top: 4px; }

/* PRO · Hub › Impostazioni (§8.3, §8.4): the SLA form's number with its unit, and the alert cards */
.sla-form { margin-top: 14px; }
.sla-form .sla-in { display: flex; align-items: center; gap: 6px; }
.sla-form .sla-in input { flex: 1; min-width: 0; }
.sla-form .sla-in .unit { color: var(--fg-3); font-size: 12.5px; }
.sla-form .acts, .al-cards .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.al-cards { margin-top: 14px; }
.al-cards .card.off { opacity: .6; }
@media (max-width: 560px) { .kpis.k3 { grid-template-columns: minmax(0, 1fr); } }
/* the Hub's S120: its account and the operator's controls on the device bar, the configuration sheet */
.s120-acct { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
pre.sheet { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
    padding: 12px 14px; font-size: 13px; line-height: 1.5; margin: 0; }
/* the S120's QR code beside the Spoke's chosen assistito */
.ref-paz .ref-qr { float: right; margin: 0 0 8px 12px; }
.ref-paz .ref-qr patient-qr { width: 160px; }
/* «Esami inviati»: the assistito's window, opened by the eye beside the name. */
.sp-exams .sp-paz-open { margin-left: 6px; vertical-align: middle; }
.sp-paz-qr { margin: 4px 0 14px; }
.sp-paz-qr patient-qr { width: 240px; }
dl.sp-paz-data { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 8px; }
dl.sp-paz-data dt { color: var(--fg-3); }
dl.sp-paz-data dd { margin: 0; overflow-wrap: anywhere; }
