/* ============================================================
   Gestionale Ortiz — "telecomando aziendale"
   Mobile-first. Stile officina: carta calda, petrolio, fiamma.
   ============================================================ */

:root {
    --paper: #F4F1EA;
    --surface: #FFFFFF;
    --ink: #1C2B33;
    --muted: #6E7F87;
    --line: #E2DDD2;
    --brand: #0E4F63;
    --brand-dark: #0A3A49;
    --accent: #E8590C;
    --accent-dark: #C74A08;
    --ok: #2F9E44;
    --ok-bg: #E3F5E8;
    --warn: #E8A100;
    --warn-bg: #FFF3D6;
    --danger: #E03131;
    --danger-bg: #FDE8E8;
    --radius: 10px;
    --shadow: 0 2px 6px rgba(28, 43, 51, .08);
    --font: 'Barlow', 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    background-image: radial-gradient(rgba(14, 79, 99, .04) 1px, transparent 1px);
    background-size: 22px 22px;
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.45;
}

/* Pagine interne admin: velatura azzurra che sale dal basso.
   L'azzurro è la versione chiara del petrolio del brand, così si sposa con la
   carta calda invece di stonarci. È agganciata al viewport (attachment fixed):
   resta sul fondo dello schermo mentre si scorre, come la chrome di una app.
   La trama a pallini resta invariata sopra. */
body.admin-page,body.op-page {
    background-image:
        radial-gradient(rgba(14, 79, 99, .04) 1px, transparent 1px),
        linear-gradient(to top,
            rgba(66, 146, 172, .32) 0%,
            rgba(66, 146, 172, .16) 20%,
            rgba(66, 146, 172, .06) 40%,
            rgba(66, 146, 172, 0) 62%);
    background-size: 22px 22px, 100% 100%;
    background-repeat: repeat, no-repeat;
    background-position: 0 0, bottom center;
    background-attachment: scroll, fixed;
}

/* ---------------- Topbar ---------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--brand);
    color: #fff;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
    box-shadow: 0 2px 8px rgba(10, 58, 73, .35);
}

.topbar-back {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    text-decoration: none;
    font-size: 22px;
}

.topbar-logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 1px;
    background: var(--accent);
}

.topbar-title {
    flex: 1;
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: .5px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-exit {
    color: rgba(255, 255, 255, .85);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 10px;
}

/* ---------------- Layout ---------------- */

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px 14px 60px;
}

.page-wide { max-width: 1080px; }

h2.section {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: .5px;
    font-size: 19px;
    color: var(--brand);
    margin: 22px 0 10px;
    border-left: 4px solid var(--accent);
    padding-left: 9px;
}

.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.mt { margin-top: 16px; }
.center { text-align: center; }

/* ---------------- Pulsantoni dashboard ---------------- */

.bigbtn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 84px;
    margin: 0 0 14px;
    padding: 16px 18px;
    border: 0;
    border-radius: var(--radius);
    background: var(--brand);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 0 var(--brand-dark), var(--shadow);
    transition: transform .06s ease;
    -webkit-tap-highlight-color: transparent;
}

.bigbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brand-dark); }

.bigbtn-accent { background: var(--accent); box-shadow: 0 4px 0 var(--accent-dark), var(--shadow); }
.bigbtn-accent:active { box-shadow: 0 1px 0 var(--accent-dark); }

.bigbtn-icon { font-size: 30px; flex: 0 0 auto; }

.bigbtn-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 26px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.bigbtn-sub { display: block; font-family: var(--font); font-weight: 500; font-size: 13.5px; letter-spacing: 0; text-transform: none; opacity: .85; }

.bigbtn-badge {
    margin-left: auto;
    background: #fff;
    color: var(--accent-dark);
    font-weight: 700;
    font-size: 16px;
    min-width: 34px;
    height: 34px;
    border-radius: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
}

.fgas-corner {
    position: absolute;
    top: 2px;
    right: -17px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    --icon-fill: rgba(255, 255, 255, .25);
    box-shadow: var(--shadow);
    z-index: 2;
}
.fgas-corner.is-soon { background: var(--warn, #e0a800); }
.fgas-corner.is-expired { background: var(--danger, #d64545); animation: fgas-pulse 1.4s ease-in-out infinite; }
@keyframes fgas-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }

.bigbtn-warn {
    margin-left: auto;
    line-height: 1;
    flex: 0 0 auto;
    color: #FFC94A;                        /* ambra: risalta sul fondo scuro */
    --icon-fill: rgba(255, 201, 74, .28);
}
.bigbtn-warn + .bigbtn-badge { margin-left: 8px; }

.bigbtn.medium { min-height: 62px; }
.bigbtn.medium .bigbtn-label { font-size: 20px; }
.bigbtn.medium .bigbtn-icon { font-size: 24px; }

/* Griglia pulsanti su desktop */
@media (min-width: 800px) {
    .btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
    .btn-grid .bigbtn { margin-bottom: 0; }
    /* nella griglia i bigbtn perdono il margin-bottom: serve tutto lo stacco qui */
    .link-row { margin-top: 26px; }
}

/* ---------------- Bottoni normali ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 10px 20px;
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-family: var(--font);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { opacity: .85; }
.btn-accent { background: var(--accent); }
.btn-ok { background: var(--ok); }
.btn-danger { background: var(--danger); }
.btn-ghost { background: transparent; color: var(--brand); border: 2px solid var(--brand); }
/* Contornato invece che pieno: distingue "cancella" dal "disattiva" rosso accanto */
.btn-danger-ghost { background: transparent; color: var(--danger); border: 2px solid var(--danger); }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 14px; }
.btn-block { display: flex; width: 100%; }

/* Set icone SVG: colore ereditato dal testo, riempimento semitrasparente */
.ico { display: block; flex: 0 0 auto; }
.bigbtn { --icon-fill: rgba(255, 255, 255, .22); }
.link-row .btn { --icon-fill: rgba(14, 79, 99, .10); }

/* Riga di collegamenti secondari (impostazioni admin) */
/* margin-top ridotto perché su mobile i bigbtn hanno già 14px di margin-bottom */
.link-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
/* Tre voci: su telefono restano su due righe (1 + 2), su desktop in fila */
.link-row-3 { grid-template-columns: 1fr 1fr; }
.link-row-3 > :first-child { grid-column: 1 / -1; }
@media (min-width: 800px) {
    .link-row-3 { grid-template-columns: repeat(3, 1fr); }
    .link-row-3 > :first-child { grid-column: auto; }
}
.link-row .btn { padding: 10px 8px; font-size: 15px; }

@media (max-width: 359px) {
    .link-row { grid-template-columns: 1fr; }
}

/* ---------------- Card ---------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    margin-bottom: 12px;
}

.card-title { font-weight: 700; font-size: 17px; margin: 0 0 4px; }

.card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.card-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Dettaglio ticket: data in evidenza, poi contatti affiancati */
.ticket-when {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 4px 0 10px;
    font-size: 17px;
    font-weight: 600;
}

.ticket-when .ico { color: var(--brand); }
.ticket-when .when-time { color: var(--muted); font-weight: 500; }

.ticket-contacts { display: flex; gap: 8px; margin-bottom: 12px; }

.ticket-contacts .btn {
    flex: 1;
    min-width: 0;              /* senza questo un indirizzo lungo sfonda la card */
    justify-content: flex-start;
}

.ticket-contacts .btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-op { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.ticket-op .ico { color: var(--brand); }

.audio-label { display: flex; align-items: center; gap: 6px; margin: 10px 0 4px; }

/* Da telefono "Chiama" (tel: funziona), da desktop il numero da comporre a mano.
   Stesso breakpoint della griglia pulsanti. */
.only-desk { display: none; }
@media (min-width: 800px) {
    .only-mobile { display: none; }
    .only-desk { display: inline; }
}

/* ---------------- Ricerca e selettore cliente ---------------- */

.search-row { display: flex; gap: 8px; margin: 12px 0; }

.search-row input[type="search"] {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    padding: 10px 12px;
    border: 2px solid var(--line);
    border-radius: 8px;
    font-family: var(--font);
    font-size: 16px;                 /* sotto i 16px iOS zooma al focus */
    background: var(--surface);
}

.search-row .btn { flex: 0 0 auto; }

.cust-picker { border: 2px solid var(--line); border-radius: 8px; padding: 8px; background: var(--surface); }

.cust-selected { display: flex; align-items: center; gap: 10px; }
.cust-selected .cust-info { flex: 1; min-width: 0; }
.cust-selected .cust-name { display: block; }
.cust-selected .cust-addr { display: block; }

.cust-search input[type="search"] {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 2px solid var(--line);
    border-radius: 8px;
    font-family: var(--font);
    font-size: 16px;
}

.cust-results { max-height: 260px; overflow-y: auto; margin-top: 8px; }
.cust-results:empty { margin-top: 0; }

.cust-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    text-align: left;
    padding: 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    font-family: var(--font);
    font-size: 15px;
    cursor: pointer;
}

.cust-item:last-child { border-bottom: 0; }
.cust-item:hover, .cust-item:focus { background: var(--warn-bg); }
.cust-empty { margin: 8px 4px; }

/* Campo di rinomina nelle card competenze */
.skill-input {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 8px;
    border: 2px solid var(--line);
    border-radius: 8px;
    font-family: var(--font);
    font-size: 16px;
}

/* Lista dati: icona in chip quadrato a larghezza fissa, testo tutto allineato */
.info-list { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }

.info-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}

.info-ico {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F1EDE4;
    border-radius: 9px;
    font-size: 17px;
    line-height: 1;
}

.info-txt { flex: 1; min-width: 0; line-height: 1.35; }
.info-txt a { word-break: break-word; }
.info-list .badge { vertical-align: middle; margin-left: 6px; }

.info-problem { margin: 14px 0 6px; font-size: 16px; }

/* ---------------- Badge ---------------- */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}

.b-green { background: var(--ok-bg); color: var(--ok); }
.b-amber { background: var(--warn-bg); color: #A97400; }
.b-red { background: var(--danger-bg); color: var(--danger); }
.b-blue { background: #E1EEF3; color: var(--brand); }
.b-gray { background: #ECEAE3; color: var(--muted); }

/* ---------------- Flash ---------------- */

.flash {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-weight: 600;
    border: 1px solid transparent;
}

.flash-success { background: var(--ok-bg); color: #226B32; border-color: #BEE3C8; }
.flash-error { background: var(--danger-bg); color: #A32020; border-color: #F3BFBF; }
.flash-info { background: #E1EEF3; color: var(--brand); border-color: #C4DAE3; }

.error-list { margin: 0; padding-left: 18px; }
.error-list li { margin: 3px 0; }

/* ---------------- Form ---------------- */

.field { margin-bottom: 14px; }

.field label {
    display: block;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--brand);
    margin-bottom: 5px;
}

.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="tel"], .field input[type="date"], .field input[type="time"],
.field input[type="number"], .field select, .field textarea {
    width: 100%;
    min-height: 50px;
    padding: 12px;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font-family: var(--font);
    font-size: 16px;
    color: var(--ink);
}

.field textarea { min-height: 90px; resize: vertical; }

.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--brand);
}

.field-inline { display: flex; gap: 10px; }
.field-inline > * { flex: 1; }

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-weight: 600;
}

.check input { width: 22px; height: 22px; accent-color: var(--accent); }

/* Scelte rapide (Oggi/Domani, Mattina/Pomeriggio) */
.quick-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

.quick-row .chip {
    flex: 1;
    min-width: 90px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.quick-row .chip.active { border-color: var(--accent); background: #FDEFE4; color: var(--accent-dark); }

/* Card scelta operatore */
.op-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: 8px;
    cursor: pointer;
}

.op-card input { width: 22px; height: 22px; accent-color: var(--accent); flex: 0 0 auto; }
.op-card.selected { border-color: var(--accent); background: #FDEFE4; }
.op-card.busy { opacity: .75; }
.op-name { font-weight: 700; }
.op-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }

/* ---------------- Calendario ---------------- */

.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }

.cal-nav .cal-month {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--brand);
}

.cal-nav a {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 8px;
    color: var(--brand);
    font-size: 20px;
    text-decoration: none;
    font-weight: 700;
}

.cal {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    table-layout: fixed;
}

.cal th {
    padding: 8px 2px;
    font-family: var(--font-display);
    font-size: 13px;
    text-transform: uppercase;
    color: var(--muted);
    background: #FAF8F3;
    border-bottom: 1px solid var(--line);
}

.cal td {
    height: 54px;
    border: 1px solid #EFECE4;
    vertical-align: top;
    padding: 3px;
    position: relative;
}

.cal td a, .cal td .cal-day {
    display: block;
    text-decoration: none;
    color: var(--ink);
    font-weight: 600;
    font-size: 14px;
    height: 100%;
}

.cal .out { background: #FAF8F3; color: #C9C3B5; }
.cal .today .cal-num { background: var(--brand); color: #fff; }
.cal .blocked { background: var(--danger-bg); }
.cal .blocked .cal-num { color: var(--danger); }
.cal .sel { outline: 3px solid var(--accent); outline-offset: -3px; }

.cal-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    border-radius: 12px;
}

.cal-dots { display: flex; gap: 3px; margin-top: 2px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 4px; }
.dot-green { background: var(--ok); }
.dot-amber { background: var(--warn); }
.dot-red { background: var(--danger); }

.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 2px; font-size: 13px; color: var(--muted); align-items: center; }
.cal-legend .dot { flex: 0 0 auto; }
.legend-block { width: 14px; height: 14px; border-radius: 4px; background: var(--danger-bg); border: 1px solid var(--danger); }

/* ---------------- Tabelle (desktop) ---------------- */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

table.data th {
    text-align: left;
    font-family: var(--font-display);
    text-transform: uppercase;
    font-size: 13.5px;
    letter-spacing: .4px;
    color: var(--muted);
    padding: 10px 12px;
    border-bottom: 2px solid var(--line);
    background: #FAF8F3;
    white-space: nowrap;
}

table.data td { padding: 10px 12px; border-bottom: 1px solid #EFECE4; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }

/* Su mobile le tabelle "responsive" diventano card */
@media (max-width: 700px) {
    table.rwd, table.rwd tbody, table.rwd tr, table.rwd td { display: block; width: 100%; }
    table.rwd thead { display: none; }
    table.rwd tr { margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 8px 4px; }
    table.rwd td { border: 0; padding: 5px 12px; }
    table.rwd td[data-l]::before {
        content: attr(data-l);
        display: block;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--muted);
    }
}

/* ---------------- Login ---------------- */

body.login-page {
    background: radial-gradient(circle at 50% -10%, #14647F 0%, #0A3A49 45%, #062631 100%);
    min-height: 100vh;
}

.login-wrap { max-width: 400px; margin: 8vh auto 0; padding: 0 16px; }

.login-logo-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0A3A49 0%, #062631 100%);
    border-radius: 16px;
    padding: 22px 20px;
    margin: 0 auto 22px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
}

.login-brand-logo {
    display: block;
    height: 48px;
    width: auto;
}

.login-logo {
    text-align: center;
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
    margin-bottom: 4px;
}

.login-logo span { color: var(--accent); }

.login-sub { text-align: center; color: rgba(255, 255, 255, .65); margin-bottom: 26px; margin-top:0; }

/* ---------------- Varie ---------------- */

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

.stat {
    flex: 1;
    min-width: 130px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 14px;
    box-shadow: var(--shadow);
}

.stat b { display: block; font-size: 26px; font-family: var(--font-display); color: var(--brand); }
.stat span { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

.audio-rec { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.rec-dot { display: inline-block; width: 12px; height: 12px; border-radius: 6px; background: var(--danger); animation: pulse 1s infinite; }

@keyframes pulse { 50% { opacity: .3; } }

.thumb-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumb-row img { width: 86px; height: 86px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* Miniatura con pulsante rimuovi (foto caricate via uploader, non ancora inviate) */
.thumb-wrap { position: relative; display: inline-block; }
.thumb-wrap img { width: 86px; height: 86px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }

.file-row { position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; }

.thumb-del {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 24px;
    height: 24px;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Pulsante UploadiFive uniformato allo stile app */
.photo-uploader { margin-bottom: 4px; }

.photo-uploader .uploadifive-button {
    background: var(--brand) !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 8px !important;
    min-height: 48px !important;
    font: 700 15px/1 var(--font) !important;
    letter-spacing: .3px;
    text-transform: uppercase;
    text-shadow: none !important;
}

.photo-uploader .uploadifive-queue-item {
    border: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    border-radius: 8px;
    font-family: var(--font);
}

.msg-unread { border-left: 4px solid var(--accent); }

dialog.modal {
    border: 0;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,.25);
    padding: 20px;
    width: min(92vw, 420px);
}

dialog.modal::backdrop { background: rgba(28, 43, 51, .5); }

/* Dialogo di conferma condiviso */
dialog.confirm-modal { width: min(92vw, 400px); text-align: center; }

.confirm-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 2px auto 12px;
    border-radius: 50%;
    background: var(--warn-bg);
    color: var(--warn);
    --icon-fill: rgba(232, 161, 0, .18);
}

dialog.confirm-modal.is-danger .confirm-ico {
    background: var(--danger-bg);
    color: var(--danger);
    --icon-fill: rgba(224, 49, 49, .16);
}

.confirm-title {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.confirm-text { margin: 0 0 18px; color: var(--muted); }

.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; }

@media (prefers-reduced-motion: no-preference) {
    dialog.confirm-modal[open] { animation: confirm-in .16s ease-out; }
    @keyframes confirm-in {
        from { opacity: 0; transform: translateY(8px) scale(.97); }
        to   { opacity: 1; transform: none; }
    }
}

/* Firma col dito */
.sign-pad { margin-top: 6px; }
.sign-pad canvas {
    width: 100%;
    height: 160px;
    border: 2px dashed var(--line);
    border-radius: 8px;
    background: #fff;            /* fisso, non var(--surface): il tratto è
                                     hardcoded scuro (#111) in app.js, un tema
                                     scuro renderebbe la firma illeggibile */
    touch-action: none;          /* senza questo il dito scorre la pagina */
    display: block;
}
.sign-pad .sign-clear { margin-top: 6px; }

/* Riquadro intervento iniziato */
.started-box {
    border: 2px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    margin: 12px 0;
    font-size: 17px;
}

/* Riepilogo dati (fine intervento, ecc.) */
.recap-box dt { font-weight: 700; }
.recap-box dd { margin: 0 0 8px; }

/* ---------------- Quadro assenze nelle approvazioni ---------------- */

.abs-band {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.35;
    margin: 10px 0 0;
    font-weight: 600;
}

.abs-green { background: var(--ok-bg); color: #1E6E2E; }
.abs-amber { background: var(--warn-bg); color: #A97400; }
.abs-red { background: var(--danger-bg); color: var(--danger); }
.abs-pending { background: var(--warn-bg); color: #A97400; margin-top: 6px; font-weight: 500; }

.split-approve { display: grid; gap: 16px; align-items: start; }
.approve-cal { display: none; }

@media (min-width: 1000px) {
    .split-approve { grid-template-columns: 1fr minmax(320px, 380px); }
    .approve-cal { display: block; position: sticky; top: 16px; }
    .approve-inline-cal { display: none; }
}

.cal .in-range { background: #FFF1E6; }
.cal .req-sel { outline: 3px solid var(--accent); outline-offset: -3px; }

.cal-count {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 2px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
}

.cal-count .dot { flex: 0 0 auto; }
.dot-hollow { background: transparent; border: 2px solid var(--warn); }

.abs-daylist { margin: 10px 0 0; padding-left: 18px; font-size: 13.5px; }
.abs-daylist li { margin-bottom: 4px; }

.approve-inline-cal > summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--brand);
    margin: 10px 0 0;
}

/* Frecce del calendario oltre la finestra caricata: lì non ci sono dati. */
.cal-nav a[aria-disabled="true"] { opacity: .35; pointer-events: none; }
