/*
 * PROTIS IBF V.3 – interfaccia responsive (smartphone, tablet, desktop) con tema chiaro/scuro.
 * Le variabili --pt-primary / --pt-accent sono impostate dalle Opzioni del componente.
 */
:root {
  --pt-primary: #0b4f8a;
  --pt-accent: #ffc300;
  --pt-bg: #f4f6fa;
  --pt-surface: #ffffff;
  --pt-surface-2: #f0f3f8;
  --pt-text: #1d2433;
  --pt-muted: #5d6779;
  --pt-border: #dde2ea;
  --pt-ok: #1e8e5a;
  --pt-ok-bg: #e3f5ec;
  --pt-warn: #b26a00;
  --pt-warn-bg: #fff3d6;
  --pt-danger: #c0392b;
  --pt-danger-bg: #fde7e4;
  --pt-info-bg: #e7f0fb;
  --pt-weekend: #f7f1e6;
  --pt-radius: 14px;
  --pt-radius-sm: 9px;
  --pt-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .06);
  --pt-font: system-ui, -apple-system, "Segoe UI", Roboto, "Titillium Web", sans-serif;
  --pt-bottombar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-bs-theme="light"]) {
    --pt-bg: #10141b;
    --pt-surface: #181e28;
    --pt-surface-2: #1f2733;
    --pt-text: #e7ebf2;
    --pt-muted: #9aa5b8;
    --pt-border: #2b3443;
    --pt-ok-bg: #12382a;
    --pt-warn-bg: #3a2c0c;
    --pt-danger-bg: #3d1916;
    --pt-info-bg: #15283f;
    --pt-weekend: #1c1f26;
    --pt-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

/* ---------------------------------------------------------------- shell */
.pt-app {
  font-family: var(--pt-font);
  color: var(--pt-text);
  background: var(--pt-bg);
  border-radius: var(--pt-radius);
  padding: 0 0 1rem;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
.pt-app *, .pt-app *::before, .pt-app *::after { box-sizing: border-box; }
.pt-app a { color: var(--pt-primary); }
.pt-app h1, .pt-app h2, .pt-app h3 { color: var(--pt-text); line-height: 1.2; margin: 0; }
.pt-ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pt-muted { color: var(--pt-muted); }

.pt-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 1rem;
  background: var(--pt-primary); color: #fff;
  border-radius: var(--pt-radius) var(--pt-radius) 0 0;
}
.pt-brand { display: flex; align-items: center; gap: .6rem; color: #fff !important; text-decoration: none; min-width: 0; }
.pt-brand img { border-radius: 9px; background: #fff; }
.pt-brand span { display: flex; flex-direction: column; min-width: 0; }
.pt-brand strong { font-size: 1.05rem; letter-spacing: .02em; }
.pt-brand small { opacity: .85; font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-userchip { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.pt-userchip-text { display: flex; flex-direction: column; text-align: right; min-width: 0; }
.pt-userchip-text strong { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-userchip-text small { font-size: .72rem; opacity: .85; }
.pt-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--pt-accent); color: #1d2433; font-weight: 700; font-size: .8rem; flex: none; }
.pt-logout { margin: 0; }
.pt-topbar .pt-btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .45); }

.pt-tabs {
  display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none;
  padding: .4rem .6rem; background: var(--pt-surface); border-bottom: 1px solid var(--pt-border);
  position: sticky; top: 0; z-index: 20;
}
.pt-tabs::-webkit-scrollbar { display: none; }
.pt-tabs a {
  display: flex; align-items: center; gap: .4rem; white-space: nowrap;
  padding: .55rem .8rem; border-radius: 999px; text-decoration: none; color: var(--pt-muted) !important; font-weight: 500; font-size: .92rem;
}
.pt-tabs a:hover { background: var(--pt-surface-2); color: var(--pt-text) !important; }
.pt-tabs a.is-active { background: var(--pt-primary); color: #fff !important; }

.pt-main { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.pt-footer { padding: .5rem 1rem; color: var(--pt-muted); font-size: .78rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

.pt-bottombar { display: none; }

/* ---------------------------------------------------------------- componenti */
.pt-card { background: var(--pt-surface); border: 1px solid var(--pt-border); border-radius: var(--pt-radius); padding: 1rem; box-shadow: var(--pt-shadow); }
.pt-card-title { font-size: .95rem !important; text-transform: uppercase; letter-spacing: .04em; color: var(--pt-muted) !important; margin-bottom: .6rem !important; }
.pt-section-title { font-size: 1.15rem !important; margin-top: .5rem !important; }
.pt-grid { display: grid; gap: 1rem; }
.pt-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pt-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pt-grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pt-hero { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.pt-hero h1 { font-size: 1.6rem; }
.pt-page-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.pt-page-head h1 { font-size: 1.45rem; }

.pt-stat { display: flex; flex-direction: column; gap: .25rem; }
.pt-stat-label { font-size: .8rem; color: var(--pt-muted); text-transform: uppercase; letter-spacing: .03em; }
.pt-stat-value { font-size: 2rem; font-variant-numeric: tabular-nums; }
.pt-progress { height: 8px; background: var(--pt-surface-2); border-radius: 99px; overflow: hidden; margin-top: .3rem; }
.pt-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--pt-primary), #2f86d1); border-radius: 99px; transition: width .4s; }
.pt-progress.is-warn span { background: var(--pt-warn); }
.pt-progress.is-over span { background: var(--pt-danger); }

.pt-project header { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.pt-project footer { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; font-size: .9rem; }
.pt-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: .4rem 0; font-size: .88rem; }
.pt-wplist { margin: 0; padding-left: 1.1rem; font-size: .85rem; color: var(--pt-muted); }

.pt-tiles .pt-tile { display: flex; flex-direction: column; gap: .2rem; padding: 1rem; border-radius: var(--pt-radius); text-decoration: none; background: var(--pt-surface); border: 1px solid var(--pt-border); border-left: 5px solid var(--pt-accent); color: var(--pt-text) !important; transition: transform .15s, box-shadow .15s; }
.pt-tiles .pt-tile:hover { transform: translateY(-2px); box-shadow: var(--pt-shadow); }
.pt-tiles .pt-tile span { color: var(--pt-muted); font-size: .85rem; }

.pt-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 99px; background: var(--pt-surface-2); color: var(--pt-muted); font-size: .78rem; font-weight: 500; white-space: nowrap; }
.pt-chip-strong { background: var(--pt-primary); color: #fff; }
.pt-chip-warn { background: var(--pt-warn-bg); color: var(--pt-warn); }
.pt-chip-ok { background: var(--pt-ok-bg); color: var(--pt-ok); }
.pt-chip-danger { background: var(--pt-danger-bg); color: var(--pt-danger); }
.pt-chip-btn { border: 1px solid var(--pt-border); background: var(--pt-surface); color: var(--pt-text); border-radius: 99px; padding: .2rem .65rem; font-size: .78rem; cursor: pointer; }
.pt-chip-btn:hover { border-color: var(--pt-primary); color: var(--pt-primary); }

.pt-alert { padding: .75rem 1rem; border-radius: var(--pt-radius-sm); border: 1px solid transparent; }
.pt-alert-warning { background: var(--pt-warn-bg); color: var(--pt-warn); border-color: rgba(178, 106, 0, .25); }
.pt-alert-danger { background: var(--pt-danger-bg); color: var(--pt-danger); }
.pt-alert-info { background: var(--pt-info-bg); color: var(--pt-text); margin-top: .75rem; font-size: .88rem; }
.pt-alert-ok { background: var(--pt-ok-bg); color: var(--pt-ok); }
.pt-flash { margin-bottom: 1rem; }
.pt-empty { padding: 1.5rem; text-align: center; color: var(--pt-muted); border: 2px dashed var(--pt-border); border-radius: var(--pt-radius); }

/* bottoni */
.pt-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .5rem 1rem; border-radius: var(--pt-radius-sm); border: 1px solid var(--pt-border); background: var(--pt-surface); color: var(--pt-text); font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none !important; transition: background .15s, border-color .15s, opacity .15s; }
.pt-btn:hover { border-color: var(--pt-primary); }
.pt-btn:disabled { opacity: .5; cursor: not-allowed; }
.pt-btn-primary { background: var(--pt-primary); border-color: var(--pt-primary); color: #fff !important; }
.pt-btn-primary:hover { filter: brightness(1.1); }
.pt-btn-accent { background: var(--pt-accent); border-color: var(--pt-accent); color: #1d2433 !important; }
.pt-btn-danger { background: var(--pt-danger); border-color: var(--pt-danger); color: #fff !important; }
.pt-btn-ghost { background: transparent; }
.pt-btn-sm { min-height: 32px; padding: .25rem .7rem; font-size: .82rem; }
.pt-btn-lg { min-height: 48px; padding: .7rem 1.4rem; font-size: 1rem; }
.pt-btn-icon { width: 40px; padding: 0; font-size: 1.3rem; }
.pt-btn-block { width: 100%; }
.pt-danger { color: var(--pt-danger) !important; }

.pt-dropdown { position: relative; }
.pt-dropdown-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 260px; background: var(--pt-surface); border: 1px solid var(--pt-border); border-radius: var(--pt-radius-sm); box-shadow: 0 10px 30px rgba(0, 0, 0, .15); padding: .35rem; }
.pt-dropdown.is-open .pt-dropdown-menu { display: block; }
.pt-dropdown-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .6rem .75rem; border-radius: 7px; font: inherit; color: var(--pt-text); cursor: pointer; }
.pt-dropdown-menu button:hover { background: var(--pt-surface-2); }
.pt-dropdown-menu hr { border: 0; border-top: 1px solid var(--pt-border); margin: .3rem 0; }

/* form */
.pt-form { display: flex; flex-direction: column; gap: .75rem; }
.pt-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--pt-muted); }
.pt-form input:not([type=checkbox]):not([type=radio]), .pt-form select, .pt-form textarea,
.pt-app .pt-input {
  width: 100%; min-height: 42px; padding: .5rem .7rem; border: 1px solid var(--pt-border); border-radius: var(--pt-radius-sm);
  background: var(--pt-surface); color: var(--pt-text); font: inherit; font-size: 16px; /* 16px evita lo zoom su iOS */
}
.pt-form input:focus, .pt-form select:focus, .pt-form textarea:focus, .pt-app .pt-input:focus { outline: 2px solid color-mix(in srgb, var(--pt-primary) 45%, transparent); border-color: var(--pt-primary); }
.pt-form textarea { min-height: 90px; resize: vertical; }
.pt-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.pt-row-wrap { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); }
.pt-manual .pt-dur { width: 100% !important; }
.pt-radio { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.pt-radio label { flex-direction: row; align-items: flex-start; gap: .5rem; font-weight: 500; color: var(--pt-text); }
.pt-radio small, .pt-form label small { font-weight: 400; color: var(--pt-muted); }
.pt-check { flex-direction: row !important; align-items: center; gap: .5rem !important; color: var(--pt-text) !important; }
.pt-help { font-size: .8rem; color: var(--pt-muted); margin: 0; }
.pt-form-actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }

/* tabelle (diventano schede su smartphone) */
.pt-table-wrap { overflow-x: auto; border-radius: var(--pt-radius); border: 1px solid var(--pt-border); background: var(--pt-surface); }
.pt-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.pt-table th, .pt-table td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--pt-border); vertical-align: middle; }
.pt-table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pt-muted); background: var(--pt-surface-2); position: sticky; top: 0; }
.pt-table tr:last-child td { border-bottom: 0; }
.pt-table tbody tr:hover { background: var(--pt-surface-2); }
.pt-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pt-table .actions { white-space: nowrap; text-align: right; }
.pt-table .actions form { display: inline; }
.pt-toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.pt-toolbar .pt-input { max-width: 320px; }

/* dialog (bottom sheet su smartphone) */
.pt-dialog, .pt-sheet { border: 0; padding: 0; border-radius: var(--pt-radius); background: var(--pt-surface); color: var(--pt-text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); width: min(560px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); font-family: var(--pt-font); }
.pt-dialog-wide { width: min(760px, calc(100vw - 2rem)); }
.pt-dialog::backdrop, .pt-sheet::backdrop { background: rgba(10, 16, 28, .5); backdrop-filter: blur(2px); }
.pt-dialog > form { max-height: calc(100dvh - 2rem); gap: 0; }
.pt-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; padding: 1rem 1rem .5rem; border-bottom: 1px solid var(--pt-border); }
.pt-dialog-head h2 { font-size: 1.15rem; }
.pt-dialog-head h2[data-bind="dayTitle"] { text-transform: capitalize; }
.pt-dialog-head p { margin: .2rem 0 0; font-size: .82rem; }
.pt-dialog-body { padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: .9rem; }
.pt-dialog-foot { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; padding: .75rem 1rem; border-top: 1px solid var(--pt-border); background: var(--pt-surface-2); border-radius: 0 0 var(--pt-radius) var(--pt-radius); }
.pt-day-total { margin-right: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.pt-day-total.is-over { color: var(--pt-danger); }
.pt-day-capacity { background: var(--pt-info-bg); padding: .5rem .75rem; border-radius: var(--pt-radius-sm); font-size: .9rem; }
.pt-wp-group { border: 1px solid var(--pt-border); border-radius: var(--pt-radius-sm); padding: .5rem .75rem .75rem; margin: 0; }
.pt-wp-group legend { font-weight: 700; padding: 0 .3rem; }
.pt-wp-group legend small { font-weight: 400; color: var(--pt-muted); }
.pt-wp-row { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; padding: .35rem 0; border-bottom: 1px dashed var(--pt-border); }
.pt-wp-row:last-child { border-bottom: 0; }
.pt-wp-row label { font-weight: 500; color: var(--pt-text); font-size: .9rem; }
.pt-wp-input { display: flex; gap: .4rem; align-items: center; }
.pt-wp-input input, .pt-dur { width: 110px !important; text-align: center; font-variant-numeric: tabular-nums; }
.pt-wp-row > input { width: 120px !important; }
.pt-manual { border: 1px dashed var(--pt-primary); border-radius: var(--pt-radius-sm); padding: .5rem .75rem .75rem; margin: 0; }
.pt-manual legend { font-weight: 700; padding: 0 .3rem; }
.pt-quick { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-top: .6rem; font-size: .82rem; color: var(--pt-muted); }
.pt-sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem; border-bottom: 1px solid var(--pt-border); }
.pt-sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; padding: 1rem; }
.pt-sheet-grid a { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .8rem .3rem; border-radius: var(--pt-radius-sm); background: var(--pt-surface-2); color: var(--pt-text) !important; text-decoration: none; font-size: .8rem; text-align: center; }
.pt-sheet-grid a.is-active { background: var(--pt-primary); color: #fff !important; }

.pt-toast { position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2000; max-width: min(92vw, 520px); padding: .75rem 1.1rem; border-radius: 12px; background: #1d2433; color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); font-size: .92rem; font-family: var(--pt-font); }
.pt-toast[data-type="error"] { background: var(--pt-danger); }
.pt-toast[data-type="warn"] { background: #8a5a00; }

/* ---------------------------------------------------------------- calendario */
.pt-cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem;
  background: var(--pt-surface); border: 1px solid var(--pt-border); border-radius: var(--pt-radius); padding: 1rem 1.25rem; box-shadow: var(--pt-shadow); }
.pt-cal-monthnav { display: flex; align-items: center; gap: .75rem; }
.pt-btn-round { border-radius: 50%; width: 44px; min-height: 44px; font-size: 1.5rem; line-height: 1; }
.pt-cal-titlebox { display: flex; flex-direction: column; align-items: center; min-width: 13ch; }
.pt-cal-kicker { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--pt-muted); font-weight: 600; }
.pt-cal-head .pt-cal-title { font-size: 1.9rem; font-weight: 750; color: var(--pt-primary) !important; letter-spacing: -.01em; min-width: 0; }
.pt-cal-who { display: flex; flex-direction: column; align-items: flex-end; gap: .45rem; }
.pt-cal-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pt-muted); font-weight: 600; }
.pt-person-select { display: flex; align-items: center; gap: .5rem; }
.pt-cal-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin: 1.1rem 0 .4rem; }
.pt-cal-bar .pt-legend { margin: 0; }
.pt-cal-note { background: var(--pt-warn-bg); color: var(--pt-warn); border-radius: var(--pt-radius-sm); padding: .65rem 1rem; font-size: .9rem; margin-bottom: .4rem; }
.pt-cal-layout { margin-top: .6rem; }
.pt-dot-off { background: #c5ccd6; }
/* giorni non rendicontabili: non cliccabili */
.pt-day.is-off { cursor: default; opacity: .55; border-top-color: transparent !important; box-shadow: none; }
.pt-day.is-off:hover { transform: none; border-color: var(--pt-border); box-shadow: none; }
/* ore rendicontate / rendicontabili */
.pt-day-rep { display: inline-flex; gap: .25rem; align-items: baseline; padding: .1rem .45rem; border-radius: 7px; width: fit-content; }
.pt-day-rep.is-partial { background: #fff1bf; color: #6b4e00; }
.pt-day-rep.is-ok { background: var(--pt-ok-bg); color: var(--pt-ok); }
.pt-day-rep.is-over { background: var(--pt-danger-bg); color: var(--pt-danger); }
@media (prefers-color-scheme: dark) { .pt-day-rep.is-partial { background: #4a3a06; color: #ffe08a; } }

.pt-calendar.is-busy .pt-cal-grid { opacity: .55; pointer-events: none; }
.pt-cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.pt-cal-nav { display: flex; align-items: center; gap: .4rem; }
.pt-cal-title { font-size: 1.45rem; min-width: 10ch; text-align: center; }
.pt-cal-actions { display: flex; gap: .5rem; align-items: center; }
.pt-person-select select { min-height: 40px; border-radius: var(--pt-radius-sm); border: 1px solid var(--pt-border); background: var(--pt-surface); color: var(--pt-text); padding: .3rem .6rem; font: inherit; max-width: 320px; }
.pt-cal-info { display: flex; gap: .4rem; flex-wrap: wrap; }
.pt-cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.pt-cal-side { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 64px; }
.pt-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .78rem; color: var(--pt-muted); margin-bottom: .5rem; }
.pt-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .3rem; vertical-align: middle; }
.pt-dot-ok { background: var(--pt-ok); } .pt-dot-partial { background: var(--pt-accent); } .pt-dot-over { background: var(--pt-danger); } .pt-dot-abs { background: #8e7cc3; }

.pt-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.pt-dow { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--pt-muted); text-align: center; padding: .25rem 0; }
.pt-dow.is-weekend { color: #b07a2a; }
.pt-day {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: .25rem; text-align: left;
  min-height: 108px; padding: .45rem .5rem; border-radius: 11px; border: 1px solid var(--pt-border); background: var(--pt-surface);
  font: inherit; color: var(--pt-text); cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s;
  border-top: 4px solid transparent;
}
.pt-day:hover { border-color: var(--pt-primary); box-shadow: var(--pt-shadow); transform: translateY(-1px); }
.pt-day:focus-visible { outline: 3px solid color-mix(in srgb, var(--pt-primary) 50%, transparent); }
.pt-day.is-blank { visibility: hidden; cursor: default; border: 0; }
.pt-day.is-weekend, .pt-day.is-holiday { background: var(--pt-weekend); }
.pt-day.is-today { box-shadow: inset 0 0 0 2px var(--pt-primary); }
.pt-day.st-ok { border-top-color: var(--pt-ok); }
.pt-day.st-partial, .pt-day.st-todo { border-top-color: var(--pt-accent); }
.pt-day.st-todo { border-top-style: dashed; }
.pt-day.st-over { border-top-color: var(--pt-danger); background: var(--pt-danger-bg); }
.pt-day.st-abs { border-top-color: #8e7cc3; }
.pt-day-head { display: flex; align-items: baseline; gap: .35rem; flex-wrap: wrap; }
.pt-day-num { font-weight: 800; font-size: 1.05rem; }
.pt-day-dow { display: none; font-size: .8rem; color: var(--pt-muted); text-transform: capitalize; }
.pt-day-hol { font-size: .68rem; color: #b07a2a; line-height: 1.1; }
.pt-day-body { display: flex; flex-direction: column; gap: .15rem; font-size: .76rem; }
.pt-day-line small { color: var(--pt-muted); }
.pt-day-rep { margin-top: auto; font-variant-numeric: tabular-nums; font-size: .8rem; }
.pt-tag { display: inline-block; padding: 0 .35rem; border-radius: 5px; background: var(--pt-surface-2); font-size: .68rem; line-height: 1.5; width: fit-content; }
.pt-tag-smartworking { background: #e0efff; color: #1b5fa8; }
.pt-tag-missione { background: #e7f6ee; color: #1e7a4c; }
.pt-tag-telelavoro { background: #ece8ff; color: #5b3fb0; }
.pt-tag-malattia { background: #f6e4f0; color: #8a2a68; }
.pt-tag-ferie { background: #fff0cc; color: #8a5a00; }
.pt-tag-permessi { background: #ece8f8; color: #5a46a0; }
@media (prefers-color-scheme: dark) {
  .pt-tag-smartworking, .pt-tag-telelavoro, .pt-tag-missione, .pt-tag-malattia, .pt-tag-ferie, .pt-tag-permessi { background: var(--pt-surface-2); color: var(--pt-text); }
}
.pt-skeleton { grid-column: 1 / -1; padding: 3rem; text-align: center; color: var(--pt-muted); }

.pt-kv { display: grid; grid-template-columns: 1fr auto; gap: .35rem .75rem; margin: 0; font-size: .92rem; }
.pt-kv dt { color: var(--pt-muted); }
.pt-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.pt-kv .pt-kv-full { grid-column: 1 / -1; }
.pt-proj-sum { border-bottom: 1px solid var(--pt-border); padding: .35rem 0; }
.pt-proj-sum:last-child { border-bottom: 0; }
.pt-proj-sum summary { display: flex; justify-content: space-between; cursor: pointer; font-weight: 600; list-style: none; }
.pt-proj-sum summary::-webkit-details-marker { display: none; }
.pt-proj-sum ul { list-style: none; margin: .25rem 0 0; padding: 0 0 0 .6rem; font-size: .82rem; color: var(--pt-muted); }
.pt-proj-sum li { display: flex; justify-content: space-between; gap: .5rem; }

/* dashboard */
.pt-report-card header { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pt-report-card header img { max-height: 34px; max-width: 160px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px; }
.pt-report-meta { display: flex; gap: .5rem; flex-wrap: wrap; font-size: .82rem; color: var(--pt-muted); margin: .4rem 0 .6rem; }
.pt-logo-preview { max-height: 60px; max-width: 100%; background: #fff; border-radius: 6px; padding: 4px; border: 1px solid var(--pt-border); }
.pt-wp-editor { display: flex; flex-direction: column; gap: .5rem; }
.pt-wp-editor .pt-wp-edit-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: .5rem; align-items: center; }
.pt-handle { color: var(--pt-muted); font-weight: 700; min-width: 3.5ch; }

.pt-report-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; margin-bottom: 1rem; }
.pt-filter { display: flex; flex-direction: column; gap: .3rem; font-size: .8rem; font-weight: 600; color: var(--pt-muted); }
.pt-filter .pt-input { min-width: 0; }
.pt-filter-project { flex: 1 1 240px; max-width: 340px; }
.pt-filter input[type=date] { width: 170px; }
.pt-filter-check { display: flex; align-items: center; min-height: 42px; font-size: .9rem; font-weight: 500; cursor: pointer; }
.pt-filter-check:has(input:disabled) { opacity: .55; cursor: default; }
.pt-filter-help { flex-basis: 100%; }
[hidden] { display: none !important; }
.pt-report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1rem; align-items: start; }
.pt-report-card .pt-stat-value { font-size: 1.35rem; }
.pt-report-card .pt-grid-3 { gap: .6rem; }
.pt-report-details[open] { grid-column: 1 / -1; }
.pt-report-card:has(.pt-report-details[open]) { grid-column: 1 / -1; }

/* layout in base alla larghezza reale disponibile (template con o senza colonne laterali) */
.pt-main { container-type: inline-size; container-name: ptapp; }
@container ptapp (max-width: 1080px) {
  .pt-cal-layout { grid-template-columns: 1fr; }
  .pt-cal-side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 760px) {
  .pt-app { border-radius: 0; margin: 0 -12px; padding-bottom: calc(var(--pt-bottombar-h) + 1rem + env(safe-area-inset-bottom)); }
  .pt-topbar { border-radius: 0; padding: .6rem .8rem; }
  .pt-brand small, .pt-userchip-text { display: none; }
  .pt-tabs { display: none; }
  .pt-main { padding: .8rem; }
  .pt-grid-3, .pt-grid-2, .pt-report-grid { grid-template-columns: 1fr; }
  .pt-report-card .pt-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .pt-filter { flex: 1 1 40%; }
  .pt-filter-project { flex: 1 1 100%; max-width: none; }
  .pt-filter input[type=date] { width: 100%; }
  .pt-stat-value { font-size: 1.6rem; }
  .pt-hero h1 { font-size: 1.35rem; }

  .pt-bottombar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    height: calc(var(--pt-bottombar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--pt-surface); border-top: 1px solid var(--pt-border); box-shadow: 0 -4px 18px rgba(0, 0, 0, .08);
  }
  .pt-bottombar a, .pt-bottombar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: 0; background: none; color: var(--pt-muted) !important; text-decoration: none; font: inherit; font-size: .68rem; cursor: pointer;
  }
  .pt-bottombar .is-active { color: var(--pt-primary) !important; font-weight: 700; }
  .pt-bottombar .pt-ico { width: 22px; height: 22px; }
  .pt-toast { bottom: calc(var(--pt-bottombar-h) + 1rem + env(safe-area-inset-bottom)); }

  /* calendario → agenda */
  .pt-cal-head { padding: .8rem; }
  .pt-cal-monthnav { width: 100%; justify-content: space-between; }
  .pt-cal-head .pt-cal-title { font-size: 1.4rem; }
  .pt-cal-who { align-items: stretch; width: 100%; }
  .pt-person-select { flex-direction: column; align-items: stretch; }
  .pt-cal-bar .pt-legend { display: none; }
  .pt-cal-bar .pt-cal-actions { width: 100%; }
  .pt-cal-bar .pt-cal-actions .pt-btn { white-space: nowrap; font-size: .88rem; padding: .5rem .6rem; }
  .pt-cal-toolbar { flex-direction: column; align-items: stretch; }
  .pt-cal-nav { justify-content: space-between; }
  .pt-cal-title { font-size: 1.2rem; }
  .pt-cal-actions { justify-content: space-between; }
  .pt-cal-actions > * { flex: 1; }
  .pt-cal-actions .pt-btn { width: 100%; }
  .pt-person-select select { max-width: none; width: 100%; }
  .pt-cal-grid { grid-template-columns: 1fr; gap: 6px; }
  .pt-dow, .pt-day.is-blank { display: none; }
  .pt-day { min-height: 0; flex-direction: row; align-items: center; gap: .6rem; padding: .6rem .7rem; border-top: 1px solid var(--pt-border) !important; border-left: 5px solid transparent; }
  .pt-day.st-ok { border-left-color: var(--pt-ok); } .pt-day.st-partial, .pt-day.st-todo { border-left-color: var(--pt-accent); }
  .pt-day.st-over { border-left-color: var(--pt-danger); } .pt-day.st-abs { border-left-color: #8e7cc3; }
  .pt-day-head { flex-direction: column; align-items: flex-start; gap: 0; min-width: 5.5rem; }
  .pt-day-dow { display: block; }
  .pt-day-body { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .3rem; flex: 1; justify-content: flex-end; }
  .pt-day-rep { margin: 0 0 0 auto; font-size: .9rem; }
  .pt-day.is-weekend:not(.st-ok):not(.st-partial):not(.st-over):not(.st-abs) { opacity: .7; padding: .35rem .7rem; }
  .pt-cal-side { grid-template-columns: 1fr; }

  .pt-dialog, .pt-dialog-wide, .pt-sheet {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 92dvh;
  }
  .pt-dialog > form { max-height: 92dvh; }
  .pt-dialog-foot { border-radius: 0; padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); }
  .pt-dialog-foot .pt-btn { flex: 1; }
  .pt-dialog-foot .pt-day-total { flex-basis: 100%; }
  .pt-dialog-foot { flex-wrap: wrap; }

  /* tabelle → schede */
  .pt-table-cards thead { display: none; }
  .pt-table-cards, .pt-table-cards tbody, .pt-table-cards tr, .pt-table-cards td { display: block; width: 100%; }
  .pt-table-cards tr { padding: .6rem .75rem; border-bottom: 1px solid var(--pt-border); }
  .pt-table-cards td { border: 0; padding: .15rem 0; text-align: left !important; }
  .pt-table-cards td[data-label]::before { content: attr(data-label) ": "; color: var(--pt-muted); font-size: .8rem; }
  .pt-table-cards td.actions { padding-top: .4rem; }
  .pt-wp-editor .pt-wp-edit-row { grid-template-columns: auto 1fr auto; }
}

/* app installata (standalone): nasconde l'intestazione del template Joomla */
@media (display-mode: standalone) {
  body > header.header, body .container-header, body > footer.footer, body .container-footer, body .container-banner, body .container-top, body .container-bottom-a, body .container-bottom-b { display: none !important; }
  body .site-grid { padding-top: env(safe-area-inset-top); }
}

@media print {
  .pt-tabs, .pt-bottombar, .pt-cal-actions, .pt-footer, .pt-topbar form { display: none !important; }
}

/* ---------------------------------------------------------------- accesso */
/* la pagina di accesso resta sempre chiara (anche con il tema scuro del sistema) */
html:has(.pt-login), body:has(.pt-login) { background: #f6f8fb !important; }
body:has(.pt-login) { padding: 0 !important; margin: 0 !important; max-width: none !important; }
body:has(.pt-login) #system-message-container { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 50; width: min(560px, 92vw); margin: 0; }
.pt-app.pt-login {
  --pt-bg: #f6f8fb; --pt-surface: #ffffff; --pt-surface-2: #f0f3f8; --pt-text: #1d2433; --pt-muted: #5d6779; --pt-border: #dde2ea;
  color-scheme: light;
}
.pt-app.pt-login { box-sizing: border-box; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  padding: 2rem 1rem; background: transparent; border-radius: 0; }
.pt-login-shell { width: min(1060px, 100%); display: grid; grid-template-columns: 1.1fr 1fr; border-radius: 24px; overflow: hidden; box-shadow: 0 18px 50px rgba(16, 36, 64, .14); border: 1px solid var(--pt-border); background: var(--pt-surface); }
.pt-login-intro { padding: 3rem 2.8rem; color: #fff; background: linear-gradient(170deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, 0)), #0a426f; display: flex; flex-direction: column; gap: 1.4rem; }
.pt-login-brand { display: flex; align-items: center; gap: .8rem; }
.pt-login-brand img { border-radius: 14px; background: #fff; }
.pt-login-brand strong { display: block; font-size: 1.25rem; letter-spacing: .02em; }
.pt-login-brand span { display: block; font-size: .85rem; opacity: .8; }
.pt-login-intro h1 { color: #fff !important; font-size: 2rem; line-height: 1.25; font-weight: 700; }
.pt-login-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .7rem; font-size: 1rem; }
.pt-login-points li { padding-left: 1.9rem; position: relative; opacity: .95; }
.pt-login-points li::before { content: ""; position: absolute; left: 0; top: .2rem; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: var(--pt-accent);
  -webkit-mask: radial-gradient(circle, #000 60%, transparent 61%); }
.pt-login-points strong { color: var(--pt-accent); }
.pt-login-sedi { margin-top: auto; font-size: .82rem; opacity: .75; }
.pt-login-panel { padding: 3rem 2.8rem; display: flex; flex-direction: column; gap: .9rem; justify-content: center; }
.pt-login-panel h2 { font-size: 1.6rem !important; }
.pt-login-panel .pt-form { gap: 1rem; }
.pt-login-panel .pt-form label { color: var(--pt-text); font-size: .9rem; }
.pt-login-panel input:not([type=checkbox]) { min-height: 48px !important; }
.pt-login-foot { color: #8a96a8; font-size: .78rem; font-family: var(--pt-font); text-align: center; line-height: 1.7; letter-spacing: .02em; }
.pt-login-foot span { display: block; }
@media (max-width: 760px) {
  .pt-app.pt-login { margin: 0; padding: 0 0 .6rem; justify-content: flex-start; gap: .6rem; }
  .pt-login-shell { grid-template-columns: 1fr; border-radius: 0 0 24px 24px; box-shadow: none; border: 0; }
  .pt-login-intro { padding: calc(1.1rem + env(safe-area-inset-top)) 1.2rem 1.1rem; gap: .6rem; }
  .pt-login-brand img { width: 44px; height: 44px; }
  .pt-login-intro h1 { font-size: 1.15rem; }
  .pt-login-panel h2 { font-size: 1.3rem !important; }
  .pt-login-panel .pt-form { gap: .7rem; }
  .pt-login-panel input:not([type=checkbox]) { min-height: 44px !important; }
  .pt-login-foot { font-size: .72rem; line-height: 1.5; }
  .pt-login-points, .pt-login-sedi { display: none; }
  .pt-login-panel { padding: 1.1rem 1.2rem 1.3rem; gap: .6rem; }
}

/* ---------------------------------------------------------------- editor intestazione timesheet */
.pt-hdr-block { border-top: 1px solid var(--pt-border); padding-top: .9rem; display: flex; flex-direction: column; gap: .7rem; }
.pt-hdr-title { font-size: 1rem !important; }
.pt-hdr-title small { font-weight: 400; color: var(--pt-muted); font-size: .82rem; }
.pt-logo-list { display: flex; flex-wrap: wrap; gap: .6rem; }
.pt-logo-item { display: flex; flex-direction: column; gap: .4rem; align-items: center; padding: .5rem; border: 1px solid var(--pt-border); border-radius: var(--pt-radius-sm); background: #fff; width: 170px; }
.pt-logo-item img { height: 64px; max-width: 150px; object-fit: contain; }
.pt-logo-tools { display: flex; gap: .3rem; align-items: center; font-size: .78rem; }
.pt-logo-tools .pt-btn-icon { width: 32px; min-height: 30px; font-size: 1rem; }
.pt-banner-preview { display: flex; flex-direction: column; gap: .3rem; font-size: .8rem; }
.pt-banner-preview img, .pt-hdr-preview-logos img { max-width: 100%; max-height: 90px; object-fit: contain; background: #fff; border: 1px solid var(--pt-border); border-radius: 6px; padding: 4px; }
.pt-strip { display: flex; gap: 28px; align-items: center; justify-content: center; background: #fff; padding: 8px; border-radius: 6px; overflow-x: auto; }
.pt-strip img { height: 52px; max-width: 220px; object-fit: contain; border: 0; padding: 0; }
.pt-hdr-rows { display: flex; flex-direction: column; gap: .4rem; }
.pt-hdr-row { display: grid; grid-template-columns: 2.2rem minmax(150px, 1fr) minmax(170px, 1fr) minmax(170px, 1.3fr) auto; gap: .4rem; align-items: center; }
.pt-hdr-row:has([data-k=value][hidden]):has([data-k=pval][hidden]) [data-k=field] { grid-column: span 2; }
.pt-hdr-row [hidden] { display: none !important; }
.pt-hdr-row.is-off > .pt-input { opacity: .5; text-decoration: line-through; }
.pt-hdr-row [data-k=pval] { border-color: var(--pt-primary); background: color-mix(in srgb, var(--pt-primary) 5%, var(--pt-surface)); }
.pt-hdr-extra { display: flex; flex-direction: column; gap: .5rem; padding: .75rem; background: var(--pt-surface-2); border-radius: var(--pt-radius-sm); }
.pt-hdr-extra .pt-help { margin: 0; }
.pt-hdr-preview-note { font-family: "Latin Modern Roman", "Computer Modern", Georgia, serif; font-size: .72rem; margin: 0 0 .4rem; }
.pt-hdr-tools { display: flex; gap: .25rem; }
.pt-hdr-tools .pt-btn-icon { width: 34px; min-height: 34px; font-size: .95rem; }
.pt-hdr-preview { background: #fff; color: #111; border: 1px solid var(--pt-border); border-radius: var(--pt-radius-sm); padding: .75rem; overflow-x: auto; }
.pt-hdr-preview-logos { text-align: center; margin-bottom: .5rem; }
.pt-hdr-preview-logos img { border: 0; }
.pt-hdr-preview table { width: 100%; border-collapse: collapse; font-family: "Latin Modern Roman", "Computer Modern", Georgia, serif; font-size: .78rem; }
.pt-hdr-preview th, .pt-hdr-preview td { border: 1px solid #333; padding: .15rem .4rem; text-align: left; vertical-align: top; background: var(--pt-tbl-value, #f1f5fa); font-weight: 400; }
.pt-hdr-preview [data-bind="preview"] th { background: var(--pt-tbl-label, #dce6f0); }
.pt-hdr-preview-days { margin-top: .9rem; overflow-x: auto; }
.pt-hdr-preview-days table { font-size: .62rem !important; table-layout: fixed; min-width: 820px; }
.pt-hdr-preview-days th, .pt-hdr-preview-days td { padding: .1rem .15rem !important; background: #fff !important; height: 1.2em; }
.pt-hdr-preview-days th { width: auto !important; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-hdr-preview-days tr.h > * { background: var(--pt-tbl-head, #dce6f0) !important; font-weight: 700; text-align: center; white-space: nowrap; }
.pt-hdr-preview-days tr.h th { text-align: left; }
.pt-hdr-preview-days tr.tot th { font-weight: 700; }
.pt-hdr-preview th { width: 30%; }
@media (max-width: 760px) {
  .pt-hdr-row { grid-template-columns: 1.6rem 1fr; }
  .pt-hdr-row > .pt-input { grid-column: 2; }
  .pt-hdr-row:has([data-k=value][hidden]):has([data-k=pval][hidden]) [data-k=field] { grid-column: 2; }
  .pt-hdr-tools { grid-column: 2; justify-content: flex-end; }
  .pt-hdr-row { padding-bottom: .5rem; border-bottom: 1px dashed var(--pt-border); }
}

/* selettore mese / anno */
.pt-monthpicker { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1.4fr 1fr; gap: .4rem; min-width: 0; }
.pt-monthpicker legend { font-size: .85rem; font-weight: 600; color: var(--pt-muted); padding: 0; margin-bottom: .3rem; }
.pt-monthpicker select { min-width: 0; }

/* selettore persone + monte ore (associazioni) */
.pt-picker { display: flex; flex-direction: column; gap: .5rem; }
.pt-picker-bar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.pt-picker-bar .pt-input { flex: 1 1 240px; max-width: 360px; }
.pt-picker-head { display: grid; grid-template-columns: 1fr 140px; gap: .75rem; padding: 0 .75rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pt-muted); font-weight: 600; }
.pt-picker-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; border: 1px solid var(--pt-border); border-radius: var(--pt-radius-sm); background: var(--pt-surface); }
.pt-picker-list li { display: grid; grid-template-columns: 1fr 140px; gap: .75rem; align-items: center; padding: .4rem .75rem; border-bottom: 1px solid var(--pt-border); }
.pt-picker-list li:last-child { border-bottom: 0; }
.pt-picker-list li.is-checked { background: color-mix(in srgb, var(--pt-primary) 7%, transparent); }
.pt-form .pt-picker-name, .pt-picker-name { display: flex; flex-direction: row; align-items: center; gap: .6rem; font-size: .92rem; font-weight: 500; color: var(--pt-text); cursor: pointer; }
.pt-picker-name input { width: 18px; height: 18px; flex: none; }
.pt-picker-name .pt-chip { margin-left: .35rem; font-size: .7rem; }
.pt-app .pt-picker-hours { min-height: 36px; padding: .3rem .5rem; text-align: right; }
.pt-app .pt-picker-hours:disabled { opacity: .45; background: var(--pt-surface-2); }
@media (max-width: 600px) { .pt-picker-head { display: none; } .pt-picker-list li { grid-template-columns: 1fr 96px; } }

/* associazioni raggruppate per persona */
.pt-assign-list { display: flex; flex-direction: column; gap: .5rem; }
.pt-assign-person { background: var(--pt-surface); border: 1px solid var(--pt-border); border-radius: var(--pt-radius); padding: 0; }
.pt-assign-person > summary { display: grid; grid-template-columns: minmax(200px, 1.3fr) auto 2fr; gap: .75rem; align-items: center; padding: .7rem 1rem; cursor: pointer; list-style: none; }
.pt-assign-person > summary::-webkit-details-marker { display: none; }
.pt-assign-person > summary:hover { background: var(--pt-surface-2); border-radius: var(--pt-radius); }
.pt-assign-name { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.pt-assign-name small { font-size: .78rem; }
.pt-assign-count { font-size: .82rem; color: var(--pt-muted); white-space: nowrap; }
.pt-assign-chips { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: flex-end; }
.pt-assign-chips .pt-chip { font-size: .72rem; }
.pt-assign-person[open] { box-shadow: var(--pt-shadow, 0 4px 18px rgba(0,0,0,.06)); }
.pt-assign-person > .pt-table-wrap, .pt-assign-person > .pt-form-actions { margin: 0 1rem; }
.pt-assign-person > .pt-form-actions { margin-bottom: .9rem; }
@media (max-width: 700px) { .pt-assign-person > summary { grid-template-columns: 1fr auto; } .pt-assign-chips { grid-column: 1 / -1; justify-content: flex-start; } }

.pt-ldap-data { grid-template-columns: auto 1fr; padding: .6rem .75rem; background: var(--pt-surface-2); border-radius: var(--pt-radius-sm); }
.pt-ldap-data dd { text-align: left; font-weight: 600; }
.pt-assign-new { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--pt-border); }
.pt-assoc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .75rem; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--pt-border); }
.pt-assoc-row > a { overflow-wrap: anywhere; }
.pt-assoc-hours { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 9.5rem; }
.pt-assoc-hours strong { color: var(--pt-text); font-weight: 600; }
.pt-hours-edit { display: inline-flex; align-items: center; gap: .35rem; justify-content: flex-end; margin: 0; }
.pt-app .pt-hours-edit .pt-input { width: 6.5rem; min-height: 34px; padding: .25rem .5rem; text-align: right; font-variant-numeric: tabular-nums; }
.pt-hours-unit { font-size: .8rem; color: var(--pt-muted); }
.pt-assoc-hours { display: inline-flex; align-items: center; gap: .4rem; justify-content: flex-end; }
.pt-picker-list li.is-assigned .pt-picker-name, [data-picker-row]:has(input[type=checkbox]:disabled) .pt-picker-name { cursor: default; }
[data-picker-row]:has(input[type=checkbox]:disabled) .pt-picker-name > span { opacity: .75; }
/* codici di assenza */
.pt-codes-help { font-size: .88rem; margin-bottom: 1rem; }
.pt-codes-help p { margin: 0 0 .4rem; }
.pt-codes-help ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .25rem; color: var(--pt-muted); }
.pt-codes-help li strong { color: var(--pt-text); }
.pt-table tr.pt-code-new td { background: color-mix(in srgb, var(--pt-ok) 12%, transparent); }
.pt-table tr.pt-code-new td:first-child { box-shadow: inset 4px 0 0 var(--pt-ok); }
.pt-center { text-align: center !important; }
.pt-sticky-actions { position: sticky; bottom: 0; padding: .75rem 0; background: linear-gradient(transparent, var(--pt-bg, #f4f6fa) 35%); z-index: 2; }
.pt-last-sync { display: flex; flex-direction: column; font-size: .8rem; color: var(--pt-muted); line-height: 1.3; }
.pt-last-sync strong { color: var(--pt-text); font-size: .9rem; }
.pt-last-sync small { font-size: .75rem; max-width: 22rem; }
.pt-codes-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.25rem; margin-bottom: 1rem; }
.pt-codes-bar > .pt-input { flex: 1 1 260px; max-width: 420px; }
.pt-codes-sync { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.pt-codes-sync .pt-last-sync { text-align: right; }
@media (max-width: 600px) { .pt-codes-bar > .pt-input { max-width: none; } .pt-codes-sync { width: 100%; justify-content: space-between; } .pt-codes-sync .pt-last-sync { text-align: left; } }
/* scheda progetto */
.pt-project-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem 1rem; }
.pt-project-grid .pt-span-2 { grid-column: span 2; }
@media (max-width: 1000px) { .pt-project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .pt-project-grid { grid-template-columns: 1fr; } .pt-project-grid .pt-span-2 { grid-column: auto; } }
.pt-wp-fixed { min-width: 5.2rem; }
.pt-hdr-opt { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: .25rem !important; font-size: .72rem !important; font-weight: 500 !important; color: var(--pt-muted) !important; white-space: nowrap; margin-right: .25rem; }
.pt-brand-logo { width: auto !important; max-width: 120px; height: 38px; object-fit: contain; background: transparent !important; border-radius: 0 !important; }
.pt-login-logo { width: auto !important; max-width: 170px; height: 64px !important; object-fit: contain; background: transparent !important; border-radius: 0 !important; }
.pt-project-grid .pt-grid-break { grid-column: 1 / -1; height: 0; }
.pt-project-grid [hidden] { display: none !important; }
/* scritte accanto al logo: su una riga ciascuna */
.pt-brand strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-login-brand strong { font-size: 1.05rem !important; white-space: nowrap; }
.pt-login-brand > div { padding-left: .8rem; border-left: 1px solid rgba(255,255,255,.3); }
@media (max-width: 760px) {
  .pt-brand strong { font-size: .82rem; letter-spacing: 0; }
  .pt-brand small { display: block !important; font-size: .7rem; }
  .pt-brand-logo { height: 30px; }
  .pt-login-brand strong { font-size: .9rem !important; white-space: normal; }
}
@media (max-width: 420px) { .pt-brand > span { display: none; } }
.pt-list-bar { display: flex; gap: .75rem; align-items: center; margin: 0 0 1rem; }
.pt-list-bar .pt-input { flex: 1 1 auto; max-width: none; }
.pt-list-bar .pt-btn { flex: none; white-space: nowrap; }
.pt-login-msg { margin-bottom: 1rem; font-size: .9rem; }
.pt-pass { position: relative; display: block; }
.pt-pass input { width: 100%; padding-right: 2.8rem !important; }
.pt-pass-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--pt-muted); cursor: pointer; padding: .35rem; border-radius: 8px; line-height: 0; }
.pt-pass-toggle:hover { color: var(--pt-primary); background: var(--pt-surface-2); }
.pt-pass-toggle .pt-eye-off { display: none; }
.pt-pass-toggle.is-on { color: var(--pt-primary); }
.pt-pass-toggle.is-on .pt-eye-off { display: inline; }
.pt-actions-split { justify-content: space-between !important; }
.pt-sitepicker { display: flex; flex-direction: column; gap: .75rem; }
/* Genera timesheet sotto il calendario */
.pt-export-wide { margin-top: 1rem; }
.pt-export-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); gap: .75rem 1rem; align-items: end; }
.pt-export-row .pt-export-btn { white-space: nowrap; min-height: 42px; grid-column: 3; justify-self: end; min-width: 220px; }
@media (max-width: 900px) { .pt-export-row { grid-template-columns: 1fr 1fr; } .pt-export-row .pt-export-project { grid-column: 1 / -1; } .pt-export-row .pt-export-btn { grid-column: 1 / -1; justify-self: stretch; } }
@media (max-width: 600px) { .pt-export-row { grid-template-columns: 1fr; } }
.pt-row-link { cursor: pointer; }
.pt-row-link:hover td { background: color-mix(in srgb, var(--pt-primary) 6%, var(--pt-surface)); }
.pt-row-link:focus-visible { outline: 2px solid var(--pt-primary); outline-offset: -2px; }
.pt-row-title { color: var(--pt-text); text-decoration: none; }
.pt-row-title:hover { color: var(--pt-primary); text-decoration: underline; }
.pt-report-card[data-report-card] { cursor: pointer; }
.pt-report-card[data-report-card] .pt-report-details { cursor: auto; }
.pt-report-card[data-report-card]:hover { box-shadow: 0 6px 22px rgba(11, 79, 138, .12); }
.pt-list-bar-split { justify-content: space-between; }
.pt-list-bar-split > select.pt-input { flex: 0 1 320px; }
.pt-list-bar-split > input[type=search] { flex: 0 1 380px; }
@media (max-width: 600px) { .pt-list-bar-split { flex-direction: column; align-items: stretch; } .pt-list-bar-split > * { flex: 1 1 auto !important; } }
/* home: riepilogo del mese */
.pt-home-month { margin-bottom: 1.25rem; }
.pt-home-month-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--pt-border); margin-bottom: 1rem; }
.pt-home-month-head h2 { font-size: 1.6rem; margin: .1rem 0 0; color: var(--pt-primary); }
.pt-home-month-body { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 2rem; }
.pt-home-kv dd strong { font-size: 1.05rem; }
@media (max-width: 760px) { .pt-home-month-body { grid-template-columns: 1fr; } }
/* foto del profilo */
.pt-avatar { text-decoration: none; overflow: hidden; }
.pt-avatar.has-photo { background: #fff; border: 2px solid rgba(255,255,255,.85); }
.pt-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pt-profile-photo { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--pt-border); }
.pt-photo { width: 96px; height: 96px; border-radius: 50%; overflow: hidden; flex: none; box-shadow: 0 0 0 3px var(--pt-surface), 0 0 0 5px color-mix(in srgb, var(--pt-primary) 35%, transparent); background: var(--pt-surface-2); }
.pt-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pt-photo.is-empty { display: grid; place-items: center; background: var(--pt-accent); color: #1d2433; font-weight: 700; font-size: 1.8rem; }
.pt-photo-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.pt-photo-form .pt-help { flex-basis: 100%; }
.pt-file-btn { cursor: pointer; }
.pt-person-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .5rem; }
.pt-person-head .pt-card-title { margin: 0 !important; }
.pt-person-head .pt-mini-avatar { width: 64px; height: 64px; font-size: 1.2rem; box-shadow: 0 0 0 3px var(--pt-surface), 0 0 0 4px var(--pt-border); }
.pt-proj-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: .5rem; padding: .55rem .7rem; border-radius: var(--pt-radius-sm); background: color-mix(in srgb, var(--pt-primary) 8%, var(--pt-surface)); font-weight: 600; }
.pt-proj-total strong { font-size: 1.1rem; color: var(--pt-primary); }
.pt-person-cell { display: inline-flex; align-items: center; gap: .6rem; vertical-align: middle; }
.pt-mini-avatar { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none; display: inline-grid; place-items: center; background: var(--pt-surface-2); box-shadow: 0 0 0 1px var(--pt-border); }
.pt-mini-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pt-mini-avatar.is-empty { background: color-mix(in srgb, var(--pt-primary) 12%, var(--pt-surface)); color: var(--pt-primary); font-size: .72rem; font-weight: 700; letter-spacing: .02em; box-shadow: none; }
.pt-assign-who { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.pt-assoc-head { display: grid; grid-template-columns: minmax(0, 1fr) 9rem 9rem 2.4rem; gap: .5rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--pt-muted); font-weight: 600; line-height: 1.2; padding-bottom: .3rem; border-bottom: 1px solid var(--pt-border); }
.pt-assoc-head span:nth-child(2), .pt-assoc-head span:nth-child(3) { text-align: right; }
.pt-assoc-row { grid-template-columns: minmax(0, 1fr) 9rem 9rem 2.4rem !important; }
.pt-assoc-row .pt-assoc-hours { min-width: 0 !important; justify-content: flex-end; }
.pt-assoc-row .pt-hours-edit .pt-input { width: 5.5rem; }
.pt-picker-head, .pt-picker-list li { grid-template-columns: 1fr 120px 120px !important; }
.pt-picker-head span:nth-child(n+2) { text-align: right; line-height: 1.2; }
@media (max-width: 600px) { .pt-picker-list li { grid-template-columns: 1fr 80px 80px !important; } .pt-assoc-row, .pt-assoc-head { grid-template-columns: minmax(0, 1fr) 6.5rem 6.5rem 2.2rem !important; } .pt-assoc-row .pt-hours-edit .pt-input { width: 4.2rem; } .pt-hours-unit { display: none; } }
/* interruttore Attivo / Disattivato */
.pt-project-data-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.pt-project-data-head .pt-card-title { margin: 0 !important; }
.pt-form .pt-switch, .pt-switch { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: .6rem !important; cursor: pointer; padding: .4rem .8rem .4rem .5rem; border-radius: 999px; border: 1px solid var(--pt-border); background: var(--pt-surface-2); color: var(--pt-text) !important; font-weight: 600 !important; font-size: .9rem !important; user-select: none; }
.pt-switch input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.pt-switch-track { width: 42px; height: 24px; border-radius: 999px; background: #c4ccd8; position: relative; transition: background .15s; flex: none; }
.pt-switch-thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.pt-switch.is-on { background: color-mix(in srgb, var(--pt-ok) 10%, var(--pt-surface)); border-color: color-mix(in srgb, var(--pt-ok) 35%, transparent); }
.pt-switch.is-on .pt-switch-track { background: var(--pt-ok); }
.pt-switch.is-on .pt-switch-thumb { left: 21px; }
.pt-switch:not(.is-on) .pt-switch-label { color: var(--pt-warn); }
.pt-switch:focus-within { outline: 2px solid var(--pt-primary); outline-offset: 2px; }
/* scheda persona: ore previste | monte ore annuo ben separati */
.pt-assoc-row .pt-assoc-hours:nth-of-type(2), .pt-assoc-head span:nth-child(3) { border-left: 2px solid var(--pt-border); padding-left: .6rem; }
.pt-assoc-row .pt-assoc-hours:nth-of-type(2) .pt-input { background: color-mix(in srgb, var(--pt-primary) 5%, var(--pt-surface)); }
.pt-assoc-row, .pt-assoc-head { grid-template-columns: minmax(0, 1fr) 9.5rem 10.5rem 2.4rem !important; }
.pt-row-bottom { align-items: end; }
.pt-person-head .pt-switch-right { margin-left: auto; }
/* interruttore di vista (Attivi / Archiviati) */
.pt-switch-view { gap: .5rem !important; padding: .35rem .7rem !important; }
.pt-switch-view .pt-switch-label { color: var(--pt-muted) !important; font-weight: 600; }
.pt-switch-view:not(.is-on) .pt-switch-off-label, .pt-switch-view.is-on .pt-switch-label:last-child { color: var(--pt-text) !important; }
.pt-switch-view.is-on { background: color-mix(in srgb, var(--pt-warn) 10%, var(--pt-surface)); border-color: color-mix(in srgb, var(--pt-warn) 35%, transparent); }
.pt-switch-view.is-on .pt-switch-track { background: var(--pt-warn); }
.pt-switch-view:not(.is-on) .pt-switch-track { background: var(--pt-ok); }
.pt-switch-view small { font-weight: 400; }
.pt-switch-form { margin: 0; flex: none; }
.pt-report-filters .pt-switch-view { margin-left: auto; align-self: center; }
.pt-switch.is-busy { opacity: .6; pointer-events: none; }
/* home: navigazione mesi */
.pt-home-monthnav { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.pt-round { border-radius: 50% !important; width: 40px; height: 40px; min-height: 40px !important; font-size: 1.3rem; display: inline-grid; place-items: center; text-decoration: none; }
.pt-home-jump { display: flex; gap: .4rem; margin-left: .5rem; }
.pt-home-jump .pt-input { width: auto; min-height: 38px; padding: .3rem .6rem; font-size: .9rem; }
.pt-home-month-head { align-items: center !important; flex-wrap: wrap; }
.pt-section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
a.pt-switch { text-decoration: none; }
/* dashboard: schede alla stessa altezza per riga */
.pt-report-grid { align-items: stretch !important; }
.pt-report-card { display: flex; flex-direction: column; }
.pt-report-card .pt-report-details { margin-top: auto; }
.pt-report-card header { min-height: 96px; align-content: flex-start; }
.pt-report-card header img { height: 30px; max-height: 30px; }
.pt-report-card header > div { flex: 1 1 100%; }
/* pagina di accesso su smartphone: intestazione blu e scheda di accesso in evidenza */
@media (max-width: 760px) {
  html:has(.pt-login), body:has(.pt-login) { background: #eef2f7 !important; }
  .pt-app.pt-login { min-height: 100dvh; padding: 0 0 1rem !important; gap: 1rem !important; justify-content: flex-start !important;
    background: linear-gradient(180deg, #0a426f 0, #0b4f8a 260px, #eef2f7 260px) no-repeat; }
  .pt-login-shell { background: transparent !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important; overflow: visible !important; gap: 0; width: 100%; }
  .pt-login-intro { background: transparent !important; padding: calc(1.6rem + env(safe-area-inset-top)) 1.25rem 1.4rem !important; align-items: center; text-align: center; gap: .9rem !important; }
  .pt-login-brand { flex-direction: column; gap: .55rem !important; }
  .pt-login-brand > div { border-left: 0 !important; padding-left: 0 !important; }
  .pt-login-logo { height: 58px !important; max-width: 190px; }
  .pt-login-brand strong { font-size: .95rem !important; white-space: nowrap; letter-spacing: .01em; }
  .pt-login-brand span { font-size: .8rem; opacity: .85; }
  .pt-login-intro h1 { font-size: 1.05rem !important; font-weight: 500 !important; opacity: .9; line-height: 1.35; }
  .pt-login-intro h1 br { display: none; }
  .pt-login-panel { margin: 0 1rem; padding: 1.5rem 1.25rem 1.3rem !important; background: var(--pt-surface); border-radius: 20px; box-shadow: 0 14px 40px rgba(10, 40, 80, .16); gap: .75rem !important; }
  .pt-login-panel h2 { font-size: 1.35rem !important; margin: 0 !important; }
  .pt-login-panel > p { font-size: .9rem; margin: 0; }
  .pt-login-panel .pt-form { gap: .85rem !important; }
  .pt-login-panel .pt-form label { font-size: .85rem !important; }
  .pt-login-panel input:not([type=checkbox]) { min-height: 50px !important; font-size: 16px !important; border-radius: 12px !important; }
  .pt-login-panel .pt-btn-lg { min-height: 52px; border-radius: 12px; font-size: 1.05rem; }
  .pt-login-panel .pt-check { font-size: .88rem !important; font-weight: 500 !important; }
  .pt-login-panel .pt-help { font-size: .8rem; text-align: center; }
  .pt-login-foot { padding: 0 1rem; font-size: .7rem !important; line-height: 1.55 !important; }
}

/* 3.18.0 – riquadro Presenze (ePAS / inserimento manuale) nella scheda persona */
.pt-epas-box { border: 1px solid var(--pt-border, #dfe5ee); border-radius: 12px; padding: .75rem .9rem; background: var(--pt-surface-2, #f6f8fb); display: grid; gap: .35rem; }
.pt-epas-box-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.pt-switch.is-disabled { opacity: .55; cursor: not-allowed; }
.pt-home-jump { align-items: center; }
.pt-home-today { min-height: 38px; display: inline-flex; align-items: center; }
.pt-home-today.is-current { opacity: .55; }

/* 3.18.1 – accesso con smartphone in orizzontale: logo a sinistra, credenziali a destra */
@media (max-height: 520px) and (orientation: landscape) {
  .pt-app.pt-login { min-height: 100dvh; padding: 0 !important; justify-content: center !important;
    background: linear-gradient(90deg, #0a426f 0, #0b4f8a 38%, #eef2f7 38%) no-repeat !important; }
  .pt-login-shell { display: grid !important; grid-template-columns: 38% 1fr; align-items: center; width: 100%; max-width: none !important;
    background: transparent !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
  .pt-login-intro { background: transparent !important; color: #fff; padding: calc(.8rem + env(safe-area-inset-top)) 1rem .8rem calc(1rem + env(safe-area-inset-left)) !important;
    align-items: center; text-align: center; gap: .5rem !important; }
  .pt-login-brand { flex-direction: column; gap: .35rem !important; }
  .pt-login-brand > div { border-left: 0 !important; padding-left: 0 !important; }
  .pt-login-logo { height: 40px !important; }
  .pt-login-brand strong { font-size: .85rem !important; white-space: normal; }
  .pt-login-brand span { font-size: .75rem; }
  .pt-login-intro h1 { font-size: .95rem !important; margin: 0; }
  .pt-login-intro h1 br { display: none; }
  .pt-login-intro p, .pt-login-intro ul { display: none; }
  .pt-login-panel { margin: .6rem calc(1rem + env(safe-area-inset-right)) .6rem 1rem; padding: .9rem 1.1rem !important; background: var(--pt-surface, #fff);
    border-radius: 16px; box-shadow: 0 10px 30px rgba(10,40,80,.14); gap: .45rem !important; max-width: 520px; justify-self: center; width: calc(100% - 2rem); }
  .pt-login-panel h2 { font-size: 1.15rem; margin: 0; }
  .pt-login-panel > p { font-size: .8rem; margin: 0; }
  .pt-login-panel .pt-input, .pt-login-panel input[type=text], .pt-login-panel input[type=password] { min-height: 40px !important; }
  .pt-login-panel .pt-btn-lg { min-height: 42px !important; }
  .pt-login-foot { display: none; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .pt-login .pt-login-panel input:not([type=checkbox]) { min-height: 38px !important; height: 38px; padding-top: .3rem !important; padding-bottom: .3rem !important; }
  .pt-login .pt-login-panel .pt-form { gap: .4rem !important; }
  .pt-login .pt-login-panel label { font-size: .85rem; }
  .pt-login .pt-login-panel .pt-btn-lg { min-height: 40px !important; padding: .4rem 1rem !important; }
  .pt-login .pt-login-panel .pt-help { font-size: .75rem; margin: 0; }
}

/* 3.18.2 – orizzontale: sfondo blu unico a tutta pagina, scheda bianca che "galleggia" a destra */
@media (max-height: 520px) and (orientation: landscape) {
  html:has(.pt-login), body:has(.pt-login) { background: #0b4f8a !important; }
  .pt-app.pt-login {
    background:
      radial-gradient(circle at 18% 22%, rgba(255,255,255,.10) 0, rgba(255,255,255,0) 38%),
      radial-gradient(circle at 85% 110%, rgba(255,199,44,.14) 0, rgba(255,199,44,0) 45%),
      linear-gradient(135deg, #08385f 0%, #0b4f8a 55%, #1565a8 100%) !important;
    padding: calc(.75rem + env(safe-area-inset-top)) calc(1.25rem + env(safe-area-inset-right)) .75rem calc(1.25rem + env(safe-area-inset-left)) !important;
    align-items: center !important;
  }
  .pt-login-shell { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) !important; gap: 2rem; max-width: 900px !important; margin: 0 auto; }
  .pt-login-intro { padding: 0 !important; }
  .pt-login-intro h1 { font-weight: 500; opacity: .92; max-width: 18rem; }
  .pt-login-intro h1::before { content: ""; display: block; width: 40px; height: 3px; border-radius: 3px; background: #ffc72c; margin: .2rem auto .55rem; }
  .pt-login .pt-login-panel { margin: 0 !important; width: 100% !important; max-width: 460px; justify-self: end;
    border-radius: 18px; box-shadow: 0 18px 50px rgba(0,20,50,.35), 0 0 0 1px rgba(255,255,255,.6) inset; }
}

/* 3.18.3 – calendario: menu mese/anno; dashboard: interruttore accanto al titolo; smartphone */
.pt-cal-jump { display: flex; align-items: center; gap: .4rem; margin-left: .25rem; }
.pt-cal-jump .pt-input { width: auto; min-height: 36px; padding: .25rem .5rem; font-size: .9rem; }
.pt-report-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap; }
.pt-report-head .pt-switch { margin-left: auto; }
@container ptapp (max-width: 1080px) {
  /* calendario a colonna singola: griglia, riepilogo, ore per progetto, infine Genera timesheet */
  .pt-cal-main { display: contents; }
  .pt-cal-layout > .pt-cal-main > .pt-cal-grid { order: 1; }
  .pt-cal-side { order: 2; }
  #pt-export-card { order: 3; }
}
@media (max-width: 760px) {
  .pt-cal-monthnav { flex-wrap: wrap; }
  .pt-cal-jump { order: 5; width: 100%; margin: .2rem 0 0; }
  .pt-cal-jump .pt-input { flex: 1; }
  .pt-report-head h1 { font-size: 1.35rem; }
  .pt-report-head .pt-switch { font-size: .85rem; }
  /* scheda persona, Progetti associati: nome del progetto su una riga intera, ore sotto */
  .pt-assoc-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 2.2rem !important; }
  .pt-assoc-head span:first-child { display: none; }
  .pt-assoc-head span:nth-child(3) { border-left: 2px solid var(--pt-border); padding-left: .6rem; }
  .pt-assoc-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 2.2rem !important; row-gap: .3rem !important; }
  .pt-assoc-row > a { grid-column: 1 / -1; font-weight: 600; overflow-wrap: normal; word-break: normal; }
  .pt-assoc-row .pt-assoc-hours { justify-content: flex-start !important; text-align: left; }
  .pt-assoc-head span:nth-child(2), .pt-assoc-head span:nth-child(3) { text-align: left; }
}

/* 3.18.4 – titolo con pulsante a destra; Progetti e Progetti associati su smartphone */
.pt-head-actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.pt-list-bar-projects .pt-switch-form { flex: none; }
@media (max-width: 760px) {
  .pt-head-actions h1 { margin: 0; }
  .pt-head-actions .pt-btn { padding: .5rem .85rem; font-size: .9rem; }
  .pt-list-bar-projects { flex-direction: column; align-items: stretch; gap: .6rem; }
  .pt-list-bar-projects > .pt-input { width: 100%; min-height: 44px; }
  .pt-list-bar-projects .pt-switch-form { display: flex; justify-content: center; }
  .pt-list-bar-projects .pt-switch-view { width: 100%; justify-content: center; }

  /* Progetti associati: una scheda per progetto, con le etichette accanto ai campi */
  .pt-assoc-head { display: none !important; }
  .pt-assoc-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto !important; gap: .45rem .75rem !important;
    padding: .7rem .8rem !important; margin: 0 0 .6rem; border: 1px solid var(--pt-border) !important; border-radius: 12px; background: var(--pt-surface-2, #f6f8fb); }
  .pt-assoc-row > a { grid-column: 1 / 3; grid-row: 1; align-self: center; font-size: 1rem; }
  .pt-assoc-row > .pt-assoc-del { grid-column: 3; grid-row: 1; justify-self: end; }
  .pt-assoc-row > .pt-assoc-hours { grid-row: 2; flex-direction: column; align-items: stretch !important; gap: .2rem !important;
    border-left: 0 !important; padding-left: 0 !important; }
  .pt-assoc-row > .pt-assoc-hours:nth-of-type(1) { grid-column: 1; }
  .pt-assoc-row > .pt-assoc-hours:nth-of-type(2) { grid-column: 2 / 4; }
  .pt-assoc-row > .pt-assoc-hours::before { content: attr(data-label); font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--pt-muted); line-height: 1.2; min-height: 1.7em; }
  .pt-assoc-row .pt-hours-edit { display: flex; align-items: center; gap: .4rem; }
  .pt-assoc-row .pt-hours-edit .pt-input { width: 100% !important; flex: 1; text-align: left; }
  .pt-assoc-row .pt-hours-unit { display: inline !important; font-size: .8rem; color: var(--pt-muted); }

  /* Aggiungi una nuova associazione: un campo per riga */
  .pt-assign-new .pt-row { display: flex !important; flex-direction: column; align-items: stretch; gap: .6rem; }
  .pt-assign-new .pt-row > label { width: 100%; }
}
@media (max-width: 760px) {
  .pt-assoc-row > .pt-assoc-hours { white-space: normal !important; min-width: 0 !important; }
  .pt-assoc-row > .pt-assoc-hours::before { white-space: normal; min-height: 0; }
}

/* 3.18.5 – Progetti: interruttore Attivi/Archiviati in alto a destra, come nella dashboard */
.pt-projects-head .pt-switch-form { margin-left: auto; }
@media (max-width: 760px) {
  .pt-projects-head h1 { order: 1; }
  .pt-projects-head > .pt-btn { order: 2; }
  .pt-projects-head .pt-switch-form { order: 3; width: 100%; display: flex; justify-content: flex-end; margin: 0; }
  .pt-projects-head .pt-switch { font-size: .85rem; }
}
@media (max-width: 760px) { .pt-projects-head > .pt-btn { margin-left: auto; } }

/* 3.18.6 – Progetti: titolo + interruttore in alto; filtro più corto con "+ Nuovo progetto" a destra */
.pt-list-bar-projects { justify-content: space-between; }
.pt-list-bar-projects > .pt-input { flex: 0 1 480px !important; }
@media (max-width: 760px) {
  .pt-projects-head { flex-wrap: nowrap; }
  .pt-projects-head .pt-switch-form { order: 2; width: auto; margin-left: auto; }
  .pt-list-bar-projects { flex-direction: column; align-items: stretch; }
  .pt-list-bar-projects > .pt-btn { order: -1; align-self: flex-end; }
  .pt-list-bar-projects > .pt-input { flex: 1 1 auto !important; }
}
@media (max-width: 400px) {
  .pt-projects-head h1 { font-size: 1.45rem; }
  .pt-projects-head .pt-switch { font-size: .8rem; padding-left: .55rem; padding-right: .55rem; }
}

/* 3.19.0 – Le mie associazioni (utenti) */
.pt-my-assoc-name { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.pt-my-assoc-name small { font-size: .78rem; }
.pt-assoc-del { display: flex; justify-content: flex-end; }
@media (max-width: 760px) {
  .pt-assoc-row > .pt-my-assoc-name { grid-column: 1 / 3; grid-row: 1; }
}
/* colonne delle ore individuate dall'etichetta (in "Le mie associazioni" il nome è uno span) */
.pt-my-assoc .pt-assoc-row .pt-assoc-hours:nth-of-type(2) { border-left: 0; padding-left: 0; }
.pt-my-assoc .pt-assoc-row .pt-assoc-hours:nth-of-type(2) .pt-input { background: var(--pt-surface); }
.pt-my-assoc .pt-assoc-row .pt-assoc-hours[data-label="Monte ore annuo"] { border-left: 2px solid var(--pt-border); padding-left: .6rem; }
.pt-my-assoc .pt-assoc-row .pt-assoc-hours[data-label="Monte ore annuo"] .pt-input { background: color-mix(in srgb, var(--pt-primary) 5%, var(--pt-surface)); }
.pt-my-assoc .pt-assign-new { border-top: 0 !important; padding-top: 0 !important; margin-top: 0 !important; }
@media (max-width: 760px) {
  .pt-assoc-row > .pt-assoc-hours[data-label="Ore previste"] { grid-column: 1 !important; }
  .pt-assoc-row > .pt-assoc-hours[data-label="Monte ore annuo"] { grid-column: 2 / 4 !important; border-left: 0 !important; padding-left: 0 !important; }
}

/* 3.20.0 – Guida */
.pt-help-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%;
  color: #fff !important; border: 1px solid rgba(255,255,255,.45); text-decoration: none; flex: none; }
.pt-help-btn:hover { background: rgba(255,255,255,.12); }
.pt-help-btn .pt-ico { width: 20px; height: 20px; }
.pt-guide-guest .pt-topbar { display: flex; align-items: center; justify-content: space-between; }
.pt-guide-guest .pt-guide-login { color: #fff !important; border-color: rgba(255,255,255,.5); }
.pt-guide { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1rem; align-items: start; }
.pt-guide-toc { position: sticky; top: 64px; padding: 1rem 1.1rem; max-height: calc(100vh - 90px); overflow: auto; }
.pt-guide-toc strong { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--pt-muted); margin-bottom: .4rem; }
.pt-guide-toc ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .15rem; }
.pt-guide-toc a { text-decoration: none; color: var(--pt-text); font-size: .92rem; display: block; padding: .2rem .35rem; border-radius: 6px; }
.pt-guide-toc a:hover, .pt-guide-toc a.is-current { background: color-mix(in srgb, var(--pt-primary) 10%, transparent); color: var(--pt-primary); font-weight: 600; }
.pt-guide-body { padding: 1.4rem 1.8rem 2rem; line-height: 1.6; }
.pt-guide-body > * { max-width: 60rem; }
.pt-guide-body h2 { font-size: 1.3rem; color: var(--pt-primary); margin: 2rem 0 .6rem; padding-top: .9rem; border-top: 1px solid var(--pt-border); scroll-margin-top: 80px; }
.pt-guide-body h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.pt-guide-body h3 { font-size: 1.05rem; margin: 1.3rem 0 .4rem; }
.pt-guide-body p, .pt-guide-body ul, .pt-guide-body ol { margin: 0 0 .8rem; }
.pt-guide-body li { margin: .2rem 0; }
.pt-guide-body .pt-table-wrap { margin: .4rem 0 1rem; }
.pt-guide-body code { background: var(--pt-surface-2, #f1f4f8); padding: .05rem .3rem; border-radius: 4px; font-size: .9em; }
.pt-guide-jump { display: none; }
@container ptapp (max-width: 900px) {
  .pt-guide { grid-template-columns: 1fr; }
  .pt-guide-toc { display: none; }
  .pt-guide-jump { display: flex; flex-direction: column; gap: .25rem; margin: 0 0 .8rem; font-size: .85rem; color: var(--pt-muted); }
  .pt-guide-body { padding: 1.1rem 1rem 1.5rem; }
}
@media (max-width: 760px) {
  .pt-guide-head h1 { font-size: 1.3rem; }
  .pt-help-btn { width: 32px; height: 32px; }
}
@media print {
  .pt-topbar, .pt-tabs, .pt-bottombar, .pt-footer, .pt-guide-toc, .pt-guide-jump, .pt-guide-print, .pt-sheet { display: none !important; }
  .pt-guide { display: block; }
  .pt-guide-body { box-shadow: none !important; border: 0 !important; max-width: none; padding: 0; }
  .pt-guide-body h2 { break-after: avoid; }
  .pt-guide-body table { break-inside: avoid; }
  html, body, .pt-app, .pt-main { background: #fff !important; }
}

/* 3.22.0 – Scrivania PDF */
.pt-scrivania-help { margin: 0 0 .6rem; }
.pt-scrivania { padding: 0; overflow: hidden; }
.pt-scrivania iframe { display: block; width: 100%; height: calc(100dvh - 230px); min-height: 560px; border: 0; }
@media (max-width: 760px) { .pt-scrivania iframe { height: calc(100dvh - 210px); min-height: 480px; } }

/* 3.22.1 – menu più compatto: tutte le voci (fino a Guida) restano visibili sugli schermi da portatile */
@media (max-width: 1500px) {
  .pt-tabs { gap: .1rem; padding: .4rem .5rem; }
  .pt-tabs a { padding: .5rem .62rem; gap: .32rem; font-size: .88rem; }
  .pt-tabs a .pt-ico { width: 17px; height: 17px; }
}
@media (max-width: 1240px) and (min-width: 761px) {
  .pt-tabs a .pt-ico { display: none; }
  .pt-tabs a { padding: .5rem .58rem; }
}

/* 3.22.2 – smartphone: "Esci" sempre dentro lo schermo (testo del marchio che si accorcia, margine di sicurezza a destra) */
@media (max-width: 760px) {
  .pt-topbar { gap: .5rem; padding-right: calc(1rem + env(safe-area-inset-right)) !important; padding-left: calc(.8rem + env(safe-area-inset-left)) !important; }
  .pt-brand { flex: 1 1 auto; min-width: 0; overflow: hidden; }
  .pt-userchip { flex: none; gap: .45rem; }
  .pt-topbar .pt-logout .pt-btn { padding: .35rem .65rem; }
}
@media (max-width: 480px) { .pt-brand > span { display: none; } }

/* 3.23.0 – ruolo nella scheda persona */
.pt-role-box { margin-bottom: .6rem; }
.pt-role-select { width: auto; min-width: 15rem; min-height: 38px; padding: .3rem .6rem; }
.pt-chip-role { background: color-mix(in srgb, var(--pt-primary) 12%, transparent); color: var(--pt-primary); }
@media (max-width: 760px) { .pt-role-box .pt-epas-box-head { flex-wrap: wrap; } .pt-role-select { width: 100%; min-width: 0; } }
.pt-role-box .pt-epas-box-head strong { white-space: nowrap; }

/* 3.24.1 – Elimina persona non disponibile: pulsante disattivato con spiegazione */
.pt-del-locked { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; max-width: 22rem; }
.pt-del-locked .pt-btn[disabled] { opacity: .45; cursor: not-allowed; }
.pt-del-locked small { line-height: 1.35; }

/* 3.25.0 – Persone: schede Personale dell'istituto / Altri istituti / Account tecnici */
.pt-seg { display: inline-flex; gap: .25rem; padding: .25rem; margin: 0 0 .9rem; background: var(--pt-surface-2, #eef2f7); border: 1px solid var(--pt-border); border-radius: 999px; max-width: 100%; overflow-x: auto; }
.pt-seg-item { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .95rem; border-radius: 999px; text-decoration: none; color: var(--pt-muted) !important; font-weight: 600; font-size: .92rem; white-space: nowrap; }
.pt-seg-item:hover { color: var(--pt-text) !important; }
.pt-seg-item.is-active { background: var(--pt-surface); color: var(--pt-primary) !important; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.pt-seg-count { font-size: .75rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; background: color-mix(in srgb, var(--pt-primary) 12%, transparent); color: var(--pt-primary); }
@media (max-width: 760px) { .pt-seg { display: flex; } .pt-seg-item { flex: 1; justify-content: center; padding: .45rem .6rem; font-size: .85rem; } }
.pt-seg-short { display: none; }
@media (max-width: 760px) { .pt-seg-long { display: none; } .pt-seg-short { display: inline; } .pt-seg { overflow: visible; } .pt-seg-item { padding: .45rem .4rem; gap: .3rem; } }

/* video di presentazione (pagina di accesso e Guida) */
.pt-video-open { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .9rem; border: 1px solid var(--pt-border); border-radius: 999px; background: var(--pt-surface); color: var(--pt-primary, #0b4f8a); font: inherit; font-weight: 600; cursor: pointer; }
.pt-video-open:hover, .pt-video-open:focus-visible { border-color: currentColor; }
.pt-video-open small { font-weight: 400; color: var(--pt-muted); }
.pt-login-video { text-align: center; }
.pt-video-dialog { width: min(960px, calc(100vw - 2rem)); }
.pt-video-wrap { padding: 0 1rem 1rem; }
.pt-video-wrap video { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; border-radius: 12px; background: #0e1a2b; }
.pt-guide-video { margin-bottom: 1.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--pt-border); }
.pt-guide-video .pt-video-wrap { padding: 0; max-width: 820px; }
@media print { .pt-guide-video, .pt-video-dialog { display: none !important; } }
