@charset "utf-8";
/*
 * tema.css - veste grafica moderna, caricata DOPO stile.css / stile-rom.css.
 * Per cambiare colori e dimensioni basta modificare le variabili qui sotto.
 */
:root {
  --nav-h: 56px;
  --fs: 14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg: #ffffff;   /* sfondo pagina (era #f1f4f9) */
  --surface: #ffffff;
  --surface-2: #eaf0f8;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #1f5fbf;
  --primary-d: #163f80;
  --nav-from: #1a365c;   /* blu Dracma Service (logo) */
  --nav-to: #1f4170;
  --brand-azzurro: #3691cf;
  --border: #d5deea;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 18px rgba(15, 23, 42, .07);
  --max-w: 1800px;
}

/* ---------- base ---------- */
html { scroll-padding-top: var(--nav-h); }
body {
  font-family: var(--font);
  font-size: var(--fs);
  color: var(--text);
  background: var(--bg);
  margin: 0;
  padding-top: var(--nav-h);
  -webkit-text-size-adjust: 100%;
}
td, th, p, li, label, .form, .testo, .testoBlu, .testoFFF, .menu {
  font-family: var(--font);
  font-size: var(--fs);
}
.testo, .testo a, .testoBlu, .testoBlu a, .form { color: var(--text); }
a { color: var(--primary); }
a:hover, .testo a:hover, .testoBlu a:hover { color: var(--primary-d); text-decoration: underline; }
.testo a, .testo a:hover, .testoBlu a, .testoBlu a:hover { font-size: var(--fs); }
img { max-width: 100%; }

/* icone delle liste (img/icone/*.svg): sempre 24x24, senza essere schiacciate dalle colonne strette */
img[src^="img/icone/"] {
  width: 24px !important; height: 24px !important; max-width: none !important; min-width: 24px;
  vertical-align: middle; transition: transform .15s;
}
a:hover > img[src^="img/icone/"] { transform: scale(1.15); }
td:has(> a > img[src^="img/icone/"]), td:has(> img[src^="img/icone/"]) {
  white-space: nowrap; text-align: center; min-width: 34px;
}

/* ---------- vecchi elementi sostituiti dalla nuova barra ---------- */
tr:has(> td[background="img/top.jpg"]) { display: none !important; }   /* vecchia testata blu */
table.menu { display: none; }                                  /* vecchio menu a colonne in fondo */
td[background="img/top.jpg"], td[background="img/footer.jpg"] { background: none !important; }
td[background="img/footer.jpg"] { height: auto !important; padding: 18px 0; color: var(--muted); }
td[height="140"] { height: auto !important; }

/* ---------- footer "Dracma Service S.r.l. - Database Interventi" sempre in fondo, anche nelle pagine corte ---------- */
body { position: relative; min-height: 100vh; box-sizing: border-box; padding-bottom: 64px; }
tr:has(> td[background="img/footer.jpg"]), .piede-app {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
}
tr:has(> td[background="img/footer.jpg"]) > td { display: block; }
tr:has(> td[background="img/footer.jpg"]) > td:not(.testo) { display: none; }
td[background="img/footer.jpg"].testo { width: 100% !important; max-width: var(--max-w); padding: 20px 0 !important; text-align: center; font-size: 12px; }
td[background="img/footer.jpg"] br { display: none; }
.piede-app { padding: 20px 0; text-align: center; color: var(--muted); font-size: 12px; }
body:has(.piede-pubblico) { padding-bottom: 0; }

/* ---------- layout fluido (era a larghezza fissa 1100px) ---------- */
body > table[width="100%"] { max-width: var(--max-w); margin: 0 auto; }
table[width="1100"], td[width="1100"] { width: 100% !important; max-width: 100%; }
td[width="1100"] { padding: 12px 28px 28px !important; }

/* titolo della pagina (primo grassetto isolato in un paragrafo) */
td[width="1100"] > p > strong:only-child {
  font-size: 19px; font-weight: 700; color: var(--primary-d);
}

/* ---------- tabelle ---------- */
table[cellspacing="3"] { border-spacing: 0 4px; }
td[bgcolor="#eeeeee" i], td[bgcolor="#EEEEEE"] { background: var(--surface-2); padding: 8px 10px; }
td[bgcolor="#f7f7f7" i] { background: #f8fafc; padding: 8px 10px; }
td[bgcolor="#ebebeb" i], td[bgcolor="#eaeaea" i], td[bgcolor="#dfdfdf" i] { background: #e3eaf4; padding: 8px 10px; }
td[bgcolor="#ffffff" i] { background: var(--surface); }
td[bgcolor="#d6d6d6" i], td[bgcolor="#cccccc" i], td[bgcolor="#9c9c9c" i] { background: #c9d5e6; padding: 8px 10px; }
td[bgcolor] { border-radius: 6px; padding: 8px 10px; }
tr[bgcolor] > td { padding: 8px 10px; }
tr[bgcolor] > td:first-child { border-radius: 6px 0 0 6px; }
tr[bgcolor] > td:last-child { border-radius: 0 6px 6px 0; }
table.testoBlu tr:hover > td[bgcolor="#eeeeee" i] { background: #dfe9f6; }

/* ---------- campi e pulsanti ---------- */
input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="email"], input[type="tel"], input[type="search"], input[type="time"],
input:not([type]), select, textarea {
  font-family: var(--font); font-size: var(--fs); color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px; max-width: 100%; box-sizing: border-box;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(31, 95, 191, .35); outline-offset: 0; border-color: var(--primary);
}
input[type="submit"], input[type="button"], input[type="reset"], button {
  font-family: var(--font); font-size: var(--fs); font-weight: 600; cursor: pointer;
  color: #fff; background: var(--primary); border: 0; border-radius: 6px; padding: 8px 16px;
}
input[type="submit"]:hover, input[type="button"]:hover, input[type="reset"]:hover, button:hover { background: var(--primary-d); }
.btn, .btn:hover {
  background: var(--surface) !important; color: var(--text) !important;
  border: 1px solid var(--border) !important; border-radius: 6px; padding: 8px 14px !important; line-height: 1.2;
}
.btn:hover { background: var(--surface-2) !important; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }

/* ---------- barra di navigazione ---------- */
.appnav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 1000;
  background: linear-gradient(90deg, var(--nav-from), var(--nav-to));
  color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
  border-bottom: 3px solid var(--brand-azzurro);
  font-family: var(--font); font-size: var(--fs);
}
.appnav, .appnav * { box-sizing: border-box; }
.appnav a { text-decoration: none; }
.appnav-in {
  height: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 8px;
}
.appnav .brand {
  display: flex; align-items: center; flex-shrink: 0; white-space: nowrap;
  padding-right: 14px; margin-right: 4px; border-right: 1px solid rgba(255, 255, 255, .28);
}
.appnav .brand img { display: block; height: 32px; width: auto; max-width: none; }
/* pagine senza menu (accesso, richiesta credenziali): logo al centro, senza la linea accanto */
.appnav .brand:last-child { border-right: 0; margin: 0; padding: 0; }
.appnav-in:has(> .brand:last-child) { justify-content: center; }
.piede-pubblico { text-align: center; color: var(--muted); font-size: 12px; margin: 40px 0 0; }
.nav-links { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; }
.nav-links > li { position: relative; }
.nav-links > li > a, .nav-links > li > button {
  display: block; padding: 9px 12px; border-radius: 6px; color: #fff; background: none;
  border: 0; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.nav-links > li > a:hover, .nav-links > li > button:hover,
.nav-links > li.dd:hover > button, .nav-links > li.dd.open > button { background: rgba(255, 255, 255, .16); color: #fff; }
.nav-links > li.is-active > a, .nav-links > li.is-active > button { background: rgba(255, 255, 255, .16); box-shadow: inset 0 -3px 0 var(--brand-azzurro); }
.caret {
  display: inline-block; width: 0; height: 0; margin-left: 4px; vertical-align: middle;
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: .85;
}
.dd-menu {
  display: none; position: absolute; top: 100%; left: 0; min-width: 240px; list-style: none;
  margin: 0; padding: 6px; background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .25); border: 1px solid var(--border);
}
.nav-links > li.dd:hover > .dd-menu, .nav-links > li.dd:focus-within > .dd-menu, .nav-links > li.dd.open > .dd-menu { display: block; }
.dd-menu a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--text); white-space: nowrap; }
.dd-menu a:hover { background: var(--surface-2); color: var(--primary-d); text-decoration: none; }
.dd-menu a.cur { background: var(--surface-2); color: var(--primary-d); font-weight: 700; }
.dd-menu .sep { height: 1px; background: var(--border); margin: 6px 4px; }
.nav-user { display: flex; align-items: center; gap: 12px; margin-left: auto; white-space: nowrap; }
.nav-user .who { color: #fff; text-align: right; line-height: 1.15; }
.nav-user .who strong { display: block; font-size: 13px; }
.nav-user .who small { opacity: .75; font-size: 11px; }
.nav-user .logout {
  color: #fff; padding: 7px 14px; border: 1px solid rgba(255, 255, 255, .5); border-radius: 6px; font-weight: 600;
}
.nav-user .logout:hover { background: rgba(255, 255, 255, .18); }
.nav-toggle { display: none; }

/* ---------- schermi medi (portatili): barra piu' compatta ---------- */
@media (max-width: 1560px) {
  .appnav-in { gap: 4px; padding: 0 10px; }
  .appnav .brand { padding-right: 10px; }
  .appnav .brand img { height: 28px; }
  .nav-links > li > a, .nav-links > li > button { padding: 9px 8px; font-size: 13px; }
  .nav-user { gap: 8px; }
  .nav-user .who small { display: none; }
  .nav-user .logout { padding: 6px 10px; }
}

/* ---------- schermi stretti: menu a pannello ---------- */
@media (max-width: 1280px) {
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 40px; height: 40px; padding: 0 9px; background: rgba(255, 255, 255, .14); border-radius: 6px; order: 3;
  }
  .nav-toggle:hover { background: rgba(255, 255, 255, .24); }
  .nav-toggle span { display: block; width: 100%; height: 2px; background: #fff; border-radius: 2px; }
  .nav-user { margin-left: auto; order: 2; }
  .nav-user .who small { display: none; }
  .nav-links {
    display: none; position: fixed; top: var(--nav-h); left: 0; right: 0; bottom: 0; overflow-y: auto;
    flex-direction: column; align-items: stretch; gap: 0; padding: 10px; background: var(--nav-from);
  }
  .appnav.open .nav-links { display: flex; }
  .nav-links > li > a, .nav-links > li > button { width: 100%; text-align: left; padding: 13px 14px; font-size: 15px; }
  .nav-links > li.dd:hover > .dd-menu, .nav-links > li.dd:focus-within > .dd-menu { display: none; }
  .nav-links > li.dd.open > .dd-menu {
    display: block; position: static; min-width: 0; margin: 0 0 6px 10px; box-shadow: none;
    background: rgba(255, 255, 255, .08); border: 0;
  }
  .dd-menu a { color: #fff; padding: 11px 12px; }
  .dd-menu a:hover, .dd-menu a.cur { background: rgba(255, 255, 255, .16); color: #fff; }
  .dd-menu .sep { background: rgba(255, 255, 255, .2); }
}
@media (max-width: 900px) {
  td[width="1100"] { padding: 10px 12px 20px !important; }
  body > table[width="100%"], body > table[width="100%"] > tbody,
  body > table[width="100%"] > tbody > tr, body > table[width="100%"] > tbody > tr > td {
    display: block; width: 100% !important; box-sizing: border-box;
  }
  body > table[width="100%"] > tbody > tr > td { overflow-x: auto; }
}
@media (max-width: 480px) {
  .appnav .brand { border-right: 0; padding-right: 0; }
  .appnav .brand img { height: 24px; }
  .nav-user .who { display: none; }
}

/* ---------- stampa ---------- */
@media print {
  .appnav { display: none !important; }
  body { padding-top: 0; background: #fff; }
  body { min-height: 0; padding-bottom: 0; }
  tr:has(> td[background="img/footer.jpg"]), .piede-app { position: static; }
}

/* ---------- telefonate aperte dai clienti dall'area riservata (interlocutore_html() in common.inc.php) ---------- */
.chiamata-cliente {
  display: inline-block; margin: 2px 0; padding: 1px 8px; border-radius: 99px;
  background: #b45309; color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap;
}

/* ---------- scelta del cliente (cerca_cliente.inc.php): tendina + ricerca per nome, come in Anagrafica ---------- */
.cc-card { background: var(--surface, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: var(--radius, 10px);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06); padding: 18px 20px; margin: 0 0 16px; text-align: left; }
.cc-card h2 { font-size: 16px; margin: 0 0 12px; color: var(--primary-d, #1a365c); }
.cc-cerca { display: flex; flex-wrap: wrap; gap: 16px 40px; }
.cc-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; flex: 1 1 320px; margin: 0; }
.cc-form label { flex-basis: 100%; font-weight: 600; }
.cc-form select, .cc-form input[type=text] { flex: 1; min-width: 0; }
.cc-risultati { list-style: none; margin: 0; padding: 0; columns: 2 320px; column-gap: 32px; }
.cc-risultati li { break-inside: avoid; padding: 6px 0; border-bottom: 1px solid var(--border, #e2e8f0); }
.cc-nota { display: block; color: var(--muted, #64748b); font-size: 12px; }
.cc-err { background: #fdecec; border: 1px solid #f0aaaa; color: #7f1d1d; border-radius: 6px; padding: 10px 14px; margin: 0 0 16px; }

/* ---------- avviso "salvato" dopo un salvataggio (menu.php) ---------- */
.avviso-salvato { position: fixed; top: calc(var(--nav-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 50;
  background: #ecfdf3; border: 1px solid #a7e3bd; color: #14532d; border-radius: 8px; padding: 10px 18px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .12); transition: opacity .5s, transform .5s; }
.avviso-salvato.via { opacity: 0; transform: translate(-50%, -8px); pointer-events: none; }
@media print { .avviso-salvato { display: none; } }

/* ---------- campo Cerca delle liste (ricerca.inc.php) ---------- */
.ric-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 16px; }   /* a tutta larghezza */
.ric-box input[type=search] { flex: 1 1 320px; min-width: 0; padding: 8px 12px; }
mark { background: #fde68a; color: inherit; padding: 0 1px; border-radius: 2px; }
.avviso-salvato.avviso-errore { background: #fdecec; border-color: #f0aaaa; color: #991b1b; }
