/* ==========================================================================
   Tema unificato Registro Accessi & Chiavi - Informatica95
   Obiettivi: coerenza visiva, leggibilità, responsive, accessibilità base
   ========================================================================== */

/* -- Reset e base tipografica -- */
:root{
  --bg:#0f172a;           /* slate-900 */
  --bg-soft:#111827;      /* gray-900 */
  --panel:#111827;        /* gray-900 (pannelli) */
  --panel-soft:#1f2937;   /* gray-800 */
  --border:#374151;       /* gray-700 */
  --text:#e5e7eb;         /* gray-200 */
  --muted:#9ca3af;        /* gray-400 */
  --primary:#22c55e;      /* green-500 */
  --primary-600:#16a34a;  /* green-600 */
  --danger:#ef4444;       /* red-500 */
  --warn:#f59e0b;         /* amber-500 */
  --focus:#60a5fa;        /* blue-400 */
  --radius:12px;
  --shadow:0 10px 25px rgba(0,0,0,.25);
  --shadow-soft:0 6px 16px rgba(0,0,0,.18);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font:16px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  color:var(--text);
  background:linear-gradient(180deg, var(--bg) 0%, #0b1224 100%);
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
}

/* -- Layout contenitori -- */
.container{max-width:1100px;margin:0 auto;padding:18px}
.panel{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow-soft);
  padding:18px;
}
.grid{display:grid;gap:16px}
.grid.cols-2{grid-template-columns:repeat(2,1fr)}
.grid.cols-3{grid-template-columns:repeat(3,1fr)}
@media (max-width: 980px){.grid.cols-2,.grid.cols-3{grid-template-columns:1fr}}

h1,h2,h3{margin:0 0 10px}
h1{font-size:1.6rem}
h2{font-size:1.25rem;color:var(--muted)}
.lead{color:var(--muted);margin-top:-6px}

/* -- Bottoni -- */
.btn{
  appearance:none; display:inline-flex; align-items:center; gap:.5rem;
  padding:.6rem .95rem; border-radius:10px; border:1px solid var(--border);
  background:var(--panel-soft); color:var(--text); text-decoration:none; cursor:pointer;
  box-shadow:var(--shadow-soft); transition:transform .08s ease, background .2s;
}
.btn:hover{transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn.primary{background:var(--primary); border-color:transparent; color:#0a0f18}
.btn.primary:hover{background:var(--primary-600)}
.btn.warn{background:var(--warn); color:#0a0f18; border-color:transparent}
.btn.danger{background:var(--danger); color:#0a0f18; border-color:transparent}
.btn.ghost{background:transparent}

/* -- Campi form -- */
.input, select, textarea{
  width:100%; padding:.6rem .7rem; border-radius:10px;
  background:#0b1224; border:1px solid var(--border); color:var(--text);
}
.input:focus, select:focus, textarea:focus{outline:2px solid var(--focus); outline-offset:2px}

/* -- Tabella -- */
.table{width:100%; border-collapse:separate; border-spacing:0; overflow:hidden}
.table thead th{
  text-align:left; background:var(--panel-soft); padding:.7rem .8rem; font-weight:600; color:var(--muted);
  position:sticky; top:0; z-index:1;
}
.table tbody td{padding:.65rem .8rem; border-top:1px solid var(--border)}
.table tbody tr:hover{background:#0b1224}

/* -- Badge & pill -- */
.badge{display:inline-block; padding:.2rem .55rem; border-radius:999px; font-size:.82rem; border:1px solid var(--border); background:var(--panel-soft)}
.badge.ok{border-color:transparent; background:var(--primary); color:#0a0f18}
.badge.warn{border-color:transparent; background:var(--warn); color:#0a0f18}
.badge.danger{border-color:transparent; background:var(--danger); color:#0a0f18}

/* -- Alert -- */
.alert{padding:.8rem 1rem; border-radius:10px; border:1px solid var(--border); background:var(--panel-soft)}
.alert.ok{border-color:transparent; background:rgba(34,197,94,.15)}
.alert.warn{border-color:transparent; background:rgba(245,158,11,.18)}
.alert.danger{border-color:transparent; background:rgba(239,68,68,.15)}

/* -- Navbar responsive -- */
.nav{
  background:rgba(15,23,42,.75); backdrop-filter:saturate(150%) blur(6px);
  position:sticky; top:0; z-index:50; border-bottom:1px solid rgba(55,65,81,.5);
}
.nav-inner{max-width:1100px; margin:0 auto; padding:.55rem .9rem; display:flex; align-items:center; justify-content:space-between; gap:12px}
.brand{display:flex; align-items:center; gap:.6rem; font-weight:700}
.brand img{height:28px; width:auto; border-radius:6px}
.menu{display:flex; gap:.35rem; align-items:center}
.menu a{color:var(--text); text-decoration:none; padding:.45rem .65rem; border-radius:8px}
.menu a:hover{background:rgba(255,255,255,.06)}
.menu .active{background:var(--primary); color:#0a0f18}

.hamb{display:none}
@media (max-width: 900px){
  .hamb{display:inline-flex}
  .menu{
    position:fixed; inset:auto 0 0 0; top:56px; background:rgba(10,15,24,.98);
    padding:10px; flex-direction:column; gap:4px; border-top:1px solid var(--border);
    transform:translateY(100%); transition:transform .2s ease;
  }
  .menu.open{transform:translateY(0)}
}

/* -- Utility -- */
.mt-1{margin-top:.25rem} .mt-2{margin-top:.5rem} .mt-3{margin-top:1rem}
.mb-1{margin-bottom:.25rem} .mb-2{margin-bottom:.5rem} .mb-3{margin-bottom:1rem}
.flex{display:flex} .items-center{align-items:center} .justify-between{justify-content:space-between} .gap-1{gap:.25rem} .gap-2{gap:.5rem} .gap-3{gap:1rem}
.hidden{display:none}
.max-w{max-width:1100px;margin:0 auto}
.card{background:var(--panel); border:1px solid var(--border); border-radius:var(--radius); padding:16px; box-shadow:var(--shadow-soft)}

/* ========================================================================== */
/* === Tweaks post-tema (03-11) ============================================= */

/* Link generici: niente blu browser, look coerente dark */
a{ color:var(--muted); text-decoration:none; }
a:hover{ color:var(--primary); text-decoration:underline; }

/* Link dentro ai pannelli/card: usa il verde del tema */
.panel a{ color:var(--primary); }
.panel a:hover{ color:var(--primary-600); text-decoration:underline; }

/* Brand: evita il blu dei link e allinea il testo */
.brand, .brand a{ color:var(--text); text-decoration:none; }
.brand img{ height:30px; margin-right:6px; }

/* Navbar: migliora contrasto e stato attivo/hover */
.nav .menu a{ color:var(--text); }
.nav .menu a:hover{ background:rgba(255,255,255,.06); }
.nav .menu a.active{ background:var(--primary); color:#0a0f18; }

/* Pulsante hamburger: leggero miglioramento accessibilità */
.hamb{ cursor:pointer; }

/* Footer: link coerenti e meno “sparati” */
footer a, .footer a{ color:var(--muted); }
footer a:hover, .footer a:hover{ color:var(--primary); text-decoration:underline; }

/* === Light theme override (03-11) ========================================= */
:root{
  --bg:#f6f7fb;            /* base chiara */
  --bg-soft:#ffffff;
  --panel:#ffffff;
  --panel-soft:#f3f4f6;
  --border:#e5e7eb;
  --text:#111827;          /* testo scuro */
  --muted:#4b5563;
  --primary:#2563eb;       /* blu accessibile */
  --primary-600:#1d4ed8;
  --danger:#b91c1c;
  --warn:#b45309;
  --focus:#2563eb;
}

/* Sfondo e tipografia */
body{
  color:var(--text);
  background:linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
}

/* Pannelli, card, tabelle */
.panel{ background:var(--panel); border:1px solid var(--border); }
.table thead th{ background:var(--panel-soft); color:#111827; }

/* Link coerenti (niente blu browser) */
a{ color:#1f2937; text-decoration:none; }
a:hover{ color:var(--primary-600); text-decoration:underline; }
.panel a{ color:var(--primary); }
.panel a:hover{ color:var(--primary-600); }

/* Navbar chiara e leggibile */
.nav{
  background:rgba(255,255,255,.9);
  border-bottom:1px solid var(--border);
}
.brand, .brand a{ color:#111827; }
.menu a{ color:#111827; }
.menu a:hover{ background:rgba(0,0,0,.05); }
.menu a.active{ background:var(--primary); color:#fff; }

/* Badge ruolo */
.badge{ background:var(--panel-soft); color:#111827; border-color:var(--border) }

/* Accessibilità/hit-area menu */
.menu{ z-index:60 }
.menu a{ pointer-events:auto; }
.hamb{ cursor:pointer; }

/* Footer */
footer a, .footer a{ color:#374151; }
footer a:hover, .footer a:hover{ color:var(--primary-600); }

/* === Light form controls override ========================================= */
.input, select, textarea{
  background:#ffffff !important;
  color:#111827 !important;
  border:1px solid var(--border) !important;
}
.input:focus, select:focus, textarea:focus{
  outline:2px solid var(--focus);
  outline-offset:2px;
  background:#ffffff;
}

/* Placeholders più leggibili in chiaro */
::placeholder{ color:#6b7280; opacity:1 }

/* Opzioni del <select> (supporto dipende dal browser, ma aiuta) */
select option{
  background:#ffffff;
  color:#111827;
}

/* Dropdown aperto su alcuni browser (webkit/blink) */
select::-ms-expand{ display:none }

/* Separatore in navbar (tra voci e blocco password/badge/logout) */
.menu .sep{
  display:inline-block;
  width:1px; height:22px;
  margin:0 .5rem; vertical-align:middle;
  background:var(--border);
}
@media (max-width: 900px){
  .menu .sep{ width:100%; height:1px; margin:.35rem 0; }
}

/* === Dropdown (submenu) ==================================================== */
.menu .dropdown{ position:relative; display:inline-block; }
.menu .dropbtn{ display:inline-flex; align-items:center; gap:.4rem; padding:.45rem .65rem; border-radius:8px; text-decoration:none; color:#111827; }
.menu .dropbtn:hover{ background:rgba(0,0,0,.05); }
.menu .caret{ font-size:.9em; opacity:.75; }

.menu .submenu{
  position:absolute; top:100%; left:0; min-width:230px;
  background:#fff; border:1px solid var(--border); border-radius:10px;
  box-shadow:0 10px 25px rgba(0,0,0,.12);
  padding:.35rem; display:none; z-index:99;
}
.menu .submenu a{
  display:block; padding:.5rem .6rem; border-radius:8px; color:#111827;
}
.menu .submenu a:hover{ background:rgba(0,0,0,.05); }

.menu .dropdown.open .submenu{ display:block; }

/* Desktop: apri al passaggio del mouse */
@media (min-width: 901px){
  .menu .dropdown:hover .submenu{ display:block; }
}

/* Mobile: il menu è colonna, lo submenu è statico */
@media (max-width: 900px){
  .menu .dropdown{ width:100%; }
  .menu .submenu{ position:static; border:1px dashed var(--border); box-shadow:none; display:none; margin:.2rem 0; }
  .menu .dropdown.open .submenu{ display:block; }
}

/* === Form layout – tema chiaro, campi uniformi ============================ */
/* .form, form{ --field-h:44px; } */
.form .row, form .row{ margin: 14px 0; }
.form label, form label{ display:block; font-weight:600; margin-bottom:6px; color:#1f2937; }
input[type="text"], input[type="email"], input[type="password"], select, textarea{
  width:100%; height:var(--field-h);
  padding:10px 12px; border:1px solid var(--border);
  border-radius:10px; background:#fff; color:#111827;
  box-sizing:border-box;
}
textarea{ min-height:120px; height:auto; resize:vertical; }

.form-actions, .actions{
  display:flex; gap:.5rem; align-items:center; flex-wrap:wrap;
  margin: 10px 0 6px 0;
}
.form-actions.center, .actions.center{ justify-content:center; }

.signature-box{
  background:var(--panel-soft);
  border:2px dashed #c7ccd6;
  border-radius:12px;
  min-height:220px;
  padding:10px;
  box-shadow: inset 0 1px 0 rgba(0,0,0,.02);
}
.signature-box .hint{ color:#6b7280; font-size:.9rem; margin-top:6px; }

.form-check{ display:flex; gap:.55rem; align-items:flex-start; margin: 12px 0; }
.form-check input[type="checkbox"]{ margin-top:.25rem; }

.helper-links{ text-align:center; margin-top:8px; }

select option{ background:#fff; color:#111827; }

.btn{ padding:.45rem .8rem; border-radius:10px; border:1px solid var(--border); background:#fff; }
.btn.primary{ background:var(--primary); color:#fff; border-color:var(--primary); }
.btn.danger{ background:#fff; color:var(--danger); border-color:#f3aaaa; }
.btn:hover{ filter:brightness(0.98); }

.inline-create-input{
  width:100%;
  height:44px;
  padding:10px 12px;
  border:1px solid var(--border, #e5e7eb);
  border-radius:10px;
  background:#fff;
  color:#111827;
  margin-top:8px;
  box-sizing:border-box;
}

canvas.signature{
  background:#fff;
  border:2px dashed #c7ccd6;
  border-radius:12px;
  min-height:220px;
  width:100%;
  display:block;
}

.actions-center{
  display:flex;
  gap:.5rem;
  justify-content:center;
  align-items:center;
  margin:10px 0 6px 0;
}

.block-after{ margin-top:10px; }

/* --- Titoli coerenti globali --- */
h1 {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
h2 {
  font-weight: 600;
  color: var(--text);
}

/* === Pagine gestione (utenti, persone, aziende) ========================= */
.page-admin {
  max-width: 1200px;
  margin: 28px auto;
  padding: 0 16px;
}

/* Box principale delle sezioni */
.page-admin .box {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-soft);
}

/* Titoli sezione */
.page-admin h2 {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.25rem;
  margin-bottom: 10px;
  color: var(--text);
}

/* Tabelle e contenuti */
.page-admin table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.page-admin th, .page-admin td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.page-admin tr:nth-child(even) { background: var(--panel); }

/* Messaggi */
.msg.ok {
  background: rgba(34,197,94,.1);
  border: 1px solid rgba(34,197,94,.3);
  color: #166534;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 12px 0;
}
.msg.err {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  color: #991b1b;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 12px 0;
}

/* Pulsanti coerenti */
.page-admin .btn {
  font-weight: 600;
  padding: .45rem .8rem;
}

/* Tabelle più leggibili su mobile */
@media (max-width: 800px) {
  .page-admin table { font-size: 14px; }
  .page-admin th, .page-admin td { padding: 6px 8px; }
}

/* === Miglioramento estetico box sezioni e tabelle ====================== */

/* Arrotonda e separa meglio i box */
.page-admin .box {
  border-radius: 18px;
  overflow: hidden; /* evita che le tabelle dentro sporgano */
  background: var(--panel-soft);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

/* Tabelle dentro box con bordi coerenti */
.page-admin table {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 12px;
  overflow: hidden;
}

.page-admin thead th:first-child {
  border-top-left-radius: 12px;
}
.page-admin thead th:last-child {
  border-top-right-radius: 12px;
}
.page-admin tbody tr:last-child td:first-child {
  border-bottom-left-radius: 12px;
}
.page-admin tbody tr:last-child td:last-child {
  border-bottom-right-radius: 12px;
}

/* Colore alternato più delicato */
.page-admin tr:nth-child(even) {
  background: #f9fafb;
}

/* Leggera ombra sotto ogni box per separarlo */
.page-admin .box + .box {
  margin-top: 28px;
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
}

/* === Migliorie estetiche input e box ===================================== */

/* Input coerenti con stile dei pulsanti */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  border-radius: 10px !important;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* Input numerici con freccette visibili */
input[type="number"] {
  width: 80px;
  text-align: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
}

/* Effetto focus più gradevole */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* Tabelle dentro box con bordi morbidi */
.page-admin table {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 14px;
  overflow: hidden;
}

.page-admin thead th:first-child {
  border-top-left-radius: 14px;
}
.page-admin thead th:last-child {
  border-top-right-radius: 14px;
}
.page-admin tbody tr:last-child td:first-child {
  border-bottom-left-radius: 14px;
}
.page-admin tbody tr:last-child td:last-child {
  border-bottom-right-radius: 14px;
}

/* Rimuove l’effetto “rettangolo grigio squadrato” */
.page-admin tr {
  background: #fff;
}
.page-admin tr:nth-child(even) {
  background: #f9fafb;
}

/* Leggera ombra sotto i box principali */
.page-admin .box {
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
}

/* === File input a tema uniforme ========================================= */
.file-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-input {
  position: absolute;
  left: -9999px; /* nasconde l’input nativo */
}

.file-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: background .15s;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
}

.file-label:hover {
  background: var(--primary-600);
}

.file-name {
  font-size: 14px;
  color: var(--muted);
}


/* === File input a tema coerente (light + dark) ========================== */
.file-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-input {
  position: absolute;
  left: -9999px; /* nasconde l’input nativo */
}

.file-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  transition: background .15s, transform .1s;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
}

.file-label:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
}

.file-name {
  font-size: 14px;
  color: var(--muted);
}

/* 🌓 Variante dark-mode */
@media (prefers-color-scheme: dark) {
  .file-label {
    background: var(--primary);
    color: #0a0f18;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
  }
  .file-label:hover {
    background: var(--primary-600);
  }
  .file-name {
    color: var(--text);
    opacity: .85;
  }
}

/* --- Input data con icona calendario stabile (Chrome fix definitivo) --- */
input[type="date"],
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 36px 8px 12px; /* spazio riservato per l’icona */
  font-size: 14px;
  color: var(--text);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}

/* Focus coerente */
input[type="date"]:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
  outline: none;
}

/* Icona calendario sempre visibile */
input[type="date"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%2364748b' viewBox='0 0 24 24'%3E%3Cpath d='M7 2a1 1 0 0 1 1 1v1h8V3a1 1 0 1 1 2 0v1h1a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1V3a1 1 0 0 1 1-1zm12 9H5v9a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-9zM5 7h14V6a1 1 0 0 0-1-1h-1v1a1 1 0 0 1-2 0V5H8v1a1 1 0 1 1-2 0V5H5a1 1 0 0 0-1 1v1z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  cursor: pointer;
}


/* Indicatore nativo invisibile ma SEMPRE cliccabile (Chrome fix 2025) */
input[type="date"] {
  position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: opacity(0); /* visivamente invisibile ma resta cliccabile */
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 36px;
  height: 100%;
  cursor: pointer;
  z-index: 2; /* sopra l’icona di sfondo */
}


/* Nasconde pulsanti interni non necessari */
input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-clear-button {
  display: none;
}

/* Compatibilità Firefox */
input[type="date"]::-moz-focus-inner { border: 0; }
input[type="date"]::-moz-focusring { color: transparent; text-shadow: 0 0 0 #000; }


.grid-flex {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 32px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  flex: 1 1 420px;
  max-width: 440px;
  box-shadow: 0 8px 30px rgba(2, 6, 23, .08);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 35px rgba(2, 6, 23, .12);
}

.card .title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.card .big {
  font-size: 56px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}

.card .underlink {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.card .underlink a {
  color: var(--primary);
  text-decoration: none;
}
.card .underlink a:hover {
  text-decoration: underline;
}

.card .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  font-size: 15px;
  transition: background .2s, transform .1s;
  margin-top: 14px;
}
.card .btn:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
}

/* === Allineamento titolo e sottotitolo Dashboard ======================== */
body.dashboard {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Titolo e sottotitolo centrati rispetto alla griglia */
body.dashboard h1,
body.dashboard h2 {
  text-align: center;
  width: 100%;
  max-width: 1000px; /* allinea con la griglia */
  margin-left: auto;
  margin-right: auto;
}

body.dashboard h1 {
  margin-top: 48px;
  margin-bottom: 8px;
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

body.dashboard h2 {
  margin-top: 0;
  margin-bottom: 48px;
  font-size: 16px;
  color: #475569;
  font-weight: 500;
  line-height: 1.5;
}

/* Card invariata ma reattiva */
body.dashboard .card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 8px 30px rgba(2,6,23,.08);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform .15s ease, box-shadow .15s ease;
}

body.dashboard .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 35px rgba(2,6,23,.12);
}

/* Evita che il body flex interferisca con altre pagine */
body:not(.dashboard) {
  display: block;
}

/* === Fix definitivo allineamento dashboard (Informatica95) =============== */
body.dashboard .grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)) !important;
  justify-content: center !important;
  align-items: stretch !important;
  gap: 32px !important;
  max-width: 1000px !important;
  margin: 0 auto !important;
  padding: 0 16px !important;
}

/* Stessa larghezza e padding per h1, h2 e griglia della dashboard */
body.dashboard > h1,
body.dashboard > h2,
body.dashboard > .grid{
  box-sizing: border-box;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px;
}

/* === LOGIN PAGE STYLING ==================================== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #f6f7fb;
  color: #0f172a;
  padding: 24px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.login-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(2,6,23,.08);
  width: 100%;
  max-width: 420px;
  padding: 28px;
  text-align: center;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.login-brand img {
  height: 42px;
}

.login-brand h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 700;
}

.login-title {
  font-size: 22px;
  margin: 10px 0 24px 0;
  font-weight: 800;
}

.login-input {
  height: 44px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  width: 100%;
  box-sizing: border-box;
}

.login-btn {
  height: 44px;
  border-radius: 10px;
  border: 0;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
  font-size: 15px;
  width: 100%;
  background: #2563eb;
  color: #fff;
  transition: background 0.2s ease-in-out;
}

.login-btn:hover {
  background: #1d4ed8;
}

.login-err {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 16px;
  font-size: 14px;
}

.login-muted {
  color: #64748b;
  font-size: 13px;
  margin-top: 14px;
  text-align: center;
}

.login-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: #64748b;
}
/* Chiavi già consegnate */
option.disabled-key {
  color: #9ca3af;
  background-color: #1f2937;
  cursor: not-allowed;
}

/* Cella azioni: NON usare la classe .actions perché è flex globale */
.page-admin .box table td.cell-actions { 
  display:table-cell !important; 
  white-space:nowrap; 
}
.page-admin .box table td.cell-actions form { 
  display:inline-block; 
  margin:0 .5rem 0 0; 
}
/* Ogni riga ha il suo contenitore di azioni */
.page-admin .box table td.cell-actions .row-actions{
  display: inline-block;         /* resta nella cella */
  white-space: nowrap;           /* i pulsanti restano in linea */
}

/* I singoli form dentro la cella non devono “scappare” */
.page-admin .box table td.cell-actions .action{
  display: inline-block !important;
  margin: 0 .5rem 0 0;
  position: static !important;   /* neutralizza eventuali regole strane */
}
/* === SAFE OVERRIDES per tabelle amministrative ============================
   Impediscono che regole generiche (es. .actions { display:flex }) rompano
   il layout nelle pagine come chiavi-in-uso.
--------------------------------------------------------------------------- */

/* Forza semantica tabellare nell'area admin */
.page-admin table            { display: table; width: 100%; border-collapse: separate; border-spacing: 0; }
.page-admin thead            { display: table-header-group; }
.page-admin tbody            { display: table-row-group; }
.page-admin tr               { display: table-row; }
.page-admin th,
.page-admin td               { display: table-cell; vertical-align: middle; }

/* Se per errore una <td> avesse class="actions", NON farla diventare flex */
.page-admin table td.actions { display: table-cell !important; }

/* Colonna azioni: pulsanti in linea, uno per riga */
.page-admin table td.cell-actions {
  white-space: nowrap;
}
.page-admin table td.cell-actions form {
  display: inline-block;
  margin: 0 .5rem 0 0;
}
.page-admin table td.cell-actions .btn {
  display: inline-block;
  vertical-align: middle;
}

/* Limita il flex di .actions alla sola area form (evita effetti collaterali) */
.form .actions,
form .actions,
.form-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0 6px 0;
}
/* ==== FIX Log Notifiche – hover scuro & impaginazione ==== */
.logview .panel { background: var(--panel-soft); }
.logview .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Righe tabella: niente overlay scuri al passaggio mouse */
.logview table tr:hover,
.logview .table tr:hover,
.page-admin.logview table tr:hover {
  background-color: rgba(255,255,255,.06) !important;
}

/* Celle trasparenti, testo leggibile */
.logview table td,
.logview table th {
  background: transparent !important;
  color: var(--text);
}

/* Evita “righe che si allargano” con JSON lungo: va a capo ma resta leggibile */
.logview pre,
.logview code,
.logview .json {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .9rem;
  line-height: 1.3;
}

/* Tabelle compatte, separazione chiara */
.logview table { width: 100%; border-collapse: separate; border-spacing: 0; }
.logview th, .logview td { padding: .55rem .75rem; border-bottom: 1px solid var(--border); }
.logview thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }

/* Bottoni filtro sempre visibili su sfondo scuro */
.logview .btn { background: #1f2937; border: 1px solid var(--border); }
.logview .btn:hover { filter: brightness(1.1); }
