/* =====================================================================
   PensioniWeb — stile applicativo
   Basato su Bootstrap 5.3; qui solo le personalizzazioni.
   ===================================================================== */

:root {
    --ic-navy: #0d2b45;
    --ic-navy-soft: #163a5c;
    --ic-accent: #0d6efd;
    --ic-green: #198754;
    --ic-yellow: #cc8a00;
    --ic-red: #c62828;
    --ic-surface: #f4f6f9;
    --ic-border: #dfe4ea;
}

body.app-body {
    background: var(--ic-surface);
    font-size: 0.925rem;
}

/* ------------------------------------------------------------ navigazione */

.app-navbar {
    background: linear-gradient(135deg, var(--ic-navy) 0%, var(--ic-navy-soft) 100%);
    box-shadow: 0 1px 10px rgba(13, 43, 69, 0.18);
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

.app-navbar .navbar-brand,
.app-navbar .nav-link,
.app-navbar .user-box {
    color: #eaf1f8;
}

.app-navbar .nav-link {
    border-radius: 0.375rem;
    padding: 0.35rem 0.7rem;
    margin-right: 0.15rem;
    font-weight: 500;
    opacity: 0.85;
}

.app-navbar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    opacity: 1;
}

.app-navbar .nav-link.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    opacity: 1;
}

.app-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.35);
}

.app-navbar .navbar-toggler-icon {
    filter: invert(1) grayscale(1) brightness(2);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.14);
    font-size: 1.1rem;
}

.brand-mark.lg {
    width: 3.2rem;
    height: 3.2rem;
    font-size: 1.7rem;
    background: var(--ic-navy);
    color: #fff;
}

.brand-text {
    line-height: 1.05;
    font-size: 1.05rem;
}

.brand-text small {
    font-size: 0.64rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    opacity: 0.7;
    text-transform: uppercase;
}

.app-main {
    min-height: calc(100vh - 118px);
}

.app-footer {
    border-top: 1px solid var(--ic-border);
    background: #fff;
    padding: 0.75rem 0;
    color: #6c757d;
}

/* ------------------------------------------------------------------ login */

.auth-body {
    background: linear-gradient(135deg, var(--ic-navy) 0%, #1d4f7c 100%);
    min-height: 100vh;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 24rem;
    background: #fff;
    border-radius: 0.9rem;
    padding: 2rem;
    box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.25);
}

.auth-brand {
    text-align: center;
    margin-bottom: 1.6rem;
}

.auth-brand h1 {
    font-size: 1.4rem;
    margin: 0.7rem 0 0.15rem;
    font-weight: 400;
}

.auth-brand p {
    font-size: 0.78rem;
    color: #6c757d;
    margin: 0;
}

.auth-footer {
    color: rgba(5, 0, 0, 0.85)
    font-size: 0.75rem;
    margin: 1.25rem 0 0;
    text-align: center;
    max-width: 24rem;
}

/* ------------------------------------------------------------------ schede */

.card {
    border: 1px solid var(--ic-border);
    border-radius: 0.6rem;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--ic-border);
    font-weight: 600;
    padding: 0.7rem 1rem;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--ic-border);
    border-radius: 0.6rem;
    padding: 1rem 1.1rem;
    height: 100%;
}

.stat-card .stat-value {
    font-size: 1.65rem;
    font-weight: 600;
    line-height: 1.1;
    color: var(--ic-navy);
}

.stat-card .stat-label {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
}

.stat-card .stat-icon {
    font-size: 1.5rem;
    opacity: 0.25;
}

/* ------------------------------------------------------------- semaforo */

.badge-status {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.3em 0.6em;
}

.status-green  { background-color: #e6f4ea !important; color: #146c43 !important; }
.status-yellow { background-color: #fff4e0 !important; color: #975a00 !important; }
.status-red    { background-color: #fdecea !important; color: #b02a20 !important; }
.status-info   { background-color: #e8f1fb !important; color: #0a58ca !important; }

tr.row-green  > td:first-child { box-shadow: inset 3px 0 0 var(--ic-green); }
tr.row-yellow > td:first-child { box-shadow: inset 3px 0 0 var(--ic-yellow); }
tr.row-red    > td:first-child { box-shadow: inset 3px 0 0 var(--ic-red); }

/* ---------------------------------------------------------- tabelle dati */

.table-compact {
    font-size: 0.82rem;
    margin-bottom: 0;
}

.table-compact > :not(caption) > * > * {
    padding: 0.35rem 0.5rem;
}

.table-compact thead th {
    background: #eef2f6;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #495057;
    white-space: nowrap;
    vertical-align: middle;
    border-bottom: 1px solid var(--ic-border);
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
}

.table-sticky-head thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.table-scroll {
    max-height: 32rem;
    overflow: auto;
    border: 1px solid var(--ic-border);
    border-radius: 0.5rem;
}

/* ------------------------------------------------- vista specchio documento */

.doc-mirror {
    background: #fff;
    border: 1px solid var(--ic-border);
    border-radius: 0.5rem;
    padding: 1.25rem;
}

.doc-mirror h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ic-navy);
    border-bottom: 2px solid var(--ic-navy);
    padding-bottom: 0.3rem;
    margin-bottom: 0.75rem;
}

.doc-mirror .col-inps     { background: #f8f9fa; }
.doc-mirror .col-computed { background: #f3f8ff; }

.delta-pos { color: var(--ic-green); font-weight: 600; }
.delta-neg { color: var(--ic-red);   font-weight: 600; }
.delta-nil { color: #6c757d; }

/* --------------------------------------------------------- righe editabili */

.row-origin-manual td { background: #fffdf3; }
.row-origin-edited td { background: #f3f9ff; }
.row-low-confidence td { background: #fff6f6; }

.cell-edit {
    border: 1px solid transparent;
    background: transparent;
    width: 100%;
    padding: 0.1rem 0.25rem;
    border-radius: 0.2rem;
    font-size: 0.82rem;
}

.cell-edit:hover {
    border-color: var(--ic-border);
    background: #fff;
}

.cell-edit:focus {
    border-color: var(--ic-accent);
    background: #fff;
    outline: 0;
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
}

.cell-edit.is-invalid {
    border-color: var(--ic-red);
    background: #fff5f5;
}

/* ----------------------------------------------------------------- varie */

.section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.hint {
    font-size: 0.78rem;
    color: #6c757d;
}

.formula {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.76rem;
    background: #f6f8fa;
    border-left: 3px solid var(--ic-accent);
    padding: 0.4rem 0.6rem;
    border-radius: 0.2rem;
    white-space: pre-wrap;
    color: #24292f;
}

.norm-warning {
    border-left: 4px solid var(--ic-yellow);
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 2.5rem;
    opacity: 0.3;
    display: block;
    margin-bottom: 0.75rem;
}

.timeline-bar {
    height: 0.6rem;
    border-radius: 0.3rem;
    background: #e9ecef;
    overflow: hidden;
    display: flex;
}

.timeline-bar span {
    display: block;
    height: 100%;
}

.nav-tabs .nav-link {
    font-size: 0.85rem;
    font-weight: 500;
}

@media print {
    .app-navbar, .app-footer, .no-print { display: none !important; }
    .app-main { min-height: auto; }
    body.app-body { background: #fff; }
}

/* --------------------------------------------------- sweetalert2: tema app */

:root {
    --swal2-border-radius: 0.6rem;
    --swal2-background: #fff;
    --swal2-color: #212529;
    --swal2-backdrop: rgba(13, 43, 69, 0.45);
    --swal2-confirm-button-border-radius: 0.375rem;
    --swal2-confirm-button-background-color: var(--ic-accent);
    --swal2-cancel-button-border-radius: 0.375rem;
    --swal2-cancel-button-background-color: #6c757d;
    --swal2-deny-button-border-radius: 0.375rem;
    --swal2-deny-button-background-color: var(--ic-red);
    --swal2-toast-box-shadow: 0 0.25rem 1rem rgba(13, 43, 69, 0.18);
}

.swal2-title {
    color: var(--ic-navy);
    font-weight: 600;
    font-size: 1.3rem;
}

.swal2-html-container {
    color: #495057;
    font-size: 0.95rem;
}

.swal2-icon.swal2-success{border-color:var(--ic-green);color:var(--ic-green)}
.swal2-icon.swal2-success [class^="swal2-success-line"]{background-color:var(--ic-green)}
.swal2-icon.swal2-success .swal2-success-ring{border-color:rgba(25,135,84,.3)}

.swal2-icon.swal2-error{border-color:var(--ic-red);color:var(--ic-red)}
.swal2-icon.swal2-error [class^="swal2-x-mark-line"]{background-color:var(--ic-red)}

.swal2-icon.swal2-warning{border-color:var(--ic-yellow);color:var(--ic-yellow)}

.swal2-icon.swal2-info{border-color:var(--ic-accent);color:var(--ic-accent)}

.swal2-icon.swal2-question{border-color:var(--ic-navy-soft);color:var(--ic-navy-soft)}

.swal2-toast .swal2-title {
    font-size: 0.95rem;
    font-weight: 500;
}
