/* Area amministrazione */
.app-navbar {
    background: var(--cq-surface);
    border-bottom: 1px solid var(--cq-border);
    padding-top: .35rem;
    padding-bottom: .35rem;
}
.app-navbar .navbar-brand {
    font-weight: 700;
    font-size: 1rem;
    color: var(--cq-text);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--cq-primary);
    color: #fff;
    font-size: .8rem;
    letter-spacing: .02em;
}
.app-navbar .nav-link {
    color: var(--cq-muted);
    font-weight: 500;
    font-size: .92rem;
    border-radius: 8px;
    padding: .45rem .7rem !important;
}
.app-navbar .nav-link:hover { color: var(--cq-text); background: #f1f4f8; }
.app-navbar .nav-link.active { color: var(--cq-primary); background: var(--cq-primary-soft); }
.job-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .7rem;
    border-radius: 999px;
    background: var(--cq-primary);
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
    text-decoration: none;
}
.job-pill:hover { background: var(--cq-primary-dark); color: #fff; }

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.app-footer {
    text-align: center;
    color: var(--cq-muted);
    font-size: .8rem;
    padding: 1.5rem 0 2rem;
}

/* KPI */
.kpi {
    background: var(--cq-surface);
    border: 1px solid var(--cq-border);
    border-radius: var(--cq-radius);
    box-shadow: var(--cq-shadow);
    padding: 1rem 1.1rem;
    height: 100%;
}
.kpi-label { color: var(--cq-muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi-value { font-size: 1.9rem; font-weight: 700; line-height: 1.15; margin-top: .2rem; }
.kpi-sub { color: var(--cq-muted); font-size: .82rem; }
.kpi.kpi-alert { border-color: #f1c9c6; background: #fff8f7; }
.kpi.kpi-alert .kpi-value { color: var(--cq-danger); }
.kpi.kpi-ok .kpi-value { color: var(--cq-success); }

.progress-thin { height: 6px; }

/* Tabelle */
.table-app {
    --bs-table-bg: transparent;
    margin-bottom: 0;
    font-size: .9rem;
}
.table-app thead th {
    background: #f8fafc;
    color: var(--cq-muted);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-bottom: 1px solid var(--cq-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.table-app th.sortable { cursor: pointer; user-select: none; }
.table-app th.sortable::after { content: ' ↕'; opacity: .35; }
.table-app th.sort-asc::after { content: ' ↑'; opacity: .8; }
.table-app th.sort-desc::after { content: ' ↓'; opacity: .8; }
.table-app td { vertical-align: middle; }
.table-app tr.row-caduto td { color: #98a2ae; }
.table-app tr.row-caduto td .rep-name { text-decoration: line-through; }
.table-app tr.row-iniziata td:first-child { box-shadow: inset 3px 0 0 var(--cq-success); }
.table-wrap { max-height: 70vh; overflow: auto; border-radius: var(--cq-radius); }
.table-card .card-body { padding: 0; }

.rep-name { font-weight: 600; }
.rep-meta { color: var(--cq-muted); font-size: .8rem; }

/* Barra filtri */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: end;
}
.filter-bar .form-label { font-size: .75rem; color: var(--cq-muted); margin-bottom: .15rem; font-weight: 600; }
.filter-bar .form-control, .filter-bar .form-select { min-width: 130px; }

/* Barra azioni multiple */
.bulk-bar {
    display: none;
    position: sticky;
    bottom: 1rem;
    z-index: 10;
    margin-top: 1rem;
    background: var(--cq-text);
    color: #fff;
    border-radius: 12px;
    padding: .6rem .8rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.bulk-bar.show { display: flex; }
.bulk-bar .btn { --bs-btn-padding-y: .3rem; --bs-btn-font-size: .85rem; }

/* Import */
.import-steps {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.import-steps .step {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .4rem .8rem;
    border-radius: 999px;
    background: #eceff3;
    color: var(--cq-muted);
    font-weight: 600;
    font-size: .85rem;
}
.import-steps .step .num {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    font-size: .75rem;
}
.import-steps .step.active { background: var(--cq-primary); color: #fff; }
.import-steps .step.active .num { color: var(--cq-primary); }
.import-steps .step.done { background: #e3f4ec; color: var(--cq-success); }

.dropzone {
    border: 2px dashed #c6d0db;
    border-radius: var(--cq-radius);
    padding: 2rem;
    text-align: center;
    background: #fbfcfd;
    transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--cq-primary); background: var(--cq-primary-soft); }

.stato-pill { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: .2rem .5rem; border-radius: 6px; white-space: nowrap; }
.stato-nuovo      { background: #e3f4ec; color: var(--cq-success); }
.stato-modificato { background: #fdf3dc; color: #8a5d00; }
.stato-invariato  { background: #eceff3; color: #56616e; }
.stato-errore     { background: #fbe7e6; color: var(--cq-danger); }

.diff-old { color: var(--cq-danger); text-decoration: line-through; }
.diff-new { color: var(--cq-success); font-weight: 600; }

.report-list { max-height: 220px; overflow: auto; font-size: .88rem; }

/* Login */
.login-wrap {
    min-height: calc(100vh - 140px);
    display: grid;
    place-items: center;
}
.login-card { width: 100%; max-width: 400px; }

@media (max-width: 575.98px) {
    .page-header h1 { font-size: 1.25rem; }
    .kpi-value { font-size: 1.5rem; }
}
