/* ═══════════════════════════════════════════════════════════════
   IGQC Web — Design System v5
   Brand Identity: ALDI Nord (analyzed from official logo + brand book)
   
   PRIMARY COLORS (from logo pixel analysis):
   • ALDI Navy    #1E2878  — Pantone 2728 C — main brand color
   • ALDI Red     #CC1020  — Pantone 485 C  — accent/alert only
   • ALDI Blue    #00A9E0  — Pantone 2985 C — interactive / data
   
   TYPOGRAPHY:
   • ALDI Sans (proprietary) → Inter as digital substitute
   • Headers: 700, tight letter-spacing -0.02em
   • Body: 400, normal
   • Labels: 600, uppercase, +0.06em
   ═══════════════════════════════════════════════════════════════ */

/* Fonts: loaded from assets/fonts.css → system fonts, no CDN */

:root {
  /* ── ALDI Brand Colors ── */
  --aldi-navy:       #1E2878;
  --aldi-navy-dk:    #141960;
  --aldi-navy-md:    #2A3496;
  --aldi-navy-lt:    #E8EAF6;
  --aldi-navy-xlt:   #F3F4FB;
  --aldi-red:        #CC1020;
  --aldi-red-dk:     #A50D1A;
  --aldi-red-lt:     #FDECEA;
  --aldi-blue:       #00A9E0;
  --aldi-blue-dk:    #007DAA;
  --aldi-blue-lt:    #E0F5FC;

  /* ── UI Colors ── */
  --bg-app:          #F4F5F9;
  --bg-sidebar:      #ffffff;   /* White sidebar */
  --bg-sidebar-hover:#f0f4ff;
  --bg-card:         #FFFFFF;
  --bg-card-hover:   #FAFBFF;

  /* ── Text ── */
  --text-primary:    #1A1D2E;
  --text-secondary:  #5A6275;
  --text-muted:      #9AA3B5;
  --text-sidebar:    #3a4060;
  --text-on-navy:    #FFFFFF;

  /* ── Borders ── */
  --border:          #E4E7EF;
  --border-light:    #EEF0F7;
  --border-focus:    var(--aldi-navy);

  /* ── Shadows ── */
  --shadow-xs: 0 1px 2px rgba(20,25,80,.04);
  --shadow-sm: 0 1px 4px rgba(20,25,80,.06), 0 2px 8px rgba(20,25,80,.04);
  --shadow-md: 0 4px 16px rgba(20,25,80,.09);
  --shadow-lg: 0 8px 32px rgba(20,25,80,.13);

  /* ── Semantic (keep accessible) ── */
  --ok:        #0D8A4E; --ok-bg:   #D1F5E4; --ok-txt:  #065F46;
  --warn:      #D97706; --warn-bg: #FEF3C7; --warn-txt:#92400E;
  --error:     #CC1020; --err-bg:  #FDECEA; --err-txt: #9B0D19;
  --info:      #00A9E0; --info-bg: #E0F5FC; --info-txt:#006B8F;

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

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

/* ─── Reset & Base ───────────────────────────────────────────── */
*, *::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: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
/* ── Link states: override ALL browser defaults ── */
a                { color: var(--aldi-navy); text-decoration: none; }
a:visited        { color: var(--aldi-navy); }
a:hover          { color: var(--aldi-navy-dk); text-decoration: underline; }
a:active         { color: var(--aldi-navy-dk); }
a:focus-visible  { outline: 2px solid var(--aldi-blue); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; }
strong, .font-bold { font-weight: 600; }
code {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  background: var(--aldi-navy-xlt);
  color: var(--aldi-navy);
  padding: 2px 6px;
  border-radius: var(--r-xs);
  font-size: .87em;
}

/* ─── 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: #1E2878;
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px 0 16px;
  flex-shrink: 0;
  transition: var(--tr-sidebar);
  /* Red top accent matches logo border */
  border-top: 3px solid var(--aldi-red);
  border-right: 1px solid rgba(255,255,255,.15);
}
.topbar-right {
  display: flex; align-items: center;
  gap: 10px; margin-left: auto;
}
.app-logo {
  height: 32px; width: auto;
  object-fit: contain; flex-shrink: 0;
}
.app-logo-wrap {
  background: #ffffff;
  border-radius: 6px;
  padding: 4px 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.app-name {
  font-size: .86rem; font-weight: 700; color: #fff;
  letter-spacing: -.01em; white-space: nowrap;
  overflow: hidden; transition: opacity .18s, width .2s;
}
.user-name {
  font-size: .79rem; color: var(--text-secondary); font-weight: 500;
}
.badge-admin {
  background: var(--aldi-navy-lt); color: var(--aldi-navy);
  border-radius: 20px; padding: 2px 10px;
  font-size: .67rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase;
}

/* 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(--aldi-navy-lt); 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: #ffffff !important;
  padding: 0;
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overflow-x: hidden;
  flex-shrink: 0;
  transition: var(--tr-sidebar);
  border-right: 1px solid #e4e7ef;
  display: flex !important;
  flex-direction: column !important;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb {
  background: #d0d4e4; border-radius: 3px;
}

.sidebar ul { list-style: none; padding: 8px 8px 0; flex: 1; }
.sidebar li { margin-bottom: 1px; }
.sidebar li a,
.sidebar li a:visited,
.sidebar li a:active  {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-md);
  color: #1a2240;            font-size: .82rem; font-weight: 500;
  transition: all .15s; white-space: nowrap; overflow: hidden;
  text-decoration: none;
}
.sidebar li a:hover {
  background: #e8eaf6; color: #1E2878 !important; text-decoration: none;
}
.sidebar li.active > a,
.sidebar li.active > a:link,
.sidebar li.active > a:visited,
.sidebar li.active > a:active,
.sidebar li.active > a:hover {
  background: #1E2878;
  color: #ffffff !important;
  box-shadow: inset 3px 0 0 #00A9E0;
  font-weight: 600;
  text-decoration: none;
}
.nav-icon  { font-size: .92rem; flex-shrink: 0; width: 20px; text-align: center; }
.nav-label { overflow: hidden; transition: opacity .15s, width .15s; white-space: nowrap; }
.nav-section {
  padding: 16px 14px 5px;
  font-size: .62rem; text-transform: uppercase; letter-spacing: .12em;
  color: #9aa3b5 !important; font-weight: 700; white-space: nowrap;
  overflow: hidden;
}
.badge-count {
  margin-left: auto; background: var(--aldi-red); color: #fff;
  border-radius: 10px; padding: 1px 6px; font-size: .65rem; font-weight: 700;
}
.sidebar hr {
  border: none; border-top: 1px solid #e4e7ef; 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; overflow: hidden; }
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; }
body.sidebar-collapsed .sidebar li.active a { box-shadow: inset 0 -2px 0 var(--aldi-blue); }

/* Tooltip on collapsed sidebar items */
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: #1E2878; color: #fff;
  border: 1px solid rgba(30,40,120,.2);
  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; }

/* ─── JS Tooltip engine ──────────────────────────────────────── */
.igqc-tooltip {
  position: fixed; z-index: 9999;
  background: rgba(17, 22, 58, .95);
  color: #fff;
  padding: 6px 11px;
  border-radius: var(--r-sm);
  font-size: .72rem; 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: var(--shadow-md);
  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(17,22,58,.95); }
.igqc-tooltip.below::after { bottom: 100%; border-bottom-color: rgba(17,22,58,.95); }

/* ─── 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-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow .18s, border-color .18s;
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--aldi-navy-lt); }
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--bg-card);
}
.card-header h3 {
  font-size: .86rem; font-weight: 700;
  color: var(--text-primary); margin: 0;
  letter-spacing: -.01em;
}
.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: .73rem; }

/* ─── 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: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 16px;
  position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--aldi-navy-lt);
}
/* Top accent line — ALDI brand color bar */
.kpi-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--aldi-navy);
}
.kpi-card.kpi-warn::before  { background: var(--warn); }
.kpi-card.kpi-ok::before    { background: var(--ok); }
.kpi-card.kpi-red::before   { background: var(--aldi-red); }
.kpi-card.kpi-blue::before  { background: var(--aldi-blue); }
.kpi-label {
  font-size: .67rem; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px;
}
.kpi-value {
  font-size: 1.8rem; font-weight: 800; 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); }
.kpi-card.kpi-blue .kpi-value { color: var(--aldi-blue-dk); }

/* ─── Page Header ────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.page-header h2 {
  font-size: 1.05rem; font-weight: 800;
  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: .81rem; font-weight: 600;
  color: var(--text-secondary);
  font-family: inherit; line-height: 1;
  transition: all .15s; white-space: nowrap;
  letter-spacing: -.005em;
}
.btn:visited { color: var(--text-secondary); }
.btn:active  { color: var(--text-secondary); }
.btn:hover   {
  border-color: var(--aldi-navy);
  color: var(--aldi-navy);
  background: var(--aldi-navy-lt);
  text-decoration: none;
}
/* Primary — ALDI Navy solid */
.btn-primary {
  background: var(--aldi-navy);
  color: var(--text-on-navy);
  border-color: var(--aldi-navy);
  box-shadow: 0 2px 8px rgba(30,40,120,.22);
}
.btn-primary:hover {
  background: var(--aldi-navy-dk);
  border-color: var(--aldi-navy-dk);
  color: var(--text-on-navy);
  box-shadow: 0 4px 14px rgba(30,40,120,.32);
}
/* Secondary — ALDI Blue (interactive accent) */
.btn-accent {
  background: var(--aldi-blue);
  color: #fff; border-color: var(--aldi-blue);
  box-shadow: 0 2px 6px rgba(0,169,224,.22);
}
.btn-accent:hover { background: var(--aldi-blue-dk); border-color: var(--aldi-blue-dk); color: #fff; }
.btn-secondary { background: var(--bg-app); border-color: var(--border); }
/* Danger — ALDI Red (used sparingly, errors only) */
.btn-danger { background: var(--aldi-red); color: #fff; border-color: var(--aldi-red); }
.btn-danger:hover { background: var(--aldi-red-dk); color: #fff; border-color: var(--aldi-red-dk); }
.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: .73rem; font-weight: 600;
  color: var(--text-secondary);
  transition: all .14s; white-space: nowrap; font-family: inherit;
}
.btn-sm:visited { color: var(--text-secondary); }
.btn-sm:active  { color: var(--text-secondary); }
.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: 700; font-size: .68rem;
  color: var(--text-secondary); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .07em;
}
.field-hint { color: var(--text-muted); font-size: .71rem; 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: .83rem; 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(30,40,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: 500; font-size: .83rem;
}
.toggle-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-weight: 500; font-size: .83rem;
}
.mt-1 { margin-top: 8px; }

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

/* ─── Tables ──────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; }
.data-table   { width: 100%; border-collapse: collapse; font-size: .79rem; }
.data-table thead th {
  background: var(--aldi-navy-xlt);
  color: var(--aldi-navy);
  font-weight: 700; font-size: .67rem;
  text-transform: uppercase; letter-spacing: .08em;
  padding: 10px 13px; text-align: left;
  border-bottom: 2px solid var(--aldi-navy-lt);
  white-space: nowrap; position: sticky; top: 0;
}
.data-table thead th a { color: var(--aldi-navy); font-weight: 700; }
.data-table thead th a:hover { color: var(--aldi-navy-dk); 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-xlt); }
.data-table tr.row-rejected td { background: var(--aldi-red-lt); }
.data-table tr.row-inactive td { opacity: .5; }
.data-table .text-center { text-align: center; }
.path-cell code { font-size: .69rem; 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(13,138,78,.15); }
.dot-warn { background: var(--warn);  box-shadow: 0 0 0 3px rgba(217,119,6,.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: 4px; padding: 2px 8px;
  font-size: .68rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase;
}
.badge-you {
  background: var(--ok-bg); color: var(--ok-txt);
  border-radius: 20px; padding: 1px 7px; font-size: .64rem;
  font-weight: 700; margin-left: 4px;
}
.badge-role      { border-radius: 20px; padding: 2px 9px; font-size: .68rem; font-weight: 700; }
.badge-admin     { background: var(--aldi-navy-lt); color: var(--aldi-navy);
                    border-radius: 20px; padding: 2px 9px; font-size: .67rem; font-weight: 700; }
.badge-admin-r   { background: #ede9fe; color: #5b21b6; border-radius: 20px;
                    padding: 2px 9px; font-size: .68rem; font-weight: 700; }
.badge-usuario   { background: var(--info-bg); color: var(--info-txt);
                    border-radius: 20px; padding: 2px 9px; font-size: .68rem; font-weight: 700; }
.status-badge    {
  display: inline-block; border-radius: 4px;
  padding: 3px 9px; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.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); }
.badge-warn                  { background: var(--warn-bg);  color: var(--warn-txt);
                                border-radius: 4px; padding: 3px 9px; font-size: .68rem; font-weight: 700; }

/* ─── Topbar pills ───────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 4px;
  font-size: .71rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.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 { text-decoration: none; opacity: .85; }
.pill-dup  { background: var(--err-bg);  color: var(--err-txt); text-decoration: none; }
.pill-dup:hover  { text-decoration: none; opacity: .85; }

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

.flash {
  border-radius: var(--r-md); padding: 11px 16px; margin-bottom: 9px;
  font-size: .82rem; 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: 3px solid var(--ok);       color: var(--ok-txt); }
.flash-error             { background: var(--err-bg);       border-left: 3px solid var(--aldi-red); color: var(--err-txt); }
.flash-info              { background: var(--aldi-navy-lt); border-left: 3px solid var(--aldi-navy);color: var(--aldi-navy); }
.flash-warn              { background: var(--warn-bg);      border-left: 3px solid var(--warn);     color: var(--warn-txt); }
.info-box {
  background: var(--aldi-navy-lt);
  border-left: 3px solid var(--aldi-navy);
  border-radius: var(--r-md);
  padding: 11px 15px; font-size: .82rem; 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: .67rem;
  color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: .08em; 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: .78rem; font-weight: 500;
  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);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); padding: 11px 15px;
}
.filter-bar label { font-weight: 600; font-size: .79rem; color: var(--text-secondary); }
.check-inline { display: inline-flex; align-items: center; gap: 4px; font-size: .79rem; 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(--aldi-navy-xlt); }
.collapsible-header h3 {
  font-size: .86rem; font-weight: 700;
  color: var(--text-primary); margin: 0; flex: 1;
}
.collapsible-arrow {
  color: var(--text-muted); font-size: .76rem;
  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: .82rem;
}

/* ─── Column selector ────────────────────────────────────────── */
.col-selector-panel {
  background: var(--bg-card); border-radius: var(--r-lg);
  border: 1px solid var(--border);
  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: 700; font-size: .82rem; 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: .75rem; font-weight: 600;
  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: .77rem; color: var(--text-secondary);
}
.pagination-info { margin-left: auto; color: var(--text-muted); font-size: .72rem; }

/* ─── 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);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.chart-card-inner { padding: 18px; }
.chart-card h4 {
  font-size: .67rem; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .08em;
}
.chart-full { grid-column: 1 / -1; }
.progress-bar {
  position: relative; background: var(--bg-app);
  border-radius: 4px; height: 20px; overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 4px; transition: width .4s; }
.progress-bar span { position: absolute; right: 7px; top: 2px; font-size: .69rem; font-weight: 700; }

/* ─── Modal ───────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(10,12,40,.55);
  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);
  border: 1px solid var(--border);
  padding: 26px; min-width: 320px; max-width: 500px;
  width: 90%; box-shadow: var(--shadow-lg);
}
.modal-box h3 {
  margin-bottom: 15px; font-size: .96rem; font-weight: 800;
  letter-spacing: -.01em;
}
.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: .83rem;
}
.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: #0D1130; color: #4ADE80;
  padding: 10px 14px; border-radius: var(--r-md); margin: 5px 0;
  font-family: 'JetBrains Mono','Courier New', monospace;
  font-size: .76rem; overflow-x: auto; white-space: nowrap;
}
.cron-hint {
  background: var(--bg-app); border-radius: var(--r-md);
  padding: 11px 13px; font-size: .78rem;
}
.test-result { margin-top: 7px; font-size: .78rem; padding: 7px 11px; 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: .73rem; 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: .7rem;
  color: var(--text-muted); text-align: center;
}

/* ─── Login ───────────────────────────────────────────────────── */
.login-body {
  /* ALDI Navy gradient + diagonal — brand-consistent */
  background: linear-gradient(135deg, #0A0E2A 0%, var(--aldi-navy) 55%, var(--aldi-navy-md) 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 24px 64px rgba(0,0,0,.4);
  /* Red top bar — matches brand border on logo */
  border-top: 4px solid var(--aldi-red);
}
.login-header { text-align: center; margin-bottom: 26px; }
.login-logo {
  height: 72px; margin-bottom: 14px; object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
}
.login-header h1 {
  font-size: 1.2rem; font-weight: 800;
  color: var(--text-primary); letter-spacing: -.02em;
}
.login-subtitle { color: var(--text-muted); font-size: .81rem; 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: .72rem; color: var(--aldi-navy); }
.row-inactive td { opacity: .5; }

/* ─── Sidebar footer area (settings + authors) ──────────────── */
.sidebar-footer-area {
  margin-top: auto;
  flex-shrink: 0;
}
.sidebar-footer-divider {
  height: 1px;
  background: #e4e7ef;
  margin: 0 12px 4px;
}
.sidebar-footer-link,
.sidebar-footer-link:visited,
.sidebar-footer-link:active {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  margin: 1px 8px;
  border-radius: var(--r-md);
  color: #5a6275 !important;
  font-size: .81rem;
  font-weight: 500;
  text-decoration: none;
  transition: all .14s;
  cursor: pointer;
}
.sidebar-footer-link:hover {
  background: #e8eaf6;
  color: #1E2878 !important;
  text-decoration: none;
}
.sidebar-footer-link.sf-active {
  background: var(--aldi-navy-lt);
  color: var(--aldi-navy);
  font-weight: 600;
}
.sidebar-footer-link.sf-logout:hover {
  background: #fdecea;
  color: #CC1020;
}
.sf-icon  { font-size: .88rem; flex-shrink: 0; width: 18px; text-align: center; }
.sf-label { overflow: hidden; white-space: nowrap; transition: opacity .15s, width .15s; }

.sidebar-authors {
  padding: 6px 14px 12px;
  overflow: hidden;
}
.sidebar-authors span {
  display: block;
  font-size: .6rem;
  color: #b0b8cc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

/* Collapsed state */
body.sidebar-collapsed .sf-label         { opacity: 0; width: 0; }
body.sidebar-collapsed .sidebar-authors  { display: none; }
body.sidebar-collapsed .sidebar-footer-link { justify-content: center; padding: 9px 10px; margin: 1px 4px; }
body.sidebar-collapsed .sidebar-footer-divider { margin: 0 4px 4px; }

/* ─── 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-toggle  { display: none !important; }
  #mobile-menu-btn { display: flex !important; }
  .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); }
  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: 16px 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 12px !important; }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.48); z-index: 140; top: var(--topbar-h);
  }
  .sidebar-overlay.visible { display: block; }
  .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: .93rem; }
}

@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; }
}
