/* ═══════════════════════════════════════════════════════════════
   IGQC Web — Design System v4
   Colors: ALDI (navy #1C2378 · red #CC1020 · light blue #00A0E0)
   Style: Modern dashboard · clean cards · sidebar dark
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* ALDI Brand (from official logo) */
  --aldi-navy:       #1C2378;
  --aldi-navy-dk:    #131a5a;
  --aldi-navy-lt:    #eaecf8;
  --aldi-red:        #CC1020;
  --aldi-blue:       #00A0E0;
  --aldi-blue-lt:    #e0f4fc;

  /* Layout colors */
  --bg-app:          #f2f4f8;
  --bg-sidebar:      #131624;
  --bg-sidebar-item: rgba(255,255,255,.06);
  --bg-card:         #ffffff;

  /* Text */
  --text-primary:    #1a2240;
  --text-secondary:  #64748b;
  --text-muted:      #94a3b8;
  --text-sidebar:    #8fa4be;

  /* Borders & shadows */
  --border:          #e2e8f0;
  --border-light:    #f1f5f9;
  --shadow-sm:       0 1px 3px rgba(15,30,80,.06), 0 2px 8px rgba(15,30,80,.04);
  --shadow-md:       0 4px 16px rgba(15,30,80,.09);
  --shadow-lg:       0 8px 32px rgba(15,30,80,.13);
  --shadow-card:     0 0 0 1px rgba(15,30,80,.05), 0 2px 8px rgba(15,30,80,.06);

  /* Semantic */
  --ok:          #10b981; --ok-bg:   #dcfce7; --ok-txt:  #065f46;
  --warn:        #f59e0b; --warn-bg: #fef3c7; --warn-txt:#92400e;
  --error:       #ef4444; --err-bg:  #fee2e2; --err-txt: #991b1b;
  --info:        #3b82f6; --info-bg: #dbeafe; --info-txt:#1e40af;

  /* Radii */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;

  /* Dimensions */
  --sidebar-w:    230px;
  --sidebar-w-sm:  52px;
  --topbar-h:      58px;
  --sidebar-tr:    width .22s cubic-bezier(.4,0,.2,1), min-width .22s cubic-bezier(.4,0,.2,1);
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--aldi-navy); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--aldi-navy-dk); }
img { max-width: 100%; }
strong, .font-bold { font-weight: 600; }
code {
  font-family: 'Courier New', monospace;
  background: var(--bg-app);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .87em;
  color: var(--aldi-navy);
}

/* ─── App shell ──────────────────────────────────────────────── */
.app-shell { display: flex; min-height: calc(100vh - var(--topbar-h)); }

/* ─── Topbar ──────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 200;
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center;
  padding: 0 20px 0 0;
}
.topbar-brand {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  height: 100%;
  background: var(--bg-sidebar);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px 0 18px;
  flex-shrink: 0;
  transition: var(--sidebar-tr);
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.topbar-right {
  display: flex; align-items: center;
  gap: 10px; margin-left: auto;
}
.app-logo {
  height: 34px; width: auto;
  object-fit: contain; flex-shrink: 0;
  /* PNG logo has own colors — no filter needed */
}
.app-name {
  font-size: .88rem; font-weight: 700; color: #fff;
  letter-spacing: -.01em; white-space: nowrap;
  overflow: hidden; transition: opacity .18s, width .2s;
}
.user-name {
  font-size: .8rem; color: var(--text-secondary); font-weight: 500;
}
.badge-admin {
  background: rgba(255,255,255,.12); color: #fff;
  border-radius: 20px; padding: 2px 9px;
  font-size: .68rem; font-weight: 700;
}

/* Sidebar toggle btn */
#sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); padding: 6px;
  border-radius: var(--r-md); transition: all .15s;
  margin-left: 6px; flex-shrink: 0;
}
#sidebar-toggle:hover { background: var(--bg-app); color: var(--aldi-navy); }

/* Mobile hamburger */
#mobile-menu-btn {
  display: none; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); padding: 8px; margin-right: 4px;
}

/* ─── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  padding: 12px 0 24px;
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overflow-x: hidden;
  flex-shrink: 0;
  transition: var(--sidebar-tr);
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 3px; }

.sidebar ul { list-style: none; padding: 0 8px; }
.sidebar li { margin-bottom: 1px; }
.sidebar li a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; border-radius: var(--r-md);
  color: var(--text-sidebar); font-size: .83rem; font-weight: 500;
  transition: all .15s; white-space: nowrap; overflow: hidden;
}
.sidebar li a:hover {
  background: var(--bg-sidebar-item); color: #fff; text-decoration: none;
}
.sidebar li.active a {
  background: linear-gradient(90deg, var(--aldi-navy) 0%, var(--aldi-blue) 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(0,160,224,.3);
}
.nav-icon  { font-size: .95rem; flex-shrink: 0; width: 20px; text-align: center; }
.nav-label { overflow: hidden; transition: opacity .15s, width .15s; white-space: nowrap; }
.nav-section {
  padding: 18px 14px 5px;
  font-size: .64rem; text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255,255,255,.2); font-weight: 700; white-space: nowrap;
}
.badge-count {
  margin-left: auto; background: var(--aldi-red); color: #fff;
  border-radius: 10px; padding: 1px 6px; font-size: .66rem; font-weight: 700;
}
.sidebar hr {
  border: none; border-top: 1px solid rgba(255,255,255,.06); margin: 8px 10px;
}

/* ─── Sidebar collapsed ─────────────────────────────────────── */
body.sidebar-collapsed .sidebar     { width: var(--sidebar-w-sm); min-width: var(--sidebar-w-sm); }
body.sidebar-collapsed .topbar-brand{ width: var(--sidebar-w-sm); min-width: var(--sidebar-w-sm); }
body.sidebar-collapsed .app-name    { opacity: 0; width: 0; overflow: hidden; }
body.sidebar-collapsed .nav-label   { opacity: 0; width: 0; overflow: hidden; }
body.sidebar-collapsed .nav-section { opacity: 0; height: 0; padding: 0; }
body.sidebar-collapsed .badge-count { display: none; }
body.sidebar-collapsed .sidebar li a { justify-content: center; padding: 10px; }
body.sidebar-collapsed .sidebar hr  { margin: 6px 4px; }

/* Tooltip on collapsed */
body.sidebar-collapsed .sidebar li a {
  position: relative;
}
body.sidebar-collapsed .sidebar li a::after {
  content: attr(data-tooltip);
  position: absolute; left: calc(var(--sidebar-w-sm) + 8px); top: 50%;
  transform: translateY(-50%);
  background: rgba(15,25,50,.92); color: #fff;
  padding: 5px 10px; border-radius: var(--r-sm);
  font-size: .76rem; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 300;
}
body.sidebar-collapsed .sidebar li a:hover::after { opacity: 1; }

/* ─── Tooltip (global, non-sidebar) ─────────────────────────── */
/* Tooltips are rendered via JS to avoid overflow/clipping issues */
.igqc-tooltip {
  position: fixed;
  z-index: 9999;
  background: rgba(13, 18, 45, .94);
  color: #fff;
  padding: 6px 11px;
  border-radius: 6px;
  font-size: .73rem;
  font-weight: 500;
  line-height: 1.4;
  max-width: 240px;
  text-align: center;
  pointer-events: none;
  white-space: normal;
  word-break: break-word;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  opacity: 0;
  transition: opacity .12s;
}
.igqc-tooltip.visible { opacity: 1; }
.igqc-tooltip::after {
  content: '';
  position: absolute;
  left: var(--arrow-left, 50%);
  transform: translateX(-50%);
  border: 5px solid transparent;
}
.igqc-tooltip.above::after {
  top: 100%;
  border-top-color: rgba(13,18,45,.94);
}
.igqc-tooltip.below::after {
  bottom: 100%;
  border-bottom-color: rgba(13,18,45,.94);
}

/* ─── Main content ───────────────────────────────────────────── */
.main-content { flex: 1; padding: 22px; min-width: 0; overflow-x: hidden; }

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow .18s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-header h3 { font-size: .88rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.card-body { padding: 18px; }
.mt-2, .card.mt-2 { margin-top: 14px; }
.mb-2, .card.mb-2 { margin-bottom: 14px; }
.subtext { color: var(--text-muted); font-size: .74rem; }

/* ─── KPI cards ──────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.kpi-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 16px;
  position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-card::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--aldi-navy), var(--aldi-blue));
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.kpi-card.kpi-warn::after  { background: var(--warn); }
.kpi-card.kpi-ok::after    { background: var(--ok); }
.kpi-card.kpi-red::after   { background: var(--aldi-red); }
.kpi-label {
  font-size: .68rem; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px;
}
.kpi-value {
  font-size: 1.75rem; font-weight: 700; color: var(--text-primary);
  letter-spacing: -.03em; line-height: 1.1;
}
.kpi-card.kpi-warn .kpi-value { color: var(--warn); }
.kpi-card.kpi-red  .kpi-value { color: var(--aldi-red); }

/* ─── Page header ────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.page-header h2 {
  font-size: 1.1rem; font-weight: 700;
  color: var(--text-primary); letter-spacing: -.02em;
}
.page-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; align-items: center; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--r-md);
  border: 1.5px solid var(--border); background: var(--bg-card);
  cursor: pointer; font-size: .82rem; font-weight: 500;
  color: var(--text-secondary); transition: all .15s;
  white-space: nowrap; font-family: inherit; line-height: 1;
}
.btn:hover {
  border-color: var(--aldi-navy); color: var(--aldi-navy);
  background: var(--aldi-navy-lt); text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--aldi-navy) 0%, var(--aldi-blue) 100%);
  color: #fff; border-color: var(--aldi-navy);
  box-shadow: 0 2px 8px rgba(28,35,120,.22);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--aldi-navy-dk) 0%, var(--aldi-navy) 100%);
  border-color: var(--aldi-navy-dk); color: #fff;
  box-shadow: 0 4px 14px rgba(28,35,120,.32);
}
.btn-secondary { background: var(--bg-app); border-color: var(--border); }
.btn-danger    { background: var(--aldi-red); color: #fff; border-color: var(--aldi-red); }
.btn-danger:hover { background: #a50d1a; color: #fff; border-color: #a50d1a; }
.btn-warn      { background: var(--warn); color: #fff; border-color: var(--warn); }
.btn-ok        { background: var(--ok);   color: #fff; border-color: var(--ok);  }
.btn-ghost     { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-full      { width: 100%; justify-content: center; }

.btn-sm {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: var(--bg-card);
  cursor: pointer; font-size: .74rem; font-weight: 500;
  color: var(--text-secondary); transition: all .14s;
  white-space: nowrap; font-family: inherit;
}
.btn-sm:hover {
  border-color: var(--aldi-navy); color: var(--aldi-navy);
  background: var(--aldi-navy-lt); text-decoration: none;
}
.btn-sm.btn-ok     { background: var(--ok);      color: #fff; border-color: var(--ok); }
.btn-sm.btn-warn   { background: var(--warn);     color: #fff; border-color: var(--warn); }
.btn-sm.btn-danger { background: var(--aldi-red); color: #fff; border-color: var(--aldi-red); }
.btn-sm.btn-active { background: var(--aldi-navy);color: #fff; border-color: var(--aldi-navy); }
.ml-1 { margin-left: 8px; }

/* ─── Forms ───────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field > label {
  display: block; font-weight: 600; font-size: .7rem;
  color: var(--text-secondary); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .05em;
}
.field-hint { color: var(--text-muted); font-size: .72rem; margin-top: 3px; }
input[type=text], input[type=password], input[type=email],
input[type=date],  input[type=time], select, textarea {
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  padding: 9px 12px; font-size: .84rem; width: 100%;
  color: var(--text-primary); background: var(--bg-card);
  font-family: inherit; transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--aldi-navy);
  box-shadow: 0 0 0 3px rgba(28,35,120,.1);
}
.input-sm   { width: auto !important; display: inline-block; }
.input-full { width: 100%; }
.form-row   { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-grid  { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 13px; }
.form-actions { display: flex; gap: 8px; padding-top: 8px; }
.checkbox-label {
  display: flex; align-items: center; gap: 7px;
  cursor: pointer; font-weight: normal; font-size: .84rem;
}
.toggle-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-weight: normal; font-size: .84rem;
}
.mt-1 { margin-top: 8px; }

/* ─── Expand panel (inline) ──────────────────────────────────── */
.expand-panel {
  display: none;
  animation: fadeSlide .18s ease-out;
}
.expand-panel.open { display: block; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(-6px); } }

/* ─── Tables ──────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; }
.data-table   { width: 100%; border-collapse: collapse; font-size: .79rem; }
.data-table thead th {
  background: var(--bg-app); color: var(--text-secondary);
  font-weight: 700; font-size: .68rem;
  text-transform: uppercase; letter-spacing: .07em;
  padding: 10px 13px; text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap; position: sticky; top: 0;
}
.data-table thead th a { color: var(--text-secondary); font-weight: 700; }
.data-table thead th a:hover { color: var(--aldi-navy); text-decoration: none; }
.data-table td {
  padding: 10px 13px; border-bottom: 1px solid var(--border-light);
  vertical-align: middle; color: var(--text-primary);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover td { background: var(--aldi-navy-lt); }
.data-table tr.row-rejected td { background: #fff5f5; }
.data-table tr.row-inactive td { opacity: .5; }
.data-table .text-center { text-align: center; }
.path-cell code { font-size: .7rem; color: var(--text-muted); word-break: break-all; }
.small  { font-size: .74rem; }
.tiny   { font-size: .67rem; }

/* ─── Status ──────────────────────────────────────────────────── */
.status-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 4px; flex-shrink: 0;
}
.dot-ok   { background: var(--ok);    box-shadow: 0 0 0 3px rgba(16,185,129,.15); }
.dot-warn { background: var(--warn);  box-shadow: 0 0 0 3px rgba(245,158,11,.15); }
.dot-err  { background: var(--aldi-red); box-shadow: 0 0 0 3px rgba(204,16,32,.15); }

.badge-soc {
  display: inline-flex; align-items: center;
  background: var(--aldi-navy-lt); color: var(--aldi-navy);
  border-radius: 20px; padding: 2px 9px;
  font-size: .69rem; font-weight: 700; letter-spacing: .04em;
}
.badge-you {
  background: var(--ok-bg); color: var(--ok-txt);
  border-radius: 20px; padding: 1px 7px; font-size: .66rem;
  font-weight: 600; margin-left: 4px;
}
.badge-role    { border-radius: 20px; padding: 2px 9px; font-size: .69rem; font-weight: 600; }
.badge-admin   { background: rgba(255,255,255,.12); color: #fff;
                  border-radius: 20px; padding: 2px 9px; font-size: .68rem; font-weight: 700; }
.badge-admin-r { background: #ede9fe; color: #5b21b6; }
.badge-usuario { background: var(--info-bg); color: var(--info-txt); }

.status-badge {
  display: inline-block; border-radius: 20px;
  padding: 3px 9px; font-size: .69rem; font-weight: 600;
}
.status-processed, .status-ok { background: var(--ok-bg);   color: var(--ok-txt); }
.status-pending                { background: var(--warn-bg); color: var(--warn-txt); }
.status-error                  { background: var(--err-bg);  color: var(--err-txt); }
.status-info                   { background: var(--info-bg); color: var(--info-txt); }
.status-keep_new               { background: var(--ok-bg);   color: var(--ok-txt); }
.status-keep_old, .status-skipped { background: var(--bg-app); color: var(--text-secondary); }
.status-badge.badge-warn       { background: var(--warn-bg); color: var(--warn-txt); }

/* ─── Topbar pills ───────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 20px; font-size: .72rem; font-weight: 600;
}
.pill-ok   { background: var(--ok-bg);   color: var(--ok-txt); }
.pill-warn { background: var(--warn-bg); color: var(--warn-txt); text-decoration: none; }
.pill-warn:hover { background: #fde68a; text-decoration: none; }
.pill-dup  { background: var(--err-bg);  color: var(--err-txt); text-decoration: none; }
.pill-dup:hover { background: #fecaca; text-decoration: none; }

/* ─── Alerts ──────────────────────────────────────────────────── */
.alert {
  border-radius: var(--r-md); padding: 11px 16px; margin-bottom: 13px;
  font-size: .83rem; display: flex; align-items: flex-start; gap: 8px;
}
.alert-ok   { background: var(--ok-bg);   border-left: 4px solid var(--ok);   color: var(--ok-txt); }
.alert-warn { background: var(--warn-bg); border-left: 4px solid var(--warn); color: var(--warn-txt); }
.alert-info { background: var(--aldi-navy-lt); border-left: 4px solid var(--aldi-navy); color: var(--aldi-navy); }

.flash {
  border-radius: var(--r-md); padding: 11px 16px; margin-bottom: 9px;
  font-size: .83rem; display: flex; align-items: center;
  justify-content: space-between; gap: 10px; box-shadow: var(--shadow-sm);
}
.flash button {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; line-height: 1; color: inherit; opacity: .55;
}
.flash button:hover { opacity: 1; }
.flash-ok, .flash-success { background: var(--ok-bg);   border-left: 4px solid var(--ok);   color: var(--ok-txt); }
.flash-error              { background: var(--err-bg);  border-left: 4px solid var(--aldi-red); color: var(--err-txt); }
.flash-info               { background: var(--aldi-navy-lt); border-left: 4px solid var(--aldi-navy); color: var(--aldi-navy); }
.flash-warn               { background: var(--warn-bg); border-left: 4px solid var(--warn); color: var(--warn-txt); }

.info-box {
  background: var(--aldi-navy-lt);
  border-left: 4px solid var(--aldi-navy);
  border-radius: var(--r-md);
  padding: 11px 15px; font-size: .83rem; color: var(--aldi-navy);
}

/* ─── Filters ────────────────────────────────────────────────── */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; padding: 12px 0;
}
.filter-group > label:first-child {
  display: block; font-weight: 700; font-size: .69rem;
  color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: .07em; margin-bottom: 6px;
}
.filter-group-wide { grid-column: 1 / -1; }
.multi-check {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 120px; overflow-y: auto;
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  padding: 7px 10px; background: var(--bg-app);
}
.multi-check::-webkit-scrollbar { width: 3px; }
.multi-check::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.multi-check label {
  display: flex; align-items: center; gap: 7px; cursor: pointer;
  font-size: .79rem; font-weight: 400; text-transform: none;
  letter-spacing: 0; color: var(--text-primary);
}
.date-range { display: flex; align-items: center; gap: 7px; }
.date-range input { flex: 1; min-width: 0; }
.filter-actions {
  display: flex; gap: 7px; flex-wrap: wrap;
  padding-top: 10px; border-top: 1px solid var(--border-light); margin-top: 5px;
}
.export-group { display: flex; gap: 4px; margin-left: auto; }
.filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--bg-card); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card); padding: 11px 15px;
}
.filter-bar label { font-weight: 500; font-size: .8rem; color: var(--text-secondary); }
.check-inline { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; cursor: pointer; }

/* ─── Collapsible ────────────────────────────────────────────── */
.collapsible-header {
  display: flex; align-items: center; cursor: pointer;
  user-select: none; gap: 8px;
  padding: 13px 18px; border-bottom: 1px solid var(--border-light);
}
.collapsible-header:hover { background: var(--bg-app); }
.collapsible-header h3 { font-size: .88rem; font-weight: 700; color: var(--text-primary); margin: 0; flex: 1; }
.collapsible-arrow { color: var(--text-muted); font-size: .78rem; transition: transform .2s; flex-shrink: 0; }
.collapsible-header.open .collapsible-arrow { transform: rotate(180deg); }
.collapsible-body { overflow: hidden; transition: max-height .25s ease, opacity .2s; }
.collapsible-body.closed { max-height: 0 !important; opacity: 0; overflow: hidden; }
.no-data-msg {
  padding: 28px; text-align: center; color: var(--text-muted); font-size: .83rem;
}

/* ─── Column selector ────────────────────────────────────────── */
.col-selector-panel {
  background: var(--bg-card); border-radius: var(--r-lg);
  box-shadow: var(--shadow-md); padding: 13px 15px; margin-bottom: 13px;
}
.col-selector-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-weight: 600; font-size: .83rem; color: var(--text-primary);
}
.col-list { list-style: none; display: flex; flex-wrap: wrap; gap: 5px; }
.col-item {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-app); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: 4px 10px;
  font-size: .76rem; font-weight: 500; cursor: default;
  user-select: none; transition: border-color .13s;
}
.col-item:hover { border-color: var(--aldi-navy); }
.drag-handle { cursor: grab; color: var(--text-muted); font-size: .9rem; }

/* ─── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 15px; border-top: 1px solid var(--border-light);
  font-size: .78rem; color: var(--text-secondary);
}
.pagination-info { margin-left: auto; color: var(--text-muted); font-size: .73rem; }

/* ─── Charts ──────────────────────────────────────────────────── */
.chart-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px;
}
.chart-card { background: var(--bg-card); border-radius: var(--r-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.chart-card-inner { padding: 18px; }
.chart-card h4 {
  font-size: .7rem; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .07em;
}
.chart-full { grid-column: 1 / -1; }
.progress-bar {
  position: relative; background: var(--bg-app);
  border-radius: 20px; height: 20px; overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 20px; transition: width .4s; }
.progress-bar span { position: absolute; right: 7px; top: 2px; font-size: .7rem; font-weight: 700; }

/* ─── Modal ───────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; background: rgba(10,15,45,.5);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 300;
}
.modal-box {
  background: var(--bg-card); border-radius: var(--r-xl); padding: 26px;
  min-width: 320px; max-width: 500px; width: 90%; box-shadow: var(--shadow-lg);
}
.modal-box h3 { margin-bottom: 15px; font-size: .98rem; font-weight: 700; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }

/* ─── Drop zone ──────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--r-lg);
  padding: 28px 20px; text-align: center; cursor: pointer;
  transition: all .18s; color: var(--text-muted); background: var(--bg-app); font-size: .84rem;
}
.drop-zone.dz-over { border-color: var(--aldi-navy); background: var(--aldi-navy-lt); color: var(--aldi-navy); }

/* ─── Code blocks ─────────────────────────────────────────────── */
.code-block {
  display: block; background: #131624; color: #4ade80;
  padding: 10px 14px; border-radius: var(--r-md); margin: 5px 0;
  font-family: 'Courier New', monospace; font-size: .77rem;
  overflow-x: auto; white-space: nowrap;
}
.cron-hint { background: var(--bg-app); border-radius: var(--r-md); padding: 11px 13px; font-size: .79rem; }
.test-result { margin-top: 7px; font-size: .79rem; padding: 6px 10px; border-radius: var(--r-sm); }
.test-ok   { background: var(--ok-bg);   color: var(--ok-txt); }
.test-fail { background: var(--err-bg);  color: var(--err-txt); }
.upload-info { background: var(--bg-app); border-radius: var(--r-md); padding: 9px 12px; font-size: .74rem; line-height: 1.7; }

/* ─── Action group ────────────────────────────────────────────── */
.action-group { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }

/* ─── Footer ──────────────────────────────────────────────────── */
.app-footer {
  background: var(--bg-card); border-top: 1px solid var(--border);
  padding: 9px 22px; font-size: .71rem; color: var(--text-muted); text-align: center;
}

/* ─── Login ───────────────────────────────────────────────────── */
.login-body {
  background: linear-gradient(145deg, #0a0e2e 0%, #1C2378 50%, #00A0E0 100%);
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 20px;
}
.login-card {
  background: var(--bg-card); border-radius: var(--r-xl);
  padding: 36px 38px; width: 100%; max-width: 390px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-header { text-align: center; margin-bottom: 26px; }
.login-logo   { height: 72px; margin-bottom: 14px; object-fit: contain; }
.login-header h1 {
  font-size: 1.25rem; font-weight: 700; color: var(--text-primary); letter-spacing: -.02em;
}
.login-subtitle { color: var(--text-muted); font-size: .82rem; margin-top: 4px; }
.login-form { margin-top: 16px; }

/* ─── Utilities ───────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-ok     { color: var(--ok); }
.text-warn   { color: var(--warn); }
.text-error  { color: var(--aldi-red); }
.text-center { text-align: center; }
.ml-auto     { margin-left: auto; }
.link-sm     { font-size: .73rem; color: var(--aldi-navy); }
.row-inactive td { opacity: .5; }

/* ─── Responsive tablet (≤1024px) ───────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 195px; }
  .kpi-grid   { grid-template-columns: repeat(3, 1fr); }
  .chart-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Responsive mobile (≤768px) ────────────────────────────── */
@media (max-width: 768px) {
  :root { --topbar-h: 52px; }
  .topbar-brand { width: var(--sidebar-w-sm) !important; min-width: var(--sidebar-w-sm) !important; }
  .app-name { display: none; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0;
    height: calc(100vh - var(--topbar-h)); z-index: 150;
    transform: translateX(-100%); transition: transform .22s ease;
    width: var(--sidebar-w) !important; min-width: var(--sidebar-w) !important;
  }
  .sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  /* Reset collapsed styles on mobile */
  body.sidebar-collapsed .sidebar    { transform: translateX(-100%); }
  body.sidebar-collapsed .sidebar.mobile-open { transform: translateX(0); }
  body.sidebar-collapsed .sidebar .nav-label  { opacity: 1 !important; width: auto !important; }
  body.sidebar-collapsed .sidebar .nav-section{ opacity: 1 !important; height: auto !important; padding: 18px 14px 5px !important; }
  body.sidebar-collapsed .sidebar .badge-count{ display: inline-block !important; }
  body.sidebar-collapsed .sidebar li a { justify-content: flex-start !important; padding: 9px 13px !important; }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 140; top: var(--topbar-h);
  }
  .sidebar-overlay.visible { display: block; }
  #mobile-menu-btn { display: flex !important; }
  .main-content { padding: 13px; }
  .kpi-grid   { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .chart-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr; }
  .export-group { margin-left: 0; }
  .topbar-right .user-name { display: none; }
  .topbar-right .status-pill:not(.pill-dup) { display: none; }
  .data-table { font-size: .72rem; }
  .data-table th, .data-table td { padding: 7px 9px; }
  .page-header { gap: 7px; }
  .page-header h2 { font-size: .95rem; }
}

@media print {
  .sidebar, .topbar, .app-footer, .page-actions,
  .filter-bar, .filter-actions, .pagination, .btn, .btn-sm { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .main-content { padding: 0; }
}
