/* ============ Synkro design tokens ============ */
:root {
  --bg: #000000;
  --surface: #0A0204;
  --surface-2: #0F0306;
  --sidebar: #050203;
  --input: #111111;
  --hover: #1A0508;
  --border: #1A0508;
  --border-strong: #2A0A10;

  --c-950: #1A0508;
  --c-900: #3D0C14;
  --c-700: #7A1828;
  --c-500: #DC143C;
  --c-400: #E8445E;
  --c-300: #F28598;

  --text: #FFFFFF;
  --text-2: #F28598;
  --text-muted: #8A6A70;
  --text-dim: #5A4A4D;

  --ok: #22C55E;
  --warn: #F59E0B;
  --err: #DC143C;

  --card-shadow: none;
  --scrollbar-thumb: #1A0508;
  --scrollbar-hover: #3D0C14;

  --r-card: 8px;
  --r-btn: 6px;

  --font-head: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

[data-theme="light"] {
  --bg: #FFFFFF;
  --surface: #FAF5F6;
  --surface-2: #F4EBED;
  --sidebar: #FAF5F6;
  --input: #FFFFFF;
  --hover: #F4EBED;
  --border: #E8DCE0;
  --border-strong: #D9C5CB;

  --c-950: #F4EBED;
  --c-900: #E8DCE0;
  --c-700: #7A1828;
  --c-500: #DC143C;
  --c-400: #E8445E;
  --c-300: #7A1828;

  --text: #1A0508;
  --text-2: #7A1828;
  --text-muted: #8A6A70;
  --text-dim: #B09A9E;

  --card-shadow: 0 2px 8px rgba(0,0,0,0.04);
  --scrollbar-thumb: #E8DCE0;
  --scrollbar-hover: #D9C5CB;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.003em;
}
#root { min-height: 100vh; }

button { font-family: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ============ Scrollbars ============ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

/* ============ App shell ============ */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.app.no-sidebar { grid-template-columns: 1fr; }

/* Sidebar */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo img { width: 26px; height: 26px; object-fit: contain; filter: drop-shadow(0 0 12px rgba(220,20,60,0.35)); }
.sidebar-logo .wordmark {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.sidebar-nav {
  flex: 1; overflow-y: auto;
  padding: 14px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #C9B0B5;
  background: transparent;
  border: none; text-align: left;
  width: 100%;
  transition: background 120ms, color 120ms;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, #DC143C 0%, #7A1828 100%);
  color: var(--text);
  box-shadow: 0 6px 18px -8px rgba(220,20,60,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
}
.nav-item.active .nav-badge { background: rgba(0,0,0,0.3); color: var(--text); }
.nav-badge {
  margin-left: auto;
  background: var(--c-500);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  font-family: var(--font-mono);
}
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar-footer .powered {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sidebar-footer .powered b { color: var(--c-300); font-weight: 600; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; border-radius: 6px;
  background: var(--hover);
}
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #DC143C, #3D0C14);
  color: var(--text); display: grid; place-items: center;
  font-size: 11px; font-weight: 700; font-family: var(--font-head);
}
.user-chip .name { font-size: 12px; font-weight: 600; }
.user-chip .role { font-size: 10px; color: var(--text-muted); }

/* Topbar */
.topbar {
  height: 64px;
  padding: 0 28px;
  display: flex; align-items: center; gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { display: flex; flex-direction: column; }
.topbar-title h1 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.topbar-title .sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.topbar-spacer { flex: 1; }

/* Main */
.main { min-width: 0; }
.page {
  padding: 28px;
  max-width: 1600px;
}

/* ============ Typography ============ */
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; letter-spacing: -0.015em; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.rose { color: var(--text-2); }
.dim  { color: var(--text-dim); }

/* ============ Cards ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--card-shadow);
}
.card-pad { padding: 20px; }
.card-head {
  padding: 16px 20px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.card-head .sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-btn);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  transition: all 120ms;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(180deg, #E8445E 0%, #DC143C 100%);
  color: var(--text);
  box-shadow: 0 6px 20px -8px rgba(220,20,60,0.7), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 8px 24px -8px rgba(220,20,60,0.9), inset 0 1px 0 rgba(255,255,255,0.2); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { background: var(--hover); border-color: var(--c-700); }
.btn-subtle {
  background: var(--hover);
  color: var(--text);
}
.btn-subtle:hover { background: var(--c-900); }
.btn-sm { padding: 6px 10px; font-size: 12px; }

/* ============ Inputs ============ */
.input, .select, .textarea {
  background: var(--input);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-btn);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  width: 100%;
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}
.input::placeholder { color: var(--text-dim); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--c-500);
  box-shadow: 0 0 0 3px rgba(220,20,60,0.15);
}
.label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  display: block;
}
.input-icon {
  position: relative;
  display: flex; align-items: center;
}
.input-icon svg { position: absolute; left: 10px; color: var(--text-muted); }
.input-icon .input { padding-left: 34px; }

/* ============ Badges ============ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-body);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-dot { width: 5px; height: 5px; border-radius: 50%; }
.badge.ok    { background: rgba(34,197,94,0.12);  color: #4ADE80; border-color: rgba(34,197,94,0.25); }
.badge.warn  { background: rgba(245,158,11,0.12); color: #FBBF24; border-color: rgba(245,158,11,0.25); }
.badge.err   { background: rgba(220,20,60,0.15);  color: #F28598; border-color: rgba(220,20,60,0.35); }
.badge.info  { background: rgba(220,20,60,0.08);  color: #F28598; border-color: var(--c-900); }
.badge.neutral { background: var(--hover); color: var(--text-2); border-color: var(--border-strong); }
.badge.agro  { background: rgba(242,133,152,0.1); color: #F28598; border-color: var(--c-700); }

/* Category chips — distinct colors from within crimson/rose family */
.chip {
  display: inline-flex; align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.chip-alim { background: rgba(232,68,94,0.12);  color: #E8445E; border-color: rgba(232,68,94,0.3); }
.chip-serv { background: rgba(242,133,152,0.12);color: #F28598; border-color: rgba(242,133,152,0.3); }
.chip-aseo { background: rgba(220,20,60,0.12); color: #F28598; border-color: rgba(220,20,60,0.3); }
.chip-pape { background: rgba(245,158,11,0.12); color: #FBBF24; border-color: rgba(245,158,11,0.25); }
.chip-tran { background: rgba(122,24,40,0.3);   color: #E8445E; border-color: rgba(122,24,40,0.6); }
.chip-tec  { background: rgba(61,12,20,0.6);    color: #F28598; border-color: rgba(122,24,40,0.6); }
.chip-hono { background: rgba(232,68,94,0.08);  color: #E8445E; border-color: rgba(232,68,94,0.25); }
.chip-otro { background: var(--hover); color: var(--text-2); border-color: var(--border-strong); }

/* ============ Tables ============ */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.tbl thead th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.tbl tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.tbl tbody tr { transition: background 100ms; }
.tbl tbody tr:hover { background: var(--hover); cursor: pointer; }
.tbl .num { font-family: var(--font-mono); text-align: right; color: var(--text); }
.tbl .mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.tbl .prov-name { color: var(--text); font-weight: 600; font-size: 13px; }
.tbl .prov-sub { color: var(--text-muted); font-size: 11px; font-family: var(--font-mono); }

/* ============ Tabs ============ */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
  overflow-x: auto;
}
.tab {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
  transition: color 120ms, border-color 120ms;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--c-500);
}
.tab .count {
  background: var(--hover);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-2);
}
.tab.active .count { background: var(--c-900); color: var(--text); }

/* ============ Stat cards ============ */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
.stat-card .label {
  margin-bottom: 10px;
  color: var(--text-muted);
}
.stat-card .val {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat-card .delta {
  margin-top: 10px;
  font-size: 11px;
  color: var(--ok);
  display: flex; align-items: center; gap: 4px;
}
.stat-card .delta.down { color: var(--err); }
.stat-card .icon {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 6px;
  display: grid; place-items: center;
  background: rgba(220,20,60,0.08);
  color: var(--c-500);
  border: 1px solid var(--c-900);
}
.stat-card.accent { border-color: var(--c-900); }
.stat-card.accent::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-500), transparent);
}

/* ============ Quick action cards ============ */
.quick-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px;
  cursor: pointer;
  transition: all 160ms;
  display: flex; flex-direction: column; gap: 10px;
  text-align: left;
  position: relative;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
.quick-card:hover {
  border-color: var(--c-700);
  background: #0F0306;
  transform: translateY(-2px);
}
.quick-card .q-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(220,20,60,0.1);
  border: 1px solid var(--c-900);
  color: var(--c-500);
  display: grid; place-items: center;
}
.quick-card h4 { font-size: 14px; font-weight: 700; }
.quick-card p { font-size: 12px; color: var(--text-muted); margin: 0; }
.quick-card .q-arrow {
  position: absolute; top: 18px; right: 18px;
  color: var(--text-dim);
  transition: color 140ms, transform 140ms;
}
.quick-card:hover .q-arrow { color: var(--c-500); transform: translateX(2px); }

/* ============ Dropzone ============ */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-card);
  padding: 40px;
  text-align: center;
  background: var(--surface);
  transition: all 160ms;
  cursor: pointer;
}
.dropzone:hover { border-color: var(--c-500); background: #0F0306; }
.dropzone.active { border-color: var(--c-500); background: rgba(220,20,60,0.04); }
.dropzone .dz-icon {
  width: 56px; height: 56px; border-radius: 12px;
  margin: 0 auto 14px;
  background: rgba(220,20,60,0.1);
  border: 1px solid var(--c-900);
  color: var(--c-500);
  display: grid; place-items: center;
}
.dropzone h4 { font-size: 15px; margin-bottom: 4px; }
.dropzone p { font-size: 12px; color: var(--text-muted); margin: 0; }

/* ============ Modal ============ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 100;
  padding: 40px 20px;
  animation: fade-in 160ms ease;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-card);
  width: 100%;
  max-width: 720px;
  max-height: 86vh;
  display: flex; flex-direction: column;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,0.9), 0 0 0 1px rgba(220,20,60,0.15);
  animation: modal-in 220ms cubic-bezier(0.22,1,0.36,1);
}
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
}
.modal-head h3 { font-size: 15px; font-weight: 700; }
.modal-head .close { margin-left: auto; background: transparent; border: none; color: var(--text-muted); padding: 4px; border-radius: 4px; }
.modal-head .close:hover { background: var(--hover); color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  background: var(--surface-2);
  border-radius: 0 0 var(--r-card) var(--r-card);
}

@keyframes fade-in { from {opacity: 0} to {opacity: 1} }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============ Toggle ============ */
.toggle {
  width: 34px; height: 20px;
  background: var(--hover);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 140ms, border-color 140ms;
}
.toggle::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-muted);
  transition: all 160ms;
}
.toggle.on { background: var(--c-500); border-color: var(--c-500); }
.toggle.on::after { left: 16px; background: #fff; }

/* ============ Progress bar ============ */
.progress {
  width: 100%; height: 6px;
  background: var(--hover);
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #7A1828, #DC143C);
  border-radius: 999px;
  transition: width 300ms ease;
}

/* ============ Glow backdrop ============ */
.glow-bg {
  position: fixed;
  pointer-events: none;
  inset: 0;
  background:
    radial-gradient(60% 40% at 20% 0%, rgba(220,20,60,0.09), transparent 60%),
    radial-gradient(40% 30% at 80% 10%, rgba(122,24,40,0.1), transparent 60%);
  z-index: 0;
}

/* ============ Login screen ============ */
.login-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(220,20,60,0.12), transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(122,24,40,0.08), transparent 60%),
    var(--bg);
  position: relative;
  overflow: hidden;
}
.login-wrap::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(220,20,60,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(220,20,60,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 70%);
}
.login-card {
  position: relative; z-index: 2;
  width: 420px; max-width: calc(100vw - 32px);
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 36px 32px 28px;
  box-shadow: 0 40px 80px -30px rgba(220,20,60,0.35), inset 0 1px 0 rgba(255,255,255,0.05);
}
.login-logo {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  margin-bottom: 28px;
}
.login-logo img { width: 54px; height: 54px; object-fit: contain; filter: drop-shadow(0 0 24px rgba(220,20,60,0.5)); }
.login-logo .name { font-family: var(--font-head); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }
.login-logo .tag { font-size: 12px; color: var(--text-2); letter-spacing: 0.05em; }
.login-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.login-card .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.login-foot {
  text-align: center;
  margin-top: 28px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.login-foot b { color: var(--c-300); font-weight: 600; }
.login-link { color: var(--c-300); font-size: 12px; text-align: center; display: block; margin-top: 14px; }
.login-link:hover { color: var(--c-400); }

/* ============ Theme toggle ============ */
.theme-toggle {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--hover);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  cursor: pointer;
  transition: all 160ms;
}
.theme-toggle:hover { background: var(--c-950); color: var(--c-500); border-color: var(--c-700); }
.theme-toggle-login {
  position: absolute;
  top: 20px; right: 20px;
  z-index: 10;
}
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.grow { flex: 1; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }
.grid { display: grid; gap: 16px; }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-dash { grid-template-columns: 1fr 380px; gap: 16px; }
.grid-chart { grid-template-columns: 1fr 1fr; gap: 16px; }
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb .sep { color: var(--text-dim); }
.breadcrumb .cur { color: var(--text); }

.hair { height: 1px; background: var(--border); }
.kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--hover);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
}

/* Filter bar */
.filter-bar {
  display: flex; gap: 10px; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filter-bar .input, .filter-bar .select { width: auto; min-width: 0; }
.filter-bar .search { flex: 1; min-width: 200px; max-width: 360px; }

/* Sub-nav pills */
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--hover);
  color: var(--text-2);
  border: 1px solid transparent;
}
.pill:hover { background: var(--c-950); color: var(--text); }
.pill.active { background: var(--c-500); color: var(--text); }

/* Bar chart cells */
.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 80px;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  font-size: 13px;
}
.bar-row .lbl { color: var(--text-2); font-size: 12px; }
.bar-row .bar-track {
  height: 8px; background: var(--hover); border-radius: 999px; overflow: hidden;
}
.bar-row .bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #7A1828, #DC143C);
  border-radius: 999px;
}
.bar-row .num { font-family: var(--font-mono); font-size: 12px; color: var(--text); text-align: right; }

/* Chat */
.chat-wrap {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - 64px);
}
.chat-sidebar {
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column;
}
.chat-sidebar .head { padding: 16px; border-bottom: 1px solid var(--border); }
.chat-list { flex: 1; overflow-y: auto; padding: 8px; }
.chat-item {
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 2px;
}
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--hover); border: 1px solid var(--border-strong); }
.chat-item .t { font-size: 13px; font-weight: 600; color: var(--text); }
.chat-item .s { font-size: 11px; color: var(--text-muted); margin-top: 2px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.chat-main { display: flex; flex-direction: column; min-height: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px 40px; }
.msg {
  max-width: 720px;
  margin-bottom: 20px;
  display: flex; gap: 12px;
}
.msg .av {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  flex: none;
  font-size: 11px; font-weight: 700;
}
.msg.bot .av { background: linear-gradient(135deg, #DC143C, #3D0C14); color: var(--text); }
.msg.user .av { background: var(--hover); color: var(--text-2); border: 1px solid var(--border-strong); }
.msg .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.msg.user .bubble { background: transparent; border-color: var(--border-strong); color: var(--text); }
.chat-input {
  border-top: 1px solid var(--border);
  padding: 16px 40px 24px;
  background: var(--bg);
}
.chat-input .wrap {
  max-width: 720px;
  display: flex; gap: 8px;
  background: var(--input);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 6px 6px 6px 14px;
  align-items: center;
}
.chat-input input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 14px;
}
.chat-suggestions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 8px;
  max-width: 720px;
}
.suggestion {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--hover);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  color: var(--text-2);
}
.suggestion:hover { background: var(--c-950); color: var(--text); border-color: var(--c-700); }

/* Step list (DIAN) */
.steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.step {
  display: flex; gap: 12px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.step-num {
  width: 28px; height: 28px; flex: none;
  border-radius: 6px;
  background: rgba(220,20,60,0.1);
  border: 1px solid var(--c-900);
  color: var(--c-500);
  font-family: var(--font-mono); font-weight: 700;
  display: grid; place-items: center;
  font-size: 13px;
}
.step-body h5 { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.step-body p { font-size: 12px; color: var(--text-muted); margin: 0; line-height: 1.45; }

/* Stacked bar / donut helpers */
.donut-legend { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 10px; font-size: 12px; margin-top: 12px; }
.donut-legend .sw { width: 10px; height: 10px; border-radius: 2px; }
.donut-legend .v { font-family: var(--font-mono); color: var(--text); font-size: 12px; text-align: right; }

/* Section header */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px; flex-wrap: wrap;
}
.section-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.section-head .sub { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.section-head .actions { display: flex; gap: 8px; }

/* Data list */
.dl { display: grid; grid-template-columns: 180px 1fr; gap: 10px 20px; font-size: 13px; }
.dl dt { color: var(--text-muted); font-size: 12px; }
.dl dd { margin: 0; color: var(--text); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--surface);
  border: 1px solid var(--c-700);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.8);
  animation: toast-in 220ms cubic-bezier(0.22,1,0.36,1);
  z-index: 200;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Proveedor row edit */
.inline-edit { background: transparent; border: 1px solid transparent; padding: 4px 6px; border-radius: 4px; font-size: 13px; color: var(--text); width: 100%; }
.inline-edit:hover { border-color: var(--border-strong); }
.inline-edit:focus { border-color: var(--c-500); outline: none; background: var(--input); }

/* Check */
.chk {
  width: 16px; height: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--input);
  display: grid; place-items: center;
  cursor: pointer;
  flex: none;
}
.chk.on { background: var(--c-500); border-color: var(--c-500); }
.chk.on svg { color: var(--text); }
.chk svg { color: transparent; }

/* Skeleton shimmer */
.shimmer {
  background: linear-gradient(90deg, var(--surface) 0%, var(--hover) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
