/* ── Reset & base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; font-size: 14px;
       background: #f0f2f5; color: #1a1a2e; }

/* ── App wrapper ─────────────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar { width: 220px; background: #1e2a3a; color: #c9d1d9;
           display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-logo { display: flex; align-items: center; gap: 10px;
                padding: 20px 16px; border-bottom: 1px solid #30363d;
                font-size: 16px; font-weight: 700; color: #fff; }
.logo-icon { font-size: 22px; }
.nav-links { list-style: none; padding: 12px 0; flex: 1; }
.nav-links li a { display: block; padding: 10px 16px; color: #8b949e;
                  text-decoration: none; border-radius: 6px; margin: 2px 8px;
                  transition: background .15s, color .15s; }
.nav-links li a:hover, .nav-links li.active a { background: #264d6e; color: #fff; }
.sidebar-footer { padding: 16px; border-top: 1px solid #30363d; }
.btn-reimport { display: block; text-align: center; padding: 8px 12px;
                background: #264d6e; color: #58a6ff; border-radius: 6px;
                text-decoration: none; font-size: 13px; }
.btn-reimport:hover { background: #388bfd; color: #fff; }

/* ── Main content ─────────────────────────────────────────────────────── */
.main-content { flex: 1; padding: 24px; overflow-y: auto; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: #1a1a2e; }
.page-header p  { color: #555; margin-top: 4px; font-size: 13px; }

/* ── KPI Cards ────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 16px; margin-bottom: 24px; }
.kpi-card { background: #fff; border-radius: 10px; padding: 20px;
            box-shadow: 0 1px 4px rgba(0,0,0,.08); border-left: 4px solid #388bfd; }
.kpi-card.red    { border-left-color: #f85149; }
.kpi-card.orange { border-left-color: #d29922; }
.kpi-card.green  { border-left-color: #3fb950; }
.kpi-label { font-size: 12px; color: #888; text-transform: uppercase;
             letter-spacing: .5px; margin-bottom: 6px; }
.kpi-value { font-size: 26px; font-weight: 700; color: #1a1a2e; }
.kpi-sub   { font-size: 12px; color: #aaa; margin-top: 4px; }

/* ── Section headers ─────────────────────────────────────────────────── */
.section-title { font-size: 15px; font-weight: 600; color: #1a1a2e;
                 margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.carrier-badge { display: inline-block; padding: 2px 8px; border-radius: 12px;
                 font-size: 11px; font-weight: 600; }
.badge-jetpack { background: #1f3a4f; color: #58a6ff; }
.badge-fiabilo { background: #2d2a1f; color: #d29922; }

/* ── Filter bar ──────────────────────────────────────────────────────── */
.filter-bar { background: #fff; border-radius: 10px; padding: 16px;
              box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 20px;
              display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-bar label { font-size: 12px; color: #555; display: flex;
                    flex-direction: column; gap: 4px; }
.filter-bar input, .filter-bar select { padding: 6px 10px; border: 1px solid #d0d7de;
  border-radius: 6px; font-size: 13px; background: #f6f8fa; }
.btn { padding: 7px 16px; border-radius: 6px; border: none; cursor: pointer;
       font-size: 13px; font-weight: 600; text-decoration: none; display: inline-flex;
       align-items: center; gap: 6px; }
.btn-primary   { background: #388bfd; color: #fff; }
.btn-primary:hover   { background: #264d6e; }
.btn-secondary { background: #f0f2f5; color: #1a1a2e; }
.btn-secondary:hover { background: #d0d7de; }

/* ── Data table ──────────────────────────────────────────────────────── */
.table-wrap { background: #fff; border-radius: 10px; overflow: auto;
              box-shadow: 0 1px 4px rgba(0,0,0,.08); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700;
           text-transform: uppercase; letter-spacing: .4px; color: #555;
           background: #f6f8fa; border-bottom: 1px solid #d0d7de;
           white-space: nowrap; cursor: pointer; user-select: none; }
thead th:hover { background: #e8edf2; }
tbody td { padding: 9px 14px; border-bottom: 1px solid #eef0f3; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f6f8fa; }

/* Row status colors */
tr.EXACT     { background: #f0fff4; }
tr.SOUS_PAYE { background: #fff5f5; }
tr.SUR_PAYE  { background: #fffbf0; }
tr.EXACT:hover     { background: #e3fce9; }
tr.SOUS_PAYE:hover { background: #ffe8e8; }
tr.SUR_PAYE:hover  { background: #fff2d6; }

/* Status badges in table */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px;
         font-size: 11px; font-weight: 700; }
.badge-exact   { background: #dafbe1; color: #116329; }
.badge-sous    { background: #ffd7d7; color: #a40000; }
.badge-sur     { background: #fff3cd; color: #664d03; }
.badge-dbseul  { background: #e8edf2; color: #333; }
.badge-carrier { background: #f0e6ff; color: #5a00c2; }

/* ── Amount diff ─────────────────────────────────────────────────────── */
.ecart-neg  { color: #cf222e; font-weight: 700; }
.ecart-pos  { color: #d29922; font-weight: 700; }
.ecart-zero { color: #3fb950; }

/* ── Unmatched panels ────────────────────────────────────────────────── */
.unmatched-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.panel-header { padding: 14px 16px; border-bottom: 1px solid #eef0f3;
                font-weight: 600; font-size: 14px; display: flex;
                justify-content: space-between; align-items: center; }
.panel-body { max-height: 600px; overflow-y: auto; }
.panel-item { padding: 10px 14px; border-bottom: 1px solid #f0f2f5;
              cursor: pointer; transition: background .1s; }
.panel-item:hover { background: #f6f8fa; }
.panel-item.selected { background: #e8f4ff; border-left: 3px solid #388bfd; }
.panel-item .code   { font-size: 12px; font-family: monospace; color: #555; }
.panel-item .name   { font-weight: 600; font-size: 13px; }
.panel-item .amount { font-size: 13px; font-weight: 600; color: #1a1a2e; }

/* ── Match action ────────────────────────────────────────────────────── */
.match-action { text-align: center; margin: 16px 0; }
#match-btn { font-size: 15px; padding: 10px 24px; display: none; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .unmatched-wrap { grid-template-columns: 1fr; }
}

/* ── Print styles ────────────────────────────────────────────────────── */
@media print {
    .sidebar, .filter-bar, .btn { display: none !important; }
    .main-content { padding: 0; }
    tr.SOUS_PAYE { background: #ffe !important; }
}
