:root {
    --navy: #0b2e4f;
    --navy-light: #14406b;
}

.bg-navy { background-color: var(--navy) !important; }
.text-navy { color: var(--navy) !important; }

.btn-primary {
    background-color: var(--navy);
    border-color: var(--navy);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--navy-light) !important;
    border-color: var(--navy-light) !important;
}
.btn-outline-primary {
    color: var(--navy);
    border-color: var(--navy);
}
.btn-outline-primary:hover, .btn-outline-primary.active {
    background-color: var(--navy) !important;
    border-color: var(--navy) !important;
    color: #fff;
}

/* Navigazione mobile in basso */
.pb-nav { padding-bottom: 84px; }
@media (min-width: 768px) { .pb-nav { padding-bottom: 1rem; } }

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: #fff;
    border-top: 1px solid #dee2e6;
    padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
    z-index: 1030;
}
.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #6c757d;
    font-size: 0.65rem;
    min-width: 56px;
    padding: 4px 0;
}
.bottom-nav a i { font-size: 1.25rem; line-height: 1; }
.bottom-nav a.active { color: var(--navy); font-weight: 600; }
.bottom-nav .bottom-nav-add i {
    font-size: 2.4rem;
    color: var(--navy);
    margin-top: -18px;
    background: #fff;
    border-radius: 50%;
}

/* ---------- Libretto EASA ---------- */

.lb-card {
    border: none;
    border-radius: 0.75rem;
    overflow: hidden;
}

.lb-card-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: #fff;
}
.lb-pageno {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
}
.lb-range { font-size: 0.8rem; opacity: 0.85; }
.lb-chip {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 2rem;
    background: rgba(255,255,255,.14);
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.lb-chip-accent { background: #ffc107; color: #1a1a1a; }
.lb-btn-pdf { border-color: rgba(255,255,255,.4); }

.lb-pagenav { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.lb-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: 2rem;
    background: #fff;
    border: 1px solid #d7dee6;
    color: var(--navy);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
}
.lb-pill:hover { background: var(--navy); color: #fff; }

.logbook-table {
    font-size: 0.72rem;
    white-space: nowrap;
    border-collapse: separate;
    border-spacing: 0;
    font-variant-numeric: tabular-nums;
}
.logbook-table th, .logbook-table td {
    text-align: center;
    vertical-align: middle;
    padding: 0.28rem 0.4rem;
    border-bottom: 1px solid #e9edf2;
    border-right: 1px solid #f0f3f6;
}
.logbook-table thead th {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #45566b;
    background: #f4f7fa;
    border-bottom: 1px solid #dbe3ea;
}
.lb-group-row th { padding-top: 0.4rem; }
.lb-sub-row th { font-weight: 500; }

/* Tinte per gruppo di colonne */
.logbook-table th.lb-g1, .logbook-table th.lb-g2 { background: #eef4fa; }
.logbook-table th.lb-g3 { background: #f2f0fa; }
.logbook-table th.lb-g4 { background: #eaf5f0; }
.logbook-table th.lb-g5 { background: #faf3e9; }
.logbook-table th.lb-g6 { background: #eef0f8; }
.logbook-table th.lb-g7 { background: #f0f7ee; }
.logbook-table th.lb-g8 { background: #f7eef2; }

.logbook-table tbody tr:not(.lb-empty):hover td { background: #f2f7fc; }
.logbook-table .lb-total-col {
    background: #fbf6e9;
    font-weight: 600;
}
.logbook-table .lb-date { font-weight: 600; text-decoration: none; color: var(--navy); }
.logbook-table .lb-date:hover { text-decoration: underline; }
.logbook-table .lb-place { font-weight: 600; color: #33475c; }
.logbook-table .lb-reg { color: #6c757d; }
.logbook-table .lb-notes {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    color: #6c757d;
}
.lb-empty td { height: 1.7rem; background: repeating-linear-gradient(#fff, #fff 100%); }

/* Colonna Data fissa nello scroll orizzontale */
.logbook-table .lb-sticky {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 2;
    border-right: 1px solid #dbe3ea;
}
.logbook-table thead .lb-sticky { z-index: 3; background: #f4f7fa; }

/* Righe totali */
.lb-row-page td {
    background: #e8f0f9 !important;
    font-weight: 700;
    color: var(--navy);
    border-top: 2px solid #b9cede;
}
.lb-row-carry td {
    background: #fdf6e3 !important;
    font-weight: 600;
    color: #6b5b1f;
}
.lb-row-grand td {
    background: var(--navy) !important;
    color: #fff;
    font-weight: 700;
}
.lb-row-grand td.lb-total-col { color: #ffc107; }
.lb-row-page td.lb-sticky, .lb-row-carry td.lb-sticky, .lb-row-grand td.lb-sticky {
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

/* Autocomplete */
.pl-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.pl-autocomplete .item {
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f5;
}
.pl-autocomplete .item:hover, .pl-autocomplete .item.hover {
    background: #eef3f8;
}
.pl-autocomplete .item .code { font-weight: 600; }
.pl-autocomplete .item .name { font-size: 0.75rem; color: #6c757d; }

/* Input touch-friendly */
@media (max-width: 767px) {
    .form-control-lg, .form-select-lg { font-size: 1.15rem; }
}

/* Stampa */
@media print {
    .navbar, .bottom-nav, .btn, form#voli-filters { display: none !important; }
    .pb-nav { padding-bottom: 0; }
    .card { border: none; box-shadow: none !important; }
}
