:root{--bg:#f4f7fb;--card:#fff;--text:#172033;--muted:#68738a;--primary:#2457d6;--border:#e1e6ef;--danger:#c83d3d}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif}a{color:var(--primary);text-decoration:none}.topbar{height:68px;background:#fff;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:0 28px;position:sticky;top:0;z-index:5}.brand{display:flex;gap:10px;align-items:center;font-size:18px}.logo{width:38px;height:38px;border-radius:11px;background:var(--primary);color:#fff;display:grid;place-items:center;font-weight:900}.container{max-width:1180px;margin:auto;padding:30px 20px}.hero{display:flex;justify-content:space-between;gap:20px;align-items:center;margin-bottom:24px}.grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-bottom:25px}.card{background:var(--card);border:1px solid var(--border);border-radius:16px;padding:20px;box-shadow:0 3px 12px rgba(20,35,70,.04);margin-bottom:16px}.wide{grid-column:1/-1}.news.read{opacity:.78}.meta,small{color:var(--muted);font-size:12px}.attachment{display:inline-block;padding:7px 10px;border:1px solid var(--border);border-radius:8px;margin:5px 5px 5px 0;background:#fff}.readtag{font-size:12px;color:#198754;margin-left:8px}.linkbtn{border:0;background:none;color:var(--primary);padding:8px 0;cursor:pointer}.btn{display:inline-block;border:0;border-radius:10px;padding:10px 14px;font-weight:700;cursor:pointer}.primary{background:var(--primary);color:#fff}.secondary{background:#edf2ff;color:var(--primary)}label{display:block;font-weight:700;font-size:13px;margin-bottom:12px}input,textarea,select{display:block;width:100%;margin-top:6px;border:1px solid #cfd6e2;border-radius:9px;padding:10px 12px;font:inherit;background:#fff}textarea{min-height:120px}.inline{display:grid;grid-template-columns:1.2fr 1fr 1fr auto;gap:10px;margin-bottom:18px}.login{min-height:100vh;display:grid;place-items:center;background:linear-gradient(135deg,#edf3ff,#f7f9fc)}.login-card{width:min(420px,92vw);background:#fff;border:1px solid var(--border);border-radius:20px;padding:32px;box-shadow:0 15px 45px rgba(30,50,90,.12)}.login-card h1{margin-top:25px}.alert{padding:10px;border-radius:8px;margin-bottom:12px}.danger{background:#fff0f0;color:var(--danger)}table{width:100%;border-collapse:collapse}th,td{padding:10px;border-bottom:1px solid var(--border);text-align:left}@media(max-width:760px){.grid{grid-template-columns:1fr}.hero{align-items:flex-start;flex-direction:column}.inline{grid-template-columns:1fr}.topbar{padding:0 15px}}


/* =========================================================
   PORTALE OSS - NOGAROLE ROCCA
   Modern UI refresh
   ========================================================= */
:root{
  --bg:#f5f7fb;
  --surface:#ffffff;
  --surface-2:#f8faff;
  --text:#162033;
  --muted:#69758a;
  --primary:#315fdb;
  --primary-2:#244fc0;
  --primary-soft:#edf2ff;
  --border:#e5e9f1;
  --border-strong:#d5dce8;
  --success:#17824b;
  --success-soft:#eaf8f0;
  --warning:#a66a00;
  --warning-soft:#fff6df;
  --danger:#c43b45;
  --danger-soft:#fff0f1;
  --shadow-sm:0 2px 8px rgba(20,32,55,.04);
  --shadow:0 10px 30px rgba(20,32,55,.07);
  --radius:18px;
  --radius-sm:12px;
}

html{scroll-behavior:smooth}
body{
  background:
    radial-gradient(circle at 10% -10%,rgba(49,95,219,.07),transparent 28rem),
    var(--bg);
  color:var(--text);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
a{color:var(--primary)}
a:hover{color:var(--primary-2)}

.topbar{
  height:72px;
  padding:0 clamp(15px,3vw,34px);
  background:rgba(255,255,255,.90);
  border-bottom:1px solid rgba(213,220,232,.8);
  box-shadow:0 2px 18px rgba(20,32,55,.035);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
}
.brand{
  gap:11px;
  font-size:17px;
  font-weight:800;
  letter-spacing:-.2px;
}
.logo{
  width:40px;
  height:40px;
  border-radius:13px;
  background:linear-gradient(135deg,var(--primary),#557de6);
  box-shadow:0 7px 16px rgba(49,95,219,.20);
}

.container{
  max-width:1240px;
  padding:34px clamp(15px,3vw,28px) 50px;
}
.hero{margin-bottom:26px}
.hero h1,.dashboard-head h1,.admin-title h1{
  letter-spacing:-.7px;
  line-height:1.15;
}
.card{
  background:rgba(255,255,255,.96);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:22px;
  box-shadow:var(--shadow-sm);
  transition:box-shadow .18s ease,transform .18s ease,border-color .18s ease;
}
.card:hover{
  box-shadow:var(--shadow);
  border-color:#dce3ef;
}
.grid{gap:20px;margin-bottom:28px}

.btn{
  min-height:42px;
  padding:10px 15px;
  border-radius:12px;
  font-size:13px;
  font-weight:750;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  transition:transform .15s ease,box-shadow .15s ease,background .15s ease;
}
.btn:hover{transform:translateY(-1px)}
.btn.primary{
  background:linear-gradient(135deg,var(--primary),#426de0);
  box-shadow:0 7px 16px rgba(49,95,219,.18);
}
.btn.primary:hover{box-shadow:0 9px 20px rgba(49,95,219,.24)}
.btn.secondary{
  background:var(--primary-soft);
  color:var(--primary);
}
.btn.secondary:hover{background:#e5ecff}

input,textarea,select{
  min-height:43px;
  border:1px solid var(--border-strong);
  border-radius:12px;
  background:#fff;
  padding:10px 13px;
  color:var(--text);
  transition:border-color .15s,box-shadow .15s,background .15s;
}
input:focus,textarea:focus,select:focus{
  outline:none;
  border-color:#6c8de5;
  box-shadow:0 0 0 4px rgba(49,95,219,.10);
}
textarea{min-height:130px}

table{
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
}
th{
  background:#f7f9fc;
  color:#536078;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.045em;
  font-weight:800;
}
th,td{padding:12px 13px;border-bottom:1px solid #edf0f5}
tr:last-child td{border-bottom:0}
tbody tr{transition:background .12s}
tbody tr:hover{background:#fafbfe}

.alert{
  padding:12px 14px;
  border:1px solid transparent;
  border-radius:12px;
}
.alert.danger{background:var(--danger-soft);color:var(--danger);border-color:#ffd8dc}

.attachment{
  border-color:var(--border);
  border-radius:10px;
  background:var(--surface-2);
}
.meta,small{color:var(--muted)}

.login{
  background:
    radial-gradient(circle at 15% 15%,rgba(49,95,219,.16),transparent 26rem),
    radial-gradient(circle at 90% 90%,rgba(75,125,230,.10),transparent 24rem),
    #f6f8fc;
}
.login-card{
  width:min(440px,92vw);
  border:1px solid rgba(220,226,237,.95);
  border-radius:24px;
  padding:34px;
  box-shadow:0 24px 70px rgba(20,32,55,.13);
}
.login-card h1{letter-spacing:-.7px}

.dashboard-actions,.action-row{gap:8px}
.unread-pill,.push-pill{
  border:1px solid transparent;
  padding:8px 12px;
}
.unread-pill{background:var(--danger-soft);color:var(--danger)}
.unread-pill.ok,.push-pill{background:var(--success-soft);color:var(--success)}
.push-pill.off{background:var(--warning-soft);color:var(--warning)}

.history-row{
  padding:13px 14px;
  border:1px solid var(--border);
  border-radius:13px;
  background:linear-gradient(180deg,#fff,#fafbfe);
}
.news{border-left:3px solid transparent}
.news:hover{border-left-color:#8aa4eb}
.read-status{font-size:12px}

@media(max-width:760px){
  .topbar{height:64px}
  .brand{font-size:15px}
  .logo{width:36px;height:36px;border-radius:11px}
  .container{padding-top:22px;padding-bottom:32px}
  .card{padding:17px;border-radius:15px}
  .btn{width:auto;min-height:44px}
  .dashboard-actions{width:100%}
  .dashboard-actions .btn{flex:1}
  table{display:block;overflow-x:auto;white-space:nowrap}
  .login-card{padding:26px 20px}
}

/* Correzione topbar mobile: impedisce che Profilo ed Esci vengano compressi
   quando è visibile lo stato delle notifiche push. */
@media(max-width:600px){
 .app-topbar{height:72px!important;min-height:72px!important;padding:9px 12px!important;gap:6px!important;overflow:hidden!important}
 .app-topbar>.app-brand{flex:0 0 118px!important;width:118px!important;max-width:118px!important;min-width:118px!important;overflow:visible!important}
 .app-topbar>.app-brand .brand-logo{width:118px!important;max-width:118px!important;height:auto!important}
 .app-topbar>.app-topbar-actions{display:flex!important;flex:1 1 auto!important;width:auto!important;max-width:none!important;min-width:0!important;overflow:visible!important;justify-content:flex-end!important;gap:5px!important}
 .app-topbar-actions>.app-topbar-link{display:inline-flex!important;flex:0 0 42px!important;width:42px!important;min-width:42px!important;max-width:42px!important;height:42px!important;min-height:42px!important;padding:0!important;overflow:visible!important;border-radius:13px!important}
 .app-topbar-actions>.app-topbar-link span{display:none!important}
 .app-topbar-actions>.app-topbar-link .app-topbar-icon{display:block!important;flex:0 0 20px!important;width:20px!important;height:20px!important}
 .app-topbar-actions>.app-topbar-notifications{display:none!important}
 .app-topbar-actions>.topbar-push-pill{display:inline-flex!important;flex:0 1 auto!important;flex-direction:row!important;align-items:center!important;justify-content:center!important;width:auto!important;min-width:0!important;max-width:132px!important;min-height:42px!important;margin:0!important;padding:8px 11px!important;overflow:hidden!important;white-space:nowrap!important;text-overflow:ellipsis!important;font-size:11px!important}
 .app-topbar-actions>.topbar-push-pill button{display:block!important;min-width:0!important;max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}
}
@media(max-width:360px){
 .app-topbar{padding-left:8px!important;padding-right:8px!important;gap:4px!important}
 .app-topbar>.app-brand{flex-basis:102px!important;width:102px!important;min-width:102px!important;max-width:102px!important}
 .app-topbar>.app-brand .brand-logo{width:102px!important;max-width:102px!important}
 .app-topbar-actions>.app-topbar-link{flex-basis:38px!important;width:38px!important;min-width:38px!important;max-width:38px!important}
 .app-topbar-actions>.topbar-push-pill{max-width:108px!important;padding-left:8px!important;padding-right:8px!important}
}
@media(max-width:430px){
  .dashboard-actions{display:grid;grid-template-columns:1fr 1fr}
  .dashboard-actions .btn{width:100%}
  .btn{font-size:12.5px;padding:10px 12px}
}


/* =========================================================
   MOBILE-FIRST OPTIMIZATION
   Target: staff phones / iPhone / Android
   ========================================================= */

/* Prevent accidental horizontal scrolling */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}

/* Touch targets: comfortable but not oversized */
@media (max-width: 768px) {
  body {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
  }

  .topbar {
    height: 62px;
    min-height: 62px;
    padding: 0 14px;
  }

  .topbar > * {
    min-width: 0;
  }

  .brand {
    min-width: 0;
    max-width: calc(100vw - 28px);
    gap: 9px;
    font-size: 14px;
    white-space: nowrap;
  }

  .brand span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .logo {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
  }

  .container {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    padding: 18px 14px 30px;
  }

  .hero,
  .dashboard-head,
  .admin-title {
    margin-bottom: 18px;
  }

  .hero h1,
  .dashboard-head h1,
  .admin-title h1 {
    font-size: 24px;
    line-height: 1.18;
    letter-spacing: -.45px;
    margin-bottom: 6px;
  }

  .hero p,
  .dashboard-head p,
  .admin-title p {
    font-size: 13px;
    line-height: 1.45;
  }

  .grid {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 12px;
    margin-bottom: 18px;
  }

  .card {
    width: 100%;
    box-sizing: border-box;
    padding: 16px;
    border-radius: 15px;
  }

  /* Avoid huge vertical cards */
  .card h2,
  .card h3 {
    line-height: 1.25;
    margin-top: 0;
  }

  .btn,
  button,
  input[type="submit"] {
    min-height: 44px;
    border-radius: 11px;
  }

  .btn {
    padding: 10px 13px;
    font-size: 13px;
  }

  /* Action groups: two compact columns when possible */
  .dashboard-actions,
  .action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .dashboard-actions .btn,
  .action-row .btn {
    width: 100%;
    min-width: 0;
  }

  /* Single primary action gets full width */
  .dashboard-actions .btn.primary:only-child,
  .action-row .btn.primary:only-child {
    grid-column: 1 / -1;
  }

  input,
  textarea,
  select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px; /* prevents iOS Safari zoom */
    min-height: 44px;
  }

  textarea {
    min-height: 120px;
  }

  .form-row,
  .form-grid,
  .filters,
  .search-row {
    grid-template-columns: 1fr !important;
    display: grid;
    gap: 10px;
  }

  /* Tables: preserve proportions and allow intentional horizontal scroll */
  .table-wrap,
  .table-responsive,
  .responsive-table {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 13px;
  }

  table {
    width: 100%;
    min-width: 620px;
    font-size: 12px;
  }

  th,
  td {
    padding: 10px 9px;
  }

  /* KPI cards: compact 2-column layout */
  .kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px;
  }

  .kpi {
    min-width: 0;
    padding: 13px;
    border-radius: 14px;
  }

  .kpi .value {
    font-size: 23px;
    line-height: 1.05;
  }

  .kpi .label {
    font-size: 11px;
    line-height: 1.25;
  }

  /* Long communication text should never push the viewport */
  .news,
  .news-details,
  .communication,
  .message,
  .attachment {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .news {
    padding: 14px;
  }

  .news h2,
  .news h3 {
    font-size: 16px;
  }

  .meta,
  small {
    font-size: 11px;
  }

  /* Status/badges remain compact */
  .unread-pill,
  .push-pill,
  .badge,
  .status {
    max-width: 100%;
    font-size: 11px;
    line-height: 1.2;
    white-space: normal;
  }

  /* Login */
  .login {
    min-height: 100dvh;
    padding: 16px;
    box-sizing: border-box;
  }

  .login-card {
    width: 100%;
    max-width: 430px;
    box-sizing: border-box;
    padding: 24px 18px;
    border-radius: 20px;
  }

  /* Modals/dialogs */
  .modal,
  .dialog {
    width: calc(100vw - 28px) !important;
    max-width: none !important;
    max-height: calc(100dvh - 28px);
    overflow-y: auto;
    margin: 14px;
    border-radius: 17px;
  }

  /* Avoid oversized empty spaces */
  .empty-state {
    padding: 24px 14px;
  }

  /* Sticky bottom actions, when present */
  .mobile-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin: 14px -14px -30px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.94);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

/* iPhone narrow screens */
@media (max-width: 390px) {
  .container {
    padding-left: 11px;
    padding-right: 11px;
  }

  .topbar {
    padding-left: 11px;
    padding-right: 11px;
  }

  .brand {
    font-size: 13px;
  }

  .logo {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }

  .card {
    padding: 14px;
  }

  .dashboard-actions,
  .action-row {
    grid-template-columns: 1fr;
  }

  .kpis {
    gap: 7px;
  }

  .kpi {
    padding: 11px;
  }

  .kpi .value {
    font-size: 21px;
  }
}

/* iOS safe areas */
@supports (padding: max(0px)) {
  .topbar {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .container {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}


/* =========================================================
   ADMIN MOBILE - prevent desktop overflow
   ========================================================= */
@media (max-width: 768px) {
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
  }

  .container,
  main.container,
  .grid,
  .grid > *,
  .card,
  .card.wide,
  .users-head,
  .users-head > div,
  .create-user-box,
  .create-user-title,
  .create-user-title > div,
  .create-user-form,
  .shift-publish-card,
  .push-info-card,
  .news-filter-card,
  .shift-history-card,
  .recent-activity-card {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  main.container {
    width: 100% !important;
    margin: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .grid {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  .grid > .card,
  .grid > section.card,
  section.card.wide {
    width: 100% !important;
    grid-column: 1 !important;
    overflow: hidden;
  }

  .users-head {
    width: 100%;
    display: block;
  }

  .users-head h2 {
    font-size: 24px;
    line-height: 1.15;
  }

  .users-head p {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.4;
  }

  .create-user-box {
    width: 100% !important;
    padding: 15px !important;
    overflow: hidden;
  }

  .create-user-title {
    width: 100%;
    gap: 10px;
    align-items: flex-start;
  }

  .create-user-title h3 {
    font-size: 18px;
  }

  .create-user-title p {
    line-height: 1.35;
  }

  .create-user-grid {
    width: 100% !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  .form-field,
  .form-field input,
  .form-field select,
  .password-wrap {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .create-user-footer {
    width: 100%;
    box-sizing: border-box;
  }

  .create-user-note {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .create-user-submit {
    width: 100% !important;
  }

  /* Push banner: never force the page wider than the phone */
  .push-info-card {
    width: 100% !important;
    overflow: hidden;
  }

  .push-info-content,
  .push-info-content > div,
  .push-info-note {
    min-width: 0 !important;
    max-width: 100%;
  }

  .push-info-content span,
  .push-info-note {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Communication cards/forms */
  .news-filter-form,
  .news-filter-form label,
  .news-filter-form input,
  .news-filter-form select {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .news-filter-form {
    width: 100%;
    grid-template-columns: minmax(0,1fr) !important;
  }

  .news-filter-actions {
    width: 100%;
  }

  .news-filter-actions .btn {
    min-width: 0;
    flex: 1;
  }

  /* Avoid oversized text caused by desktop inheritance */
  .admin-title {
    min-width: 0;
    max-width: 100%;
  }

  .admin-title h1,
  .admin-title p {
    overflow-wrap: anywhere;
  }

  /* Tables scroll inside their own area, never the page */
  .card table {
    max-width: 100%;
  }

  .card .table-wrap,
  .card .table-responsive,
  .card .responsive-table {
    max-width: 100%;
    overflow-x: auto;
  }
}

@media (max-width: 430px) {
  main.container {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .card,
  .card.wide {
    border-radius: 14px;
  }

  .users-head h2 {
    font-size: 22px;
  }

  .create-user-box {
    padding: 13px !important;
    border-radius: 14px;
  }

  .create-user-icon {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
}


/* =========================================================
   MOBILE HEADER - compact, no overlap
   ========================================================= */
@media (max-width: 768px) {
  .topbar {
    height: 64px !important;
    min-height: 64px !important;
    padding: 0 12px !important;
    overflow: hidden !important;
  }

  .topbar,
  .topbar > *,
  .topbar .inner,
  .topbar nav,
  .topbar .nav,
  .topbar .actions {
    box-sizing: border-box;
    min-width: 0 !important;
  }

  .topbar .inner {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
  }

  .brand {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
  }

  .brand .logo {
    flex: 0 0 38px !important;
    width: 38px !important;
    height: 38px !important;
  }

  .brand span,
  .brand strong {
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 14px !important;
  }

  .topbar nav,
  .topbar .nav,
  .topbar .actions {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    max-width: 48% !important;
    overflow: hidden !important;
  }

  .topbar nav a,
  .topbar .nav a,
  .topbar .actions a,
  .topbar .actions button {
    min-height: 40px !important;
    padding: 8px 9px !important;
    border-radius: 11px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  /* Profile becomes a compact icon/text button */
  .topbar .profile,
  .topbar a[href*="profile"] {
    max-width: 82px !important;
    overflow: hidden !important;
  }

  .topbar .profile span,
  .topbar a[href*="profile"] span {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .topbar .logout,
  .topbar a[href*="logout"] {
    padding-left: 7px !important;
    padding-right: 7px !important;
  }
}

@media (max-width: 430px) {
  .topbar {
    height: 60px !important;
    min-height: 60px !important;
    padding: 0 9px !important;
  }

  .brand .logo {
    flex-basis: 34px !important;
    width: 34px !important;
    height: 34px !important;
  }

  .brand span,
  .brand strong {
    font-size: 12.5px !important;
  }

  .topbar nav,
  .topbar .nav,
  .topbar .actions {
    max-width: 50% !important;
    gap: 3px !important;
  }

  .topbar nav a,
  .topbar .nav a,
  .topbar .actions a,
  .topbar .actions button {
    min-height: 38px !important;
    padding: 7px 7px !important;
    font-size: 11px !important;
  }

  .topbar .profile,
  .topbar a[href*="profile"] {
    max-width: 58px !important;
  }

  .topbar .profile span,
  .topbar a[href*="profile"] span {
    display: none !important;
  }
}


/* Final mobile header: compact Portale OSS branding */
@media (max-width: 768px) {
  .topbar {
    overflow: hidden !important;
    width: 100% !important;
  }
  .topbar .brand {
    min-width: 0 !important;
    overflow: hidden !important;
    flex: 1 1 auto !important;
  }
  .topbar .brand span,
  .topbar .brand strong {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
}


/* Push status: multi-device */
.push-pill{
  flex-direction:column;
  align-items:flex-start;
}
.push-enable-button{
  border:0;
  padding:0;
  background:transparent;
  color:inherit;
  font:inherit;
  font-weight:750;
  cursor:pointer;
}

/* Portale OSS official branding */
.brand-logo{display:block;width:150px;height:auto;max-height:52px;object-fit:contain;object-position:left center;}
.login-brand{display:block!important;margin-bottom:22px!important;}

/* Menu principale mobile */
.mobile-bottom-nav,.mobile-more-menu,.mobile-more-backdrop{display:none}
@media(max-width:760px){
  body{padding-bottom:calc(76px + env(safe-area-inset-bottom))}
  body.mobile-menu-open{overflow:hidden}
  .mobile-bottom-nav{position:fixed;left:0;right:0;bottom:0;z-index:80;display:grid;grid-template-columns:repeat(5,1fr);min-height:68px;padding:6px 6px calc(6px + env(safe-area-inset-bottom));background:rgba(255,255,255,.96);border-top:1px solid #dce3ef;box-shadow:0 -8px 24px rgba(24,40,76,.10);backdrop-filter:blur(18px)}
  .mobile-bottom-item{appearance:none;border:0;background:transparent;color:#6b768b;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:0;padding:5px 2px;border-radius:12px;font:inherit;text-decoration:none;cursor:pointer}
  .mobile-bottom-item>span{font-size:20px;line-height:1}
  .mobile-bottom-item>small{font-size:9px;font-weight:800;line-height:1.15;color:inherit;white-space:nowrap}
  .mobile-bottom-item.active{color:#2f5ed7;background:#edf2ff}
  .mobile-more-button>span{font-size:18px;font-weight:900;letter-spacing:1px}
  .mobile-more-backdrop{position:fixed;inset:0;z-index:88;display:block;background:rgba(17,27,48,.36);backdrop-filter:blur(2px)}
  .mobile-more-backdrop[hidden],.mobile-more-menu[hidden]{display:none!important}
  .mobile-more-menu{position:fixed;left:10px;right:10px;bottom:calc(76px + env(safe-area-inset-bottom));z-index:89;display:block;padding:8px 14px 14px;border:1px solid #dfe5ef;border-radius:22px;background:#fff;box-shadow:0 22px 55px rgba(17,31,62,.24)}
  .mobile-more-handle{width:38px;height:4px;margin:2px auto 8px;border-radius:999px;background:#d7deea}
  .mobile-more-head{display:flex;align-items:center;justify-content:space-between;padding:3px 2px 10px}
  .mobile-more-head strong{font-size:16px;color:#1c2940}
  .mobile-more-close{width:34px;height:34px;border:0;border-radius:10px;background:#f1f4f9;color:#526078;font-size:23px;line-height:1;cursor:pointer}
  .mobile-more-links{display:grid;gap:7px}
  .mobile-more-links a{display:grid;grid-template-columns:38px 1fr auto;align-items:center;gap:10px;min-height:58px;padding:9px 11px;border:1px solid #e4e9f1;border-radius:14px;background:#fafbfe;color:#1c2940}
  .mobile-more-links a>span{font-size:20px;text-align:center}.mobile-more-links a strong{display:block;font-size:12px}.mobile-more-links a small{display:block;margin-top:2px;font-size:9px;color:#748096}.mobile-more-links a>b{font-size:21px;color:#8c97aa}
}
.login-brand-logo{display:block;width:min(255px,100%);height:auto;max-height:100px;object-fit:contain;object-position:left center;}
@media(max-width:760px){.brand-logo{width:128px;max-height:45px}.login-brand-logo{width:min(235px,100%);max-height:90px}}


/* =========================================================
   TOPBAR UNIFICATA
   ========================================================= */
.app-topbar{
  min-height:68px;
  height:auto;
  gap:16px;
}
.app-brand{
  display:flex;
  align-items:center;
  min-width:0;
}
.app-brand .brand-logo{
  display:block;
}
.app-topbar-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  min-width:0;
}
.app-topbar-link{
  min-height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  padding:9px 13px;
  border:1px solid #dce3ef;
  border-radius:14px;
  background:linear-gradient(180deg,#fff,#fafbfe);
  color:var(--primary);
  font-size:12px;
  font-weight:800;
  line-height:1;
  white-space:nowrap;
  box-shadow:0 3px 12px rgba(28,48,90,.04);
  transition:background .16s,border-color .16s,box-shadow .16s,transform .16s;
}
.app-topbar-link:hover{
  background:var(--primary-soft);
  border-color:#bdccef;
  box-shadow:0 6px 16px rgba(36,87,214,.09);
  transform:translateY(-1px);
}
.app-topbar-icon{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.app-topbar-notifications{position:relative}.topbar-notification-count{position:absolute;right:-4px;top:-5px;min-width:20px;height:20px;padding:0 5px;display:grid;place-items:center;border:2px solid #fff;border-radius:999px;background:#d93a45;color:#fff;font-size:8px;font-weight:900}
.app-topbar-profile{background:linear-gradient(180deg,#f5f8ff,#edf2ff)}
.app-topbar-logout{
  color:#b33b45;
  background:linear-gradient(180deg,#fff,#fff8f8);
}
@media(max-width:600px){
  .app-topbar{
    padding:10px 14px;
    min-height:72px;
  }
  .app-brand .brand-logo{
    max-width:168px;
    height:auto;
  }
  .app-topbar-actions{
    gap:6px;
  }
  .app-topbar-link{
    min-height:40px;
    padding:8px 10px;
    font-size:11px;
  }
  .app-topbar-notifications{display:none}
}
@media(max-width:410px){
  .app-brand .brand-logo{
    max-width:145px;
  }
  .app-topbar-link:not(.app-topbar-back) span{
    display:none;
  }
  .app-topbar-link{width:40px;padding:8px}
  .app-topbar-back{width:auto;max-width:118px}
  .app-topbar-back span{overflow:hidden;text-overflow:ellipsis}
}

/* =========================================================
   FINAL CONSISTENCY PASS — Portale OSS
   ========================================================= */
:focus-visible{outline:3px solid rgba(49,95,219,.28);outline-offset:2px}button,a,input,select,textarea{-webkit-tap-highlight-color:transparent}.alert.success{background:var(--success-soft);color:var(--success);border-color:#ccebd8}.alert.warning{background:var(--warning-soft);color:#8a5c00;border-color:#f2ddb0}.empty-state{padding:20px;border:1px dashed var(--border-strong);border-radius:14px;background:#fafbfe;color:var(--muted);text-align:center}@media(max-width:768px){.app-topbar{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}.container{padding-left:max(14px,env(safe-area-inset-left));padding-right:max(14px,env(safe-area-inset-right))}.card:hover,.btn:hover{transform:none}}@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}

/* =========================================================
   DESIGN SYSTEM CONDIVISO — uniformità 2026
   ========================================================= */
.page-title,.page-head,.profile-head,.schedule-head,.schedule-title,.team-head,.documents-head,.leave-head,.audit-head,.health-head,.edit-news-head{
  position:relative;margin-bottom:20px;padding:19px 21px;border:1px solid #dfe5ef;border-radius:20px;
  background:linear-gradient(135deg,rgba(237,242,255,.92),rgba(255,255,255,.96));box-shadow:var(--shadow-sm)
}
.page-title h1,.page-head h1,.profile-head h1,.schedule-head h1,.schedule-title h1,.team-head h1,.documents-head h1,.leave-head h1,.audit-head h1,.health-head h1,.edit-news-head h1{
  margin:0;font-size:clamp(25px,3.2vw,34px);line-height:1.12;letter-spacing:-.7px
}
.page-title p,.page-head p,.profile-head p,.schedule-head p,.schedule-title p,.team-head p,.documents-head p,.leave-head p,.audit-head p,.health-head p,.edit-news-head p{margin:6px 0 0;color:var(--muted);font-size:12px}
.ui-section-title{display:flex;align-items:center;gap:11px;margin:0 0 15px}.ui-section-title-icon{width:40px;height:40px;display:grid;place-items:center;flex:0 0 40px;border-radius:12px;background:linear-gradient(145deg,#edf2ff,#e4ebff);color:var(--primary)}

label{color:#344258}.field-help,.form-help{display:block;margin-top:6px;color:var(--muted);font-size:10px;line-height:1.45}
input,textarea,select{border-color:#d8dfeb;border-radius:13px;background:linear-gradient(180deg,#fff,#fdfdff);box-shadow:0 2px 6px rgba(25,43,80,.025)}
input:hover,textarea:hover,select:hover{border-color:#bdc8da}input::placeholder,textarea::placeholder{color:#9aa4b4}
input[type="checkbox"],input[type="radio"]{width:20px;height:20px;min-height:20px;padding:0;accent-color:var(--primary);box-shadow:none}
input[type="file"]{padding:7px;background:#fff}input[type="file"]::file-selector-button{margin-right:10px;padding:8px 11px;border:0;border-radius:9px;background:#eaf0ff;color:#315fdb;font:inherit;font-size:11px;font-weight:800;cursor:pointer}
.btn{border:1px solid transparent;letter-spacing:-.05px}.btn.secondary{border-color:#dae3f6}.btn.danger,.btn.danger-soft,.danger-button{background:#fff0f1!important;color:#b8303b!important;border-color:#ffd5d9!important}.btn.success{background:#e8f7ef;color:#167347;border-color:#ccebd9}.btn.icon-only{width:42px;padding:9px}

.table-scroll,.users-table-scroll,.audit-scroll{border:1px solid var(--border);border-radius:16px;background:#fff;overflow:auto;box-shadow:var(--shadow-sm)}
.table-scroll table,.users-table-scroll table,.audit-scroll table{border:0;border-radius:0}.table-scroll th,.users-table-scroll th,.audit-scroll th{position:sticky;top:0;z-index:1;background:#f6f8fc}.table-scroll tr:last-child td,.users-table-scroll tr:last-child td,.audit-scroll tr:last-child td{border-bottom:0}
.status-badge,.role-badge{display:inline-flex;align-items:center;padding:5px 9px;border-radius:999px;background:#eef2f7;color:#526078;font-size:10px;font-weight:800}
.account-attention-light{display:inline-flex;align-items:center;padding:4px 8px;border-radius:999px;background:#fff3dc;color:#946000;font-size:9px;font-weight:850}.user-email-filter[data-email-filter=attention]{color:#946000;border-color:#efd69e}.user-email-filter[data-email-filter=attention].active{background:#fff3dc;color:#805300;border-color:#dcbf79}

.empty-state,.leave-empty,.schedule-empty-msg,.device-empty,.news-filter-empty,.previous-shifts-empty,.ui-empty-state{
  padding:25px 18px!important;border:1px dashed #cfd8e7!important;border-radius:17px!important;background:linear-gradient(180deg,#fbfcff,#f7f9fd)!important;color:#6c7890!important;text-align:center!important
}
.empty-state:before,.leave-empty:before,.schedule-empty-msg:before,.device-empty:before,.ui-empty-state:before{content:'◇';display:grid;place-items:center;width:38px;height:38px;margin:0 auto 9px;border-radius:12px;background:#eaf0ff;color:#315fdb;font-size:19px;font-weight:900}

.ui-confirm-backdrop{position:fixed;inset:0;z-index:3000;display:grid;place-items:center;padding:18px;background:rgba(18,29,52,.48);backdrop-filter:blur(5px)}.ui-confirm-backdrop[hidden]{display:none}.ui-confirm-dialog{width:min(430px,100%);padding:22px;border:1px solid #dfe5ef;border-radius:22px;background:#fff;box-shadow:0 28px 80px rgba(17,31,62,.28)}.ui-confirm-icon{width:48px;height:48px;display:grid;place-items:center;margin-bottom:14px;border-radius:15px;background:#fff0f1;color:#c13a45}.ui-confirm-icon svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2}.ui-confirm-dialog h2{margin:0;font-size:21px}.ui-confirm-dialog p{margin:8px 0 19px;color:#68758a;font-size:12px;line-height:1.5}.ui-confirm-actions{display:flex;justify-content:flex-end;gap:8px}
.portal-toast{position:fixed;left:50%;bottom:28px;z-index:3500;max-width:min(520px,calc(100vw - 28px));padding:12px 16px;transform:translateX(-50%);border:1px solid #bfe3ce;border-radius:14px;background:#eaf8f0;color:#176b3a;font-size:12px;font-weight:800;line-height:1.4;text-align:center;box-shadow:0 16px 45px rgba(20,38,75,.2)}.portal-toast.info{border-color:#c9d6f4;background:#eef3ff;color:#315fdb}.portal-toast.error{border-color:#f1c3c7;background:#fff0f1;color:#aa2e38}.portal-toast[hidden]{display:none}

@media(max-width:760px){
 .page-title,.page-head,.profile-head,.schedule-head,.schedule-title,.team-head,.documents-head,.leave-head,.audit-head,.health-head,.edit-news-head{padding:16px;border-radius:18px}
 .ui-responsive-table{display:block!important;border:0!important;background:transparent!important;overflow:visible!important;white-space:normal!important}.ui-responsive-table thead,.ui-responsive-table>tbody>tr:first-child:has(th){display:none}.ui-responsive-table tbody{display:grid;gap:10px}.ui-responsive-table tbody tr{display:block;padding:12px 14px;border:1px solid var(--border);border-radius:15px;background:#fff;box-shadow:var(--shadow-sm)}.ui-responsive-table td{display:grid;grid-template-columns:minmax(88px,.42fr) 1fr;gap:10px;align-items:start;padding:8px 0;border-bottom:1px solid #edf0f4;white-space:normal}.ui-responsive-table td:last-child{border-bottom:0}.ui-responsive-table td:before{content:attr(data-label);color:#7a8598;font-size:9px;font-weight:850;text-transform:uppercase;letter-spacing:.04em}.ui-responsive-table td:empty{display:none}
 .ui-confirm-actions{display:grid;grid-template-columns:1fr 1fr}.ui-confirm-actions .btn{width:100%}
 .portal-toast{bottom:94px}
 .btn,button,input:not([type="checkbox"]):not([type="radio"]),select{min-height:44px}
 small,.meta,.muted{line-height:1.45}
 .table-scroll:has(.ui-responsive-table),.users-table-scroll:has(.ui-responsive-table),.audit-scroll:has(.ui-responsive-table){overflow:visible;border:0;background:transparent;box-shadow:none}
 .ui-responsive-table .action-row{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px!important}.ui-responsive-table .action-row .btn,.ui-responsive-table .action-row form{width:100%!important}
}

/* =========================================================
   PORTALE OSS — ARMONIZZAZIONE VISIVA V18
   Un solo linguaggio grafico per Dashboard, operatori e Admin
   ========================================================= */
:root{
  --page-max:1240px;
  --surface:#fff;
  --surface-soft:#f8faff;
  --surface-blue:#f3f7ff;
  --ink:#17243b;
  --ink-soft:#526078;
  --line:#e1e7f0;
  --line-strong:#d5deeb;
  --blue:#315fdb;
  --blue-dark:#244db9;
  --blue-soft:#edf3ff;
  --green:#18764a;
  --green-soft:#eaf8f0;
  --amber:#946000;
  --amber-soft:#fff5df;
  --red:#b7333e;
  --red-soft:#fff0f1;
  --shadow-card:0 8px 26px rgba(28,45,78,.055);
  --shadow-raised:0 16px 42px rgba(28,45,78,.10);
}

body{
  min-height:100vh;
  background:
    radial-gradient(circle at 8% -8%,rgba(49,95,219,.08),transparent 29rem),
    radial-gradient(circle at 100% 22%,rgba(95,129,224,.045),transparent 25rem),
    #f5f7fb;
}
body .container{max-width:var(--page-max);padding-top:30px}
h1,h2,h3{color:var(--ink);text-wrap:balance}
p{color:var(--ink-soft)}
hr{height:1px;border:0;background:var(--line)}

body .card{
  border-color:var(--line);
  border-radius:20px;
  background:rgba(255,255,255,.975);
  box-shadow:var(--shadow-card);
}
body .card:hover{border-color:#d9e1ed;box-shadow:0 11px 31px rgba(28,45,78,.075)}
body a.card:hover{transform:translateY(-1px)}

/* Intestazioni pagina coerenti */
body .container :is(
  .page-title,.page-head,.admin-title,.oss-welcome,.profile-head,.schedule-head,.schedule-title,
  .team-head,.documents-head,.leave-head,.campaign-head,.availability-head,.inbox-head,.tasks-head,
  .audit-head,.health-head,.edit-news-head,.edit-head,.preview-title,.revision-head,.receipt-head,
  .delivery-head,.report-head,.coord-msg-hero,.automation-hero
){
  position:relative;
  margin-bottom:18px;
  padding:20px 22px;
  overflow:hidden;
  border:1px solid #dbe4f2;
  border-radius:22px;
  background:linear-gradient(135deg,rgba(239,244,255,.98),rgba(255,255,255,.98) 72%);
  box-shadow:var(--shadow-card);
}
body .container :is(
  .page-title,.page-head,.admin-title,.oss-welcome,.profile-head,.schedule-head,.schedule-title,
  .team-head,.documents-head,.leave-head,.campaign-head,.availability-head,.inbox-head,.tasks-head,
  .audit-head,.health-head,.edit-news-head,.edit-head,.preview-title,.revision-head,.receipt-head,
  .delivery-head,.report-head,.coord-msg-hero,.automation-hero
)::before{
  content:"";position:absolute;left:0;top:0;bottom:0;width:4px;
  background:linear-gradient(180deg,#315fdb,#7392e9)
}
body .container :is(
  .page-title,.page-head,.admin-title,.oss-welcome,.profile-head,.schedule-head,.schedule-title,
  .team-head,.documents-head,.leave-head,.campaign-head,.availability-head,.inbox-head,.tasks-head,
  .audit-head,.health-head,.edit-news-head,.edit-head,.preview-title,.revision-head,.receipt-head,
  .delivery-head,.report-head,.coord-msg-hero,.automation-hero
) h1{margin-top:0;font-size:clamp(25px,3.1vw,34px);line-height:1.12;letter-spacing:-.75px}
body .container :is(
  .page-title,.page-head,.admin-title,.oss-welcome,.profile-head,.schedule-head,.schedule-title,
  .team-head,.documents-head,.leave-head,.campaign-head,.availability-head,.inbox-head,.tasks-head,
  .audit-head,.health-head,.edit-news-head,.edit-head,.preview-title,.revision-head,.receipt-head,
  .delivery-head,.report-head,.coord-msg-hero,.automation-hero
) p{margin-top:6px;color:#68758b;font-size:12px;line-height:1.5}

/* Titoli e separatori interni */
body :is(.section-heading,.oss-section-heading,.coord-section-title,.documents-dashboard-head,.leave-dashboard-head,.planning-card-title,.profile-title,.edit-section-head,.report-card-head){
  position:relative;
}
body :is(.section-heading,.oss-section-heading){padding-bottom:9px;border-bottom:1px solid #e8edf4}
body :is(.section-heading,.oss-section-heading) h2{letter-spacing:-.3px}
body .oss-eyebrow,body .coord-eyebrow,body .coord-kicker{
  color:#526b9f;font-size:9px;font-weight:900;letter-spacing:.13em;text-transform:uppercase
}

/* Barre strumenti, filtri e navigazione */
body :is(.documents-tools,.inbox-tools,.audit-filters,.delivery-filters,.team-controls,.schedule-month-nav,.user-search-tools){
  padding:10px;
  border:1px solid var(--line);
  border-radius:16px;
  background:rgba(255,255,255,.94);
  box-shadow:0 4px 16px rgba(28,45,78,.035);
}
body .admin-nav{
  padding:8px;border:1px solid var(--line);border-radius:18px;background:rgba(255,255,255,.96);box-shadow:var(--shadow-card)
}
body .admin-nav-item{border-radius:12px;transition:background .16s,color .16s,transform .16s}
body .admin-nav-item:hover{transform:translateY(-1px);background:#f4f7fd}
body .admin-nav-item.active{background:linear-gradient(135deg,#315fdb,#416dde);color:#fff;box-shadow:0 7px 16px rgba(49,95,219,.18)}
body .admin-section-intro{
  padding:15px 17px;border:1px solid #dce4f1;border-radius:17px;background:linear-gradient(135deg,#f8faff,#fff);box-shadow:0 4px 16px rgba(28,45,78,.035)
}

/* Pulsanti e campi */
body .btn{
  min-height:43px;border-radius:13px;font-weight:800;box-shadow:none;
  transition:transform .16s ease,box-shadow .16s ease,background .16s ease,border-color .16s ease
}
body .btn.primary{background:linear-gradient(135deg,#315fdb,#416dde);box-shadow:0 7px 17px rgba(49,95,219,.17)}
body .btn.primary:hover{background:linear-gradient(135deg,#2b57cf,#3964d5);box-shadow:0 10px 23px rgba(49,95,219,.23)}
body .btn.secondary{border-color:#d9e2f5;background:#eff4ff;color:#2f59c8}
body .btn.secondary:hover{border-color:#c8d5f0;background:#e8efff}
body :is(input,textarea,select){border-color:var(--line-strong);border-radius:13px;background:#fff}
body :is(input,textarea,select):focus{border-color:#7190e3;box-shadow:0 0 0 4px rgba(49,95,219,.105)}
body label>span:first-child{color:#435168}

/* KPI e riquadri numerici */
body :is(.kpi,.schedule-kpi,.mv-kpi,.report-stat,.user-profile-kpis>div,.health-score,.tasks-count){
  border-color:#dfe6f1;
  border-radius:15px;
  background:linear-gradient(180deg,#fff,#f9fbfe);
  box-shadow:0 4px 14px rgba(28,45,78,.035)
}
body :is(.kpi,.schedule-kpi,.mv-kpi,.report-stat,.user-profile-kpis>div) strong,
body :is(.kpi,.schedule-kpi,.mv-kpi,.report-stat,.user-profile-kpis>div) .value{font-variant-numeric:tabular-nums}

/* Elenchi operativi e card cliccabili */
body :is(
  .task-row,.inbox-item,.coord-todo-item,.coord-action,.oss-task,.oss-quick-card,.oss-recent-row,
  .documents-dashboard-row,.leave-card,.leave-admin-card,.document-card,.campaign-choice,.history-row
){
  border-color:var(--line);
  border-radius:15px;
  transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease,background .16s ease
}
body :is(a.task-row,a.inbox-item,a.coord-todo-item,a.coord-action,a.oss-task,a.oss-quick-card,a.oss-recent-row):hover{
  transform:translateY(-1px);border-color:#cfd9e9;box-shadow:0 9px 23px rgba(28,45,78,.07)
}
body :is(.task-icon,.inbox-icon,.coord-todo-icon,.oss-quick-icon,.documents-dashboard-icon,.profile-icon,.edit-section-icon){
  background:linear-gradient(145deg,#eef3ff,#e5edff);color:#315fdb;box-shadow:inset 0 0 0 1px rgba(49,95,219,.045)
}

/* Tabelle: intestazioni più chiare e righe meno piatte */
body table{border-color:var(--line);box-shadow:0 3px 12px rgba(28,45,78,.025)}
body table th{height:43px;background:#f5f8fc;color:#526078;font-size:9px;letter-spacing:.065em}
body table td{color:#2b3a52;vertical-align:middle}
body table tbody tr:nth-child(even){background:#fcfdff}
body table tbody tr:hover{background:#f6f9ff}

/* Details, modali e messaggi */
body details{border-radius:15px}
body details>summary{border-radius:13px;transition:background .15s ease}
body details>summary:hover{background:rgba(237,242,255,.62)}
body .alert{padding:13px 15px;border-radius:14px;box-shadow:0 3px 12px rgba(28,45,78,.025)}
body .empty-state,body .ui-empty-state{min-height:120px;display:grid;align-content:center}
body :is(.ui-confirm-dialog,.team-person-sheet,.team-month-editor){border-radius:24px;box-shadow:0 28px 80px rgba(17,31,62,.25)}

/* Dashboard e centro operativo */
body .oss-dashboard{max-width:1100px}
body .oss-shift-card,body .oss-matrix-card,body .planning-card,body .coord-area{
  border-color:var(--line);border-radius:20px;box-shadow:var(--shadow-card)
}
body .coord-area{background:linear-gradient(180deg,#fff,#fbfcff)}
body .coord-action{background:rgba(255,255,255,.94)}
body .coord-system{border-color:var(--line);background:#f8faff}

/* Pagine di accesso e sicurezza */
body.login-page,body:has(.recovery-card),body:has(.reset-card),body:has(.first-password-page){
  background:
    radial-gradient(circle at 12% 8%,rgba(49,95,219,.12),transparent 25rem),
    radial-gradient(circle at 90% 92%,rgba(91,130,231,.08),transparent 23rem),
    #f5f7fb
}
body :is(.login-card,.recovery-card,.reset-card,.first-password-card){
  border:1px solid #dce3ee;border-radius:26px;box-shadow:0 25px 70px rgba(23,39,72,.14)
}

/* Mobile: meno rumore, più spazio utile e controlli facili da toccare */
@media(max-width:760px){
  body .container{padding-top:18px;padding-bottom:34px}
  body .card{padding:16px;border-radius:17px}
  body .container :is(
    .page-title,.page-head,.admin-title,.oss-welcome,.profile-head,.schedule-head,.schedule-title,
    .team-head,.documents-head,.leave-head,.campaign-head,.availability-head,.inbox-head,.tasks-head,
    .audit-head,.health-head,.edit-news-head,.edit-head,.preview-title,.revision-head,.receipt-head,
    .delivery-head,.report-head,.coord-msg-hero,.automation-hero
  ){padding:16px 17px;border-radius:19px}
  body .container :is(
    .page-title,.page-head,.admin-title,.oss-welcome,.profile-head,.schedule-head,.schedule-title,
    .team-head,.documents-head,.leave-head,.campaign-head,.availability-head,.inbox-head,.tasks-head,
    .audit-head,.health-head,.edit-news-head,.edit-head,.preview-title,.revision-head,.receipt-head,
    .delivery-head,.report-head,.coord-msg-hero,.automation-hero
  ) h1{font-size:25px}
  body :is(.documents-tools,.audit-filters,.delivery-filters,.team-controls,.schedule-month-nav,.user-search-tools){padding:9px;border-radius:14px}
  body .admin-nav{margin-left:-2px;margin-right:-2px;padding:6px;border-radius:15px}
  body .admin-nav-items{scrollbar-width:none}
  body .admin-nav-items::-webkit-scrollbar{display:none}
  body .admin-nav-item{min-height:42px}
  body :is(.oss-shift-card,.oss-matrix-card,.planning-card,.coord-area){border-radius:18px}
  body a.card:hover,body :is(a.task-row,a.inbox-item,a.coord-todo-item,a.coord-action,a.oss-task,a.oss-quick-card,a.oss-recent-row):hover{transform:none}
  body table tbody tr:nth-child(even){background:transparent}
  body .ui-responsive-table tbody tr{border-radius:17px;background:#fff!important}
}

@media(max-width:430px){
  body .container{padding-left:12px;padding-right:12px}
  body .btn{min-height:44px}
  body .oss-welcome-actions{display:grid;grid-template-columns:1fr 1fr;width:100%}
  body .oss-welcome-actions .btn{width:100%;white-space:normal;text-align:center}
  body :is(.support-stats,.runtime-overview){grid-template-columns:1fr}
}

/* Intestazioni delle pagine secondarie e dei visualizzatori */
body .container :is(.av-edit-head,.admin-campaign-head,.preview-head,.trash-head),
body .container.page>.head,
body .container.viewer>.vh{
  position:relative;
  margin-bottom:18px;
  padding:20px 22px;
  overflow:hidden;
  border:1px solid #dbe4f2;
  border-radius:22px;
  background:linear-gradient(135deg,rgba(239,244,255,.98),rgba(255,255,255,.98) 72%);
  box-shadow:var(--shadow-card);
}
body .container :is(.av-edit-head,.admin-campaign-head,.preview-head,.trash-head)::before,
body .container.page>.head::before,
body .container.viewer>.vh::before{
  content:"";position:absolute;left:0;top:0;bottom:0;width:4px;
  background:linear-gradient(180deg,#315fdb,#7392e9)
}
body .container :is(.av-edit-head,.admin-campaign-head,.preview-head,.trash-head) h1,
body .container.page>.head h1,
body .container.viewer>.vh h1{
  margin-top:0;font-size:clamp(25px,3.1vw,34px);line-height:1.12;letter-spacing:-.75px
}
body .container :is(.av-edit-head,.admin-campaign-head,.preview-head,.trash-head) p,
body .container.page>.head p,
body .container.viewer>.vh p{margin-top:6px;color:#68758b;font-size:12px;line-height:1.5}

/* Le pagine informative mantengono la stessa eleganza, con una lettura più comoda. */
body .legal-page{
  border:1px solid var(--line);border-radius:22px;background:#fff;box-shadow:var(--shadow-card)
}
body .legal-page>h1{margin-bottom:8px;font-size:clamp(27px,3vw,36px);letter-spacing:-.75px}
body .legal-page>.lead{margin-top:0;padding-bottom:16px;border-bottom:1px solid var(--line);line-height:1.65}

@media(max-width:760px){
  body .container :is(.av-edit-head,.admin-campaign-head,.preview-head,.trash-head),
  body .container.page>.head,
  body .container.viewer>.vh{padding:16px 17px;border-radius:19px}
  body .container :is(.av-edit-head,.admin-campaign-head,.preview-head,.trash-head) h1,
  body .container.page>.head h1,
  body .container.viewer>.vh h1{font-size:25px}
  body .legal-page{border-radius:18px}
}

/* =========================================================
   HOTFIX MOBILE V18.1 — correzioni rilevate su iPhone
   ========================================================= */
@media(max-width:760px){
  /* Le tabelle trasformate in schede non devono conservare la larghezza desktop. */
  body table.ui-responsive-table{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    table-layout:auto!important;
  }
  body :is(.prep-table-wrap,.mv-table-wrap):has(>table.ui-responsive-table){
    width:100%;
    max-width:100%;
    overflow:visible!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
  }
  body :is(.prep-table,.mv-table).ui-responsive-table tbody{
    width:100%;
  }
  body :is(.prep-table,.mv-table).ui-responsive-table tbody tr{
    width:100%;
    min-width:0;
    box-sizing:border-box;
    overflow:hidden;
  }
  body :is(.prep-table,.mv-table).ui-responsive-table td{
    grid-template-columns:minmax(92px,.42fr) minmax(0,1fr)!important;
    width:100%;
    min-width:0;
    box-sizing:border-box;
    text-align:left!important;
    overflow-wrap:anywhere;
  }
  body :is(.prep-table,.mv-table).ui-responsive-table td::before{
    text-align:left;
  }
  body :is(.prep-table,.mv-table).ui-responsive-table :is(.prep-state,.mv-vouchers,.mv-badge){
    justify-self:start;
    max-width:100%;
  }

  /* Preparazione turno: mese e frecce sempre contenuti nella larghezza disponibile. */
  body .prep-month-nav{
    display:grid!important;
    grid-template-columns:44px minmax(0,1fr) 44px;
    gap:7px!important;
    width:100%;
    min-width:0;
    align-items:stretch;
  }
  body .prep-month-nav>form{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 62px!important;
    gap:7px!important;
    min-width:0;
  }
  body .prep-month-nav input[type="month"]{
    width:100%!important;
    min-width:0!important;
    max-width:100%;
    box-sizing:border-box;
    padding-left:10px;
    padding-right:4px;
  }
  body .prep-month-nav>.btn,
  body .prep-month-nav>form>.btn{
    width:100%!important;
    min-width:0!important;
    padding-left:5px;
    padding-right:5px;
  }

  /* Menu coordinatore: le voci lunghe vanno a capo nella propria colonna. */
  body .admin-nav-items{
    overflow:visible!important;
  }
  body .admin-nav-item{
    min-width:0;
    white-space:normal!important;
    line-height:1.25;
    overflow-wrap:anywhere;
    align-items:flex-start;
  }
  body .admin-nav-item>span{
    min-width:0;
  }

  /* Calendari: azioni su due colonne, senza pulsanti tagliati lateralmente. */
  body .excel-month-actions{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:7px!important;
    width:100%;
    min-width:0;
    align-items:stretch;
  }
  body .excel-month-actions>.btn,
  body .excel-month-actions>form{
    width:100%!important;
    min-width:0!important;
    box-sizing:border-box;
  }
  body .excel-month-actions>.btn,
  body .excel-month-actions>form>.btn{
    width:100%!important;
    min-width:0!important;
    box-sizing:border-box;
    white-space:normal;
    line-height:1.25;
  }
  body .excel-month-actions :is(.calendar-publish-form,.calendar-lock-form){
    grid-column:1/-1;
  }

  /* La matrice delle disponibilità resta una vera matrice a scorrimento orizzontale. */
  body .matrix-card,
  body .matrix-wrap{
    min-width:0;
    max-width:100%;
  }
  body .matrix-wrap{
    overflow-x:auto!important;
    overflow-y:visible;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-inline:contain;
  }
}

@media(max-width:390px){
  body :is(.prep-table,.mv-table).ui-responsive-table td{
    grid-template-columns:84px minmax(0,1fr)!important;
    gap:8px;
  }
  body .admin-nav-item{
    padding-left:8px;
    padding-right:8px;
    font-size:10.5px;
  }
}

/* Accessibilità condivisa: navigazione da tastiera, tocco e animazioni ridotte. */
.skip-link{position:fixed;z-index:5000;top:8px;left:8px;transform:translateY(-160%);padding:10px 14px;border-radius:10px;background:#172744;color:#fff;font-size:13px;font-weight:850;text-decoration:none;box-shadow:0 8px 24px rgba(16,34,65,.3)}
.skip-link:focus{transform:translateY(0)}
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{outline:3px solid #f0a51a!important;outline-offset:3px!important}
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
button:disabled,[aria-disabled="true"]{cursor:not-allowed;opacity:.62}
@media(pointer:coarse){button,.btn,input[type="button"],input[type="submit"],select{min-height:44px}}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto!important}*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}

.single-shift-dialog{width:min(500px,calc(100vw - 28px));padding:0;border:0;border-radius:22px;background:#fff;color:#1a2943;box-shadow:0 28px 80px rgba(17,34,65,.34)}.single-shift-dialog::backdrop{background:rgba(16,31,57,.55);backdrop-filter:blur(4px)}.single-shift-dialog form{display:grid;gap:14px;padding:25px}.single-shift-dialog small{color:#58709b;font-size:10px;font-weight:900;letter-spacing:.14em}.single-shift-dialog h2{margin:0;font-size:23px}.single-shift-dialog p{margin:0;color:#68758a;font-size:12px;line-height:1.55}.single-shift-dialog label:not(.team-email-choice){display:grid;gap:6px;color:#34445e;font-size:11px;font-weight:850}.single-shift-dialog input[type="text"]{min-height:52px;padding:10px 14px;border:2px solid #cad6e8;border-radius:13px;background:#f9fbfe;color:#172744;font-size:22px;font-weight:900;text-transform:uppercase}.single-shift-dialog form>div:last-child{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:3px}.single-shift-dialog .team-email-choice[hidden]{display:none!important}

/* Rifinitura finale condivisa: azioni, stati e feedback coerenti. */
.btn,button.btn,a.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;border-radius:11px;font-weight:800;line-height:1.2;text-decoration:none;transition:transform .14s ease,box-shadow .14s ease,background-color .14s ease,border-color .14s ease}
.btn:hover:not(:disabled):not([aria-disabled="true"]){transform:translateY(-1px)}.btn:active:not(:disabled){transform:translateY(0)}
.btn.primary{border-color:#315fdb;background:linear-gradient(135deg,#315fdb,#4774e3);color:#fff;box-shadow:0 5px 14px rgba(49,95,219,.18)}
.btn.secondary{border-color:#d8e0ec;background:#fff;color:#31425f;box-shadow:0 3px 9px rgba(25,43,76,.05)}
.btn.danger,.btn.danger-soft,.danger-button{border-color:#b92f38!important;background:linear-gradient(135deg,#c93842,#ad2630)!important;color:#fff!important;box-shadow:0 5px 14px rgba(185,47,56,.18)!important}
.btn.success{border-color:#238451;background:linear-gradient(135deg,#258c57,#197544);color:#fff;box-shadow:0 5px 14px rgba(31,126,77,.16)}
.btn:disabled,.btn[aria-disabled="true"]{transform:none!important;box-shadow:none!important;filter:saturate(.55)}
.priority-badge,.status-badge,.guest-admin-status{display:inline-flex;align-items:center;justify-content:center;line-height:1.15;white-space:nowrap}
.alert,.portal-toast,.reparto-note{line-height:1.48}.card>form:last-child,.card>.action-row:last-child{margin-bottom:0}
@media(max-width:760px){.card{scroll-margin-top:14px}.btn{min-height:44px}.action-row,.form-actions{gap:8px}.portal-toast{max-width:calc(100vw - 24px)}}
