:root {
  --navy-950: #071b2b;
  --navy-900: #0a263d;
  --ink: #102538;
  --muted: #6f7f8e;
  --line: #dfe7ec;
  --surface: #ffffff;
  --canvas: #f3f7f8;
  --lime: #8fd14f;
  --lime-soft: #edf8e3;
  --cyan: #3db8d5;
  --cyan-soft: #e5f7fb;
  --blue: #3478c8;
  --blue-soft: #eaf2fb;
  --violet: #7658c7;
  --violet-soft: #f0ecfb;
  --amber: #d59a24;
  --amber-soft: #fff5d9;
  --red: #d65353;
  --shadow: 0 16px 40px rgba(14, 42, 61, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 228px;
  padding: 30px 18px 22px;
  display: flex;
  flex-direction: column;
  background: var(--navy-950);
  color: #fff;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 30px;
  letter-spacing: .04em;
}
.brand > span:last-child { display: grid; gap: 1px; }
.brand strong { font-size: 16px; }
.brand small { color: #8fa8b8; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.brand-mark {
  width: 36px;
  height: 36px;
  padding: 7px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  border-radius: 11px;
  background: var(--lime);
}
.brand-mark i { background: var(--navy-950); border-radius: 2px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { opacity: .55; }

.sidebar nav { display: grid; gap: 7px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #9eb1be;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  transition: .18s ease;
}
.nav-item span { width: 20px; color: #7291a4; font-size: 18px; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: rgba(143,209,79,.12); border-color: rgba(143,209,79,.22); color: #fff; }
.nav-item.active span { color: var(--lime); }

.source-card {
  margin-top: auto;
  padding: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
}
.source-dot, .live-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 4px rgba(143,209,79,.13);
}
.source-card div { display: grid; gap: 3px; min-width: 0; }
.source-card strong { font-size: 11px; }
.source-card small { color: #7f9aaa; font-size: 10px; overflow: hidden; text-overflow: ellipsis; }

main { margin-left: 228px; padding: 30px 34px 24px; max-width: 1720px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 7px; color: #7390a1; font-size: 10px; font-weight: 800; letter-spacing: .15em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(27px, 3vw, 38px); line-height: 1.1; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 18px; letter-spacing: -.02em; }
.subtitle { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.header-actions { display: flex; align-items: stretch; gap: 9px; }
.theme-button {
  min-height: 48px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(14,42,61,.06);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.theme-button:hover { border-color: #8ca1ac; transform: translateY(-1px); }
.theme-button span:first-child { font-size: 17px; line-height: 1; }
.publish-button {
  min-height: 48px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid #6fac3f;
  border-radius: 12px;
  background: var(--lime);
  color: #17351f;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(98, 155, 54, .15);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.publish-button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 11px 22px rgba(98, 155, 54, .2); }
.publish-button:disabled { cursor: wait; opacity: .72; }
.publish-icon { font-size: 18px; line-height: 1; }
.button-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(23, 53, 31, .25);
  border-top-color: #17351f;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.snapshot {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.7);
}
.snapshot div { display: grid; gap: 2px; }
.snapshot small { color: var(--muted); font-size: 10px; }
.snapshot strong { font-size: 12px; white-space: nowrap; }
.publish-notice {
  margin-top: 16px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #536776;
  font-size: 11px;
  font-weight: 650;
}
.publish-notice > span { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; }
.publish-notice.working { border-color: #b9dfeb; background: var(--cyan-soft); color: #27798e; }
.publish-notice.working > span { background: var(--cyan); box-shadow: 0 0 0 4px rgba(61,184,213,.12); }
.publish-notice.success { border-color: #cfe7bb; background: var(--lime-soft); color: #497e36; }
.publish-notice.success > span { background: #65b84c; }
.publish-notice.error { border-color: #efc6c3; background: #fff0ef; color: #a34844; }
.publish-notice.error > span { background: var(--red); }

.filters {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px 140px 160px auto;
  gap: 9px;
}
.filters input, .filters select, .reset-button {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  transition: .18s ease;
}
.filters input:focus, .filters select:focus { border-color: #81a9bf; box-shadow: 0 0 0 3px rgba(61,184,213,.11); }
.filters select { padding: 0 32px 0 12px; }
.search-box { position: relative; }
.search-box span { position: absolute; left: 14px; top: 9px; color: #8194a1; font-size: 19px; }
.search-box input { padding: 0 14px 0 40px; }
.reset-button {
  width: auto;
  padding: 0 16px;
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #fff;
  font-weight: 700;
}
.reset-button:disabled { cursor: default; opacity: .35; }
.filter-summary { margin: 9px 0 0; color: #8595a0; font-size: 10px; }

.advanced-search-panel {
  margin-top: 28px;
  padding: 20px;
}
.advanced-search-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.advanced-search-heading .eyebrow { margin-bottom: 4px; }
.advanced-search-heading h2 { margin-bottom: 4px; }
.advanced-search-heading p:last-child { margin: 0; color: var(--muted); font-size: 11px; }
.advanced-search-heading .reset-button { flex: 0 0 auto; height: 40px; }
.advanced-filters {
  margin-top: 17px;
  grid-template-columns: minmax(260px, 1.7fr) repeat(5, minmax(120px, 1fr));
  align-items: end;
}
.filter-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.filter-field > span {
  color: #728491;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.advanced-text-search { align-self: end; }
.advanced-status-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}
.advanced-status-grid button {
  min-width: 0;
  padding: 12px 13px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fafb;
  color: var(--ink);
  text-align: left;
  transition: .18s ease;
}
.advanced-status-grid button:hover {
  border-color: #9bc4d5;
  background: #f2f8fa;
  transform: translateY(-1px);
}
.advanced-status-grid button.selected {
  border-color: var(--cyan);
  background: var(--cyan-soft);
  box-shadow: 0 0 0 3px rgba(61,184,213,.10);
}
.advanced-status-grid span { align-self: end; font-size: 10px; font-weight: 750; }
.advanced-status-grid strong { grid-row: 1 / 3; grid-column: 2; align-self: center; color: var(--navy-900); font-size: 23px; }
.advanced-status-grid small { color: var(--muted); font-size: 8px; }

.kpi-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.kpi-card {
  min-height: 137px;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--blue);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(17,52,75,.035);
}
.kpi-card.mint { border-top-color: var(--lime); }
.kpi-card.cyan { border-top-color: var(--cyan); }
.kpi-card.lime { border-top-color: #54b772; }
.kpi-card.violet { border-top-color: var(--violet); }
.kpi-head { display: flex; justify-content: space-between; align-items: center; color: #5c7080; font-size: 11px; font-weight: 700; }
.kpi-head b {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 16px;
}
.mint .kpi-head b, .lime .kpi-head b { background: var(--lime-soft); color: #4f9b42; }
.cyan .kpi-head b { background: var(--cyan-soft); color: #2b93ad; }
.violet .kpi-head b { background: var(--violet-soft); color: var(--violet); }
.kpi-value { display: block; margin: 12px 0 2px; font-size: 31px; line-height: 1; letter-spacing: -.04em; }
.kpi-card small { color: #8a98a3; font-size: 10px; }

.insights-grid { margin-top: 14px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 14px; }
.panel { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.progress-panel, .route-panel { padding: 20px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading .eyebrow { margin-bottom: 4px; }
.rate-badge, .panel-count {
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--lime-soft);
  color: #4a8e37;
  font-size: 12px;
  font-weight: 800;
}
.panel-count { background: var(--blue-soft); color: var(--blue); }
.total-progress, .mini-bar { overflow: hidden; height: 8px; border-radius: 999px; background: #edf1f3; }
.total-progress { margin-top: 20px; }
.total-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #65b84c, var(--lime)); }
.progress-copy { margin-top: 8px; display: flex; justify-content: space-between; font-size: 10px; }
.progress-copy span { color: var(--muted); }
.cutter-list { margin-top: 17px; padding-top: 14px; display: grid; gap: 12px; border-top: 1px solid #edf1f3; }
.cutter-row { display: flex; align-items: center; gap: 10px; }
.avatar { width: 31px; height: 31px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; font-size: 11px; font-weight: 850; }
.avatar-blue { background: var(--blue-soft); color: var(--blue); }
.avatar-green { background: var(--lime-soft); color: #4d9139; }
.cutter-data { min-width: 0; flex: 1; }
.cutter-data > div:first-child { margin-bottom: 5px; display: flex; justify-content: space-between; gap: 8px; }
.cutter-data strong { font-size: 11px; }
.cutter-data span { color: var(--muted); font-size: 9px; }
.cutter-row > b { width: 34px; text-align: right; font-size: 10px; }
.mini-bar { height: 5px; }
.mini-bar span { display: block; height: 100%; border-radius: inherit; background: var(--cyan); }

.route-content { margin-top: 17px; display: grid; grid-template-columns: 145px 1fr; gap: 20px; align-items: center; }
.donut { width: 132px; aspect-ratio: 1; padding: 16px; display: grid; place-items: center; border-radius: 50%; }
.donut > div { width: 100%; height: 100%; display: grid; place-content: center; text-align: center; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1px #eef2f4; }
.donut strong { font-size: 25px; line-height: 1; }
.donut span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.legend { display: grid; gap: 13px; }
.legend > div { display: grid; grid-template-columns: 9px 1fr auto; gap: 9px; align-items: center; }
.legend-swatch { width: 8px; height: 24px; border-radius: 999px; }
.legend-swatch.pickup { background: var(--lime); }
.legend-swatch.shipment { background: var(--cyan); }
.legend p { margin: 0; display: grid; gap: 2px; }
.legend strong { font-size: 10px; }
.legend small { color: var(--muted); font-size: 9px; }
.legend b { font-size: 11px; }
.delivery-strip { margin-top: 14px; padding: 11px 12px; display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 8px; align-items: center; border-radius: 10px; background: #f6f9fa; font-size: 9px; }
.delivery-strip span { color: #657785; }
.delivery-strip i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; }
.delivered-dot { background: #56b56f; }
.pending-dot { background: var(--amber); }
.delivery-strip strong { font-size: 12px; }

.orders-panel { margin-top: 14px; overflow: hidden; }
.orders-heading { padding: 19px 20px 15px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.orders-heading .eyebrow { margin-bottom: 4px; }
.quick-tabs { padding: 3px; display: flex; gap: 2px; border-radius: 9px; background: #eff3f5; }
.quick-tabs button { padding: 6px 9px; border: 0; border-radius: 7px; background: transparent; color: #728491; font-size: 9px; font-weight: 750; }
.quick-tabs button.selected { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(20,47,65,.09); }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 1020px; border-collapse: collapse; }
th { padding: 10px 13px; background: #f7f9fa; color: #748794; font-size: 9px; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
td { padding: 11px 13px; border-top: 1px solid #edf1f3; vertical-align: middle; font-size: 10px; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #fafcfc; }
.order-id { color: #1b4a68; font-size: 11px; }
.client-name { display: block; max-width: 210px; font-size: 10px; }
td small { display: block; margin-top: 2px; color: #8b9aa5; font-size: 8px; }
.movement-pill { display: inline-flex; padding: 5px 7px; border-radius: 7px; font-size: 8px; font-weight: 750; white-space: nowrap; }
.movement-pill.pickup { background: var(--lime-soft); color: #4b8e38; }
.movement-pill.shipment { background: var(--cyan-soft); color: #26849c; }
.cutter-cell { display: flex; align-items: center; gap: 8px; }
.cutter-cell .avatar { width: 28px; height: 28px; }
.cutter-cell p { margin: 0; display: grid; gap: 1px; }
.cutter-cell strong { font-size: 9px; }
.cutter-cell small { margin: 0; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 7px; font-size: 8px; font-weight: 800; }
.status i { width: 5px; height: 5px; border-radius: 50%; }
.status.done { background: var(--lime-soft); color: #4b8e38; }
.status.done i, .status.delivered i { background: #5caf61; }
.status.pending { background: #fff0ef; color: #bb4f4a; }
.status.pending i { background: var(--red); }
.status.delivered { background: #e9f7ed; color: #438554; }
.status.waiting { background: var(--amber-soft); color: #9c711f; }
.status.waiting i { background: var(--amber); }
.date-cell { white-space: nowrap; font-weight: 650; }
.date-cell small { font-weight: 500; }
.empty-state { padding: 34px; color: var(--muted); text-align: center; }

footer { padding: 18px 2px 0; display: flex; justify-content: space-between; color: #91a0aa; font-size: 9px; }

/* Modo claro mitologico: piedra, marfil, bronce envejecido y carmesi. */
html[data-theme="light"] {
  color-scheme: light;
  --navy-950: #241a16;
  --navy-900: #493025;
  --ink: #30231c;
  --muted: #77695d;
  --line: #d8c5a6;
  --surface: #fffaf0;
  --canvas: #efe3cc;
  --lime: #bd9340;
  --lime-soft: #f5e8c3;
  --cyan: #557b7a;
  --cyan-soft: #e2eeea;
  --blue: #5c7281;
  --blue-soft: #e8eceb;
  --violet: #785f74;
  --violet-soft: #eee5ec;
  --amber: #ba7d2c;
  --amber-soft: #faedcc;
  --red: #a22d27;
  --shadow: 0 16px 36px rgba(70,43,26,.12);
}
html[data-theme="light"] body {
  background:
    radial-gradient(circle at 83% -12%, rgba(163,45,37,.12), transparent 31%),
    radial-gradient(circle at 16% 92%, rgba(126,92,39,.10), transparent 32%),
    repeating-linear-gradient(135deg, rgba(94,68,41,.024) 0 1px, transparent 1px 10px),
    var(--canvas);
}
html[data-theme="light"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .24;
  background:
    linear-gradient(115deg, transparent 0 86%, rgba(150,39,33,.18) 86% 86.7%, transparent 86.7%),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(111,78,41,.035) 40px, transparent 41px 80px);
}
html[data-theme="light"] .app-shell { position: relative; z-index: 1; }
html[data-theme="light"] .sidebar {
  border-right: 1px solid #70503b;
  background:
    linear-gradient(160deg, transparent 0 78%, rgba(157,42,35,.28) 78% 80%, transparent 80%),
    radial-gradient(circle at 14% 2%, rgba(197,155,73,.16), transparent 30%),
    linear-gradient(180deg, #33241d, #1c1512 72%);
  box-shadow: 12px 0 34px rgba(61,38,25,.24);
}
html[data-theme="light"] .brand strong {
  color: #f4e8ce;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: .13em;
}
html[data-theme="light"] .brand small { color: #b9a78b; }
html[data-theme="light"] .brand-mark {
  border: 2px solid #c69a48;
  border-radius: 50%;
  background: #9e3028;
  box-shadow: 0 0 0 3px rgba(193,151,72,.13), inset 0 0 0 2px #5d211c;
  transform: rotate(45deg);
}
html[data-theme="light"] .brand-mark i { border-radius: 0; background: #f1dcae; }
html[data-theme="light"] .nav-item { border-radius: 3px; color: #c4b79f; letter-spacing: .025em; }
html[data-theme="light"] .nav-item span { color: #a98b5d; }
html[data-theme="light"] .nav-item:hover { border-color: rgba(201,157,76,.28); background: rgba(255,244,220,.07); color: #fff4dc; }
html[data-theme="light"] .nav-item.active {
  border-color: rgba(203,155,68,.46);
  background: linear-gradient(90deg, rgba(156,43,36,.72), rgba(112,68,37,.32));
  box-shadow: inset 3px 0 0 #d4a74f;
}
html[data-theme="light"] .nav-item.active span { color: #f2c96f; }
html[data-theme="light"] .source-card {
  border-color: rgba(213,178,111,.24);
  border-radius: 4px;
  background: rgba(255,239,203,.045);
}
html[data-theme="light"] .source-dot,
html[data-theme="light"] .live-dot {
  background: #b98b35;
  box-shadow: 0 0 0 4px rgba(185,139,53,.13);
}
html[data-theme="light"] h1,
html[data-theme="light"] h2 {
  font-family: Georgia, "Times New Roman", serif;
}
html[data-theme="light"] h1 {
  padding-left: 15px;
  border-left: 4px solid #a5322a;
  color: #38261d;
  text-shadow: 0 1px 0 rgba(255,255,255,.65);
}
html[data-theme="light"] .eyebrow { color: #9e4a35; }
html[data-theme="light"] .theme-button {
  border-color: #bca47e;
  border-radius: 4px;
  background: linear-gradient(180deg, #fff9ea, #ead9ba);
  color: #503b2d;
  box-shadow: 0 8px 18px rgba(75,49,28,.11), inset 0 1px 0 #fff;
}
html[data-theme="light"] .theme-button:hover { border-color: #9b712f; background: #f8eccf; }
html[data-theme="light"] .publish-button {
  border-color: #7e251f;
  border-radius: 4px;
  background: linear-gradient(135deg, #b33b32, #872820);
  color: #fff4e8;
  box-shadow: 0 9px 20px rgba(139,41,33,.22), inset 0 1px 0 rgba(255,255,255,.18);
  text-transform: uppercase;
  letter-spacing: .045em;
}
html[data-theme="light"] .snapshot {
  border-color: #cdbb9d;
  border-radius: 4px;
  background: rgba(255,249,235,.78);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75);
}
html[data-theme="light"] .publish-notice { border-radius: 3px; background: #fff8e9; }
html[data-theme="light"] .panel,
html[data-theme="light"] .kpi-card {
  border-color: #d3bd98;
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(171,127,54,.055), transparent 38%),
    #fffaf0;
  box-shadow: 0 14px 32px rgba(79,48,27,.11), inset 0 1px 0 rgba(255,255,255,.85);
}
html[data-theme="light"] .advanced-search-panel { position: relative; overflow: hidden; }
html[data-theme="light"] .advanced-search-panel::before {
  content: "ARCHIVO DE PRODUCCION";
  position: absolute;
  top: 0;
  right: 18px;
  padding: 4px 10px;
  border-radius: 0 0 3px 3px;
  background: #a02f28;
  color: #fff1df;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .13em;
}
html[data-theme="light"] .filters input,
html[data-theme="light"] .filters select,
html[data-theme="light"] .reset-button {
  border-color: #cdb995;
  border-radius: 3px;
  background: #fffdf6;
  color: #3d2d23;
}
html[data-theme="light"] .filters input:focus,
html[data-theme="light"] .filters select:focus { border-color: #a57834; box-shadow: 0 0 0 3px rgba(165,120,52,.12); }
html[data-theme="light"] .reset-button { border-color: #5f4031; background: #4a3329; color: #fff2dc; }
html[data-theme="light"] .filter-field > span { color: #8b6342; }
html[data-theme="light"] .advanced-status-grid button {
  border-color: #d0bc99;
  border-radius: 3px;
  background: linear-gradient(180deg, #fffdf5, #f3e7cf);
  color: #4b372a;
}
html[data-theme="light"] .advanced-status-grid button:hover { border-color: #a87831; background: #f7e9c9; }
html[data-theme="light"] .advanced-status-grid button.selected {
  border-color: #a6332b;
  background: linear-gradient(90deg, rgba(164,48,40,.13), rgba(196,151,68,.16));
  box-shadow: inset 3px 0 0 #a6332b, 0 0 0 3px rgba(163,49,41,.07);
}
html[data-theme="light"] .advanced-status-grid strong { color: #7d3026; }
html[data-theme="light"] .kpi-card { border-top-width: 3px; }
html[data-theme="light"] .kpi-card.blue { border-top-color: #7a5a42; }
html[data-theme="light"] .kpi-card.mint,
html[data-theme="light"] .kpi-card.lime { border-top-color: #b58a36; }
html[data-theme="light"] .kpi-card.cyan { border-top-color: #557b7a; }
html[data-theme="light"] .kpi-card.violet { border-top-color: #9f332b; }
html[data-theme="light"] .kpi-head { color: #705b48; }
html[data-theme="light"] .kpi-head b,
html[data-theme="light"] .avatar,
html[data-theme="light"] .rate-badge,
html[data-theme="light"] .panel-count { border-radius: 3px; }
html[data-theme="light"] .total-progress,
html[data-theme="light"] .mini-bar { background: #dfd0b4; }
html[data-theme="light"] .total-progress span,
html[data-theme="light"] .mini-bar span { background: linear-gradient(90deg, #9f3028, #c99c47); }
html[data-theme="light"] .donut { filter: sepia(.18) saturate(.88); }
html[data-theme="light"] .donut > div { background: #fffaf0; box-shadow: inset 0 0 0 1px #dbc9aa; }
html[data-theme="light"] .delivery-strip { border: 1px solid #d9c7a8; border-radius: 3px; background: #f7ecd8; }
html[data-theme="light"] .quick-tabs { border: 1px solid #d3c09f; border-radius: 3px; background: #eadcc3; }
html[data-theme="light"] .quick-tabs button { border-radius: 2px; color: #806b57; }
html[data-theme="light"] .quick-tabs button.selected { background: #fffaf0; color: #6e2c24; box-shadow: inset 0 -2px 0 #a6342c; }
html[data-theme="light"] th { border-bottom: 1px solid #cdb995; background: #eadcc4; color: #765942; }
html[data-theme="light"] td { border-top-color: #e3d5bd; }
html[data-theme="light"] tbody tr:hover { background: rgba(185,137,54,.065); }
html[data-theme="light"] .order-id { color: #8f3028; }
html[data-theme="light"] .movement-pill,
html[data-theme="light"] .status { border: 1px solid currentColor; border-radius: 2px; }
html[data-theme="light"] footer { color: #8b7966; }

/* Modo oscuro de supervivencia: consola industrial, contención y alerta. */
html[data-theme="dark"] {
  color-scheme: dark;
  --navy-950: #050806;
  --navy-900: #141c16;
  --ink: #e1e7dc;
  --muted: #879286;
  --line: #2b352d;
  --surface: #101511;
  --canvas: #070a08;
  --lime: #a7be4b;
  --lime-soft: #1d281b;
  --cyan: #6d9a7f;
  --cyan-soft: #16251d;
  --blue: #8da58f;
  --blue-soft: #1b251d;
  --violet: #9d8ba8;
  --violet-soft: #251f28;
  --amber: #c7a64c;
  --amber-soft: #2c2515;
  --red: #d4493f;
  --shadow: 0 18px 46px rgba(0,0,0,.38);
}
html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 84% -8%, rgba(150,181,72,.10), transparent 31%),
    radial-gradient(circle at 72% 78%, rgba(157,40,35,.08), transparent 34%),
    repeating-linear-gradient(0deg, rgba(139,161,126,.018) 0 1px, transparent 1px 4px),
    var(--canvas);
}
html[data-theme="dark"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: .28;
  background: linear-gradient(90deg, transparent 0 49.85%, rgba(174,197,101,.035) 50%, transparent 50.15%);
  mix-blend-mode: screen;
}
html[data-theme="dark"] .sidebar {
  border-right: 1px solid #303a31;
  background:
    linear-gradient(135deg, transparent 0 84%, rgba(177,57,49,.18) 84% 86%, transparent 86%),
    radial-gradient(circle at 18% 2%, rgba(153,183,65,.11), transparent 30%),
    linear-gradient(180deg, #090d0a, #050806 72%);
  box-shadow: 14px 0 40px rgba(0,0,0,.32);
}
html[data-theme="dark"] .brand strong { color: #eef0e8; letter-spacing: .12em; }
html[data-theme="dark"] .brand small { color: #788276; }
html[data-theme="dark"] .brand-mark {
  border: 1px solid #c2d56a;
  border-radius: 4px;
  background: #9eaf43;
  box-shadow: 0 0 20px rgba(163,185,70,.18);
  transform: rotate(2deg);
}
html[data-theme="dark"] .brand-mark i { border-radius: 0; background: #11170f; }
html[data-theme="dark"] .nav-item { border-radius: 3px; color: #7f8b80; letter-spacing: .03em; }
html[data-theme="dark"] .nav-item:hover { border-color: #2d382f; background: #111712; color: #d9dfd5; }
html[data-theme="dark"] .nav-item.active {
  border-color: rgba(205,69,59,.58);
  background: linear-gradient(90deg, rgba(193,57,49,.22), rgba(115,135,64,.07));
  box-shadow: inset 3px 0 0 var(--red);
}
html[data-theme="dark"] .nav-item.active span { color: #df5b50; }
html[data-theme="dark"] .source-card {
  border-color: #303a31;
  border-radius: 4px;
  background: rgba(139,164,81,.045);
}
html[data-theme="dark"] .source-dot,
html[data-theme="dark"] .live-dot {
  background: #b8ce57;
  box-shadow: 0 0 0 3px rgba(174,201,77,.10), 0 0 12px rgba(174,201,77,.42);
}
html[data-theme="dark"] .eyebrow { color: #98a56c; }
html[data-theme="dark"] h1 { color: #edf0e8; text-shadow: 0 0 24px rgba(169,191,84,.08); }
html[data-theme="dark"] .theme-button {
  border-color: #3b473c;
  border-radius: 4px;
  background: #151b16;
  color: #bbc5b7;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.015), 0 10px 24px rgba(0,0,0,.26);
}
html[data-theme="dark"] .theme-button:hover { border-color: #a4b65a; background: #1b231c; color: #e8ede4; }
html[data-theme="dark"] .publish-button {
  border-color: #a73d35;
  border-radius: 4px;
  background: linear-gradient(135deg, #b43e35, #7e2c27);
  color: #fff0ec;
  box-shadow: 0 10px 24px rgba(132,35,30,.22), inset 0 1px 0 rgba(255,255,255,.08);
  text-transform: uppercase;
  letter-spacing: .05em;
}
html[data-theme="dark"] .snapshot {
  border-color: #303a31;
  border-radius: 4px;
  background: rgba(15,21,16,.88);
}
html[data-theme="dark"] .publish-notice {
  border-radius: 3px;
  background: #111713;
  color: #aab4a7;
}
html[data-theme="dark"] .publish-notice.working { border-color: #516858; background: #142019; color: #9db5a3; }
html[data-theme="dark"] .publish-notice.success { border-color: #5d6e38; background: #1b2417; color: #b7c784; }
html[data-theme="dark"] .publish-notice.error { border-color: #733b36; background: #281613; color: #da8179; }
html[data-theme="dark"] .panel,
html[data-theme="dark"] .kpi-card {
  border-color: #2c362e;
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(158,180,78,.025), transparent 42%),
    #101511;
  box-shadow: 0 16px 40px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.018);
}
html[data-theme="dark"] .advanced-search-panel { position: relative; overflow: hidden; }
html[data-theme="dark"] .advanced-search-panel::before {
  content: "CONTROL // SECTOR PRODUCCIÓN";
  position: absolute;
  top: 0;
  right: 18px;
  padding: 4px 9px;
  border-radius: 0 0 3px 3px;
  background: #802e29;
  color: #f2d9d5;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .12em;
}
html[data-theme="dark"] .filters input,
html[data-theme="dark"] .filters select,
html[data-theme="dark"] .reset-button {
  border-color: #354037;
  border-radius: 3px;
  background: #0b100d;
  color: #d7ddd3;
}
html[data-theme="dark"] .filters input::placeholder { color: #68736a; }
html[data-theme="dark"] .filters input:focus,
html[data-theme="dark"] .filters select:focus { border-color: #9daf55; box-shadow: 0 0 0 3px rgba(157,175,85,.09); }
html[data-theme="dark"] .reset-button { border-color: #4c594d; background: #1d261f; color: #c7cec4; }
html[data-theme="dark"] .filter-field > span { color: #8e9c79; }
html[data-theme="dark"] .advanced-status-grid button {
  border-color: #303b32;
  border-radius: 3px;
  background: #0c110e;
  color: #bac4b8;
}
html[data-theme="dark"] .advanced-status-grid button:hover { border-color: #788847; background: #151d16; }
html[data-theme="dark"] .advanced-status-grid button.selected {
  border-color: #c24b41;
  background: linear-gradient(90deg, rgba(177,56,48,.17), rgba(136,154,72,.08));
  box-shadow: inset 3px 0 0 #cf493f, 0 0 18px rgba(169,55,48,.09);
}
html[data-theme="dark"] .advanced-status-grid strong { color: #d7dfb4; }
html[data-theme="dark"] .kpi-card { border-top-width: 2px; }
html[data-theme="dark"] .kpi-card.blue,
html[data-theme="dark"] .kpi-card.violet { border-top-color: #566459; }
html[data-theme="dark"] .kpi-head { color: #95a094; }
html[data-theme="dark"] .kpi-head b { border-radius: 3px; filter: saturate(.72); }
html[data-theme="dark"] .rate-badge,
html[data-theme="dark"] .panel-count { border: 1px solid #52613c; border-radius: 3px; }
html[data-theme="dark"] .total-progress,
html[data-theme="dark"] .mini-bar { background: #252e27; }
html[data-theme="dark"] .total-progress span,
html[data-theme="dark"] .mini-bar span { background: linear-gradient(90deg, #71813b, #b1c659); }
html[data-theme="dark"] .avatar { border-radius: 3px; }
html[data-theme="dark"] .donut { filter: saturate(.66) brightness(.88); }
html[data-theme="dark"] .donut > div { background: #101511; box-shadow: inset 0 0 0 1px #2b352d; }
html[data-theme="dark"] .delivery-strip { border: 1px solid #28332a; border-radius: 3px; background: #0b100d; }
html[data-theme="dark"] .delivery-strip span { color: #849084; }
html[data-theme="dark"] .quick-tabs { border: 1px solid #2c362e; border-radius: 3px; background: #0a0e0b; }
html[data-theme="dark"] .quick-tabs button { border-radius: 2px; color: #7e897e; }
html[data-theme="dark"] .quick-tabs button.selected { background: #283025; color: #d9dfd5; box-shadow: inset 0 -2px 0 #adbf56; }
html[data-theme="dark"] th { border-bottom: 1px solid #323c34; background: #0b100d; color: #899589; }
html[data-theme="dark"] td { border-top-color: #252e27; }
html[data-theme="dark"] tbody tr:hover { background: rgba(159,179,81,.035); }
html[data-theme="dark"] .order-id { color: #bccd7d; }
html[data-theme="dark"] td small { color: #748075; }
html[data-theme="dark"] .movement-pill,
html[data-theme="dark"] .status { border: 1px solid currentColor; border-radius: 2px; }
html[data-theme="dark"] .movement-pill.pickup { background: #1c2619; color: #a9bf65; }
html[data-theme="dark"] .movement-pill.shipment { background: #17231c; color: #82a992; }
html[data-theme="dark"] .status.done { background: #1d281a; color: #afc66d; }
html[data-theme="dark"] .status.pending { background: #2a1714; color: #dc7168; }
html[data-theme="dark"] .status.delivered { background: #18251b; color: #83b18e; }
html[data-theme="dark"] .status.waiting { background: #2a2415; color: #d1b45f; }
html[data-theme="dark"] footer { color: #606b62; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: minmax(230px, 1fr) repeat(3, 145px); }
  .reset-button { grid-column: 4; justify-self: end; }
  .advanced-search-heading .reset-button { grid-column: auto; }
  .advanced-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .advanced-text-search { grid-column: span 2; }
}

@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; height: auto; padding: 15px 20px; flex-direction: row; align-items: center; }
  .brand { padding: 0; }
  .brand small, .source-card, .sidebar nav a:nth-child(n+2) { display: none; }
  .sidebar nav { margin-left: auto; }
  .nav-item { padding: 9px 11px; }
  main { margin-left: 0; padding: 24px 20px; }
  .insights-grid { grid-template-columns: 1fr; }
  .header-actions { align-items: flex-end; flex-direction: column-reverse; }
}

@media (max-width: 700px) {
  .topbar { display: grid; }
  .header-actions { width: 100%; align-items: stretch; flex-direction: column-reverse; }
  .publish-button { width: 100%; }
  .snapshot { width: fit-content; }
  .filters { grid-template-columns: 1fr 1fr; }
  .search-box { grid-column: 1 / -1; }
  .reset-button { grid-column: auto; justify-self: stretch; }
  .advanced-search-heading { flex-direction: column; }
  .advanced-search-heading .reset-button { width: 100%; }
  .advanced-filters { grid-template-columns: 1fr 1fr; }
  .advanced-text-search { grid-column: 1 / -1; }
  .advanced-status-grid { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-card:last-child { grid-column: 1 / -1; }
  .orders-heading { align-items: flex-start; flex-direction: column; }
  .route-content { grid-template-columns: 120px 1fr; gap: 10px; }
  .donut { width: 110px; }
  .delivery-strip { grid-template-columns: 1fr auto; }
  footer { gap: 8px; flex-direction: column; }
}

@media (max-width: 430px) {
  main { padding: 20px 14px; }
  h1 { font-size: 28px; }
  .filters { grid-template-columns: 1fr; }
  .search-box { grid-column: auto; }
  .advanced-filters { grid-template-columns: 1fr; }
  .advanced-text-search { grid-column: auto; }
  .advanced-status-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-card:last-child { grid-column: auto; }
  .route-content { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
  .quick-tabs { width: 100%; }
  .quick-tabs button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
