/* Gestionale — tema "regia" (stessa famiglia grafica della suite sala consiliare).
   Scuro di default, chiaro da pulsante o preferenza di sistema. Font di sistema Apple (SF) dove c'è. */
:root {
  --bg: #0f1217; --panel: #171b22; --panel2: #1e232c; --line: #2a303b; --line2: #363d4a;
  --fg: #e6e8ec; --muted: #9aa3b2; --dim: #6b7383;
  --accent: #4f8cff; --accent2: #7b5cff; --accent-fg: #fff; --accent-soft: rgba(79,140,255,.14);
  --ok: #2fbf71; --warn: #f5a524; --err: #ff5d5d; --info: #4f8cff;
  --radius: 12px; --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable Text", "Segoe UI",
          Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --fs: 15.5px; --fs-sm: 13.5px; --fs-xs: 12.5px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f4f6; --panel: #ffffff; --panel2: #f6f7f9; --line: #dde1e7; --line2: #cdd3db;
    --fg: #14181f; --muted: #4b5565; --dim: #7b8494; --accent: #2f6fe0; --accent-soft: rgba(47,111,224,.10);
    --ok: #1f9d5a; --warn: #c27c0e; --err: #d93f3f; --info: #2f6fe0; color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f3f4f6; --panel: #ffffff; --panel2: #f6f7f9; --line: #dde1e7; --line2: #cdd3db;
  --fg: #14181f; --muted: #4b5565; --dim: #7b8494; --accent: #2f6fe0; --accent-soft: rgba(47,111,224,.10);
  --ok: #1f9d5a; --warn: #c27c0e; --err: #d93f3f; --info: #2f6fe0; color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--fg); font: var(--fs)/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.ico { flex: none; vertical-align: middle; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.012em; }
h1 { font-size: 25px; } h2 { font-size: 19px; } h3 { font-size: 16.5px; }
small, .muted { color: var(--muted); }
.dim { color: var(--dim); }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
code { background: var(--panel2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font: 13.5px var(--mono); word-break: break-all; }
button, input, select, textarea { font-family: inherit; }

/* ---------- struttura */
.shell { display: flex; min-height: 100vh; }
.side { width: 264px; flex: none; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 16px 12px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 700; font-size: 17px; min-width: 0; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand::before { content: ""; width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: conic-gradient(from 210deg, var(--accent), var(--accent2), var(--accent)); }
.brand:has(img)::before { display: none; }
.brand img { max-height: 34px; max-width: 150px; }
.side-label { padding: 14px 22px 6px; color: var(--dim); font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; font-weight: 600; }
.nav { flex: 1; overflow-y: auto; padding: 0 10px 12px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--muted);
  text-decoration: none; font-weight: 550; cursor: pointer; list-style: none; user-select: none; transition: background .12s, color .12s; }
.nav-item:hover { background: var(--panel2); color: var(--fg); }
.nav-item.active { background: var(--accent-soft); color: var(--fg); }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item.active .ico { color: var(--accent); }
.nav-item.sub { padding-left: 22px; font-weight: 500; font-size: 14.5px; }
.nav-item span { flex: 1; }
.nav summary::-webkit-details-marker { display: none; }
.nav details[open] > summary { color: var(--fg); }
.nav details[open] > summary .chev { transform: rotate(180deg); }
.chev { transition: transform .15s; color: var(--dim); }
/* utente e uscita in fondo al menu (al posto della barra piena) */
.side-foot { margin: 0; padding: 10px 12px 14px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.side-user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px;
  text-decoration: none; color: var(--fg); font-size: 14px; font-weight: 550; }
.side-user:hover { background: var(--panel2); }
.side-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout { flex: none; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  border: 1px solid var(--line2); background: transparent; color: var(--muted); border-radius: 9px; }
.logout:hover { color: var(--err); border-color: color-mix(in srgb, var(--err) 50%, var(--line2)); background: color-mix(in srgb, var(--err) 10%, transparent); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 24px;
  background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 550; white-space: nowrap; overflow: hidden; }
.crumbs > * { overflow: hidden; text-overflow: ellipsis; }
.crumbs a { text-decoration: none; } .crumbs a:hover { color: var(--fg); }
.crumbs .sep { color: var(--dim); flex: none; }
.clock-pill { padding: 5px 11px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); font-size: 13px;
  color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.content { padding: 28px clamp(16px, 4vw, 52px); max-width: 1520px; width: 100%; margin: 0 auto; flex: 1; }
.foot { padding: 10px 24px; color: var(--dim); font-size: 12px; text-align: right; }
.only-mobile { display: none !important; }
.scrim { display: none; }

@media (max-width: 900px) {
  :root { --fs: 16px; }
  .only-mobile { display: inline-flex !important; }
  .side { position: fixed; left: 0; top: 0; z-index: 30; width: min(300px, 86vw); transform: translateX(-100%); transition: transform .2s;
    box-shadow: 0 0 40px rgba(0,0,0,.4); }
  body.nav-open { overflow: hidden; }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(5,8,12,.55); z-index: 20; }
  .top { padding: 0 12px; height: 54px; }
  .clock-pill { display: none; }
  .content { padding: 18px 14px 40px; }
  h1 { font-size: 22px; }
  .nav-item { padding: 11px 12px; }
}

/* ---------- componenti */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; min-width: 0; }
.card + .card { margin-top: 20px; }
.grid > .card + .card { margin-top: 0; }
.card > h2, .card-head h2, .card.f > h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650;
  display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g-main, .g3 { grid-template-columns: minmax(0, 1fr); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .g2, .g4 { grid-template-columns: minmax(0, 1fr); }
  .li { flex-wrap: wrap; } .li .li-side { text-align: left; flex-basis: 100%; }
  .card { padding: 16px 15px; border-radius: 11px; }
  .kv { flex-direction: column; gap: 2px; } .kv > span { min-width: 0; font-size: var(--fs-sm); }
  .page-head { gap: 8px; } .page-head h1 { flex: 0 0 100% !important; order: -1; }
  .valbar > span:first-child { flex-basis: 100%; }
}
.stack > * + * { margin-top: var(--gap, 20px); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { flex: 1; min-width: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--accent); background: var(--accent);
  color: var(--accent-fg); font: 600 15px var(--font); padding: 9px 16px; border-radius: 9px; cursor: pointer; text-decoration: none;
  white-space: nowrap; min-height: 40px; transition: filter .12s, background .12s; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--panel2); color: var(--fg); border-color: var(--line2); }
.btn.ghost:hover { border-color: var(--dim); filter: none; }
.btn.danger { background: color-mix(in srgb, var(--err) 10%, transparent); color: var(--err); border-color: color-mix(in srgb, var(--err) 50%, var(--line2)); }
.btn.danger:hover { background: color-mix(in srgb, var(--err) 18%, transparent); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.sm { padding: 5px 11px; font-size: 13.5px; min-height: 32px; border-radius: 8px; }
.btn.lg { padding: 13px 24px; font-size: 16.5px; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--line2);
  border-radius: 9px; background: var(--panel2); color: var(--fg); cursor: pointer; text-decoration: none; flex: none; }
.iconbtn:hover { border-color: var(--dim); }

.flash { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.flash.err { background: color-mix(in srgb, var(--err) 12%, transparent); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.flash.info { background: color-mix(in srgb, var(--info) 11%, transparent); border-color: color-mix(in srgb, var(--info) 38%, transparent); }
.flash a { color: var(--accent); }

/* form */
form.f { display: grid; gap: 16px; }
.fgrid { display: grid; gap: 14px 18px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld.wide { grid-column: 1 / -1; }
.fld > span { font-size: var(--fs-sm); color: var(--muted); font-weight: 550; }
.fld small { color: var(--dim); font-size: var(--fs-xs); }
.req { color: var(--err); font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=month],
input[type=url], input[type=search], input[type=datetime-local], input[type=tel], select, textarea {
  width: 100%; background: var(--panel2); color: var(--fg); border: 1px solid var(--line2); border-radius: 9px;
  padding: 9px 12px; font: 15px var(--font); min-height: 40px; }
@media (max-width: 900px) {   /* 16px: iOS non fa zoom entrando nel campo */
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=month],
  input[type=url], input[type=search], input[type=datetime-local], input[type=tel], select, textarea { font-size: 16px; min-height: 44px; }
  .btn { min-height: 44px; } .btn.sm { min-height: 36px; }
}
select[multiple] { min-height: 0; }
input[type=file] { color: var(--muted); font-size: 14px; max-width: 100%; }
input[type=file]::file-selector-button { font: 600 13.5px var(--font); color: var(--fg); background: var(--panel2); border: 1px solid var(--line2);
  border-radius: 8px; padding: 6px 11px; margin-right: 10px; cursor: pointer; }
input[type=color] { width: 46px; height: 40px; padding: 2px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 9px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; }
input[type=checkbox] { accent-color: var(--accent); }
.chk { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 10px; align-items: start; cursor: pointer; padding: 4px 0; }
.chk input { margin: 3px 0 0; width: 18px; height: 18px; }
.chk small { grid-column: 2; color: var(--dim); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px 18px; margin: 0; }
legend { padding: 0 6px; color: var(--muted); font-weight: 650; font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters .fld { min-width: 160px; }
@media (max-width: 700px) { .filters .fld { min-width: 0; flex: 1 1 140px; } }

/* tabelle */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--panel2); white-space: nowrap; font-weight: 650; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--panel2) 70%, transparent); }
.tbl tbody tr[data-href] { cursor: pointer; }
.tbl a.rowlink { text-decoration: none; font-weight: 600; }
.tbl a.rowlink:hover { color: var(--accent); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { background: var(--panel2); }
.empty { padding: 34px; text-align: center; color: var(--muted); }
/* su telefono le tabelle con etichette (data-l) diventano schede impilate */
@media (max-width: 700px) {
  .tbl-wrap:has(td[data-l]) { border: 0; background: none; overflow: visible; }
  .tbl:has(td[data-l]) thead { display: none; }
  .tbl:has(td[data-l]) tr { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 8px 12px; margin-bottom: 10px; }
  .tbl:has(td[data-l]) td { display: flex; gap: 12px; justify-content: space-between; border: 0; padding: 5px 0; text-align: right; }
  .tbl:has(td[data-l]) td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: var(--fs-sm); text-align: left; flex: none; }
  .tbl:has(td[data-l]) td.num { white-space: normal; }
  .tbl:has(td[data-l]) td:empty { display: none; }
  .tbl:has(td[data-l]) tfoot tr { background: var(--panel2); }
}

.badge { --b: var(--dim); display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: color-mix(in srgb, var(--b) 16%, transparent); color: color-mix(in srgb, var(--b) 70%, var(--fg));
  border: 1px solid color-mix(in srgb, var(--b) 40%, transparent); white-space: nowrap; }
.badge.ok { --b: var(--ok); } .badge.err { --b: var(--err); } .badge.warn { --b: var(--warn); } .badge.info { --b: var(--info); } .badge.acc { --b: var(--accent); }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; padding: 0 5px; border-radius: 4px;
  border: 1px solid currentColor; opacity: .85; vertical-align: 1px; }

.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex: none;
  background: conic-gradient(from 210deg, var(--accent), var(--accent2), var(--accent)); color: #fff; font-weight: 700; }

.kv { display: flex; gap: 10px; padding: 6px 0; align-items: baseline; }
.kv > span { color: var(--muted); min-width: 140px; display: inline-flex; gap: 8px; align-items: center; }
.kv > b { font-weight: 550; word-break: break-word; }
.kvs { margin-top: 6px; }

/* righe "scheda" */
.list { display: grid; gap: 10px; }
.li { display: flex; gap: 14px; align-items: center; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel2); text-decoration: none; transition: border-color .12s; }
a.li:hover { border-color: var(--dim); }
.li .li-main { flex: 1; min-width: 0; }
.li .li-title { font-weight: 600; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .li-sub { color: var(--muted); font-size: var(--fs-sm); }
.li .li-side { text-align: right; color: var(--muted); font-size: var(--fs-sm); }
.li .li-side b { color: var(--fg); }

/* profilo */
.profile { display: flex; gap: 22px; align-items: flex-start; }
.profile .avatar { width: 96px; height: 96px; font-size: 34px; }
.profile-name { font-size: 21px; font-weight: 650; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.profile-name small { font-weight: 500; font-size: 15px; }
@media (max-width: 600px) { .profile { flex-direction: column; } }

/* timbratura e statistiche */
.punch { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 10px 0; }
.punch .clock { font-size: 44px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.stat { padding: 15px 17px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel2); }
.stat b { display: block; font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { color: var(--muted); font-size: var(--fs-sm); }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; color: var(--muted); }
/* schede a pillola (come le sotto-schede della regia) */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; text-decoration: none; color: var(--muted); border: 1px solid var(--line2); border-radius: 999px;
  background: var(--panel); font-weight: 550; font-size: 14px; }
.tabs a.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.tabs a:hover:not(.on) { color: var(--fg); border-color: var(--dim); }

/* accesso */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent),
              radial-gradient(700px 400px at 110% 110%, color-mix(in srgb, var(--accent2) 14%, transparent), transparent); }
.auth .card { width: min(420px, 100%); border-radius: 16px; padding: 28px; }
.auth h1 { margin-bottom: 4px; }
.ms-btn { width: 100%; justify-content: center; background: var(--panel2); color: var(--fg); border-color: var(--line2); padding: 11px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 12px; margin: 6px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

.perm-mod { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; background: var(--panel2); }
.perm-mod h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.perm-access { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 10px; margin-bottom: 10px; border-radius: 8px;
  background: var(--accent-soft); }
.perm-access .chk.mod span { font-weight: 650; }
.perm-mod.off .perm-access ~ .perm-grid, .perm-mod.off .perm-access .chk:not(.mod) { opacity: .4; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2px 18px; }
.mono { font-family: var(--mono); font-size: 13px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
.inline { display: inline; margin: 0; }
details.box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 14px; background: var(--panel2); }
details.box > summary { cursor: pointer; font-weight: 600; }
[hidden] { display: none !important; }
.list > *, .stack > *, .grid > * { min-width: 0; }
.bell { position: relative; }
.dotn { position: absolute; top: -5px; right: -6px; background: var(--err); color: #fff; font-size: 10.5px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
.notif { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel2); }
.notif.unread { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); }
.notif .when { color: var(--dim); font-size: 12px; white-space: nowrap; }
.secret-ok { color: var(--ok); font-weight: 600; } .secret-no { color: var(--dim); }
.token-box { font-family: var(--mono); padding: 12px; border: 1px dashed var(--accent); border-radius: var(--radius-sm); word-break: break-all; background: var(--accent-soft); user-select: all; }
.att { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel2); }
.att a { text-decoration: none; font-weight: 550; } .att .muted { font-size: var(--fs-xs); }
.balance-neg { color: var(--err); font-weight: 700; }

/* planning settimanale */
.week { table-layout: fixed; min-width: 960px; }
.week td { vertical-align: top; height: 68px; padding: 6px; }
.week th:first-child, .week td:first-child { width: 150px; position: sticky; left: 0; background: var(--panel); z-index: 1; }
.week thead th:first-child { background: var(--panel2); }
.pl { display: block; border-left: 3px solid var(--b, var(--accent)); background: color-mix(in srgb, var(--b, var(--accent)) 15%, transparent);
  border-radius: 6px; padding: 4px 7px; margin-bottom: 4px; font-size: 13px; text-decoration: none; line-height: 1.3; min-width: 0; flex: 1; }
.pl b { display: block; font-weight: 600; overflow-wrap: break-word; hyphens: auto; } .pl:hover { filter: brightness(1.12); }
.pl.pending { border-left-style: dashed; outline: 1px dashed color-mix(in srgb, var(--b, var(--accent)) 60%, transparent); outline-offset: -1px; }
.pl-row { position: relative; }
.pl-row input { position: absolute; top: 5px; right: 5px; width: 17px; height: 17px; margin: 0; z-index: 1; }
.pl-row input + .pl { padding-right: 26px; }
.week td.off { background: color-mix(in srgb, var(--dim) 7%, transparent); }
.week .today { box-shadow: inset 0 0 0 2px var(--accent); }
.valbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--ok) 45%, var(--line)); background: color-mix(in srgb, var(--ok) 9%, var(--panel)); }

.agenda { display: none; }
@media (max-width: 700px) {
  .week-wrap { display: none; }
  .agenda { display: grid; gap: 10px; }
  .agenda-day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
  .agenda-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
  .agenda-day.off { background: color-mix(in srgb, var(--dim) 7%, var(--panel)); }
  .agenda-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
  .agenda .pl { font-size: 14.5px; padding: 7px 10px; }
  .agenda .pl-row input { width: 22px; height: 22px; top: 8px; right: 8px; }
  .agenda .pl-row input + .pl { padding-right: 38px; }
}

/* fascicolo */
.contract { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel2); }
.contract + .contract { margin-top: 10px; }
.contract.concluso { opacity: .72; }
.contract.in_corso { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }

@media print {
  .side, .top, .foot, .scrim, .form-actions, .valbar { display: none !important; }
  body { background: #fff; color: #000; } .card, .tbl-wrap { border-color: #ccc; background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.tbl.rates input { min-width: 72px; width: 100%; text-align: right; padding: 6px 8px; min-height: 34px; }
.tbl.rates th, .tbl.rates td { padding: 8px 6px; }
.tbl.rates input[type=date] { min-width: 132px; text-align: left; }
.tbl.rates tr.newrow td { background: var(--accent-soft); }
.pl.leave { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--b) 16%, transparent) 0 8px,
  color-mix(in srgb, var(--b) 9%, transparent) 8px 16px); }
/* planning mensile */
.month-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.month { table-layout: fixed; min-width: 900px; }
.month td { vertical-align: top; height: 118px; padding: 5px; border-right: 1px solid var(--line); }
.month td:last-child { border-right: 0; }
.month td.out { opacity: .45; }
.month td.off { background: color-mix(in srgb, var(--dim) 7%, transparent); }
.month td.today { box-shadow: inset 0 0 0 2px var(--accent); }
.month .mday { display: flex; gap: 6px; align-items: baseline; margin-bottom: 4px; font-size: 13px; }
.month .mday > a:first-child { font-weight: 700; text-decoration: none; }
.month .mday .madd { margin-left: auto; text-decoration: none; font-size: 16px; line-height: 1; }
.month .pl { font-size: 12px; padding: 3px 6px; margin-bottom: 3px; }
.month .pl b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) { .month-wrap { display: none; } }
