body {
    color: #1f2937;
    background:
        radial-gradient(circle at top left, rgba(14, 165, 233, 0.08), transparent 28%),
        radial-gradient(circle at top right, rgba(34, 197, 94, 0.08), transparent 24%);
}

.navbar-brand {
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
}

.navbar-brand-logo {
    display: block;
    height: 2rem;
    width: auto;
}

.login-logo {
    display: block;
    max-width: 14rem;
    width: 100%;
    height: auto;
}

.card {
    border-radius: 1rem;
}

.dashboard-hero-card {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(244, 247, 250, 0.95)),
        linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(34, 197, 94, 0.05));
}

.activity-card {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96)),
        linear-gradient(135deg, rgba(14, 165, 233, 0.06), rgba(15, 23, 42, 0.03));
}

.activity-indicator {
    width: 0.95rem;
    height: 0.95rem;
    border-radius: 999px;
    display: inline-block;
    flex: 0 0 auto;
}

.activity-idle {
    background: #94a3b8;
    box-shadow: 0 0 0 0.2rem rgba(148, 163, 184, 0.18);
}

.activity-running {
    background: #0ea5e9;
    box-shadow: 0 0 0 0.2rem rgba(14, 165, 233, 0.18);
    animation: activity-pulse 1.2s ease-in-out infinite;
}

.activity-success {
    background: #16a34a;
    box-shadow: 0 0 0 0.2rem rgba(22, 163, 74, 0.18);
}

.activity-error {
    background: #dc2626;
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.18);
}

.header-activity-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #334155;
}

.header-activity-dot {
    border: none;
    padding: 0;
    cursor: help;
    background-clip: padding-box;
}

.header-activity-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
}

.kpi-card {
    overflow: hidden;
    position: relative;
}

.kpi-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 0.4rem;
    border-radius: 1rem 0 0 1rem;
}

.kpi-neutral {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
}

.kpi-neutral::before {
    background: #64748b;
}

.kpi-warning {
    background: linear-gradient(180deg, rgba(255, 251, 235, 0.98), rgba(255, 247, 237, 0.98));
}

.kpi-warning::before {
    background: #d97706;
}

.kpi-danger {
    background: linear-gradient(180deg, rgba(254, 242, 242, 0.98), rgba(254, 226, 226, 0.98));
}

.kpi-danger::before {
    background: #dc2626;
}

.kpi-success {
    background: linear-gradient(180deg, rgba(240, 253, 244, 0.98), rgba(220, 252, 231, 0.98));
}

.kpi-success::before {
    background: #16a34a;
}

.kpi-info {
    background: linear-gradient(180deg, rgba(240, 249, 255, 0.98), rgba(224, 242, 254, 0.98));
}

.kpi-info::before {
    background: #0284c7;
}

.dashboard-kpi-row {
    --bs-gutter-y: 1rem;
}

.card .card-body > .h5,
.card .card-body > .h3 {
    letter-spacing: -0.02em;
}

.table td,
.table th {
    vertical-align: middle;
}

.status-badge {
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
}

.status-parsed,
.status-ok,
.status-resolved_validated {
    background: #dcfce7;
    color: #166534;
}

.status-manual_review,
.status-nok_presenti,
.status-open,
.status-assigned,
.status-in_progress {
    background: #fef3c7;
    color: #92400e;
}

.status-rejected,
.status-ko,
.status-failed,
.status-resolved_rejected {
    background: #fee2e2;
    color: #991b1b;
}

.status-default,
.status-not_parsed,
.status-unsupported {
    background: #e5e7eb;
    color: #374151;
}

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

.dashboard-table-shell {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.88);
    overflow: hidden;
}

.dashboard-table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.dashboard-table tbody tr:hover {
    background: rgba(14, 165, 233, 0.04);
}

.dashboard-table tbody tr.table-row-nok {
    background: rgba(255, 247, 237, 0.82);
}

.dashboard-table tbody tr.table-row-nok:hover {
    background: rgba(254, 215, 170, 0.4);
}

.dashboard-table tbody td a {
    color: #0f172a;
    font-weight: 600;
    text-decoration: none;
}

.dashboard-table tbody td a:hover {
    text-decoration: underline;
}

.breakdown-row + .breakdown-row {
    padding-top: 0.25rem;
}

.breakdown-track {
    background: #e2e8f0;
    border-radius: 999px;
    height: 0.7rem;
    overflow: hidden;
}

.breakdown-bar {
    height: 100%;
    border-radius: 999px;
}

.tone-success {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.tone-warning {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.tone-danger {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.tone-neutral {
    background: linear-gradient(90deg, #94a3b8, #64748b);
}

.tone-info {
    background: linear-gradient(90deg, #38bdf8, #0ea5e9);
}

.toolbar-card {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(8px);
}

.admin-section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.admin-section-tabs .btn {
    min-width: 8rem;
}

.global-footer {
    margin-top: 2rem;
    padding: 1rem 0 1.25rem;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(6px);
}

.global-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.9rem 1.2rem;
}

.global-footer-brand {
    font-weight: 600;
    color: #334155;
}

.global-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.global-footer-links a {
    color: #64748b;
    text-decoration: none;
}

.global-footer-links a:hover {
    color: #0f172a;
    text-decoration: underline;
}

.nok-value-indicator {
    display: inline-block;
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 999px;
    background: #dc2626;
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.12);
    vertical-align: middle;
}

@media (max-width: 768px) {
    .global-footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}

.payload-table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.payload-table {
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 0.8rem;
    overflow: hidden;
}

.payload-table thead th {
    border-bottom: 1px solid rgba(148, 163, 184, 0.38);
    border-right: 1px solid rgba(226, 232, 240, 0.95);
}

.payload-table thead th:last-child {
    border-right: none;
}

.payload-table tbody td {
    padding: 0.95rem 0.85rem;
    border-top: 1px solid rgba(226, 232, 240, 0.95);
    border-right: 1px solid rgba(241, 245, 249, 0.95);
    vertical-align: middle;
}

.payload-table tbody td:last-child {
    border-right: none;
}

.payload-table tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.96);
}

.payload-table tbody tr:hover {
    background: rgba(14, 165, 233, 0.06);
}

.payload-outcome-ok {
    color: #166534;
    font-weight: 700;
}

.payload-outcome-danger {
    color: #b91c1c;
    font-weight: 700;
}

.payload-outcome-neutral {
    color: #475569;
    font-weight: 700;
}

.payload-muted {
    color: #64748b;
}

.payload-table-wrapper {
    max-height: none;
    overflow: visible;
    border-radius: 0.8rem;
    border: none;
}

.payload-section-header {
    background: linear-gradient(90deg, #f1f5f9, #f8fafc) !important;
    border-top: 2px solid #e2e8f0;
}

.payload-section-header td {
    padding: 0.6rem 0.85rem !important;
    font-size: 0.85rem;
}

.payload-label-cell {
    color: #334155;
    max-width: 300px;
}

.payload-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-align: center;
    min-width: 3rem;
}

.payload-badge-ok {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
    border: 1px solid rgba(22, 163, 74, 0.25);
}

.payload-badge-nok {
    background: rgba(220, 38, 38, 0.12);
    color: #991b1b;
    border: 1px solid rgba(220, 38, 38, 0.25);
}

.payload-badge-na {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.payload-row-danger {
    background: rgba(254, 226, 226, 0.5) !important;
}

.payload-row-danger:hover {
    background: rgba(254, 226, 226, 0.7) !important;
}

.detail-page-header {
    padding: 1.25rem 1.4rem;
    border-radius: 1rem;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.94)),
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.08), transparent 30%);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.detail-section-card {
    overflow: hidden;
}

.detail-section-card .card-body {
    padding: 1.25rem 1.3rem;
}

.detail-metric-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
}

.detail-table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(148, 163, 184, 0.38);
    border-right: 1px solid rgba(226, 232, 240, 0.95);
}

.detail-table thead th:last-child {
    border-right: none;
}

.detail-table tbody td {
    padding: 0.9rem 0.85rem;
    border-top: 1px solid rgba(226, 232, 240, 0.95);
    border-right: 1px solid rgba(241, 245, 249, 0.95);
}

.detail-table tbody td:last-child {
    border-right: none;
}

.detail-table tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.96);
}

.detail-table tbody tr:hover {
    background: rgba(14, 165, 233, 0.06);
}

.detail-table,
.payload-table {
    box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.85);
}

.detail-tablist {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.detail-tab-button {
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: #fff;
    color: #475569;
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.15s ease;
}

.detail-tab-button:hover {
    border-color: rgba(14, 165, 233, 0.35);
    color: #0369a1;
    background: rgba(14, 165, 233, 0.05);
}

.detail-tab-button.active {
    border-color: #0ea5e9;
    background: rgba(14, 165, 233, 0.12);
    color: #0c4a6e;
}

.detail-expander summary {
    cursor: pointer;
    list-style: none;
}

.detail-expander-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    column-gap: 0.75rem;
}

.detail-expander-main {
    min-width: 0;
}

.detail-expander-badge {
    justify-self: end;
}

.detail-expander summary::-webkit-details-marker {
    display: none;
}

.detail-expander summary::after {
    content: "+";
    color: #64748b;
    font-size: 1.25rem;
    font-weight: 700;
    justify-self: end;
}

.detail-expander[open] summary::after {
    content: "-";
}

pre {
    max-height: 70vh;
}

/* ── Explorer / Shared Folder Browser ── */

.explorer-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.explorer-header:hover {
    background: rgba(14, 165, 233, 0.04);
}

.explorer-chevron {
    display: inline-block;
    font-size: 0.7rem;
    color: #64748b;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.explorer-chevron.open {
    transform: rotate(90deg);
}

.explorer-collapsible {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.explorer-collapsible.open {
    max-height: 2000px;
}

.explorer-container {
    display: flex;
    height: 65vh;
    min-height: 420px;
    max-height: 75vh;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.explorer-sidebar {
    width: 260px;
    min-width: 200px;
    border-right: 1px solid rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    background: #f8fafc;
}

.explorer-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.explorer-sidebar-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
}

.explorer-add-folder-btn {
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    border-radius: 0.4rem;
}

.explorer-tree {
    flex: 1;
    overflow-y: auto;
    padding: 0.4rem 0;
}

.explorer-tree-node {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.32rem 0.5rem;
    cursor: pointer;
    border-radius: 0.35rem;
    margin: 0 0.4rem;
    font-size: 0.88rem;
    color: #334155;
    user-select: none;
    transition: background 0.12s, box-shadow 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.explorer-tree-node:hover {
    background: rgba(14, 165, 233, 0.08);
}

.explorer-tree-node.active {
    background: rgba(14, 165, 233, 0.14);
    color: #0369a1;
    font-weight: 600;
}

.explorer-tree-node.drag-over {
    background: rgba(34, 197, 94, 0.18);
    box-shadow: inset 0 0 0 2px #22c55e;
}

.explorer-tree-toggle {
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.7rem;
    color: #94a3b8;
    transition: transform 0.15s;
}

.explorer-tree-toggle.expanded {
    transform: rotate(90deg);
}

.explorer-tree-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.explorer-tree-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.explorer-tree-children {
    padding-left: 0.9rem;
}

.explorer-new-folder {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

/* ── Main panel ── */

.explorer-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.explorer-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    background: #fafbfc;
}

.explorer-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.88rem;
}

.explorer-breadcrumb-sep {
    color: #94a3b8;
    font-size: 0.8rem;
}

.explorer-breadcrumb {
    padding: 0.15rem 0.45rem;
    border-radius: 0.3rem;
    border: none;
    background: none;
    color: #475569;
    cursor: pointer;
    font-size: 0.88rem;
    transition: background 0.12s;
}

.explorer-breadcrumb:hover {
    background: rgba(14, 165, 233, 0.1);
    color: #0369a1;
}

.explorer-breadcrumb.current {
    font-weight: 600;
    color: #0f172a;
    cursor: default;
}

.explorer-breadcrumb.current:hover {
    background: none;
    color: #0f172a;
}

/* ── Drop zone ── */

.explorer-drop-zone {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.explorer-drop-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(34, 197, 94, 0.08);
    border: 3px dashed #22c55e;
    border-radius: 0.75rem;
    margin: 0.5rem;
}

.explorer-drop-zone.dragging .explorer-drop-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
}

.explorer-drop-overlay-content {
    text-align: center;
    color: #166534;
}

.explorer-drop-icon {
    font-size: 2.5rem;
    margin-bottom: 0.25rem;
}

.explorer-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.explorer-empty-drop-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #64748b;
}

.explorer-empty-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* ── File/folder grid ── */

.explorer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
}

.explorer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.75rem 0.5rem;
    border-radius: 0.6rem;
    cursor: pointer;
    transition: background 0.12s, box-shadow 0.12s;
    position: relative;
    user-select: none;
    min-width: 0;
}

.explorer-item:hover {
    background: rgba(14, 165, 233, 0.06);
}

.explorer-item.explorer-selected {
    background: rgba(14, 165, 233, 0.12);
    box-shadow: inset 0 0 0 2px #3b82f6;
}

.explorer-item.drag-over {
    background: rgba(34, 197, 94, 0.15);
    box-shadow: inset 0 0 0 2px #22c55e;
}

.explorer-bulk-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #1e40af;
    color: #fff;
    font-size: 0.82rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
}

.explorer-bulk-bar .btn {
    font-size: 0.78rem;
    padding: 0.15rem 0.6rem;
}

.explorer-item-icon {
    font-size: 2.2rem;
    line-height: 1;
    margin-bottom: 0.3rem;
}

.explorer-item-name {
    font-size: 0.82rem;
    word-break: break-all;
    line-height: 1.3;
    max-width: 100%;
    color: #1e293b;
}

.explorer-item-meta {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 0.15rem;
}

.explorer-item-actions {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    display: flex;
    gap: 0.2rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.explorer-item:hover .explorer-item-actions {
    opacity: 1;
}

.explorer-item-download {
    width: 1.4rem;
    height: 1.4rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    border-radius: 0.3rem;
    border: 1px solid #93c5fd;
    background: #fff;
    color: #2563eb;
    cursor: pointer;
    transition: background 0.12s;
}

.explorer-item-download:hover {
    background: #dbeafe;
}

.explorer-item-delete {
    width: 1.4rem;
    height: 1.4rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border-radius: 0.3rem;
    border: 1px solid #fca5a5;
    background: #fff;
    color: #dc2626;
    cursor: pointer;
    transition: background 0.12s;
}

.explorer-item-delete:hover {
    background: #fee2e2;
}


/* ── Upload progress ── */

.explorer-progress {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.explorer-progress .progress {
    flex: 1;
}

.supplier-prefix-editor {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.supplier-prefix-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-height: 2rem;
}

.supplier-prefix-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #bae6fd;
    border-radius: 999px;
    padding: 0.25rem 0.55rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.supplier-prefix-chip button {
    border: none;
    background: transparent;
    color: #075985;
    padding: 0;
    line-height: 1;
    font-size: 0.9rem;
    cursor: pointer;
}

.supplier-prefix-input-row {
    display: flex;
    gap: 0.4rem;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .explorer-container {
        flex-direction: column;
        min-height: auto;
    }
    .explorer-sidebar {
        width: 100%;
        min-width: unset;
        border-right: none;
        border-bottom: 1px solid rgba(15, 23, 42, 0.08);
        max-height: 200px;
    }
    .explorer-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

@keyframes activity-pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.18);
        opacity: 0.7;
    }
}

@media (max-width: 768px) {
    .display-6 {
        font-size: 2rem;
    }
}

@media (min-width: 1200px) {
    .dashboard-kpi-col {
        flex: 0 0 16.6667%;
        width: 16.6667%;
    }

    .dashboard-kpi-col .display-6 {
        font-size: 2rem;
    }
}
