:root {
  --ink: #1c1915;
  --muted: #5e584f;
  --paper: #efeae2;
  --card: #fbf8f3;
  --line: #e3d9cc;
  --navy: #16324a;
  --navy-2: #0e2436;
  --brass: #8d6a34;
  --good: #1d5c45;
  --good-bg: #e5f2eb;
  --bad: #7c2d2d;
  --bad-bg: #f8e8e4;
  --warn-bg: #f8efd8;
  --shadow: 0 10px 30px rgba(22, 50, 74, 0.06);
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --safe-bottom: env(safe-area-inset-bottom);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(141, 106, 52, 0.16), transparent 50%),
    var(--paper);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.5;
}
body.role-client { padding-bottom: calc(76px + var(--safe-bottom)); }
a { color: var(--navy); }
.skip {
  position: absolute; left: -999px; top: 8px;
}
.skip:focus { left: 8px; background: white; padding: 8px; z-index: 5; }
.demo-banner {
  margin: 0;
  padding: 8px 16px;
  background: var(--navy-2);
  color: #f4ead7;
  font-size: 13px;
  letter-spacing: 0.01em;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
}
.brand {
  display: flex; gap: 10px; align-items: center;
  text-decoration: none; color: inherit; min-width: 0;
}
.brand strong, .brand small { display: block; }
.brand strong { font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.brand small { color: var(--muted); font-size: 12px; }
.mark {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--navy);
  color: #f3e2c2;
  font-family: var(--serif);
  font-weight: 650;
}
.bell {
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  white-space: nowrap;
}
.bell em, .subnav em, .tabbar em {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--brass); color: white;
  font-style: normal; font-size: 11px;
}
.subnav {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 4px 16px 12px;
  scrollbar-width: none;
}
.subnav a {
  text-decoration: none;
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--navy);
  border: 1px solid transparent;
}
.subnav a.is-on { background: white; border-color: var(--line); }
.wrap { width: min(1080px, calc(100% - 28px)); margin: 0 auto 28px; }
.flash { padding: 12px 14px; border-radius: 12px; }
.flash-ok { background: var(--good-bg); color: var(--good); }
.flash-err { background: var(--bad-bg); color: var(--bad); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
h1 { font-size: 34px; margin: 8px 0 8px; }
h2 { font-size: 24px; margin: 0 0 8px; }
.lede { color: var(--muted); margin-top: 0; }
.stack { display: grid; gap: 14px; }
.grid { display: grid; gap: 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat strong { display: block; font-family: var(--serif); font-size: 32px; letter-spacing: -0.03em; }
.muted { color: var(--muted); }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn, button, .tabbar a, input, select, textarea { font: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 16px;
  border-radius: 12px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
  background: var(--navy); color: white;
}
.btn.ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn.warn { background: var(--bad); }
.btn.small { min-height: 40px; padding: 8px 12px; font-size: 15px; }
.btn.full { width: 100%; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 4px 0 12px; }
.check input { width: 1.25rem; height: 1.25rem; min-height: 0; }
.field.spaced { margin-top: 14px; }
.choice { margin: 8px 0; }
label { font-size: 14px; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border-radius: 12px; border: 1px solid #d9d0c3;
  background: white; color: var(--ink); font-size: 16px;
}
textarea { min-height: 110px; resize: vertical; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chip {
  border: 1px solid var(--line); background: white; color: var(--ink);
  border-radius: 999px; min-height: 44px; padding: 8px 12px;
  text-decoration: none; white-space: normal; text-align: center;
}
.chip.is-on, .choice input:checked + span {
  background: var(--navy); color: white; border-color: var(--navy);
}
.choice { display: block; position: relative; margin: 8px 0; }
.choice input { position: absolute; opacity: 0; }
.choice span {
  display: flex; align-items: center; min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: white;
}
.slot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.slot input[name="note"] { flex: 1 1 180px; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: var(--warn-bg); color: #6d4d12; font-size: 12px;
}
.tag.ok { background: var(--good-bg); color: var(--good); }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 12px 0; border-top: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.auth-card { max-width: 460px; margin: 12px auto; }
.kicker { letter-spacing: 0.14em; text-transform: uppercase; font-size: 12px; color: var(--brass); margin: 0 0 6px; }
details.demo-box { background: white; border-radius: 14px; padding: 10px 12px; border: 1px dashed var(--line); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(251, 248, 243, 0.96);
  border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + var(--safe-bottom));
  backdrop-filter: blur(10px);
  z-index: 3;
}
.tabbar a {
  text-decoration: none; color: var(--muted);
  text-align: center; font-size: 11.5px; padding: 6px 1px; border-radius: 10px;
  min-width: 0;
}
.tabbar a.is-on { color: var(--navy); background: white; }
.note { font-size: 14px; color: var(--muted); }
.split { display: grid; gap: 12px; }
.prose p, .prose li { max-width: 68ch; }
.install-grid { display: grid; gap: 12px; }
.callout { border-left: 3px solid var(--brass); padding-left: 12px; }
@media (min-width: 800px) {
  h1 { font-size: 46px; }
  .grid.two { grid-template-columns: 1.2fr 0.8fr; }
  .grid.three { grid-template-columns: repeat(3, 1fr); }
  .split { grid-template-columns: 1fr 1fr; }
  .install-grid { grid-template-columns: 1fr 1fr; }
  body.role-admin .wrap, body.role-employee .wrap { width: min(1180px, calc(100% - 48px)); }
}
@media (max-width: 720px) {
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  td { border: 0; padding: 4px 0; }
  tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
}

/* mostra/nascondi password */
.password-wrap { position: relative; display: block; width: 100%; }
.password-wrap input { display: block; width: 100%; padding-right: 52px; }
button.password-toggle {
  position: absolute; top: 0; right: 0;
  width: 48px; height: 100%; min-height: 48px;
  margin: 0; padding: 0; border: 0; border-radius: 12px;
  background: transparent; color: var(--muted);
  box-shadow: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  -webkit-appearance: none; appearance: none;
  touch-action: manipulation;
}
button.password-toggle:hover,
button.password-toggle:focus-visible { color: var(--navy); }
button.password-toggle:focus { outline: none; }
button.password-toggle:focus-visible { outline: 2px solid var(--navy); outline-offset: -4px; }
.password-toggle svg { width: 22px; height: 22px; display: block; pointer-events: none; }
.password-toggle .icon-hide { display: none; }
.password-wrap.is-shown .password-toggle .icon-show { display: none; }
.password-wrap.is-shown .password-toggle .icon-hide { display: block; }

/* regole nuova password */
.pw-rules { margin: -4px 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.pw-rules-title, .pw-specials-title { margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--navy); }
.pw-specials-title { margin-top: 10px; }
.pw-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pw-checklist li { display: flex; align-items: flex-start; gap: 8px; font-size: 15px; line-height: 1.35; }
.pw-mark { flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; line-height: 1; margin-top: 1px; box-sizing: border-box; }
.pw-checklist li.is-ok .pw-mark { background: var(--good); border-color: var(--good); color: #fff; }
.pw-checklist li.is-ok .pw-mark::before { content: "\2713"; }
.pw-checklist li.is-ko .pw-mark { border-color: var(--bad); color: var(--bad); }
.pw-checklist li.is-ko .pw-mark::before { content: "\2717"; }
.pw-checklist li.is-ok { color: var(--good); }
.pw-specials { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.pw-specials kbd { min-width: 32px; height: 32px; padding: 0 6px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 8px; background: #fff; font: 600 17px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--navy); }
.pw-match { margin: -4px 0 12px; font-size: 15px; }
.pw-match.is-ok { color: var(--good); }
.pw-match.is-ko { color: var(--bad); }

/* data non selezionabile nel calendario appuntamenti */
input[type="date"] { min-height: 48px; }

/* pagina Studio Interprofessionale e piè di pagina */
.appfoot { margin: 28px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); text-align: center; font-size: 14px; color: var(--muted); overflow-wrap: break-word; }
.appfoot a { color: var(--navy); }
.studio-hero { text-align: center; }
.studio-logo { display: block; margin: 4px auto 10px; width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 6px 18px rgba(22, 50, 74, 0.18); }
.studio-hero h1 { font-size: clamp(26px, 8.2vw, 34px); overflow-wrap: break-word; }
.studio-hero .lede { max-width: 30em; margin: 0 auto; }
.studio-hero .lede + .lede { margin-top: 0.2em; }
.studio-data { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin: 0; }
.studio-data dt { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brass); margin-top: 10px; }
.studio-data dt:first-child { margin-top: 0; }
.studio-data dd { margin: 0; overflow-wrap: anywhere; }
.studio-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.studio-actions .btn { text-align: center; justify-content: center; padding-left: 8px; padding-right: 8px; }
.studio-safety { font-size: 15px; }
@media (min-width: 640px) {
  .studio-data { grid-template-columns: max-content 1fr; }
  .studio-data dt { margin-top: 0; padding-top: 3px; }
}
