/* smadb.valentinafioretti.com
   Il database SMA: pazienti in terapia, e quando tocca il prossimo controllo.

   THE PALETTE IS VALENTINAFIORETTI.COM'S, not Pediatras'. This app sits on
   her own domain and is read by her and by the doctors who follow these
   children; the clinical family's cream/plum belongs to pediatras.it, and a
   second brand on her own host would say this is somebody else's tool.
   Plum #67527e, lavender #907ba9/#c4afd5, cream ground - derived from the
   logo, the same three numbers as the public site and as the first version of
   the job board. Cormorant Garamond for display, Inter for body, both served
   locally from /assets/fonts.

   The ACCENT is the app's own: a muted teal that the public site does not
   use, so a filled button here can only mean "the database" and never "the
   website". Statuses are the plain three, because on this app they mean
   something medical - a check that is due, late, or done - and a status that
   is decorative is a status that gets ignored. */

:root{
  --cream:#faf6f0; --cream-deep:#f4ede3; --paper:#fffdfa;
  --lav-50:#f7f3fa; --lav-100:#efe8f5; --lav-200:#e0d4ec; --lav-300:#c4afd5;
  --lav-500:#907ba9; --plum:#67527e; --plum-deep:#4c3b60;
  --ink:#39313f; --ink-soft:#6d6477; --line:rgba(103,82,126,.16);

  /* this app's accent */
  --accent:#2f6f72; --accent-deep:#235558; --accent-soft:#e6f0f0;

  --ok:#2f7d55; --warn:#9a6b1f; --bad:#9c3b3b;
  --ok-bg:rgba(47,125,85,.10); --ok-line:rgba(47,125,85,.30);
  --warn-bg:rgba(154,107,31,.09); --warn-line:rgba(154,107,31,.26);
  --bad-bg:rgba(156,59,59,.08); --bad-line:rgba(156,59,59,.25);
  --top-bg:rgba(250,246,240,.94); --btn-fg:#fff; --shadow:rgba(76,59,96,.45);
  --chevron-img:url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23907ba9' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme:light;
  --serif:"Cormorant Garamond","Iowan Old Style",Garamond,Georgia,serif;
  --sans:"Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --radius:16px;
}


/* ---------- dark ----------
   Only the tokens are redefined; no rule below this point knows which theme
   it is in. Three selectors and not one, because the theme has three states:
   the OS default (nothing stamped on <html>), and the two explicit choices the
   header button writes to localStorage. The media query is guarded against
   [data-theme="light"] so choosing light on a dark OS actually wins.

   --plum-deep carries the headings and the big numbers, so in dark it has to
   become the LIGHTEST plum, not the darkest. Same inversion for --btn-fg:
   white on the dark-mode plum is unreadable, so a filled button goes dark-on-
   light. The logo is a transparent PNG drawn in plum and reads on both. */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
  --cream:#1b1720; --cream-deep:#221d28; --paper:#272231;
  --lav-50:#2a2433; --lav-100:#322b3d; --lav-200:#3d3449; --lav-300:#6b5c80;
  --lav-500:#a894c0; --plum:#c4afd5; --plum-deep:#ded2ea;
  --ink:#efe9f3; --ink-soft:#b0a6bb; --line:rgba(196,175,213,.18);
  --accent:#62a9ab; --accent-deep:#86c4c5; --accent-soft:rgba(98,169,171,.14);
  --ok:#74c494; --warn:#d6a860; --bad:#e58c8c;
  --ok-bg:rgba(116,196,148,.12); --ok-line:rgba(116,196,148,.32);
  --warn-bg:rgba(214,168,96,.12); --warn-line:rgba(214,168,96,.30);
  --bad-bg:rgba(229,140,140,.12); --bad-line:rgba(229,140,140,.30);
  --top-bg:rgba(27,23,32,.94); --btn-fg:#191520; --shadow:rgba(0,0,0,.75);
  --chevron-img:url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a894c0' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme:dark;

}
:root[data-theme="dark"]{
  --cream:#1b1720; --cream-deep:#221d28; --paper:#272231;
  --lav-50:#2a2433; --lav-100:#322b3d; --lav-200:#3d3449; --lav-300:#6b5c80;
  --lav-500:#a894c0; --plum:#c4afd5; --plum-deep:#ded2ea;
  --ink:#efe9f3; --ink-soft:#b0a6bb; --line:rgba(196,175,213,.18);
  --accent:#62a9ab; --accent-deep:#86c4c5; --accent-soft:rgba(98,169,171,.14);
  --ok:#74c494; --warn:#d6a860; --bad:#e58c8c;
  --ok-bg:rgba(116,196,148,.12); --ok-line:rgba(116,196,148,.32);
  --warn-bg:rgba(214,168,96,.12); --warn-line:rgba(214,168,96,.30);
  --bad-bg:rgba(229,140,140,.12); --bad-line:rgba(229,140,140,.30);
  --top-bg:rgba(27,23,32,.94); --btn-fg:#191520; --shadow:rgba(0,0,0,.75);
  --chevron-img:url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a894c0' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme:dark;

}
/* The monogram is a dark-plum line drawing; lift it off a dark ground. */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .brand img, :root:not([data-theme="light"]) .login-card img{ filter:brightness(1.9) saturate(.85); }
}
:root[data-theme="dark"] .brand img, :root[data-theme="dark"] .login-card img{ filter:brightness(1.9) saturate(.85); }


*,*::before,*::after{ box-sizing:border-box; }
body{
  margin:0; background:var(--cream); color:var(--ink);
  font-family:var(--sans); font-size:15px; line-height:1.6;
  -webkit-font-smoothing:antialiased;
}
a{ color:var(--plum); }
img{ max-width:100%; height:auto; display:block; }
:focus-visible{ outline:2px solid var(--plum); outline-offset:2px; border-radius:4px; }

/* 1140, the same --wrap as valentinafioretti.com, so the header of the
   database and the header of the public site sit on the same line when you
   move between them. */
.wrap{ width:100%; max-width:1140px; margin-inline:auto; padding-inline:20px; }

/* ---------- header ---------- */
.top{
  position:sticky; top:0; z-index:20; background:var(--top-bg);
  backdrop-filter:saturate(1.4) blur(8px); border-bottom:1px solid var(--line);
}
/* The inline padding has to be repeated, not dropped: this element is also
   the .wrap, and `padding:8px 0` here beats .wrap's padding-inline, which
   would put the mark 20px further left than the same mark on the public
   site. */
.top-inner{ display:flex; align-items:center; gap:10px; min-height:56px; padding:8px 20px; }
.brand{ display:flex; align-items:center; gap:10px; text-decoration:none; color:inherit; }
.brand img{ width:34px; height:auto; }
/* The app's name beside the monogram, in Cormorant like her own wordmark:
   the mark alone would promise valentinafioretti.com, and this is the thing
   behind the login. */
.brand-text b{
  font-family:var(--serif); font-weight:700; font-size:1.25rem;
  letter-spacing:.01em; color:var(--ink);
}
.top .spacer{ flex:1; }

/* ---------- the account menu ----------
   The app's, down to the class names: a filled avatar, a chevron that turns,
   a head carrying the address, rows with icons. The MECHANISM stays this
   app's <details> rather than the app's button-plus-JS, because with
   JavaScript off a <details> still opens and the way out of the board still
   works; the script below only adds close-on-outside-click and Escape. */
.acct{ position:relative; margin-left:2px; }
.acct-btn{
  list-style:none; cursor:pointer; user-select:none;
  display:inline-flex; align-items:center; gap:3px;
  padding:3px 4px 3px 3px; border-radius:999px; color:var(--ink-soft);
}
.acct-btn::-webkit-details-marker{ display:none; }
.acct-btn::marker{ content:""; }
.acct-btn:hover{ background:var(--lav-50); }
.acct-btn .icn{ transition:transform .16s ease; }
.acct[open] .acct-btn .icn{ transform:rotate(180deg); }
/* Plum and lavender: the avatar and the role tag are chrome, and the chrome
   is her wordmark's two colours rather than this app's accent. */
.avatar{
  width:34px; height:34px; border-radius:50%; display:grid; place-items:center;
  background:var(--plum); color:var(--btn-fg);
  font-family:var(--serif); font-size:.84rem; font-weight:800;
}
.menu{
  position:absolute; right:0; top:calc(100% + 11px); width:262px; z-index:30;
  background:var(--paper); border:1px solid var(--line);
  border-radius:var(--radius); box-shadow:0 22px 48px -30px var(--shadow); padding:6px;
}
.menu-head{
  display:grid; gap:1px; padding:9px 12px 12px;
  border-bottom:1px solid var(--line); margin-bottom:6px;
}
.menu-head .tiny{ margin:0; font-size:.68rem; }
.menu-head .muted{ color:var(--ink-soft); }
.menu-head b{ font-size:.86rem; color:var(--ink); word-break:break-all; }
.role-tag{
  justify-self:start; margin-top:8px; padding:3px 10px;
  border-radius:999px; background:var(--lav-100); color:var(--plum);
  font-size:.64rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase;
}
.menu-item{
  display:flex; align-items:center; gap:10px; width:100%;
  padding:9px 12px; border:0; background:none; cursor:pointer; text-align:left;
  font:inherit; font-size:.9rem; font-weight:600; color:var(--ink);
  border-radius:12px; text-decoration:none;
}
/* display:flex would otherwise beat the UA's [hidden] rule and the theme row,
   hidden until the script labels it, would show as an empty line. */
.menu-item[hidden]{ display:none; }
.menu-item:hover{ background:var(--lav-50); color:var(--plum-deep); text-decoration:none; }
.menu-item .icn{ color:var(--ink-soft); flex:0 0 auto; }
.menu-item:hover .icn{ color:var(--plum); }
.menu-item.danger:hover{ color:var(--bad); background:var(--bad-bg); }
.menu-item.danger:hover .icn{ color:var(--bad); }
.th-ico{ display:flex; align-items:center; }

/* ---------- stats ---------- */
.stats{ display:flex; flex-wrap:wrap; gap:14px; margin:30px 0 22px; }
/* flex:1 1 0 and not the content width: five cards sized by their own label
   gave five different widths, with "in archivio" half again as wide as
   "aperte" for no reason the reader can see. */
.stat{
  flex:1 1 0; min-width:150px;
  background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  padding:22px 22px 20px;
}
.stat b{ display:block; font-family:var(--serif); font-size:2.7rem; line-height:1; color:var(--plum-deep); font-weight:500; margin-bottom:8px; }
.stat span{ font-size:.72rem; letter-spacing:.14em; text-transform:uppercase; color:var(--lav-500); }

/* ---------- feed health ---------- */
.health{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:18px; font-size:.78rem; }
.health i{ font-style:normal; }
.feed{
  display:inline-flex; align-items:center; gap:7px; padding:5px 11px;
  border-radius:999px; border:1px solid var(--line); background:var(--paper); color:var(--ink-soft);
}
.feed::before{ content:""; width:7px; height:7px; border-radius:50%; background:var(--ok); }
.feed.bad{ border-color:var(--bad-line); color:var(--bad); }
.feed.bad::before{ background:var(--bad); }

/* ---------- filters ---------- */
.filters{
  display:grid; gap:14px;
  background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  padding:16px; margin-bottom:22px;
}
.filters input[type=search], .filters input[type=date], .filters select{
  font:inherit; font-size:.88rem; color:var(--ink); background:var(--cream);
  border:1px solid var(--line); border-radius:9px; padding:8px 11px;
}
.f-search{ display:flex; gap:10px; }
.f-search input[type=search]{ flex:1; min-width:0; }
/* flex and not a grid of equal columns: an equal column forces every control
   to the column width, which pushes the chevron back to the far right with a
   gap of dead space in front of it - the thing that was just fixed. Each
   group stays as wide as its own content and the row wraps. */
.f-grid{ display:flex; flex-wrap:wrap; gap:12px 16px; }
.fgroup{ display:grid; gap:5px; min-width:0; }
.fgroup > span{
  font-size:.66rem; letter-spacing:.13em; text-transform:uppercase; color:var(--lav-500);
}
.f-row{
  display:flex; flex-wrap:wrap; align-items:center; gap:12px;
  border-top:1px solid var(--line); padding-top:13px;
}
.f-row .spacer{ flex:1; }

/* The native select arrow sits hard against the right border, which on a
   wide select leaves a gap of dead space between the label and the chevron.
   Our own chevron is painted 10px in and the control is sized to its
   content, so the arrow always sits just after the text. */
.filters select, .pz-do select, .eform select{
  -webkit-appearance:none; -moz-appearance:none; appearance:none;
  padding-right:30px;
  background-image:var(--chevron-img);
  background-repeat:no-repeat;
  background-position:right 11px center;
  max-width:100%;
}
.filters select:hover, .pz-do select:hover, .eform select:hover{ border-color:var(--lav-300); }
/* Edge/IE paint their own arrow on top of ours. */
.filters select::-ms-expand, .pz-do select::-ms-expand, .eform select::-ms-expand{ display:none; }
.filters input[type=search]{ flex:1; min-width:200px; }
.filters label.chk{ display:inline-flex; align-items:center; gap:7px; font-size:.85rem; color:var(--ink-soft); }
.btn{
  font:inherit; font-size:.86rem; cursor:pointer; border-radius:9px; padding:8px 16px;
  border:1px solid var(--accent); background:var(--accent); color:var(--btn-fg); text-decoration:none;
}
.btn:hover{ background:var(--accent-deep); border-color:var(--accent-deep); }
.btn.ghost{ background:transparent; color:var(--plum); }
.btn.ghost:hover{ background:var(--lav-100); color:var(--plum-deep); }

/* ---------- list ---------- */
.count{ font-size:.82rem; color:var(--ink-soft); margin:0 0 12px; }
.list{ display:grid; gap:12px; margin:0 0 40px; padding:0; list-style:none; }
.meta{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; font-size:.78rem; color:var(--ink-soft); }
.pill{
  display:inline-block; padding:3px 9px; border-radius:999px; font-size:.7rem;
  letter-spacing:.06em; border:1px solid var(--line); background:var(--lav-50); color:var(--lav-500);
}
/* THREE STATUSES AND A WORD IN EACH. vf_pill_stato() always puts the phrase
   inside the pill - "in ritardo", "fra 12 giorni" - because "in ritardo" in
   red and "fra 3 giorni" in red look the same to a reader who cannot tell
   those two reds apart, and this is the one app where that matters. */
.pill.ok{ background:var(--ok-bg); border-color:var(--ok-line); color:var(--ok); }
.pill.warn{ background:var(--warn-bg); border-color:var(--warn-line); color:var(--warn); }
.pill.bad{ background:var(--bad-bg); border-color:var(--bad-line); color:var(--bad); }
.note-saved{ font-size:.75rem; color:var(--lav-500); }

.empty{
  background:var(--paper); border:1px dashed var(--lav-300); border-radius:var(--radius);
  padding:40px 24px; text-align:center; color:var(--ink-soft);
}

footer.foot{ border-top:1px solid var(--line); padding:20px 0 40px; font-size:.76rem; color:var(--lav-500); }

/* ---------- login ---------- */
.login-wrap{ min-height:100vh; display:grid; place-items:center; padding:24px; }
.login-card{
  background:var(--paper); border:1px solid var(--line); border-radius:20px;
  padding:40px 36px; width:100%; max-width:420px; text-align:center;
  box-shadow:0 30px 70px -45px var(--shadow);
}
.login-card img{ width:58px; margin:0 auto 18px; }
.login-card h1{ font-family:var(--serif); font-weight:500; font-size:1.7rem; margin:0 0 6px; color:var(--plum-deep); }
.login-card p{ margin:0 0 22px; color:var(--ink-soft); font-size:.9rem; }
.login-card input[type=email]{
  width:100%; font:inherit; padding:12px 14px; border:1px solid var(--line);
  border-radius:10px; background:var(--cream); color:var(--ink); margin-bottom:12px; text-align:center;
}
.login-card .btn{ width:100%; padding:12px; }
.msg{ border-radius:10px; padding:12px 14px; font-size:.86rem; margin-bottom:18px; }
.msg.ok{ background:var(--ok-bg); color:var(--ok); }
.msg.err{ background:var(--bad-bg); color:var(--bad); }

@media (max-width:700px){
  .stats .stat{ flex:1 1 44%; }
}

/* ---------- the section bar ----------
   Under the header and not inside it: the mark, the wordmark, the account
   menu and three tabs do not fit 390px, and a nav that overflows
   at the width this is actually read on is a nav that is wrong. It scrolls
   sideways on a phone rather than wrapping, so the header height is the same
   on every page. */
.subnav{ border-top:1px solid var(--line); }
.subnav-in{
  display:flex; gap:4px; overflow-x:auto; scrollbar-width:none;
  -webkit-overflow-scrolling:touch;
}
.subnav-in::-webkit-scrollbar{ display:none; }
.sub-i{
  display:inline-flex; align-items:center; gap:7px; white-space:nowrap;
  padding:11px 12px; font-size:.86rem; font-weight:600; text-decoration:none;
  color:var(--ink-soft); border-bottom:2px solid transparent; margin-bottom:-1px;
}
.sub-i:hover{ color:var(--plum-deep); }
.sub-i .icn{ color:var(--lav-500); }
/* Plum. This said "the accent, not the plum: this is the job board, and its
   green is what says so" - which was true while this header was its own. It
   is the family's header now and the active-section marker is plum on all
   three hosts. */
.sub-i.on{ color:var(--plum-deep); border-bottom-color:var(--plum); }
.sub-i.on .icn{ color:var(--plum); }

/* ---------- a disclosure panel ---------- */
.panel{
  background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  margin:0 0 18px;
}
.panel > summary{
  display:flex; align-items:center; gap:8px; cursor:pointer; list-style:none;
  padding:14px 20px; font-family:var(--serif); font-weight:600; color:var(--plum-deep);
}
.panel > summary::-webkit-details-marker{ display:none; }
.panel > summary .icn{ color:var(--accent); }
.panel[open] > summary{ border-bottom:1px solid var(--line); }
.panel-in{ padding:16px 20px 20px; display:grid; gap:14px; }
.open-note{ margin-top:10px; }
.open-note .panel-in{ padding-top:20px; }
.open-note .band-h{ margin-bottom:0; }

/* A details inside a card footer: a text control, not a panel. */
details.inline{ display:inline-block; }
details.inline > summary{
  cursor:pointer; list-style:none; font-size:.82rem; color:var(--plum);
  border:1px solid var(--line); border-radius:9px; padding:6px 14px; background:transparent;
}
details.inline > summary::-webkit-details-marker{ display:none; }
details.inline > summary:hover{ background:var(--lav-100); color:var(--plum-deep); }
/* Open, the body has to leave the footer's flex row and take the card's full
   width, or a six-field form renders one field wide. */
details.inline[open]{ display:block; width:100%; }
details.inline[open] > summary{ margin-bottom:10px; }
details.inline .panel-in{
  padding:14px 0 0; border-top:1px solid var(--line);
}

/* ---------- the entry forms ---------- */
.eform{ display:grid; gap:14px; }
.eform input, .eform select{
  font:inherit; font-size:.88rem; color:var(--ink); background:var(--cream);
  border:1px solid var(--line); border-radius:9px; padding:8px 11px; min-width:0;
}
.eform input:focus, .eform select:focus{ outline:2px solid var(--lav-300); outline-offset:1px; }
.eform .fgroup{ flex:1 1 180px; }
.eform .fgroup.wide{ flex:1 1 100%; }
.eform .fgroup > span i{ text-transform:none; letter-spacing:0; }
.f-grid.tight{ gap:10px 12px; }
.f-grid.tight .fgroup{ flex:1 1 140px; }

/* ---------- a small table (the punteggi) ---------- */
.tbl{ width:100%; border-collapse:collapse; font-size:.84rem; }
.tbl th{
  text-align:left; font-size:.66rem; letter-spacing:.13em; text-transform:uppercase;
  color:var(--lav-500); font-weight:600; padding:0 10px 7px 0; border-bottom:1px solid var(--line);
}
.tbl td{ padding:8px 10px 8px 0; border-bottom:1px solid var(--line); color:var(--ink-soft); }
.tbl tr:last-child td{ border-bottom:0; }
.tbl td.num{ font-variant-numeric:tabular-nums; color:var(--ink); }
/* The table is the one thing here that cannot shrink below its content, so
   it scrolls inside its own box instead of widening the page. */
.panel-in > .tbl{ display:table; }
details.inline .panel-in{ overflow-x:auto; }

/* A row the app cannot schedule says so in the warning brown, never in
   yellow: yellow never carries text in this family. */
.warn-txt{ color:var(--warn); }

/* ---------- scadenze ---------- */
.band{ margin:0 0 26px; }
.band-h{
  font-family:var(--serif); font-size:1.05rem; font-weight:600; color:var(--plum-deep);
  margin:0 0 10px; display:flex; align-items:center; gap:9px;
}
.band-n{
  font-family:var(--sans); font-size:.72rem; font-weight:700; color:var(--lav-500);
  background:var(--lav-100); border-radius:999px; padding:2px 9px;
}
.dl{ padding:14px 18px; }
.dl-row{ display:flex; align-items:center; gap:16px; }
/* The number first and large: this page is read in a glance on a phone, and
   the glance is "how long have I got". */
/* min-width and not a fixed width: a gene-therapy 48-month check is years
   and "1141" at this size overflowed a 58px column. */
.dl-when{
  flex:0 0 auto; min-width:58px; text-align:center; line-height:1;
  border-right:1px solid var(--line); padding-right:14px;
}
.dl-when b{
  display:block; font-family:var(--serif); font-size:1.9rem; font-weight:500;
  color:var(--plum-deep); font-variant-numeric:tabular-nums;
}
.dl-when span{ font-size:.62rem; letter-spacing:.1em; text-transform:uppercase; color:var(--lav-500); }
.dl-what{ flex:1; min-width:0; display:grid; gap:6px; }
.dl-what .pz-name{ font-size:1rem; }
/* Urgency is carried by the number's colour and one left edge, not by a
   coloured card: five bands of coloured cards would make the page shout and
   nothing in it would read as more urgent than anything else. */
.band-oggi .dl{ border-left:3px solid var(--bad); }
.band-oggi .dl-when b{ color:var(--bad); }
.band-settimana .dl{ border-left:3px solid var(--warn); }
.band-settimana .dl-when b{ color:var(--warn); }
.stat.hot b{ color:var(--bad); }

/* ---------- i bottoni che cancellano ---------- */
.btn.ghost.danger{ color:var(--bad); border-color:var(--bad-line); }
.btn.ghost.danger:hover{ background:var(--bad-bg); color:var(--bad); }
.btn .icn{ vertical-align:-3px; margin-right:4px; }

@media (max-width:700px){
  .subnav-in{ padding-inline:14px; }
  .sub-i span{ font-size:.82rem; }
  /* The count goes ABOVE the title rather than beside it: at 390 a title
     runs to five lines and a number centred against five lines reads as
     belonging to the middle one. */
  .dl-row{ flex-wrap:wrap; align-items:flex-start; gap:8px; }
  .dl-when{
    flex:1 1 100%; border-right:0; padding-right:0; text-align:left;
    display:flex; align-items:baseline; gap:6px;
  }
  .dl-when b{ font-size:1.5rem; }
  .eform .fgroup{ flex:1 1 100%; }
}

/* 560px, the phone proper. The header here is the monogram, two words and
   an avatar, which fits with room to spare - this block only keeps the
   wordmark from crowding the mark once the gutters have taken their 40. */
@media (max-width:560px){
  .top-inner{ gap:8px; }
  .brand{ gap:8px; }
  .brand-text b{ font-size:1.05rem; }
}

/* ========================================================================
   I PAZIENTI
   A row is a child, and the thing you came to the page to read is the date.
   So the layout is the scadenziario's - number first, name second, action
   third - on both pages, because they answer the same question at two
   different widths of attention and two different layouts would mean
   learning the page twice.
   ======================================================================== */
.pz{
  background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  padding:14px 18px;
}
/* URGENCY IS ONE LEFT EDGE, never a coloured card. Thirty coloured cards
   would make the list shout and nothing in it would read as more urgent than
   anything else - the same reasoning as the bands below, which is why the
   two use the same three pixels. */
.pz.is-late{ border-left:3px solid var(--bad); }
.pz.is-soon{ border-left:3px solid var(--warn); }

.pz-row{ display:flex; align-items:center; gap:16px; }

/* The date, large, on the left. A DATE and not a countdown: this is the
   number that gets copied into a diary, and "fra 12 giorni" cannot be. The
   countdown is the small line under it, which is what makes the list
   skimmable - two different readings of the same fact, and both are wanted. */
.pz-next{
  flex:0 0 auto; min-width:104px; text-align:center; line-height:1.15;
  border-right:1px solid var(--line); padding-right:14px;
}
.pz-next b{
  display:block; font-family:var(--serif); font-size:1.32rem; font-weight:600;
  color:var(--plum-deep); font-variant-numeric:tabular-nums;
}
.pz-next span{ font-size:.68rem; letter-spacing:.04em; color:var(--lav-500); }
.pz.is-late .pz-next b{ color:var(--bad); }
.pz.is-soon .pz-next b{ color:var(--warn); }

.pz-who{ flex:1; min-width:0; display:grid; gap:5px; }
.pz-name{
  font-family:var(--serif); font-size:1.12rem; font-weight:600; line-height:1.3;
  margin:0; color:var(--plum-deep);
}
.pz-name a{ color:inherit; text-decoration:none; }
.pz-name a:hover{ text-decoration:underline; }
.pz-note{ margin:2px 0 0; font-size:.8rem; color:var(--ink-soft); }

/* "Fatto", with the date it defaults to. The date is EDITABLE and not a bare
   button, because a check gets written down the week after it happened as
   often as on the day, and a button that could only ever mean "today" would
   quietly make the record wrong in exactly that case. */
.pz-do{ flex:0 0 auto; display:flex; align-items:center; gap:7px; }
.pz-do input[type=date]{
  font:inherit; font-size:.8rem; background:var(--cream); color:var(--ink);
  border:1px solid var(--line); border-radius:8px; padding:6px 9px;
}
.pz-do .btn{ font-size:.8rem; padding:6px 13px; white-space:nowrap; }

/* The therapy, in three tints used identically on every page. A drug that is
   lavender in the list and teal on the card costs a second's reading, thirty
   times down a page. The three are far enough apart in hue AND in lightness
   to survive a monochrome print of the list, which is a thing that happens
   on a ward. */
.pill.tp{ display:inline-flex; align-items:center; gap:4px; letter-spacing:.03em; }
.pill.tp .icn{ margin:0; }
.pill.tp-risdiplam{ background:var(--lav-100); border-color:var(--lav-300); color:var(--plum); }
.pill.tp-spinraza{ background:var(--accent-soft); border-color:var(--accent); color:var(--accent-deep); }
.pill.tp-genica{ background:var(--cream-deep); border-color:var(--lav-300); color:var(--plum-deep); }

/* The band for the overdue. The job board had no equivalent - a bando that
   closed is closed - and here it is the first thing on the page: a check that
   has not happened yet is still owed, however late. */
.band-ritardo .dl{ border-left:3px solid var(--bad); }
.band-ritardo .dl-when b{ color:var(--bad); }

/* ---------- la scheda del paziente ---------- */
.crumb{ font-size:.8rem; margin:4px 0 14px; }
.crumb a{ color:var(--lav-500); text-decoration:none; display:inline-flex; align-items:center; gap:5px; }
.crumb a:hover{ color:var(--plum-deep); }

.card{
  background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  padding:20px 22px; margin:0 0 18px;
}
.card h1{ font-family:var(--serif); font-size:1.7rem; font-weight:600; margin:0 0 8px; color:var(--plum-deep); }
.pz-head{ display:flex; gap:24px; align-items:flex-start; flex-wrap:wrap; }
.pz-head > div:first-child{ flex:1 1 300px; min-width:0; }

/* The next date again, and bigger than anything else on the page, because
   this is the page somebody opens to find out exactly that. */
.pz-big{
  flex:0 0 auto; min-width:190px; text-align:center; line-height:1.2;
  background:var(--lav-50); border:1px solid var(--line); border-radius:var(--radius);
  padding:16px 20px;
}
.pz-big span{ display:block; font-size:.66rem; letter-spacing:.11em; text-transform:uppercase; color:var(--lav-500); }
.pz-big b{
  display:block; font-family:var(--serif); font-size:1.75rem; font-weight:600;
  color:var(--plum-deep); font-variant-numeric:tabular-nums; margin:4px 0 2px;
}
.pz-big i{ font-style:normal; font-size:.8rem; color:var(--ink-soft); }
.pz-big.is-late{ background:var(--bad-bg); border-color:var(--bad-line); }
.pz-big.is-late b{ color:var(--bad); }

/* The anagrafica, as pairs. A <dl> and not a table: these are four facts
   about one person, not rows of anything. */
.kv{ display:grid; grid-template-columns:auto 1fr; gap:4px 16px; margin:14px 0 10px; font-size:.86rem; }
.kv dt{ color:var(--lav-500); font-size:.72rem; letter-spacing:.07em; text-transform:uppercase; padding-top:3px; }
.kv dd{ margin:0; color:var(--ink); }

/* THE CALENDAR TABLE - the seven rows db.xlsx printed, plus the column it
   could not have. A done row is quiet and a missed one is not: a 12-month
   check sitting undone must not look like a 12-month check that has simply
   not come round yet, which is the single thing the spreadsheet could not
   show and the reason this app exists. */
.tbl.cal td{ color:var(--ink); }
.cal-fatto td{ color:var(--ink-soft); }
/* A milestone that fell due before the record began: receded, not alarming.
   Italic because it is the one row in the table that is a statement about
   what is NOT known rather than about what happened. */
.cal-storico td{ color:var(--ink-soft); opacity:.72; font-style:italic; }
.cal-ritardo td, .cal-oggi td{ background:var(--bad-bg); }
.cal-ritardo td:first-child, .cal-oggi td:first-child{ box-shadow:inset 3px 0 0 var(--bad); }
.cal-prossimo td{ background:var(--warn-bg); }
.cal-prossimo td:first-child{ box-shadow:inset 3px 0 0 var(--warn); }

ul.plain{ list-style:none; margin:0; padding:0; display:grid; gap:9px; font-size:.86rem; }
ul.plain b{ color:var(--plum-deep); margin-right:6px; }

/* A form that is one control sitting in a table cell or next to another. */
form.inline{ display:inline-flex; gap:6px; align-items:center; margin:0; }
form.inline .btn{ font-size:.78rem; padding:5px 11px; white-space:nowrap; }

/* ---------- i promemoria ---------- */
/* The state of the feature, said once at the top of its own page. A box and
   not a toast: it is true until somebody changes it, and a thing that is
   permanently true should not be dismissible. */
.notice{
  background:var(--warn-bg); border:1px solid var(--warn-line); border-radius:var(--radius);
  padding:14px 18px; margin:0 0 20px; font-size:.86rem; color:var(--ink);
}
.notice b{ color:var(--warn); }

.pm{
  background:var(--paper); border:1px solid var(--line); border-radius:var(--radius);
  padding:16px 18px; display:grid; gap:12px;
}
.pm.is-off{ background:var(--cream-deep); }
.pm-head{ display:flex; gap:18px; align-items:flex-start; flex-wrap:wrap; }
.pm-head > div:first-child{ flex:1 1 260px; min-width:0; }
.pm-acts{ flex:0 0 auto; display:flex; gap:8px; align-items:center; }
.pm code, .foot code, .health code{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:.9em;
  background:var(--lav-50); border:1px solid var(--line); border-radius:5px; padding:1px 5px;
}

/* A <select multiple> is the one form control that cannot be styled into
   looking like the others, so it is left alone and only sized. The recipient
   list is short on purpose - it can only hold what is in .env. */
.eform select[multiple]{ height:auto; padding:7px 9px; background-image:none; }

@media (max-width:700px){
  /* The date goes ABOVE the name rather than beside it: at 390 a name plus a
     therapy pill plus an age runs to three lines, and a date centred against
     three lines reads as belonging to the middle one. Same move as the
     scadenziario's .dl-when, for the same reason. */
  .pz-row{ flex-wrap:wrap; align-items:flex-start; gap:9px; }
  .pz-next{
    flex:1 1 100%; border-right:0; padding-right:0; text-align:left;
    display:flex; align-items:baseline; gap:8px;
  }
  .pz-do{ flex:1 1 100%; }
  .pz-do input[type=date]{ flex:1; min-width:0; }
  .pz-big{ flex:1 1 100%; }
  .kv{ grid-template-columns:1fr; gap:1px 0; }
  .kv dt{ padding-top:8px; }
  /* The calendar is the one thing here that cannot shrink below its content. */
  .tbl.cal{ display:block; overflow-x:auto; white-space:nowrap; }
}
