/* ============================================================
   gestionale-bossola — stylesheet principale
   Palette: sfondo #F6EEDB | primario #889C82 | accent #E1AD37 | testo #252525
   Mobile-first
   ============================================================ */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #F6EEDB;
    --primary:   #889C82;
    --primary-d: #6e7f68;
    --primary-a: #4a6245;
    --accent:    #E1AD37;
    --accent-d:  #c49520;
    --text:      #252525;
    --text-muted:#5c5c5c;
    --white:     #ffffff;
    --border:    #d4c9af;
    --error:     #c0392b;
    --success:   #27ae60;
    --radius:    8px;
    --shadow:    0 2px 12px rgba(37,37,37,.10);
    --transition:.2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
main { padding-bottom: 2rem; }

a { color: var(--primary-a); text-decoration: none; }
a:hover { color: #3d5239; text-decoration: underline; }

img, svg { max-width: 100%; display: block; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); }
h3 { font-size: 1.2rem; }

/* ---------- Layout utils ---------- */
.container {
    width: 100%;
    max-width: 1140px;
    margin-inline: auto;
    padding-inline: 1rem;
}

.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.card-warning {
    background: #fff8e1;
    border: 1px solid #E1AD37;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.mb-2 { margin-bottom: 1.5rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .65rem 1.4rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    text-decoration: none;
}
.btn:active { transform: scale(.97); }

.btn-primary   { background: var(--primary-a); color: var(--white); }
.btn-primary:hover { background: #3d5239; color: var(--white); text-decoration: none; }

.btn-accent    { background: var(--accent); color: var(--text); }
.btn-accent:hover { background: var(--accent-d); text-decoration: none; }

.btn-secondary { background: #e8e0d0; color: #252525; border: none; border-radius: 8px; cursor: pointer; }
.btn-secondary:hover { background: #d9cfc0; text-decoration: none; color: #252525; }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--primary-a);
    color: var(--primary-a);
    border-radius: var(--radius);
    cursor: pointer;
    padding: 0.4rem 0.9rem;
}
.btn-outline:hover { background: var(--primary-a); color: var(--white); text-decoration: none; }

.btn-warning { background: #E1AD37; color: var(--text); border: none; border-radius: 5px; cursor: pointer; }
.btn-warning:hover { background: #CDA434; color: var(--text); text-decoration: none; }
.btn-success { background: var(--primary-a); color: #fff; border: none; border-radius: 5px; cursor: pointer; }
.btn-success:hover { background: #3d5239; text-decoration: none; }
.btn-danger  { background: #c0392b; color: #fff; border: none; border-radius: 5px; cursor: pointer; }
.btn-danger:hover  { background: #a93226; text-decoration: none; }

.btn-full { width: 100%; }
.btn-sm   { padding: 0.25rem 0.6rem; font-size: 0.8rem; min-height: 36px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.2rem; }

label {
    display: block;
    font-weight: 600;
    margin-bottom: .35rem;
    font-size: .95rem;
}

.form-control {
    width: 100%;
    padding: .65rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--white);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
    box-sizing: border-box;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(225, 173, 55, 0.35);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control-time { max-width: 100px; }

.form-row    { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 120px; }

.form-check  { display: flex; align-items: center; gap: 0.5rem; }
.form-check input { width: 1rem; height: 1rem; accent-color: #889C82; cursor: pointer; }

.form-actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }

.label-hint { font-size: 0.78rem; color: var(--text-muted); font-weight: 400; }

.card-form { max-width: 560px; }

/* ---------- Alerts ---------- */
.alert {
    padding: .8rem 1rem;
    border-radius: var(--radius);
    font-size: .95rem;
    margin-bottom: 1rem;
    border-left: 4px solid transparent;
}
.alert-error   { background: #fdecea; border-color: var(--error);   color: var(--error);   }
.alert-success { background: #eafaf1; border-color: var(--success);  color: #155724; }
.alert-info    { background: #eef4fd; border-color: #3498db;         color: #2471a3;        }

/* ---------- Rotate hint ---------- */
.rotate-hint {
    display: none;
    background: var(--accent);
    color: var(--text);
    font-size: .85rem;
    font-weight: 600;
    padding: .55rem 1rem;
    border-radius: var(--radius);
    margin-bottom: .75rem;
    text-align: center;
}
@media (max-width: 600px) and (orientation: portrait) {
    .rotate-hint { display: block; }
}

/* ---------- Navbar ---------- */
.navbar {
    background: var(--primary-a);
    color: var(--white);
    padding: .75rem 0;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.navbar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    letter-spacing: .02em;
    display: flex;
    align-items: center;
    gap: 14px;
}
.navbar-brand span.navbar-title { font-size: 1.15rem; font-weight: 700; color: #F6EEDB; letter-spacing: .03em; white-space: nowrap; }
.navbar-nav { display: flex; gap: .5rem; align-items: center; list-style: none; margin: 0; }
.navbar-nav a { color: #ffffff; font-size: .95rem; padding: .3rem .6rem; border-radius: 4px; white-space: nowrap; }
.navbar-nav a:hover { color: var(--white); background: rgba(255,255,255,.12); text-decoration: none; }
.nav-active { font-weight: 700; background: rgba(0,0,0,.22); }

.navbar-toggle {
    display: none;
    background: none;
    border: 1.5px solid rgba(255,255,255,.5);
    color: var(--white);
    font-size: 1.3rem;
    line-height: 1;
    padding: .3rem .6rem;
    border-radius: 5px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ---------- Page header ---------- */
.page-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.page-header h1 { font-size: 1.4rem; margin: 0; }
.page-header .text-muted { display: block; margin-bottom: 0.2rem; }

/* ---------- Section title ---------- */
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

/* ---------- Dashboard stats ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}
.stat-icon {
    width: 46px; height: 46px;
    border-radius: 10px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }

/* ---------- Tables ---------- */
.table-wrap       { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: -1.5rem; padding: 0 1.5rem 1.5rem; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; min-width: 600px; border-collapse: collapse; font-size: 0.92rem; }
.table thead tr { background: var(--primary-a); color: #fff; }
.table thead th { padding: 0.6rem 0.75rem; text-align: left; font-weight: 600; }
.table tbody tr { border-bottom: 1px solid #e8e0d0; }
.table tbody tr:last-child { border-bottom: none; }
.table tbody td { padding: 0.6rem 0.75rem; vertical-align: middle; }
.table tbody tr:hover { background: #faf6ec; }
.row-inattiva td { opacity: 0.55; }

.td-azioni { white-space: nowrap; }
.td-azioni .btn + .btn,
.td-azioni form + form,
.td-azioni form + .btn { margin-left: 0.3rem; }

/* ---------- Table details (sessione) ---------- */
.table-details th {
    width: 130px;
    font-weight: 600;
    color: var(--text-muted);
    padding: .6rem .75rem;
    vertical-align: top;
}
.table-details td { padding: .6rem .75rem; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 4px;
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
}
.badge-green      { background: #eafaf1; color: #155724; }
.badge-red        { background: #fdecea; color: var(--error);   }
.badge-yellow     { background: #fef9e7; color: #b7950b;        }
.badge-blue       { background: #eaf4fd; color: #2471a3;        }
.badge-gray       { background: #f0f0f0; color: #666;           }
.badge-tipo-spa      { background: #dce8da; color: #4a6045; }
.badge-tipo-suite_spa{ background: #f5e8c0; color: #7a5c00; }
.badge-tipo-chalet   { background: #f0e5d8; color: #765D56; }
.badge-attiva     { background: #d4edda; color: #276b3d; }
.badge-inattiva   { background: #f2e4e4; color: #9a3333; }
.badge-base       { background: #e8e8e8; color: #555; }
.badge-doppio     { background: #fff0cc; color: #7a5a00; }

/* ---------- Login page ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 2rem 1rem;
}
.login-box { width: 100%; max-width: 420px; }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .logo-icon {
    width: 64px; height: 64px;
    background: var(--primary);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .75rem;
}
.login-logo .logo-icon svg { width: 34px; height: 34px; fill: var(--white); }
.login-logo h1 { font-size: 1.5rem; color: var(--text); }
.login-logo p  { color: var(--text-muted); font-size: .9rem; margin-top: .25rem; }
.login-card { padding: 2rem; }
.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-left: 2.6rem; }
.input-icon-wrap .input-icon {
    position: absolute; left: .8rem; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none;
}
.login-footer { text-align: center; margin-top: 1.5rem; font-size: .85rem; color: var(--text-muted); }

/* ---------- Utilities ---------- */
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.small       { font-size: 0.82rem; }

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
    .card       { padding: 2rem; }
    .login-card { padding: 2.5rem; }
}

@media (max-width: 1024px) {
    .navbar-brand img { max-width: 120px; height: auto; }
    .navbar-toggle { display: flex; align-items: center; }
    .navbar-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #3d5239;
        padding: .5rem 0;
        box-shadow: 0 4px 12px rgba(0,0,0,.2);
        z-index: 99;
    }
    .navbar-nav.navbar-menu-open { display: flex; }
    .navbar-nav li { width: 100%; }
    .navbar-nav a {
        display: block;
        padding: .65rem 1.25rem;
        border-radius: 0;
        font-size: 1rem;
    }
    .navbar { position: sticky; top: 0; z-index: 100; }
    .navbar .container { position: relative; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
    .page-header  { flex-direction: column; }
    .td-azioni .btn  { display: block; margin: 0.2rem 0; }
    .td-azioni form  { display: block; margin: 0.2rem 0; }
}

/* WCAG — Skip link */
.skip-link { position:absolute; top:-100%; left:1rem; z-index:9999; background:var(--accent); color:var(--text); padding:.6rem 1.2rem; border-radius:0 0 var(--radius) var(--radius); font-weight:700; font-size:.95rem; text-decoration:none; transition:top .15s; }
.skip-link:focus { top:0; outline:3px solid var(--text); outline-offset:2px; }

/* WCAG — Screen reader only */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* WCAG — Focus visibile */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline:3px solid var(--accent); outline-offset:2px; border-radius:3px; }
.form-control:focus-visible { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px #E1AD37; }
.navbar-nav a:focus-visible { outline:2px solid var(--accent); outline-offset:2px; background:rgba(255,255,255,.15); color:#fff; text-decoration:none; }

/* WCAG — aria-current page in navbar */
.navbar-nav a[aria-current="page"] { font-weight:700; color:#fff; background:rgba(0,0,0,.22); }

/* WCAG — form-control invalid */
.form-control[aria-invalid="true"] { border-color:var(--error); box-shadow:0 0 0 3px rgba(192,57,43,.2); }

/* ---------- Subnav Anagrafiche ---------- */
.subnav-ana {
    background: var(--white);
    border-bottom: 2px solid var(--border);
    padding: .5rem 0;
    margin-bottom: 1.5rem;
}
.subnav-ana__list {
    display: flex;
    gap: .25rem;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}
.subnav-ana a {
    display: inline-block;
    padding: .4rem .9rem;
    border-radius: var(--radius);
    font-size: .95rem;
    font-weight: 600;
    color: var(--primary-a);
    text-decoration: none;
}
.subnav-ana a:hover {
    background: var(--bg);
    color: #3d5239;
    text-decoration: none;
}
.subnav-ana a[aria-current="page"] {
    background: var(--primary-a);
    color: var(--white);
}

/* ---------- Navbar shrink on scroll ---------- */
.navbar {
    transition: padding var(--transition), box-shadow var(--transition);
}
.navbar--shrunk {
    padding: .35rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,.22);
}
.navbar--shrunk .navbar-brand img {
    height: 36px !important;
    transition: height var(--transition);
}
.navbar--shrunk .navbar-brand span.navbar-title {
    font-size: 1rem;
}
/* Disabilita shrink nelle pagine con subnav */
.navbar--no-shrink.navbar--shrunk {
    padding: .75rem 0;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.navbar--no-shrink.navbar--shrunk .navbar-brand img {
    height: 52px !important;
}
/* Tooltip accessibile */
.tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-a);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  cursor: help;
  flex-shrink: 0;
  position: relative;
}
.tooltip-icon:focus { outline: 2px solid var(--primary-a); outline-offset: 2px; }
.tooltip-icon .tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: #252525;
  color: #fff;
  font-size: .78rem;
  font-weight: 400;
  line-height: 1.4;
  padding: .5rem .7rem;
  border-radius: 6px;
  width: 260px;
  pointer-events: none;
  z-index: 100;
  transition: opacity .15s;
  white-space: normal;
}
.tooltip-icon:hover .tooltip-text,
.tooltip-icon:focus .tooltip-text {
  visibility: visible;
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .tooltip-icon .tooltip-text { transition: none; }
}

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

/* ---------- Site footer ---------- */
.site-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--primary);
    margin-top: 3rem;
}
.site-footer a {
    color: var(--primary-a);
    text-decoration: underline;
}
.site-footer a:hover {
    color: var(--primary-dark);
}

/* ===================================================================
   UTILITY CLASSES — Sprint style-src v1.5.6
   Queste classi devono stare ALLA FINE del file per garantire
   che .d-none sovrascriva qualsiasi classe component precedente.
   =================================================================== */

/* ----- Display ----- */
.d-flex         { display: flex; }
.d-inline-block { display: inline-block; }
.d-inline       { display: inline; }
.d-block        { display: block; }
.d-grid         { display: grid; }
/* .d-none DEVE stare per ultima — vedi fine sezione */

/* ----- Flex ----- */
.flex-wrap      { flex-wrap: wrap; }
.flex-col       { flex-direction: column; }
.align-center   { align-items: center; }
.align-start    { align-items: flex-start; }
.align-end      { align-items: flex-end; }
.justify-between{ justify-content: space-between; }
.flex-1         { flex: 1; }
.flex-2         { flex: 2; }
.flex-shrink-0  { flex-shrink: 0; }
.align-self-end { align-self: flex-end; }

/* ----- Gap ----- */
.gap-xs  { gap: .25rem; }
.gap-sm  { gap: .5rem; }
.gap-md  { gap: .75rem; }
.gap-lg  { gap: 1rem; }
.gap-xl  { gap: 1.5rem; }

/* ----- Margin bottom (nota: .mb-2 = 1.5rem già definita) ----- */
.mb-0   { margin-bottom: 0; }
.mb-xs  { margin-bottom: .25rem; }
.mb-sm  { margin-bottom: .5rem; }
.mb-md  { margin-bottom: .75rem; }
.mb-lg  { margin-bottom: 1rem; }
.mb-2xl { margin-bottom: 2rem; }
.mb-3xl { margin-bottom: 2.5rem; }

/* ----- Margin top ----- */
.mt-0   { margin-top: 0; }
.mt-xs  { margin-top: .25rem; }
.mt-sm  { margin-top: .5rem; }
.mt-md  { margin-top: .75rem; }
.mt-lg  { margin-top: 1rem; }
.mt-xl  { margin-top: 1.5rem; }
.mt-2xl { margin-top: 2rem; }
.mt-3xl { margin-top: 2.5rem; }
.pt-2xl { padding-top: 2rem; }

/* ----- Margin left ----- */
.ml-xs   { margin-left: .25rem; }
.ml-sm   { margin-left: .35rem; }
.ml-md   { margin-left: .5rem; }
.ml-auto { margin-left: auto; }

/* ----- Margin ----- */
.m-0 { margin: 0; }

/* ----- Padding ----- */
.p-0 { padding: 0; }

/* ----- Font size ----- */
.fs-xs   { font-size: .75rem; }
.fs-sm   { font-size: .85rem; }
.fs-md   { font-size: .9rem; }
.fs-base { font-size: 1rem; }
.fs-lg   { font-size: 1.05rem; }
.fs-xl   { font-size: 1.1rem; }
.fs-2xl  { font-size: 1.3rem; }

/* ----- Font weight ----- */
.fw-normal { font-weight: 400; }
.fw-600    { font-weight: 600; }
.fw-700    { font-weight: 700; }

/* ----- Text ----- */
.text-right   { text-align: right; }
.text-nowrap  { white-space: nowrap; }
.text-italic  { font-style: italic; }
.text-error   { color: var(--error); }
.text-primary-a { color: var(--primary-a); }
.text-amber   { color: #7a5a00; }
.text-amber-mid { color: #c07000; }
.text-amber-dark { color: #5c4400; }
.cursor-pointer { cursor: pointer; }

/* ----- Width / max-width ----- */
.w-auto   { width: auto; }
.w-full   { width: 100%; }
.mw-140   { max-width: 140px; }
.mw-480   { max-width: 480px; }
.mw-600   { max-width: 600px; }
.mw-640   { max-width: 640px; }
.mw-680   { max-width: 680px; }
.mw-760   { max-width: 760px; }

/* ----- Card modifiers ----- */
.card-compact { padding: .75rem 1rem; }
.card-empty   { text-align: center; padding: 2rem; }
.card-notice  { background: #fff8e1; border-left: 4px solid #ffe082; }

/* ----- Error pages (404, 500) ----- */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.error-box  { text-align: center; max-width: 480px; padding: 2rem; }
.error-code { font-size: 5rem; font-weight: 700; line-height: 1; margin-bottom: .5rem; }
.error-code--404 { color: var(--text); }
.error-code--500 { color: var(--error); }
.error-msg  { font-size: 1.2rem; color: var(--text-muted); margin-bottom: 1.5rem; }

/* ----- Navbar ----- */
.navbar-logo-img { height: 52px; width: auto; }
.navbar-shrunk-logo { height: 36px !important; transition: height var(--transition); }

/* ----- Login / TOTP ----- */
.login-box-wide  { max-width: 480px; }
.login-logo-img  { max-width: 220px; margin-bottom: 1rem; }
.login-logo-img-sm { max-width: 180px; margin-bottom: 1rem; }
.totp-instruction-list { padding-left: 1.4rem; margin-bottom: 1.5rem; line-height: 2; }
.qr-code-img    { border: 8px solid #fff; border-radius: 8px; box-shadow: var(--shadow); }
.qr-figure      { text-align: center; margin-bottom: 1.5rem; }
.totp-secret-block {
    margin-top: .75rem;
    padding: .75rem;
    background: #f9f6ef;
    border-radius: 6px;
    font-family: monospace;
    font-size: .95rem;
    letter-spacing: .1em;
    text-align: center;
}
.otp-input-setup  { font-size: 1.4rem; letter-spacing: .25em; text-align: center; }
.otp-input-verify { font-size: 1.6rem; letter-spacing: .3em; text-align: center; }
.totp-actions   { text-align: center; }
.totp-link      { font-size: .85rem; color: var(--text-muted); }
.totp-verify-hint { margin-bottom: 1rem; }

/* ----- Password toggle button ----- */
.btn-password-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 .7rem;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1rem;
}
.btn-password-toggle:hover  { color: var(--text); }
.btn-password-toggle:focus-visible { outline: 2px solid var(--primary-a); outline-offset: 2px; }

/* ----- Dashboard ----- */
#dashboard-save-msg { font-size: .85rem; color: var(--primary-a); margin-top: .5rem; }
.alert-section { margin-bottom: 2rem; }
.alert-toggle  {
    width: 100%; background: none; border: none; cursor: pointer;
    display: flex; align-items: center; gap: .75rem; padding: 0; text-align: left;
}
.alert-chevron { margin-left: auto; font-size: 1.2rem; color: #7a5a00; transition: transform .2s; }
.alert-count-text { font-size: 1.1rem; color: #7a5a00; font-weight: 700; }
.alert-body-inner { margin-top: 1rem; }
.alert-buttons-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.alert-group-block { margin-bottom: 1.5rem; }
.alert-group-title {
    font-size: .95rem; color: #5c4400; margin-bottom: .5rem;
    font-weight: 600; padding: .3rem .6rem; background: #fff8e1; border-radius: 4px;
}
.alert-footer-note { margin-top: .5rem; font-size: .85rem; color: #7a5a00; }
.alert-footer-link { color: #7a5a00; font-weight: 600; text-decoration: underline; }
.alert-row-error   { color: var(--error); font-weight: 600; }
.alert-row-sub     { font-size: .75rem; color: var(--text-muted); font-weight: 400; }
.dashboard-quick-access { margin-top: 2rem; }
.dashboard-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.dashboard-card-title { margin-bottom: .75rem; color: var(--text-muted); }
.dashboard-card-desc  { font-size: .9rem; color: var(--text-muted); margin-bottom: 1rem; }
.dashboard-header-sub { color: var(--text-muted); font-size: .9rem; margin-top: .2rem; }

/* ----- Form helpers ----- */
.form-label-block  { display: block; font-weight: 600; margin-bottom: .25rem; }
.label-optional    { font-weight: 400; color: var(--text-muted); }
.form-section-title { margin: 1.5rem 0 .5rem; font-size: 1.05rem; }
.error-list { margin: 0; padding-left: 1.4rem; }

/* ----- Filter bars (pattern comune) ----- */
.filter-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.filter-form-center { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

/* ----- Pagination ----- */
.pagination-nav  { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
.pagination-info { font-size: .9rem; color: var(--text-muted); }
.pagination-disabled { opacity: .45; cursor: default; }

/* ----- Result count ----- */
.result-count { margin-bottom: .75rem; font-size: .9rem; color: var(--text-muted); }

/* ----- Acquisti ----- */
.th-160 { width: 160px; }
.price-input { max-width: 140px; }
.price-missing-text { color: #c07000; }
.row-price-missing { background: #fffbf0; }
.acq-storico-title { font-size: 1.1rem; margin-bottom: 1rem; }
.acq-warning-link  { color: #c07000; text-decoration: none; margin-left: .35rem; }

/* ----- Fattura / Carico ----- */
.modal-actions { display: flex; gap: .5rem; margin-top: 1rem; }
.hint-text     { font-size: .75rem; color: var(--text-muted); margin-bottom: .25rem; }
.xml-success   { margin-top: .6rem; font-size: .9rem; color: var(--success); }
.xml-remove-link { color: var(--error); }
.form-righe-title { margin: 2rem 0; font-size: 1.05rem; }
.label-hint-error { color: #c0392b; }
.nf-errore { color: var(--error); font-size: .85rem; margin-bottom: .75rem; }

/* ----- Impostazioni ----- */
.settings-section-title { margin-bottom: .75rem; font-size: 1.1rem; }
.settings-section-desc  { font-size: .9rem; color: var(--text-muted); margin-bottom: 1rem; }
.logo-preview-bg {
    background: #4a6245;
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: inline-block;
}
.logo-preview-img { height: 80px; width: auto; }
.logo-section { margin-bottom: 2rem; }
.logo-section-title { font-size: 1.1rem; margin-bottom: 1rem; }
.logo-section-desc { font-size: .9rem; color: var(--text-muted); margin-bottom: 1rem; }

/* ----- Log sistema ----- */
.log-td-nowrap { white-space: nowrap; }
.log-empty-card { text-align: center; padding: 2rem; }
.log-empty-msg  { margin: 0; }

/* ----- Changelog ----- */
.changelog-container { padding: 2rem 1rem; max-width: 760px; }
.changelog-intro { color: var(--text-muted); margin-bottom: 2rem; }

/* ----- Statistiche ----- */
.personalizzato-fields { display: flex; gap: .75rem; flex-wrap: wrap; }
.stat-filter-wrap      { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.stat-filter-legend    { font-weight: 700; font-size: 1rem; color: var(--text-muted); margin-bottom: 1rem; }
.stat-filter-label     { display: block; font-size: .85rem; margin-bottom: .3rem; font-weight: 600; }
.stat-section-title    { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 1rem; }
.fieldset-reset        { border: none; padding: 0; margin: 0; }
.stat-filter-field     { flex: 1; min-width: 160px; }
.stat-summary-row      { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.5rem; }
.stat-th-right         { text-align: right; }
.stat-td-right         { text-align: right; }
.stat-td-bold          { text-align: right; font-weight: 600; }
.print-header-flex     { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.print-instructions    { font-size: .85rem; color: #5c5c5c; margin-bottom: 1.5rem; }
.print-logo-img        { height: 48px; width: auto; display: block; }

/* ----- Sessioni ----- */
.sessione-spacer { margin-top: 2.5rem; }

/* ----- Nuova sessione ----- */
/* gruppo-turno è mostrato/nascosto via JS — usa d-none come classe iniziale */

/* ----- Marginalità placeholder ----- */
.card-placeholder { text-align: center; padding: 3rem 2rem; margin-top: 2rem; }
.placeholder-title { color: var(--text-muted); margin-bottom: 1rem; }
.placeholder-desc  { color: var(--text-muted); font-size: 1rem; max-width: 480px; margin: 0 auto; }

/* ----- Configurazione ----- */
.entita-ha-turni-group { /* mostra/nasconde via PHP — gestito con d-none */ }

/* ----- Utenti ----- */
.utente-me-badge { font-size: .8rem; }
.utenti-footer-note { font-size: .875rem; margin-top: .5rem; }
.password-hint-text { margin-top: .3rem; }

/* ----- TOTP logo ----- */
.login-logo-totp { max-width: 220px; margin-bottom: 1rem; }

/* ===================================================================
   .d-none DEVE STARE SEMPRE PER ULTIMA
   Senza !important: JS via element.style.display può fare override.
   Con CSS cascade, stando per ultima sovrascrive qualsiasi classe
   componente con specificità uguale (es. .personalizzato-fields).
   =================================================================== */
.d-none { display: none; }

/* Dashboard drag & drop */
.drag-handle {
    position: absolute;
    top: .6rem;
    right: .6rem;
    cursor: grab;
    color: var(--text-muted);
    font-size: 1.2rem;
    line-height: 1;
    padding: .2rem;
    border-radius: 4px;
    transition: color .15s;
}
.drag-handle:hover { color: var(--text); }
.dashboard-card { position: relative; }
.dashboard-card.dragging { opacity: .4; border: 2px dashed var(--primary-a); }
.dashboard-card.drag-over { border: 2px solid var(--primary-a); }

@media (prefers-reduced-motion: reduce) {
    .drag-handle { transition: none !important; }
}

/* ─── RESPONSIVE MOBILE SMALL (≤ 480px) ─────────────────────────────────────
   Fix overflow orizzontale a 320px — sprint responsive v1.6.2
   ──────────────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    /* Navbar: nasconde il testo del brand a larghezze molto ridotte;
       il logo da solo identifica l'applicazione */
    .navbar-title { display: none; }

    /* Dashboard: una sola colonna di stat-card evita overflow a 2 colonne */
    .stats-grid { grid-template-columns: 1fr; }

    /* Tooltip: position:fixed evita che il pannello (260px) estenda
       lo scrollWidth del documento; il tooltip appare centrato in basso */
    .tooltip-icon .tooltip-text {
        position: fixed;
        left: 50%;
        bottom: 1rem;
        top: auto;
        transform: translateX(-50%);
        width: min(260px, calc(100vw - 2rem));
    }

    /* Filter form: select a larghezza piena per evitare overflow */
    .filter-form select.form-control,
    .filter-form-center select.form-control { width: 100%; }
}