/* Tema grafico unico dell'app QTB: lo stesso di AIRBOOK (Bootstrap 5.3, blu #1c6cc7), pensato prima per il telefono.
   Il testo resta a 16px: sotto quella misura i telefoni ingrandiscono la pagina quando si tocca un campo.
   Le pagine non hanno stili propri che ridefiniscono bottoni, campi, tabelle o titoli. */

/* ── Variabili del tema ─────────────────────────────────────────────── */
:root {
    --ab-primary: #1c6cc7;
    --ab-primary-hover: #175aa6;
    --ab-primary-active: #154f93;
    --ab-header-bg: #212529;
    --ab-card-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    --ab-thead-bg: #f1f3f5;
    --ab-page-bg: #f4f6f9;
    --ab-card-header-bg: #f8f9fa;

    --bs-primary: #1c6cc7;
    --bs-primary-rgb: 28, 108, 199;
    --bs-primary-bg-subtle: #e8f0fa;
    --bs-primary-border-subtle: #a4c4e9;
    --bs-primary-text-emphasis: #0b2b50;
    --bs-link-color: #1c6cc7;
    --bs-link-color-rgb: 28, 108, 199;
    --bs-link-hover-color: #175aa6;
    --bs-link-hover-color-rgb: 23, 90, 166;
    --bs-focus-ring-color: rgba(28, 108, 199, .25);
    --bs-body-font-size: 1rem;
    --bs-border-radius: .375rem;
}

/* ── Componenti Bootstrap compilati con il blu di default ───────────── */
.btn-primary {
    --bs-btn-bg: #1c6cc7;
    --bs-btn-border-color: #1c6cc7;
    --bs-btn-hover-bg: #175aa6;
    --bs-btn-hover-border-color: #175aa6;
    --bs-btn-active-bg: #154f93;
    --bs-btn-active-border-color: #154f93;
    --bs-btn-disabled-bg: #1c6cc7;
    --bs-btn-disabled-border-color: #1c6cc7;
    --bs-btn-focus-shadow-rgb: 28, 108, 199;
}

.btn-outline-primary {
    --bs-btn-color: #1c6cc7;
    --bs-btn-border-color: #1c6cc7;
    --bs-btn-hover-bg: #1c6cc7;
    --bs-btn-hover-border-color: #1c6cc7;
    --bs-btn-active-bg: #175aa6;
    --bs-btn-active-border-color: #175aa6;
    --bs-btn-disabled-color: #1c6cc7;
    --bs-btn-disabled-border-color: #1c6cc7;
    --bs-btn-focus-shadow-rgb: 28, 108, 199;
}

.btn-link { --bs-btn-color: #1c6cc7; --bs-btn-hover-color: #175aa6; }

.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: #8eb6e3;
    box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
}

.form-check-input:checked { background-color: #1c6cc7; border-color: #1c6cc7; }

.nav-pills .nav-link.active, .dropdown-item.active, .dropdown-item:active { background-color: #1c6cc7; }

.page-link { color: #1c6cc7; }
.active > .page-link, .page-link.active { background-color: #1c6cc7; border-color: #1c6cc7; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .375rem; white-space: nowrap; }
.btn-link.p-0 { display: inline; }

/* ── Intestazione di pagina ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.page-title { font-size: 1.35rem; font-weight: 600; margin: 0; }
.page-subtitle { margin: .15rem 0 0; color: var(--bs-secondary-color); }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ── Riquadri ───────────────────────────────────────────────────────── */
.ab-card {
    border-color: var(--bs-border-color-translucent);
    box-shadow: var(--ab-card-shadow);
    margin-bottom: 1rem;
}

.ab-card > .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    background: var(--ab-card-header-bg);
    font-weight: 600;
}

.ab-card > .card-header .card-actions { display: flex; gap: .5rem; flex-wrap: wrap; font-weight: normal; }

.section-title {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--ab-primary);
    border-bottom: 2px solid var(--bs-primary-border-subtle);
    padding-bottom: .25rem;
    margin: 1rem 0 .75rem;
}

/* ── Campi ──────────────────────────────────────────────────────────── */
.form-label { font-size: .8rem; font-weight: 600; color: var(--bs-secondary-color); margin-bottom: .25rem; }

/* ── Tabelle ────────────────────────────────────────────────────────── */
.ab-table { font-size: .8125rem; margin-bottom: 0; }

.ab-table > thead th {
    background: var(--ab-thead-bg);
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    vertical-align: bottom;
}

.ab-table > thead th.sortable { cursor: pointer; user-select: none; }

.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-actions { text-align: right; white-space: nowrap; }
.table-actions .btn + .btn, .table-actions .btn + a, .table-actions a + .btn { margin-left: .25rem; }

.btn-icon { width: 2rem; height: 2rem; padding: 0; }
.btn-icon.btn-sm { width: 1.75rem; height: 1.75rem; }

.row-selected > * { --bs-table-bg-state: var(--bs-primary-bg-subtle); }

/* ── Stati ──────────────────────────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .1rem .55rem;
    border-radius: 50rem;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

.status-ok { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); border-color: var(--bs-success-border-subtle); }
.status-warn { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); border-color: var(--bs-warning-border-subtle); }
.status-danger { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); border-color: var(--bs-danger-border-subtle); }
.status-info { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); border-color: var(--bs-primary-border-subtle); }
.status-muted { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); border-color: var(--bs-border-color); }

.alert { display: flex; gap: .5rem; align-items: flex-start; }
.alert > .bi { flex-shrink: 0; margin-top: .1rem; }

/* ── Struttura: barra in alto, contenuto, piede ─────────────────────── */
body { background-color: var(--ab-page-bg); }
h1:focus { outline: none; }

.layout { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    background: var(--ab-header-bg);
    color: #fff;
    padding: 0 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .15);
}

.topbar .brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: #fff; text-decoration: none; padding: 6px 0; }
.topbar .brand img { height: 40px; width: 40px; display: block; }

.topnav { display: flex; flex-wrap: wrap; gap: 0 1.25rem; align-items: center; }
.topnav a, .topnav .btn-link {
    color: rgba(255, 255, 255, .85);
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 0;
}
.topnav a:hover, .topnav .btn-link:hover, .topnav a.active { color: #fff; }
.topnav a.active { font-weight: 600; }
.topnav .logout { margin: 0; }
.topnav .btn-link { border: 0; font-size: inherit; }

.navbar-toggle { display: none; }

.qtb-main { flex: 1; padding: 1rem; max-width: 760px; margin: 0 auto; width: 100%; }

.footer { background: var(--ab-header-bg); color: rgba(255, 255, 255, .75); text-align: center; padding: 16px; margin-top: 24px; font-size: .75rem; }
.footer p { margin: 0; }

@media (max-width: 900px) {
    .navbar-toggle { display: inline-flex; }
    .topnav { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 0; padding-bottom: 6px; }
    .topbar.open .topnav { display: flex; }
    .topnav a, .topnav .btn-link { border-top: 1px solid rgba(255, 255, 255, .12); padding: .75rem 4px; width: 100%; justify-content: flex-start; }
}

/* ── Accesso ────────────────────────────────────────────────────────── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: linear-gradient(135deg, var(--ab-primary) 0%, var(--ab-header-bg) 100%);
}

.login-box { background: #fff; padding: 2rem; border-radius: var(--bs-border-radius-lg); box-shadow: 0 10px 25px rgba(0, 0, 0, .2); width: 100%; max-width: 360px; }
.login-logo { display: block; width: 100%; height: auto; margin: 0 auto .5rem; }
.login-subtitle { text-align: center; color: var(--bs-secondary-color); font-size: .8rem; margin-bottom: 1.25rem; }

/* ── Pezzi comuni delle pagine ──────────────────────────────────────── */
.narrow { max-width: 420px; margin: 1.5rem auto; }

/* Campo da compilare a mano (ore di decollo e atterraggio del QTB) */
.da-compilare { background-color: #fff8cc; }

/* Scheda con il bordo sinistro colorato secondo la gravità */
.riga { border-left: 6px solid transparent; }
.riga.avviso { border-left-color: var(--bs-warning); }
.riga.grave { border-left-color: var(--bs-danger); background: var(--bs-danger-bg-subtle); }

.firma-canvas { width: 100%; height: auto; aspect-ratio: 600 / 220; background: #fff; border: 2px dashed var(--bs-border-color); border-radius: var(--bs-border-radius); touch-action: none; display: block; }
.firma-attuale { max-width: 100%; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); background: #fff; }
.foto-profilo { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 1px solid var(--bs-border-color); flex: 0 0 auto; }
.foto-vuota { display: inline-flex; align-items: center; justify-content: center; background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); font-size: 3rem; }

/* Pulsanti grandi da toccare sul telefono */
.btn-tocco { min-height: 48px; }

#blazor-error-ui { background: #fff3cd; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; font-size: .8rem; }

/* Grafico di massa e centraggio (pagina Apri QTB) */
.grafico-centraggio { width: 100%; height: auto; display: block; background: rgba(127, 127, 127, .06); border-radius: .5rem; color: var(--bs-body-color); }
.grafico-centraggio .griglia { stroke: currentColor; stroke-opacity: .12; }
.grafico-centraggio .etichetta { font-size: 10px; fill: currentColor; opacity: .7; }
.grafico-centraggio .titolo-asse { font-size: 11px; fill: currentColor; opacity: .8; }
.grafico-centraggio .inviluppo { fill: rgba(40, 160, 80, .18); stroke: #2a9d55; stroke-width: 2; }
.grafico-centraggio .tratta { stroke: currentColor; stroke-dasharray: 3 3; opacity: .6; }
.grafico-centraggio .punto.decollo { fill: #1f6fd1; }
.grafico-centraggio .punto.atterraggio { fill: none; stroke: #1f6fd1; stroke-width: 2.5; }
.grafico-centraggio .punto.decollo.fuori { fill: #d33; }
.grafico-centraggio .punto.atterraggio.fuori { stroke: #d33; }
.legenda-grafico { font-size: .75rem; opacity: .75; margin: .25rem 0 0; }
.riepilogo-centraggio { font-size: .85rem; margin-bottom: .75rem; }

/* ── Stampa ─────────────────────────────────────────────────────────── */
@media print {
    .topbar, .footer, .no-print { display: none !important; }
    .ab-card { box-shadow: none; }
    .table-responsive { overflow: visible !important; }
}
