/*
 * Sistema visual ejecutivo para Dashboard Vias.
 * Esta capa intencionalmente vive al final para unificar los estilos historicos
 * sin alterar la logica ni las vistas especializadas del dashboard.
 */

:root,
:root:not(.dark),
:root.light {
  color-scheme: light;
  --bg: #f3f6f8;
  --ink: #18232f;
  --muted: #647383;
  --line: #dbe3e9;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --topbar-bg: #ffffff;
  --sidebar-bg: #102738;
  --sidebar-ink: #eef4f7;
  --sidebar-muted: #9db0bd;
  --sidebar-active: #147d78;
  --tabs-bg: #edf3f5;
  --table-head: #f0f4f6;
  --field-bg: #ffffff;
  --stock-bg: #edf8f0;
  --stock-ink: #166534;
  --stock-ok: #15803d;
  --stock-low: #a16207;
  --stock-low-soft: #fff7e6;
  --bar-track: #e6ecef;
  --footer-bg: #ffffff;
  --accent: #0f766e;
  --accent-2: #126d86;
  --accent-3: #14a694;
  --entry: #15803d;
  --entry-soft: #edf8f0;
  --exit: #b91c1c;
  --exit-soft: #fef2f2;
  --shadow: rgba(24, 45, 60, 0.08);
  --professional-shadow: 0 1px 2px rgba(20, 40, 54, 0.04), 0 8px 24px rgba(20, 40, 54, 0.055);
  --professional-radius: 12px;
  --font-main: "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
  --font-condensed: "Arial Narrow", "Aptos Narrow", "Roboto Condensed", Arial, sans-serif;
  scrollbar-gutter: stable;
}

:root.dark {
  color-scheme: dark;
  --bg: #0b1420;
  --ink: #e7eef4;
  --muted: #96a7b6;
  --line: #273849;
  --surface: #111e2b;
  --surface-soft: #162535;
  --topbar-bg: #0b1420;
  --sidebar-bg: #08131e;
  --sidebar-ink: #edf5f7;
  --sidebar-muted: #8ba3b1;
  --sidebar-active: #14847d;
  --tabs-bg: #182a3a;
  --table-head: #1a2b3b;
  --field-bg: #0d1925;
  --stock-bg: #163524;
  --stock-ink: #86efac;
  --stock-ok: #4ade80;
  --stock-low: #fcd34d;
  --stock-low-soft: #382d18;
  --bar-track: #22384a;
  --footer-bg: #111e2b;
  --accent: #2dd4bf;
  --accent-2: #67c7df;
  --accent-3: #44dbc6;
  --entry: #4ade80;
  --entry-soft: #163524;
  --exit: #fca5a5;
  --exit-soft: #3b1d21;
  --shadow: rgba(0, 0, 0, 0.24);
  --professional-shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 10px 28px rgba(0, 0, 0, 0.18);
}

html {
  background: var(--bg);
}

body,
:root:not(.dark) body,
:root.light body,
:root.dark body {
  position: relative;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  display: none;
  content: none;
  background: none;
}

.app-shell {
  position: relative;
  z-index: 1;
}

button,
input,
select,
textarea,
table {
  font-family: inherit;
}

h1,
h2,
h3,
.eyebrow,
.sidebar .brand-block,
.sidebar .nav-menu,
.kpi-card,
.priority-strip,
.field-label,
th,
.badge,
.status-pill,
.type-pill {
  font-family: var(--font-condensed);
  font-stretch: condensed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent), transparent 76%);
  outline-offset: 2px;
}

* {
  scrollbar-color: color-mix(in srgb, var(--muted), transparent 50%) transparent;
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb:hover {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted), transparent 52%) padding-box;
}

.app-shell {
  grid-template-columns: 244px minmax(0, 1fr);
}

.workspace {
  min-height: 100vh;
}

/* Navegacion sobria y de alta densidad. */
.sidebar,
:root:not(.dark) .sidebar,
:root.light .sidebar,
:root.dark .sidebar {
  isolation: auto;
  padding: 18px 14px 14px;
  border-right: 1px solid rgba(75, 213, 226, 0.22);
  background-color: #03101c;
  background-image:
    linear-gradient(180deg, rgba(2, 11, 22, 0.28), rgba(2, 12, 24, 0.7)),
    radial-gradient(circle at 52% 18%, rgba(45, 212, 191, 0.34), transparent 38%),
    url("/assets/dashboard-water-vortex.png");
  background-position: center, center, 72% 44%;
  background-repeat: no-repeat;
  background-size: auto, auto, auto 112%;
  box-shadow:
    inset -1px 0 rgba(95, 225, 233, 0.08),
    10px 0 28px rgba(0, 8, 18, 0.24);
}

.sidebar::before,
:root:not(.dark) .sidebar::before,
:root.dark .sidebar::before {
  display: none;
  content: none;
}

.sidebar .brand-block,
:root:not(.dark) .sidebar .brand-block,
:root.dark .sidebar .brand-block {
  gap: 11px;
  padding: 4px 4px 17px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.sidebar .brand-mark,
:root:not(.dark) .brand-mark,
:root.light .brand-mark {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

.sidebar .brand-block strong {
  color: #f5f8fa;
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 8px rgba(0, 8, 18, 0.78);
}

.sidebar .brand-block span {
  margin-top: 2px;
  color: var(--sidebar-muted);
  font-size: 11px;
}

.sidebar .nav-menu {
  gap: 3px;
  margin: 0;
  padding-top: 17px;
}

.sidebar .nav-group {
  display: flex;
  gap: 9px;
  align-items: center;
  margin: 18px 9px 7px;
  color: var(--sidebar-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.sidebar .nav-group:first-child {
  margin-top: 2px;
}

.sidebar .nav-group::after {
  height: 1px;
  background: linear-gradient(90deg, rgba(83, 218, 229, 0.22), rgba(255, 255, 255, 0.04));
}

.sidebar .tab,
:root:not(.dark) .sidebar .tab,
:root.dark .sidebar .tab {
  grid-template-columns: 25px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #cbd8df;
  box-shadow: none;
  transform: none;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.sidebar .tab::before {
  display: none;
}

.sidebar .tab span:last-child {
  font-size: 13px;
  font-weight: 540;
  text-shadow: 0 1px 5px rgba(0, 7, 16, 0.82);
}

.sidebar .nav-icon,
.sidebar .tab.active .nav-icon {
  width: 25px;
  height: 25px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9fb5c1;
  filter: drop-shadow(0 0 7px rgba(75, 213, 226, 0.16));
}

.sidebar .nav-icon svg,
.sidebar .tab.active .nav-icon svg {
  width: 17px;
  height: 17px;
  filter: none;
}

.sidebar .tab:hover,
:root:not(.dark) .sidebar .tab:hover,
:root.dark .sidebar .tab:hover {
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(36, 165, 186, 0.1);
  color: #ffffff;
  box-shadow: none;
  transform: none;
}

.sidebar .tab.active,
:root:not(.dark) .sidebar .tab.active,
:root.light .sidebar .tab.active,
:root.dark .sidebar .tab.active,
.sidebar .tab.active:hover {
  border-color: rgba(83, 226, 230, 0.28);
  border-left: 3px solid #38c9b8;
  border-radius: 8px;
  background:
    linear-gradient(100deg, rgba(45, 212, 191, 0.25), rgba(8, 101, 133, 0.16));
  color: #ffffff;
  box-shadow:
    inset 0 1px rgba(185, 247, 245, 0.08),
    0 8px 18px rgba(0, 12, 25, 0.18);
}

.sidebar .tab.active .nav-icon {
  color: #5eead4;
  filter: drop-shadow(0 0 8px rgba(45, 212, 191, 0.34));
}

.sidebar .copyright,
.copyright {
  position: static;
  max-width: none;
  margin-top: auto;
  padding: 18px 5px 0;
  color: var(--sidebar-muted);
  font-size: 9px;
  line-height: 1.45;
  opacity: 0.72;
}

.sidebar-collapse {
  position: fixed;
  z-index: 30;
  top: 31px;
  left: 230px;
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: #173649;
  color: #d7e5eb;
  box-shadow: 0 4px 12px rgba(4, 17, 28, 0.24);
  cursor: pointer;
  transition: left 220ms cubic-bezier(0.2, 0.72, 0.2, 1), background 150ms ease, color 150ms ease, transform 180ms ease;
}

.sidebar-collapse:hover {
  background: var(--sidebar-active);
  color: #ffffff;
}

.sidebar-collapse svg {
  width: 15px;
  height: 15px;
  transition: transform 180ms ease;
}

@media (min-width: 901px) {
  .app-shell {
    transition: grid-template-columns 220ms cubic-bezier(0.2, 0.72, 0.2, 1);
  }

  body.sidebar-collapsed .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  body.sidebar-collapsed .sidebar {
    padding-inline: 10px;
  }

  body.sidebar-collapsed .sidebar .brand-block {
    grid-template-columns: 42px;
    justify-content: center;
    padding-inline: 7px;
  }

  body.sidebar-collapsed .sidebar .brand-block > div,
  body.sidebar-collapsed .sidebar .tab span:last-child,
  body.sidebar-collapsed .sidebar .copyright {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  body.sidebar-collapsed .sidebar .nav-menu {
    padding-top: 12px;
  }

  body.sidebar-collapsed .sidebar .nav-group {
    height: 12px;
    margin: 11px 6px 5px;
    overflow: hidden;
    color: transparent;
    font-size: 0;
  }

  body.sidebar-collapsed .sidebar .nav-group::after {
    width: 100%;
    background: rgba(255, 255, 255, 0.12);
  }

  body.sidebar-collapsed .sidebar .tab,
  :root:not(.dark) body.sidebar-collapsed .sidebar .tab,
  :root.dark body.sidebar-collapsed .sidebar .tab {
    grid-template-columns: 1fr;
    width: 48px;
    min-height: 42px;
    margin-inline: auto;
    padding: 0;
    justify-items: center;
  }

  body.sidebar-collapsed .sidebar .tab.active {
    border-left-width: 1px;
  }

  body.sidebar-collapsed .sidebar-collapse svg {
    transform: rotate(180deg);
  }

  body.sidebar-collapsed .sidebar-collapse {
    left: 62px;
  }
}

/* Cabecera tipo barra de aplicacion. */
.topbar,
:root:not(.dark) .topbar,
:root.light .topbar,
:root.dark .topbar {
  position: sticky;
  z-index: 12;
  top: 0;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 14px;
  min-height: 82px;
  padding: 15px clamp(20px, 2.7vw, 36px);
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  background-image: none;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--line), transparent 30%);
  overflow: hidden;
  animation: executive-header-in 480ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.topbar::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  width: clamp(150px, 20vw, 280px);
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  content: "";
  pointer-events: none;
  animation: executive-accent-scan 1100ms cubic-bezier(0.2, 0.72, 0.2, 1) 160ms both;
}

.topbar-title h1,
:root.light .topbar-title h1 {
  color: var(--ink);
  font-size: clamp(21px, 2vw, 27px);
  font-weight: 680;
  line-height: 1.18;
  letter-spacing: -0.025em;
}

.eyebrow,
:root.light .eyebrow,
:root.light .inventory-head .eyebrow {
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.105em;
  text-transform: uppercase;
}

.topbar-status,
:root:not(.dark) .topbar-status,
:root.light .topbar-status,
:root.dark .topbar-status {
  position: relative;
  display: grid;
  min-width: 184px;
  gap: 1px;
  padding: 8px 12px 8px 28px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  background-image: none;
  box-shadow: none;
}

.topbar-status::before {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--entry);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--entry), transparent 84%);
  content: "";
  transform: translateY(-50%);
  animation: executive-status-pulse 2.8s ease-out infinite;
}

.topbar-status[data-state="loading"]::before {
  background: #e69a18;
  box-shadow: 0 0 0 4px color-mix(in srgb, #e69a18, transparent 84%);
  animation-duration: 1.1s;
}

.topbar-status[data-state="error"]::before {
  background: var(--exit);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--exit), transparent 84%);
  animation: none;
}

.topbar-status span,
:root.light .topbar-status span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.topbar-status strong,
:root.light .topbar-status strong {
  color: var(--ink);
  font-size: 11px;
  font-weight: 560;
}

.topbar-actions {
  gap: 8px;
}

.icon-button,
:root:not(.dark) .icon-button:not(.primary-action),
:root.light .icon-button:not(.primary-action),
:root.dark .icon-button:not(.primary-action) {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  background-image: none;
  color: var(--ink);
  box-shadow: none;
  font-size: 12px;
  font-weight: 620;
}

.icon-button:hover,
:root:not(.dark) .icon-button:not(.primary-action):hover,
:root.light .icon-button:not(.primary-action):hover,
:root.dark .icon-button:not(.primary-action):hover {
  border-color: color-mix(in srgb, var(--accent), var(--line) 42%);
  background: color-mix(in srgb, var(--accent), var(--surface) 94%);
  color: var(--accent);
  box-shadow: none;
  transform: none;
}

.primary-action,
:root:not(.dark) .primary-action,
:root.light .primary-action,
:root.dark .primary-action {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-color: var(--accent);
  background: var(--accent);
  background-image: none;
  color: #ffffff;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--accent), transparent 78%);
}

.primary-action::after {
  position: absolute;
  z-index: -1;
  top: -35%;
  bottom: -35%;
  left: 0;
  width: 24%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.34), transparent);
  content: "";
  pointer-events: none;
  transform: translateX(-240%) skewX(-18deg);
  transition: transform 560ms cubic-bezier(0.2, 0.72, 0.2, 1);
}

.primary-action:hover::after,
.primary-action:focus-visible::after {
  transform: translateX(520%) skewX(-18deg);
}

.primary-action:hover,
:root:not(.dark) .primary-action:hover,
:root.light .primary-action:hover,
:root.dark .primary-action:hover {
  border-color: color-mix(in srgb, var(--accent), #000000 14%);
  background: color-mix(in srgb, var(--accent), #000000 10%);
  color: #ffffff;
}

/* Contenido y resumen. */
main {
  width: 100%;
  max-width: 1720px;
  margin-inline: auto;
  padding: 22px clamp(20px, 2.7vw, 36px) 52px;
}

.kpi-grid {
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card,
:root:not(.dark) .kpi-card,
:root.light .kpi-card,
:root.dark .kpi-card {
  isolation: isolate;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  min-height: 94px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--professional-radius);
  background: var(--surface);
  background-image: none;
  box-shadow: var(--professional-shadow);
  transition: border-color 140ms ease, box-shadow 140ms ease;
  animation: executive-card-in 520ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.kpi-card:nth-child(1) { animation-delay: 70ms; }
.kpi-card:nth-child(2) { animation-delay: 120ms; }
.kpi-card:nth-child(3) { animation-delay: 170ms; }
.kpi-card:nth-child(4) { animation-delay: 220ms; }

.fine-pointer .kpi-card::before,
.fine-pointer .surface::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    220px circle at var(--spot-x, 50%) var(--spot-y, 0%),
    color-mix(in srgb, var(--accent), transparent 84%),
    transparent 72%
  );
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.fine-pointer .kpi-card:hover::before,
.fine-pointer .surface:hover::before {
  opacity: 0.62;
}

.kpi-card:hover,
:root.light .kpi-card:hover {
  border-color: color-mix(in srgb, var(--accent), var(--line) 64%);
  box-shadow: 0 1px 2px rgba(20, 40, 54, 0.04), 0 10px 28px rgba(20, 40, 54, 0.075);
  transform: none;
}

.kpi-card::after,
:root:not(.dark) .kpi-card::after,
:root.light .kpi-card::after {
  inset: 15px auto 15px 0;
  width: 3px;
  height: auto;
  border-radius: 0 3px 3px 0;
  background: var(--line);
  opacity: 0.8;
}

.kpi-entry::after {
  background: var(--line);
}

.kpi-exit::after {
  background: var(--line);
}

.kpi-icon,
.kpi-card.kpi-empty .kpi-icon {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  opacity: 1;
}

.kpi-icon svg {
  width: 19px;
  height: 19px;
}

.kpi-entry .kpi-icon {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.kpi-exit .kpi-icon {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.kpi-card p,
.kpi-card span,
:root.light .kpi-card p,
:root.light .kpi-card small {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 520;
}

.kpi-card strong,
:root.light .kpi-card strong,
.kpi-card.kpi-empty strong {
  margin: 3px 0 4px;
  color: var(--ink);
  font-size: clamp(24px, 2vw, 30px);
  font-weight: 700;
  letter-spacing: -0.035em;
}

#kpiTopProvider,
#kpiTopCode {
  font-size: clamp(20px, 1.6vw, 25px);
}

.kpi-meta,
.kpi-card .kpi-meta {
  display: flex;
  min-height: 20px;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
  overflow: visible;
  white-space: normal;
}

.kpi-meta-value {
  color: var(--muted);
}

.kpi-trend {
  display: inline-flex;
  min-height: 19px;
  gap: 2px;
  align-items: center;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted) !important;
  font-family: var(--font-main);
  font-size: 9px !important;
  font-weight: 680 !important;
  line-height: 1;
}

.kpi-trend.down {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted) !important;
}

:root.dark .kpi-trend.down {
  color: var(--muted) !important;
}

.kpi-trend.neutral {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted) !important;
}

.kpi-compare-label {
  color: var(--muted);
  font-family: var(--font-main);
  font-size: 9px !important;
}

/* Resumen transversal de decisiones que requieren atencion. */
.priority-strip {
  display: grid;
  grid-template-columns: minmax(158px, 0.18fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  margin-bottom: 16px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--professional-radius);
  background: color-mix(in srgb, var(--surface), var(--accent) 1.5%);
  box-shadow: var(--professional-shadow);
  animation: executive-card-in 520ms cubic-bezier(0.2, 0.72, 0.2, 1) 260ms both;
}

.priority-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
}

.priority-heading-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent-2), transparent 66%);
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent-2), transparent 89%);
  color: var(--accent-2);
}

:root.dark .priority-heading-icon {
  color: var(--accent-2);
}

.priority-heading-icon svg {
  width: 18px;
  height: 18px;
}

.priority-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.12;
}

.priority-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  min-width: 0;
}

.priority-item {
  --priority-color: var(--accent-2);
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  min-height: 86px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.priority-item.critical { --priority-color: var(--exit); }
.priority-item.warning,
.priority-item.pending { --priority-color: #c98216; }
.priority-item.success { --priority-color: var(--entry); }

.priority-item::before {
  position: absolute;
  inset: 9px auto 9px 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--priority-color);
  content: "";
}

.priority-item:hover {
  border-color: color-mix(in srgb, var(--priority-color), var(--line) 46%);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--priority-color), transparent 90%);
  transform: translateY(-1px);
}

.priority-item:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--priority-color), transparent 72%);
  outline-offset: 2px;
}

.priority-item-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--priority-color), transparent 89%);
  color: var(--priority-color);
}

.priority-item-icon svg {
  width: 16px;
  height: 16px;
}

.priority-item-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.priority-item-label {
  color: var(--priority-color);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.priority-item-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.priority-item-copy small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-main);
  font-size: 9.5px;
  line-height: 1.3;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.priority-item-action {
  display: inline-flex;
  width: max-content;
  gap: 4px;
  align-items: center;
  margin-top: 2px;
  color: var(--priority-color);
  font-family: var(--font-main);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.2;
}

.priority-item-action b {
  font-size: 13px;
  line-height: 1;
  transition: transform 150ms ease;
}

.priority-item:hover .priority-item-action b {
  transform: translateX(2px);
}

/* Superficies, formularios y tablas. */
.surface,
:root:not(.dark) .surface,
:root.light .surface,
:root.dark .surface {
  position: relative;
  isolation: isolate;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--professional-radius);
  background: var(--surface);
  background-image: none;
  box-shadow: var(--professional-shadow);
}

:root.dark .kpi-card,
:root.dark .priority-strip,
:root.dark .priority-item,
:root.dark .surface {
  border-color: rgba(103, 199, 223, 0.24);
  background: var(--surface);
  box-shadow:
    inset 0 1px 0 rgba(171, 236, 247, 0.06),
    0 8px 24px rgba(0, 7, 18, 0.18);
}

.panel.active .surface {
  animation: executive-panel-in 420ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.panel.active .surface:nth-child(2) { animation-delay: 45ms; }
.panel.active .surface:nth-child(3) { animation-delay: 90ms; }

@keyframes executive-header-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes executive-card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes executive-panel-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes executive-accent-scan {
  0% {
    opacity: 0;
    transform: translateX(-520%);
  }
  24%, 72% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: translateX(110%);
  }
}

@keyframes executive-status-pulse {
  0%, 52% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--entry), transparent 84%);
  }
  78% {
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--entry), transparent 100%);
  }
  100% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--entry), transparent 84%);
  }
}

.surface:hover,
:root.light .surface:hover {
  border-color: var(--line);
  box-shadow: var(--professional-shadow);
  transform: none;
}

:root.dark .kpi-card:hover,
:root.dark .priority-strip:hover,
:root.dark .priority-item:hover,
:root.dark .surface:hover {
  border-color: rgba(45, 212, 191, 0.38);
  background: var(--surface);
  box-shadow:
    inset 0 1px 0 rgba(191, 247, 242, 0.1),
    0 9px 26px rgba(0, 11, 24, 0.22);
}

@media (max-width: 900px) {
  :root.dark .kpi-card,
  :root.dark .priority-strip,
  :root.dark .priority-item,
  :root.dark .surface {
    background: var(--surface);
  }
}

.section-head,
:root.light .section-head,
:root.light .inventory-head {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.section-head h2,
.inventory-head h2,
:root.light .section-head h2,
:root.light .inventory-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(17px, 1.4vw, 20px);
  font-weight: 660;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.field-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 680;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.input,
.search-field,
.transfer-search,
:root:not(.dark) .input,
:root:not(.dark) .search-field,
:root:not(.dark) .transfer-search,
:root.light .input,
:root.light .search-field,
:root.light .transfer-search,
:root.dark .input,
:root.dark .search-field,
:root.dark .transfer-search {
  min-height: 43px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field-bg);
  background-image: none;
  color: var(--ink);
  box-shadow: 0 1px 1px rgba(20, 40, 54, 0.025);
  font-size: 13px;
  font-weight: 450;
}

.input::placeholder {
  color: color-mix(in srgb, var(--muted), transparent 14%);
}

.input:hover,
.search-field:hover,
.transfer-search:hover {
  border-color: color-mix(in srgb, var(--accent), var(--line) 62%);
}

.input:focus,
.search-field:focus-within,
.transfer-search:focus-within,
:root:not(.dark) .input:focus,
:root:not(.dark) .search-field:focus-within,
:root:not(.dark) .transfer-search:focus-within,
:root.light .input:focus,
:root.light .search-field:focus-within,
:root.light .transfer-search:focus-within,
:root.dark .input:focus,
:root.dark .search-field:focus-within,
:root.dark .transfer-search:focus-within {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 84%);
}

.search-field {
  grid-template-columns: 43px minmax(0, 1fr);
  min-height: 48px;
}

.search-field .input {
  min-height: 46px;
  box-shadow: none;
}

.search-icon {
  width: 30px;
  height: 30px;
  margin-left: 8px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent), transparent 91%);
  color: var(--accent);
}

.search-icon svg {
  width: 16px;
  height: 16px;
}

.inventory-layout {
  gap: 16px;
}

.inventory-results-panel::before,
.inventory-movement-panel::before,
:root:not(.dark) .inventory-results-panel::before,
:root:not(.dark) .inventory-movement-panel::before {
  display: none;
  content: none;
}

.result-card,
.inventory-card,
.metric,
.notification-card,
.notification-filter-card,
.notification-scope,
.transfer-folio,
.report-control-panel,
.report-preview-card,
.provider-bars .bar-row,
:root:not(.dark) .inventory-card,
:root:not(.dark) .result-card,
:root:not(.dark) .metric,
:root:not(.dark) .transfer-folio,
:root.light .inventory-card,
:root.light .result-card,
:root.light .metric,
:root.light .notification-card,
:root.light .notification-filter-card,
:root.light .notification-scope,
:root.light .transfer-folio,
:root.light .report-control-panel,
:root.light .report-preview-card,
:root.light .provider-bars .bar-row {
  border-color: var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  background-image: none;
  box-shadow: none;
}

.inventory-card,
:root:not(.dark) .inventory-card,
:root.light .inventory-card {
  min-height: 90px;
  padding: 13px 14px;
  border-left: 3px solid var(--accent);
}

.inventory-card::before,
:root:not(.dark) .inventory-card::before,
:root.light .inventory-card::before {
  display: none;
  content: none;
}

.inventory-card:hover,
.result-card:hover,
.transfer-folio:hover,
:root:not(.dark) .inventory-card:hover,
:root.light .inventory-card:hover {
  border-color: color-mix(in srgb, var(--accent), var(--line) 58%);
  box-shadow: 0 5px 16px var(--shadow);
  transform: none;
}

.inventory-card strong,
:root.light .inventory-card strong,
.result-card strong,
:root.light .result-card strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 680;
}

.inventory-card > div:first-child > div,
:root.light .inventory-card > div:first-child > div,
.result-card p,
:root.light .result-card p {
  color: var(--muted);
  font-size: 12px;
}

.stock,
:root:not(.dark) .stock,
:root.light .stock {
  border: 1px solid color-mix(in srgb, var(--entry), transparent 72%);
  border-radius: 8px;
  background: var(--stock-bg);
  background-image: none;
  color: var(--stock-ink);
  box-shadow: none;
}

.stock.zero,
:root:not(.dark) .stock.zero,
:root.light .stock.zero {
  border-color: color-mix(in srgb, var(--exit), transparent 70%);
  background: var(--exit-soft);
  color: var(--exit);
}

.stock.low,
:root:not(.dark) .stock.low,
:root.light .stock.low,
:root.dark .stock.low {
  border-color: color-mix(in srgb, var(--stock-low), transparent 64%);
  background: var(--stock-low-soft);
  color: var(--stock-low);
}

:root.dark .stock.low {
  color: var(--stock-low);
}

.table-wrap,
.inventory-table,
:root:not(.dark) .table-wrap,
:root:not(.dark) .inventory-table,
:root.light .table-wrap,
:root.light .inventory-table,
:root.dark .table-wrap,
:root.dark .inventory-table {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  background-image: none;
  box-shadow: none;
}

table {
  font-size: 12px;
}

th,
:root:not(.dark) th,
:root.light th,
:root.light .inventory-table th,
:root.dark th {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--table-head);
  background-image: none;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.055em;
}

td,
:root:not(.dark) td,
:root.light td,
:root.light .inventory-table td,
:root.dark td {
  padding: 10px 11px;
  border-bottom-color: var(--line);
  background: transparent;
  color: var(--ink);
}

tbody tr:nth-child(even) td,
:root:not(.dark) tbody tr:nth-child(even) td,
:root.light tbody tr:nth-child(even) td,
:root.light .inventory-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface-soft), transparent 28%);
}

tbody tr:hover td,
:root:not(.dark) tbody tr:hover td,
:root.light tbody tr:hover td,
:root.light .inventory-table tbody tr:hover td {
  background: color-mix(in srgb, var(--accent), var(--surface) 94%);
}

.summary-inline,
.summary-strip {
  color: var(--muted);
}

.badge,
.status-pill,
.type-pill {
  font-weight: 650;
}

footer#status {
  display: none;
}

/* Tablet y movil: menos altura de cabecera, KPIs realmente escaneables. */
@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .priority-strip {
    grid-template-columns: 1fr;
  }

  .priority-heading {
    padding-bottom: 0;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar,
  :root:not(.dark) .sidebar,
  :root.light .sidebar,
  :root.dark .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 20;
    width: min(286px, calc(100vw - 48px));
    height: 100dvh;
    box-shadow: none;
    transform: translateX(-104%);
  }

  body.nav-open .sidebar,
  :root:not(.dark) body.nav-open .sidebar,
  :root.light body.nav-open .sidebar,
  :root.dark body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 18px 0 36px rgba(5, 18, 29, 0.26);
  }

  .topbar,
  :root:not(.dark) .topbar,
  :root.light .topbar,
  :root.dark .topbar {
    position: relative;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 0;
    padding: 14px 16px;
  }

  .menu-button {
    display: block;
    grid-column: 1;
    grid-row: 1;
    width: 40px;
    height: 40px;
    border-color: var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  .sidebar-collapse {
    display: none;
  }

  .topbar-title {
    grid-column: 2 / -1;
    grid-row: 1;
    align-self: center;
  }

  .topbar-title h1 {
    font-size: clamp(20px, 5.6vw, 24px);
  }

  .topbar-status {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    padding: 2px 0 2px 18px;
    border: 0;
    background: transparent;
  }

  .topbar-status::before {
    left: 3px;
  }

  .topbar-status span {
    display: none;
  }

  .topbar-status strong {
    max-width: none;
    color: var(--muted);
    font-size: 10px;
  }

  .topbar-actions {
    grid-column: 3;
    grid-row: 2;
    flex-wrap: nowrap;
  }

  .topbar-actions .icon-button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 11px;
  }

  main {
    padding: 16px 16px 38px;
  }

  .surface,
  :root:not(.dark) .surface,
  :root.light .surface,
  :root.dark .surface {
    padding: 16px;
  }

  .inventory-results-panel,
  .inventory-movement-panel {
    overflow: visible;
  }
}

@media (max-width: 600px) {
  .topbar {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .topbar-title {
    grid-column: 2;
  }

  .topbar-status {
    grid-column: 1 / -1;
    grid-row: 2;
    padding-left: 18px;
  }

  .topbar-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 3;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .topbar-actions .icon-button {
    width: 100%;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi-card {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 9px;
    min-height: 86px;
    padding: 12px 11px;
  }

  .fine-pointer .surface::before {
    display: none;
  }

  .kpi-card:nth-child(n + 3) {
    grid-column: 1 / -1;
  }

  .kpi-icon {
    width: 34px;
    height: 34px;
  }

  .kpi-card strong,
  .kpi-card.kpi-empty strong {
    font-size: 23px;
  }

  .priority-strip {
    gap: 9px;
    padding: 11px;
  }

  .priority-heading {
    gap: 9px;
  }

  .priority-heading-icon {
    width: 32px;
    height: 32px;
  }

  .priority-heading h2 {
    font-size: 16px;
  }

  .priority-items {
    display: flex;
    gap: 9px;
    overflow-x: auto;
    padding: 1px 1px 5px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .priority-item {
    flex: 0 0 min(286px, calc(100vw - 56px));
    scroll-snap-align: start;
  }

  #kpiTopProvider,
  #kpiTopCode {
    font-size: 20px;
  }

  .inventory-card,
  :root:not(.dark) .inventory-card,
  :root.light .inventory-card {
    padding: 12px;
  }
}

@media (max-width: 380px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card:nth-child(n + 3) {
    grid-column: auto;
  }
}

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

  .topbar,
  .topbar::after,
  .topbar-status::before,
  .kpi-card,
  .priority-strip,
  .panel.active .surface {
    animation: none !important;
  }

  .primary-action::after {
    display: none;
  }
}

/* Antigüedad de los datos y filtros de consulta de inventario. */
.topbar-status {
  max-width: 310px;
}

.topbar-status strong,
.topbar-status small {
  overflow-wrap: anywhere;
  white-space: normal;
}

.topbar-status small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.topbar-status[data-state="stale"]::before,
.topbar-status[data-state="unknown"]::before {
  background: #d48a13;
  box-shadow: 0 0 0 4px color-mix(in srgb, #d48a13, transparent 84%);
  animation: none;
}

.topbar-status[data-state="stale"] small,
.topbar-status[data-state="unknown"] small {
  color: #95600b;
  font-weight: 650;
}

:root.dark .topbar-status[data-state="stale"] small,
:root.dark .topbar-status[data-state="unknown"] small {
  color: #f7c76d;
}

.topbar-status[data-state="error"] small {
  color: var(--exit);
}

.data-freshness-notice {
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid #d5ae68;
  border-left: 4px solid #c48720;
  border-radius: 8px;
  background: #fff7e8;
  color: #7e520b;
  font-size: 13px;
  line-height: 1.6;
}

.data-freshness-notice[hidden] {
  display: none;
}

:root.dark .data-freshness-notice {
  border-color: #8c6d37;
  background: #302619;
  color: #f7d295;
}

.data-freshness-notice[data-state="error"] {
  border-color: var(--exit);
  background: var(--exit-soft);
  color: var(--exit);
}

.topbar-actions .icon-button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.inventory-quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.inventory-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.inventory-filter:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.inventory-filter[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), var(--surface) 90%);
  color: var(--accent);
}

.inventory-filter:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.inventory-filter [data-filter-count] {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-soft);
  color: inherit;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.inventory-filter[aria-pressed="true"] [data-filter-count] {
  background: color-mix(in srgb, var(--accent), transparent 86%);
}

.inventory-filter-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.inventory-filter-icon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
}

.inventory-ft-controls {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.inventory-ft-controls .field-label {
  display: grid;
  gap: 8px;
  max-width: 360px;
}

.inventory-flow-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.inventory-flow-stats small,
.inventory-flow-recent {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.inventory-flow-stats strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.inventory-flow-recent {
  margin-top: 8px;
}

.inventory-access-dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--professional-radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--professional-shadow);
}

.inventory-access-dialog::backdrop {
  background: rgb(4 15 26 / 72%);
}

.inventory-access-form {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.inventory-access-form > p,
.inventory-access-form > h2 {
  margin: 0;
}

#inventoryAccessDescription {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.inventory-access-form .field-label {
  display: grid;
  gap: 8px;
}

.inventory-access-error {
  color: var(--exit);
  font-size: 13px;
  line-height: 1.5;
}

.inventory-access-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.inventory-results-panel .inventory-head {
  flex-wrap: wrap;
  gap: 8px;
}

.inventory-rotation-meta {
  display: block;
  margin-top: 6px;
  color: var(--accent);
  font-size: 11px;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .topbar-status {
    max-width: none;
  }
}

@media (max-width: 600px) {
  .inventory-quick-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-filter {
    justify-content: space-between;
    min-height: 44px;
    padding: 9px 11px;
  }

  .inventory-flow-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-flow-stats > span:last-child {
    grid-column: 1 / -1;
  }

  .data-freshness-notice {
    padding: 11px 12px;
    font-size: 12px;
  }
}

/* Inventario compacto: la existencia es el dato principal. */
.inventory-results .inventory-card--ok { --inventory-state-color: var(--stock-ok); }
.inventory-results .inventory-card--low { --inventory-state-color: var(--stock-low); }
.inventory-results .inventory-card--zero { --inventory-state-color: var(--exit); }

:root .inventory-results .inventory-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(94px, auto);
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 10px 12px;
  border-left: 3px solid var(--inventory-state-color);
  background: var(--surface-soft);
}

:root .inventory-results .inventory-card:hover {
  border-color: var(--line);
  border-left-color: var(--inventory-state-color);
}

:root .inventory-card .inventory-material {
  min-width: 0;
}

:root .inventory-card .inventory-material > strong {
  display: block;
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

:root .inventory-card .inventory-material .inventory-description {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

:root .inventory-card .inventory-material .inventory-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.inventory-card .inventory-waste-meta,
.inventory-card .inventory-rotation-meta {
  display: inline;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 450;
  line-height: 1.4;
}

:root .inventory-card .inventory-quantities {
  display: block;
  min-width: 0;
}

:root .inventory-card .stock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  justify-items: end;
  gap: 2px 4px;
  min-width: 94px;
  min-height: 54px;
  padding: 7px 9px;
}

:root .inventory-card .stock .stock-status {
  grid-column: 1 / -1;
  margin: 0;
  color: inherit;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  text-transform: none;
}

:root .inventory-card .stock .stock-quantity {
  margin: 0;
  color: inherit;
  font-family: var(--font-main);
  font-size: 24px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

:root .inventory-card .stock .stock-unit {
  color: inherit;
  font-size: 10px;
  font-weight: 500;
}

/* Verde para entradas, rojo para salidas; turquesa para acciones y selección. */
.kpi-card .kpi-icon,
.kpi-card.kpi-empty .kpi-icon {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

:root .kpi-card.kpi-entry .kpi-icon {
  border-color: color-mix(in srgb, var(--entry), var(--line) 65%);
  background: var(--entry-soft);
  color: var(--entry);
}

:root .kpi-card.kpi-exit .kpi-icon {
  border-color: color-mix(in srgb, var(--exit), var(--line) 65%);
  background: var(--exit-soft);
  color: var(--exit);
}

:root .kpi-card.kpi-entry::after { background: var(--entry); }
:root .kpi-card.kpi-exit::after { background: var(--exit); }
#kpiTodayEntries { color: var(--entry); }
#kpiTodayExits { color: var(--exit); }

.type-pill.type-entry {
  border-color: color-mix(in srgb, var(--entry), var(--line) 65%);
  background: var(--entry-soft);
  color: var(--entry);
}

.type-pill.type-exit {
  border-color: color-mix(in srgb, var(--exit), var(--line) 65%);
  background: var(--exit-soft);
  color: var(--exit);
}

.movement-quantity {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.movement-quantity.entry { color: var(--entry); }
.movement-quantity.exit { color: var(--exit); }

@media (max-width: 600px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }

  :root .kpi-grid .kpi-card {
    grid-column: auto;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    min-height: 80px;
    padding: 8px 11px;
  }

  .kpi-grid .kpi-icon {
    display: none;
  }

  .kpi-grid .kpi-card > div:last-child {
    min-width: 0;
  }

  :root .kpi-grid .kpi-card p {
    margin: 0;
    font-size: 11px;
    line-height: 1.35;
  }

  :root .kpi-grid .kpi-card strong {
    display: block;
    margin: 3px 0;
    font-size: 22px;
    line-height: 1.15;
  }

  #kpiTopProvider,
  #kpiTopCode {
    overflow: hidden;
    font-size: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .kpi-grid .kpi-card .kpi-meta {
    min-height: 0;
    gap: 3px 4px;
    font-size: 10px;
    line-height: 1.3;
  }

  .kpi-grid .kpi-compare-label {
    display: none;
  }

  .kpi-grid .kpi-trend {
    min-height: 17px;
    padding: 2px 5px;
  }

  :root .inventory-results .inventory-card {
    gap: 9px;
    padding: 9px 10px;
  }

  :root .inventory-card .inventory-material .inventory-description {
    font-size: 11.5px;
  }
}

/* Tendencia semanal junto a las cifras, sin ampliar el resumen móvil. */
.kpi-value-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.kpi-value-row > strong { min-width: 0; white-space: nowrap; overflow: visible; text-overflow: clip; overflow-wrap: normal; word-break: normal; }
:root .kpi-grid .kpi-value-row > strong.kpi-value-long { font-size: 24px; }
:root .kpi-grid .kpi-value-row > strong.kpi-value-longer { font-size: 22px; }
.kpi-sparkline { display: grid; gap: 2px; min-width: 0; width: 100%; max-width: 100px; justify-self: end; margin: 0; }
.kpi-entry .kpi-sparkline { color: var(--entry); }
.kpi-exit .kpi-sparkline { color: var(--exit); }
.kpi-sparkline-svg { display: block; width: 100%; height: 30px; overflow: visible; }
.kpi-sparkline-baseline { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.kpi-sparkline-area { fill: currentColor; opacity: 0.1; }
.kpi-sparkline-line { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.kpi-sparkline-point { fill: currentColor; }
.kpi-sparkline-point.today { stroke: var(--surface); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.kpi-sparkline figcaption { color: var(--muted); font-size: 10px; line-height: 1.2; text-align: right; }
@media (max-width: 600px) {
  .kpi-value-row { gap: 6px; }
  .kpi-sparkline { max-width: 66px; }
  .kpi-sparkline-svg { height: 24px; }
  :root .kpi-grid .kpi-value-row > strong.kpi-value-long { font-size: 18px; }
  :root .kpi-grid .kpi-value-row > strong.kpi-value-longer { font-size: 16px; }
}
