@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(https://fonts.gstatic.com/s/plusjakartasans/v12/LDIbaomQNQcsA88c7O9yZ4KMCoOg4IA6-91aHEjcWuA_d0nNSg.ttf) format("truetype"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url(https://fonts.gstatic.com/s/plusjakartasans/v12/LDIbaomQNQcsA88c7O9yZ4KMCoOg4IA6-91aHEjcWuA_TknNSg.ttf) format("truetype"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 800; font-display: swap; src: url(https://fonts.gstatic.com/s/plusjakartasans/v12/LDIbaomQNQcsA88c7O9yZ4KMCoOg4IA6-91aHEjcWuA_KUnNSg.ttf) format("truetype"); }

:root {
  /* Backgrounds */
  --bg: #0a0a0b;
  --bg-elev: #0f1013;
  --bg-elev-2: #14161b;
  --bg-soft: #181b21;

  /* Borders */
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  /* Text */
  --text: #f3f5f7;
  --muted: #908e8e;
  --muted-2: #7d7c82;

  /* Cyan / acento */
  --cyan: #00ccff;
  --cyan-soft: rgba(0, 204, 255, 0.10);
  --cyan-soft-2: rgba(0, 204, 255, 0.16);
  --cyan-label: rgba(0, 204, 255, 0.52);
  --text-cyan-muted: rgba(0, 195, 240, 0.62);
  --gridline: rgba(0, 204, 255, 0.16);

  /* Semánticos */
  --green: #15d49c;  --green-soft: rgba(21, 212, 156, 0.10);
  --amber: #ffb020;  --amber-soft: rgba(255, 176, 32, 0.10);
  --red: #ff637d;    --red-soft: rgba(255, 99, 125, 0.10);
  --blue: #7ab7ff;   --blue-soft: rgba(122, 183, 255, 0.10);
  /* tints tokenizados (auto) */
  --amber-a08: rgba(255, 176, 32, 0.08);
  --amber-a12: rgba(255, 176, 32, 0.12);
  --amber-a20: rgba(255, 176, 32, 0.20);
  --amber-a25: rgba(255, 176, 32, 0.25);
  --amber-a28: rgba(255, 176, 32, 0.28);
  --cyan-a12: rgba(0, 204, 255, 0.12);
  --cyan-a18: rgba(0, 204, 255, 0.18);
  --cyan-a22: rgba(0, 204, 255, 0.22);
  --cyan-a24: rgba(0, 204, 255, 0.24);
  --cyan-a25: rgba(0, 204, 255, 0.25);
  --cyan-a28: rgba(0, 204, 255, 0.28);
  --cyan-a38: rgba(0, 204, 255, 0.38);
  --green-a08: rgba(21, 212, 156, 0.08);
  --green-a12: rgba(21, 212, 156, 0.12);
  --green-a25: rgba(21, 212, 156, 0.25);
  --green-a28: rgba(21, 212, 156, 0.28);
  --red-a28: rgba(255, 99, 125, 0.28);
  --red-a30: rgba(255, 99, 125, 0.30);
  --cyan-chart-bar: rgba(0, 204, 255, 0.55);
  --cyan-chart-line: rgba(0, 204, 255, 0.16);
  --purple: #a78bfa; --purple-soft: rgba(167, 139, 250, 0.12);
  --warm: #b5a090;   --warm-soft: rgba(181, 160, 144, 0.10);

  /* Sombras y foco */
  --glow: 0 0 0 3px rgba(0, 204, 255, 0.22);
  --shadow-sm: 0 1px 3px rgba(0, 18, 28, 0.30);
  --shadow-md: 0 4px 14px rgba(0, 20, 30, 0.26);
  --shadow-lg: 0 12px 40px rgba(0, 26, 40, 0.34), 0 2px 12px rgba(0, 204, 255, 0.06);
  --shadow: var(--shadow-lg);

  /* Tipografía */
  --display: "Plus Jakarta Sans", "Inter", ui-sans-serif, system-ui, sans-serif;
  --sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --kpi-num: "Plus Jakarta Sans", "Inter", ui-sans-serif, system-ui, sans-serif;
  --fs-section-hero: 24px;
  --fs-panel-title: 14px;
  --fs-module-title: 13px;
  --fs-body: 13px;
  --fs-meta: 12px;
  --fs-caption: 11px;
  --fs-placeholder-title: 30px;

  /* Layout */
  --sidebar-w: 252px;
  --topbar-h: 56px;

  /* Radios */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-md: 16px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Componente — Navegación */
  --nav-label-color: #625f5f;
  --nav-item-text: #908e8e;
  --nav-item-bg: rgba(24, 24, 28, 0.82);
  --nav-item-border: rgba(255, 255, 255, 0.08);
  --nav-item-hover-text: #f0f1f3;
  --nav-item-hover-bg: rgba(0, 204, 255, 0.10);
  --nav-item-hover-border: rgba(0, 204, 255, 0.24);
  --nav-item-active-text: #f0f1f3;
  --nav-item-active-bg: rgba(0, 204, 255, 0.16);
  --nav-item-active-border: transparent;

  /* Componente — Login / Auth */
  --login-status-bg: rgba(24, 24, 28, 0.72);
  --login-status-text: #908e8e;
  --login-status-border: rgba(255, 255, 255, 0.08);
  --login-gate-bg: linear-gradient(145deg, rgba(24, 24, 28, 0.96), rgba(12, 12, 14, 0.90));
  --login-card-bg: rgba(255, 255, 255, 0.03);
  --login-card-border: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
  --bg: #f4f2ed;
  --bg-elev: #f6f4ef;
  --bg-elev-2: #ffffff;
  --bg-soft: #ece9e2;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.13);
  --text: #17191c;
  --muted: #5e5a57;
  --muted-2: #636875;
  --cyan: #009fc7;
  --cyan-soft: rgba(0, 159, 199, 0.10);
  --cyan-soft-2: rgba(0, 159, 199, 0.14);
  --cyan-label: rgba(0, 159, 199, 0.58);
  --text-cyan-muted: rgba(0, 140, 175, 0.58);
  --gridline: rgba(0, 159, 199, 0.18);
  --green: #0c9b6d;  --green-soft: rgba(12, 155, 109, 0.10);
  --amber: #c78000;  --amber-soft: rgba(199, 128, 0, 0.10);
  --red: #d4485e;    --red-soft: rgba(212, 72, 94, 0.10);
  /* tints tokenizados (auto) */
  --amber-a08: rgba(199, 128, 0, 0.08);
  --amber-a12: rgba(199, 128, 0, 0.12);
  --amber-a20: rgba(199, 128, 0, 0.20);
  --amber-a25: rgba(199, 128, 0, 0.25);
  --amber-a28: rgba(199, 128, 0, 0.28);
  --cyan-a12: rgba(0, 159, 199, 0.12);
  --cyan-a18: rgba(0, 159, 199, 0.18);
  --cyan-a22: rgba(0, 159, 199, 0.22);
  --cyan-a24: rgba(0, 159, 199, 0.24);
  --cyan-a25: rgba(0, 159, 199, 0.25);
  --cyan-a28: rgba(0, 159, 199, 0.28);
  --cyan-a38: rgba(0, 159, 199, 0.38);
  --green-a08: rgba(12, 155, 109, 0.08);
  --green-a12: rgba(12, 155, 109, 0.12);
  --green-a25: rgba(12, 155, 109, 0.25);
  --green-a28: rgba(12, 155, 109, 0.28);
  --red-a28: rgba(212, 72, 94, 0.28);
  --red-a30: rgba(212, 72, 94, 0.30);
  --cyan-chart-bar: rgba(0, 159, 199, 0.55);
  --cyan-chart-line: rgba(0, 159, 199, 0.16);
  --blue: #347de6;   --blue-soft: rgba(52, 125, 230, 0.10);
  --purple: #7c3aed; --purple-soft: rgba(124, 58, 237, 0.12);
  --warm: #8b7260;   --warm-soft: rgba(139, 114, 96, 0.10);
  --glow: 0 0 0 3px rgba(0, 159, 199, 0.22);
  --shadow-sm: 0 1px 3px rgba(16, 36, 54, 0.06);
  --shadow-md: 0 4px 14px rgba(16, 36, 54, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 80, 110, 0.09), 0 1px 4px rgba(0, 80, 110, 0.05);

  /* Componente — Navegación */
  --nav-label-color: #5e5a57;
  --nav-item-text: #17191c;
  --nav-item-bg: #f6f4ef;
  --nav-item-border: rgba(0, 0, 0, 0.10);
  --nav-item-hover-text: #0a0a0b;
  --nav-item-hover-bg: rgba(0, 159, 199, 0.10);
  --nav-item-hover-border: rgba(0, 159, 199, 0.28);
  --nav-item-active-text: #0a0a0b;
  --nav-item-active-bg: rgba(0, 159, 199, 0.16);
  --nav-item-active-border: transparent;

  /* Componente — Login / Auth */
  --login-status-bg: rgba(0, 0, 0, 0.05);
  --login-status-text: #17191c;
  --login-status-border: rgba(0, 0, 0, 0.10);
  --login-gate-bg: linear-gradient(145deg, rgba(246, 244, 239, 0.98), rgba(236, 233, 226, 0.95));
  --login-card-bg: rgba(255, 255, 255, 0.92);
  --login-card-border: rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  width: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

body {
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.login-stage {
  width: min(100%, 460px);
  display: grid;
  gap: 18px;
}

.login-brand {
  justify-items: center;
  text-align: center;
  margin-bottom: 6px;
}

[data-yiqi-logo] { cursor: pointer; }
[data-yiqi-logo] .yql { fill: currentColor; }
[data-yiqi-logo] .yqs { fill: var(--cyan); }
[data-yiqi-logo] .anim { transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: reduce) {
  [data-yiqi-logo] .anim { transform: none; }
}

.login-footer {
  display: grid;
  gap: 14px;
  justify-items: center;
  padding-top: 4px;
}
.login-forgot {
  font-size: 13px;
  color: var(--muted);
  justify-self: start;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: var(--sans);
}

.recovery-title { margin: 0; font-size: 20px; font-weight: 700; color: var(--text); white-space: nowrap; }
.recovery-msg { margin: 0; font-size: 12px; color: var(--green); }
.recovery-actions { display: flex; gap: 10px; margin-top: 6px; }
.recovery-actions .btn { flex: 1; margin-top: 0; }
.btn-back { background: var(--bg-soft); color: var(--text); }
.btn-back:hover { background: var(--bg-elev); }
.login-foot-div { width: 100%; height: 1px; background: var(--line); }
.login-web { font-size: 13px; color: var(--muted); }
.login-forgot:hover, .login-web:hover { color: var(--cyan); }

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: var(--bg-elev);
}

.brand-block {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.brand-kicker,
.page-kicker,
.section-kicker,
.panel-kicker,
.nav-label,
.kpi-label,
.status-label {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.brand-kicker,
.section-kicker,
.panel-kicker {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 700;
}

.brand-wordmark {
  display: grid;
  gap: 4px;
}

.brand-logo {
  width: 100px;
  height: auto;
  display: block;
}

.brand-logo-light {
  display: none;
}

[data-theme="light"] .brand-logo-dark {
  display: none;
}

[data-theme="light"] .brand-logo-light {
  display: block;
}

.brand-yiqi {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand-sub {
  color: var(--muted);
  font-size: 13px;
}

.source-card,
.kpi-card,
.panel,
.hero-card,
.status-panel {
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  box-shadow: var(--shadow-sm);
}

.source-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-lg);
}

.source-card p,
.hero-copy p,
.status-panel p,
.kpi-card p,
.decision-card p,
.signal-list p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.sidebar {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding: 14px 10px 18px;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.nav {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.nav-lbl {
  display: block;
  padding: 10px 8px 4px;
  color: var(--muted-2);
  font: 700 9px var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-div {
  height: 1px;
  margin: 5px 0;
  background: var(--line);
}

.nav-link {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 500 12.5px var(--sans);
  text-align: left;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-link:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.nav-link.is-active {
  background: var(--cyan-soft);
  color: var(--cyan);
}

.n-ico {
  display: grid;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  place-items: center;
  border-radius: var(--radius-xs);
  background: var(--bg-soft);
  color: var(--muted);
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-link:hover .n-ico {
  color: var(--text);
}

.nav-link.is-active .n-ico {
  background: var(--cyan-soft-2);
  color: var(--cyan);
}

.n-ico svg {
  width: 13px;
  height: 13px;
}

.nav-eye {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: var(--muted-2);
  transition: color 0.18s ease;
}

.nav-eye svg {
  width: 14px;
  height: 14px;
}

.nav-link.is-active .nav-eye {
  color: var(--cyan);
}

.nav-chevron,
.src-chev {
  width: 14px;
  height: 14px;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--muted-2);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.22s ease;
}

.src-item {
  display: flex;
  flex-direction: column;
}

.src-item.is-open .src-chev {
  transform: rotate(180deg);
}

.src-body {
  display: none;
  padding: 4px 4px 6px 8px;
}

.src-item.is-open .src-body {
  display: block;
}

.src-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev-2);
}

.src-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.src-card-title {
  color: var(--text);
  font: 600 13px var(--sans);
  line-height: 1.3;
}

.src-card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.sb-footer {
  margin-top: auto;
  padding: 14px 0 0 6px;
  border-top: 1px solid var(--line);
}

.sb-theme-switch {
  display: flex;
  width: 100%;
  margin-bottom: 10px;
  gap: 2px;
  padding: 3px;
}

.sb-theme-switch .theme-option {
  display: inline-flex;
  flex: 1;
  min-width: 0;
  width: auto;
  height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sb-theme-switch .theme-option svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.sb-copy {
  color: var(--muted-2);
  font: 500 10px/1.45 var(--mono);
}

.source-row,
.panel-header,
.topbar,
.topbar-actions,
.hero-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.content {
  padding: 28px 36px 40px;
  display: grid;
  gap: 20px;
  align-content: start;
  min-width: 0;
}

.runtime-banner {
  display: flex;
  align-items: baseline;
  gap: 4px 8px;
  padding: 8px 0;
  border: none;
  background: transparent;
  min-width: 0;
  flex-wrap: wrap;
  line-height: 1.5;
}

.runtime-banner strong {
  font: 500 11px var(--sans);
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.runtime-banner p {
  margin: 0;
  font: 400 11px var(--sans);
  color: var(--muted-2);
  min-width: 0;
  white-space: normal;
}

.ldot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ldot-g {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.runtime-banner[data-state="mock"] {
  border-color: transparent;
}

.runtime-banner[data-state="error"] {
  border-color: var(--red-a30);
}

.load-progress {
  display: grid;
  gap: 8px;
  padding: 6px 0;
  background: transparent;
}

.load-progress-track {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
  overflow: hidden;
}

.load-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
  transition: width 0.35s ease;
}

.load-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font: 600 13px var(--sans);
}
.load-progress-meta strong { font-family: var(--mono); color: var(--cyan); }

.load-progress-meta strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
}

[data-theme="light"] .account-chip,
[data-theme="light"] .source-card,
[data-theme="light"] .hero-card,
[data-theme="light"] .panel,
[data-theme="light"] .status-panel,
[data-theme="light"] .kpi-card,
[data-theme="light"] .pulse-card,
[data-theme="light"] .watchlist-card,
[data-theme="light"] .summary-card,
[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, 0.92);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 99;
  min-height: var(--topbar-h);
  min-width: 0;
  flex-wrap: wrap;
  align-items: flex-start;
  background: rgba(12, 12, 14, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

[data-theme="light"] .topbar {
  background: rgba(238, 236, 231, 0.88);
}

.app-topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 8px 28px 10px;
}

.topbar-l,
.topbar-c,
.topbar-r {
  display: flex;
  align-items: center;
  min-width: 0;
}

.topbar-l {
  gap: 10px;
}

.topbar-c {
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-r {
  justify-content: flex-end;
  gap: 6px;
}

.topbar-logo {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.topbar-logo-svg {
  height: 39px;
  width: auto;
  display: block;
}

.t-pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg-elev-2);
  color: var(--muted);
  font: 700 10px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar > div {
  min-width: 0;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.account-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--bg-elev-2);
  overflow: visible;
  flex-shrink: 0;
  min-width: 0;
}

.account-user-block {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 100%;
  padding: 0 10px 0 8px;
  border-right: 1px solid var(--line);
}

.account-avatar {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--cyan-soft);
  border: 1px solid var(--cyan-a24);
  display: grid;
  place-items: center;
  font: 700 9px var(--mono);
  color: var(--cyan);
  text-transform: uppercase;
}

.account-user {
  font: 500 11px var(--sans);
  color: var(--muted);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schema-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 12px;
  border: none;
  background: none;
  color: var(--text);
  cursor: pointer;
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
  transition: background 0.18s ease;
}

.schema-toggle:hover {
  background: var(--bg-soft);
}

#schema-label {
  font: 600 11px var(--mono);
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.schema-chev {
  display: flex;
  flex-shrink: 0;
  color: var(--muted-2);
  transition: transform 0.18s ease;
}

.schema-toggle[aria-expanded="true"] .schema-chev {
  transform: rotate(180deg);
}

.btn-refresh,
.btn-exit {
  height: 32px;
  display: inline-flex;
  align-items: center;
  border: none;
  border-radius: var(--radius-pill);
  font: 600 12px var(--sans);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.btn-refresh {
  width: 32px;
  padding: 0;
  justify-content: center;
  background: var(--cyan-soft-2);
  color: var(--cyan);
}

.btn-refresh:hover {
  background: var(--cyan-a28);
}

.btn-exit {
  padding: 0 10px;
  background: var(--bg-elev-2);
  color: var(--muted-2);
}

.btn-exit:hover {
  color: var(--text);
}

.schema-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(320px, 84vw);
  max-height: min(72vh, 620px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 20;
}

.schema-option {
  width: 100%;
  text-align: left;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  padding: 10px;
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.schema-option:hover,
.schema-option:focus-visible {
  outline: none;
  background: var(--cyan-soft);
}

.schema-option.is-active {
  background: var(--green-soft);
}

.schema-option-name {
  font-size: 13px;
  font-weight: 600;
}

.schema-option-id {
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
}

.session-warning {
  margin: 0;
  max-width: 52ch;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--amber-a28);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
  line-height: 1.4;
}

.page-kicker {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted-2);
  margin-bottom: 6px;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: -0.04em;
}

h2 {
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: -0.04em;
  max-width: 12ch;
}

h3 {
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: -0.02em;
}

h4 {
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: -0.02em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--cyan-soft);
  border-color: var(--cyan-a28);
  color: var(--cyan);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.range-filter {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: var(--radius-pill);
  background: var(--bg-elev-2);
  max-width: 100%;
  flex-wrap: wrap;
}

.range-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.range-btn:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.range-btn.is-active {
  background: var(--cyan-soft);
  color: var(--cyan);
  font-weight: 600;
}

.range-btn:focus-visible {
  outline: 2px solid var(--cyan-a38);
  outline-offset: -2px;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  border-radius: var(--radius-pill);
  padding: 4px;
}

.theme-switch:hover {
  border-color: var(--cyan-a28);
}

.theme-switch:focus-visible {
  outline: 2px solid var(--cyan-a38);
  outline-offset: 1px;
}

.theme-option {
  min-width: 78px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 600 11px var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.theme-option:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.theme-option.is-active {
  color: var(--cyan);
  background: var(--cyan-soft);
  box-shadow: 0 0 0 1px var(--cyan-a18) inset;
}

.login-form {
  display: grid;
  gap: 10px;
}

.brand-tagline {
  margin: 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.login-copy {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.auth-status[data-state="idle"] {
  visibility: hidden;
}

.auth-status[data-state="loading"] {
  color: var(--cyan);
}

.login-pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-pass-wrap .login-input {
  width: 100%;
  padding-right: 42px;
}

.login-pass-toggle {
  position: absolute;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s ease;
}

.login-pass-toggle:hover {
  color: var(--cyan);
}

.login-pass-toggle svg {
  width: 18px;
  height: 18px;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.login-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--cyan);
}

.login-label {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-input {
  min-width: 0;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 12px;
  border-radius: var(--radius);
}

.login-input:focus {
  outline: 2px solid var(--cyan-a38);
  outline-offset: 1px;
}

.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover,
.login-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-elev) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
}

.login-submit {
  margin-top: 6px;
}

.login-hint {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.login-input::placeholder {
  color: var(--muted-2);
}

.auth-status {
  margin: 0;
  min-height: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--login-status-text);
  background: none;
  border: none;
  padding: 0;
}

.auth-status[data-state="success"] {
  color: var(--green);
  border-color: var(--green-a28);
}

.auth-status[data-state="error"] {
  color: var(--red);
  border-color: var(--red-a28);
}

.dashboard-shell {
  display: grid;
  gap: 20px;
}

.login-gate {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--login-gate-bg);
  overflow: hidden;
}

.login-card {
  width: 100%;
  display: grid;
  gap: 14px;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--login-card-border);
  background: var(--login-card-bg);
}

.login-gate > .login-card {
  grid-area: 1 / 1;
  height: 100%;
  align-content: start;
}

.login-card.is-card-hidden {
  visibility: hidden;
  pointer-events: none;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 18px;
  padding: 28px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: none;
  pointer-events: none;
}

.cockpit-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  padding: 4px 0 4px;
}

.cp-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--cyan);
  font: 700 10px var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.cp-title {
  color: var(--text);
  font: 700 30px/1.12 var(--display);
  letter-spacing: -0.025em;
}

.cp-sub {
  max-width: 60ch;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.hero-copy {
  display: block;
  flex: 1;
  min-width: 280px;
  position: relative;
  z-index: 1;
}

.hero-status {
  position: relative;
  z-index: 1;
}

.hero-chips {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.hero-session-card {
  min-width: auto;
  flex: 0 0 auto;
  gap: 2px;
  padding: 11px 14px;
}

.hero-session-card .status-value {
  font-size: 18px;
}

.hero-session-card p {
  margin: 0;
  font-size: 11px;
  color: var(--muted-2);
}

.hc-clock {
  font-variant-numeric: tabular-nums;
}

.status-panel {
  flex: 1;
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: var(--radius-lg);
  min-height: 100%;
}

.status-label,
.kpi-label {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
}

.kpi-label,
.pulse-label,
.watchlist-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.wl-label {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
  font: 700 10px var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  line-height: 1.35;
}

.metric-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid var(--cyan-a22);
  background: var(--cyan-soft);
  color: var(--cyan);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mock-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--amber-a20);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  border: 1px solid var(--amber-a28);
  vertical-align: middle;
}

.status-value {
  font-size: 20px;
  font-weight: 700;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.pulse-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.pulse-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-elev-2);
  box-shadow: var(--shadow-sm);
}

.pulse-label {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.metric-label { flex: 1; min-width: 0; line-height: 1.35; }

.pulse-value {
  margin-top: 8px;
  margin-bottom: 6px;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.kpi-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: none;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: visible;
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: none;
  pointer-events: none;
}

.kpi-card > * {
  position: relative;
  z-index: 1;
}

.skeleton-card {
  min-height: 156px;
}

.skeleton-line {
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  background-size: 200% 100%;
  animation: yiqi-shimmer 1.4s linear infinite;
}

.skeleton-label {
  width: 42%;
  height: 12px;
}

.skeleton-value {
  width: 70%;
  height: 28px;
}

.skeleton-text {
  width: 100%;
  height: 12px;
}

.kpi-value {
  font-family: var(--kpi-num);
  font-size: clamp(22px, 1.8vw, 26px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  width: fit-content;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font: 600 11px var(--mono);
  letter-spacing: 0.02em;
  line-height: 1.3;
  justify-self: center;
}

.is-positive {
  color: var(--green);
}

.is-negative {
  color: var(--red);
}

.is-neutral {
  color: var(--muted);
}

.kpi-delta.is-positive {
  color: var(--green);
  border-color: var(--green-a28);
  background: var(--green-soft);
}

.kpi-delta.is-negative {
  color: var(--red);
  border-color: var(--red-a28);
  background: var(--red-soft);
}

.kpi-delta.is-neutral {
  color: var(--muted);
  border-color: var(--line-strong);
  background: var(--bg-soft);
}

.kpi-note {
  font: 400 12px var(--sans);
  color: var(--muted-2);
  line-height: 1.4;
}

.kpi-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  margin-left: auto;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.kpi-help:hover,
.kpi-help:focus-visible,
.kpi-help.is-open {
  color: var(--text);
  border-color: var(--cyan);
  outline: none;
}
.kpi-help-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  width: max-content;
  max-width: 260px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  box-shadow: var(--shadow-md);
  color: var(--muted);
  font: 400 12px/1.45 var(--sans);
  letter-spacing: normal;
  text-transform: none;
  text-align: left;
  white-space: normal;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  z-index: 60;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.kpi-help.is-open .kpi-help-pop {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.kpi-trend {
  height: 40px;
  margin-top: 4px;
}

.kpi-trend svg {
  width: 100%;
  height: 100%;
}

.kpi-trend-grid {
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 1;
}

[data-theme="light"] .kpi-trend-grid {
  stroke: rgba(16, 36, 54, 0.12);
}

.kpi-trend-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.kpi-trend-line.is-positive {
  stroke: var(--green);
}

.kpi-trend-line.is-negative {
  stroke: var(--red);
}

.kpi-trend-line.is-neutral {
  stroke: var(--muted);
}

.kpi-trend-fill {
  opacity: 0.18;
}

.kpi-trend-fill.is-positive {
  fill: var(--green);
}

.kpi-trend-fill.is-negative {
  fill: var(--red);
}

.kpi-trend-fill.is-neutral {
  fill: var(--muted);
}

.accent-cyan {
  background: var(--bg-elev-2);
}

.kpi-card.kpi-clickable { cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.kpi-card.kpi-clickable:hover { box-shadow: var(--shadow-md); background: var(--bg-soft); }
.kpi-card.kpi-clickable:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.kpi-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  transition: color 0.15s ease, transform 0.2s ease;
}
.kpi-collapse svg { width: 14px; height: 14px; }
.kpi-collapse:hover,
.kpi-collapse:focus-visible { color: var(--text); outline: none; }
.kpi-card.is-collapsed .kpi-collapse { transform: rotate(-90deg); }
.kpi-body {
  display: grid;
  gap: 10px;
  overflow: hidden;
  max-height: 320px;
  opacity: 1;
  transition: max-height 0.26s ease, opacity 0.2s ease, margin-top 0.26s ease;
}
.kpi-card.is-collapsed .kpi-body {
  max-height: 0;
  opacity: 0;
  margin-top: -10px;
}


.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.dashboard-grid > * { min-width: 0; }
.section-container {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.panel {
  display: grid;
  gap: 18px;
  padding: 20px;
  border-radius: var(--radius-lg);
}

.panel-wide {
  grid-column: span 2;
}

.panel-full {
  grid-column: 1 / -1;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge-cyan {
  color: var(--cyan);
  background: var(--cyan-soft);
}

.badge-green {
  color: var(--green);
  background: var(--green-a08);
}

.badge-amber {
  color: var(--amber);
  background: var(--amber-a08);
}

.badge-muted {
  color: var(--muted);
  background: var(--bg-soft);
}


.modal-breakdown {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 9px;
}

.donut-block {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}
.panel:has(.donut-block) { container-type: inline-size; }
@container (max-width: 360px) {
  .donut-block { grid-template-columns: 1fr; justify-items: center; gap: 14px; }
  .donut-legend { width: 100%; max-width: 300px; }
}
.donut-chart {
  position: relative;
  height: 180px;
  min-width: 0;
}
.donut-legend {
  display: grid;
  gap: 8px;
  align-content: center;
}
.legend-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 6px 12px;
  align-items: center;
}
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-label { font: 400 12px var(--sans); color: var(--muted); }
.legend-pct { font: 600 12px var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .donut-block { grid-template-columns: 1fr; gap: 16px; justify-items: center; }
  .donut-legend { width: 100%; max-width: 320px; }
}

.branch-list {
  display: grid;
  gap: 12px;
}

.branch-row {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.branch-meta {
  display: grid;
  gap: 4px;
}

.branch-name {
  font-size: 13px;
  font-weight: 600;
}

.branch-detail {
  color: var(--muted);
  font-size: 12px;
}

.branch-bar {
  height: 14px;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
  overflow: hidden;
}

.branch-fill {
  height: 100%;
  min-width: 5px;
  border-radius: inherit;
  background: var(--cyan);
  transform-origin: left center;
  animation: funnelGrow 0.8s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.branch-list .branch-row:nth-child(1) .branch-fill { animation-delay: 0.00s; }
.branch-list .branch-row:nth-child(2) .branch-fill { animation-delay: 0.05s; }
.branch-list .branch-row:nth-child(3) .branch-fill { animation-delay: 0.10s; }
.branch-list .branch-row:nth-child(4) .branch-fill { animation-delay: 0.15s; }
.branch-list .branch-row:nth-child(5) .branch-fill { animation-delay: 0.20s; }
.branch-list .branch-row:nth-child(6) .branch-fill { animation-delay: 0.25s; }
.branch-list .branch-row:nth-child(7) .branch-fill { animation-delay: 0.30s; }
.branch-list .branch-row:nth-child(8) .branch-fill { animation-delay: 0.35s; }
.branch-list .branch-row:nth-child(9) .branch-fill { animation-delay: 0.40s; }
.branch-list .branch-row:nth-child(10) .branch-fill { animation-delay: 0.45s; }
@media (prefers-reduced-motion: reduce) { .branch-fill { animation: none; } }

.branch-revenue {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}

.branch-empty {
  color: var(--muted-2);
  font: 500 13px var(--mono);
}

.kpi-card-na .kpi-na {
  margin-top: 6px;
  font: 500 13px var(--sans);
  color: var(--muted-2);
  line-height: 1.4;
}

.pulse-card-na .pulse-na {
  margin-top: 6px;
  font: 500 13px var(--sans);
  color: var(--muted-2);
  line-height: 1.4;
}

.highlight-card-na .highlight-na,
.watchlist-card-na .watchlist-na {
  margin-top: 6px;
  font: 500 13px var(--sans);
  color: var(--muted-2);
  line-height: 1.4;
}

.trend-chart {
  position: relative;
  height: 250px;
  min-width: 0;
}

.trend-bar-wrap {
  min-height: 208px;
  display: grid;
  grid-template-rows: auto minmax(96px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.trend-bar {
  width: 100%;
  border-radius: var(--radius-sm) var(--radius-sm) 2px 2px;
  background: var(--cyan);
  min-height: 24px;
  transition: filter 0.2s ease;
  cursor: pointer;
}
.trend-bar:hover { filter: brightness(1.08); }

.trend-bar:hover {
  box-shadow: 0 12px 24px rgba(0, 160, 232, 0.32), inset 0 1px 1px rgba(255, 255, 255, 0.22);
  transform: translateY(-3px);
}

.trend-value,
.trend-day {
  text-align: center;
  font-size: 11px;
}
.trend-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
}

.trend-value {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.trend-day {
  font-family: var(--mono);
  color: var(--muted);
}

.trend-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  font-size: 13px;
}

.hourly-performance {
  display: grid;
  gap: 12px;
}

.hourly-row {
  display: grid;
  grid-template-columns: minmax(0, 112px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.hourly-meta {
  display: grid;
  gap: 3px;
}

.hourly-range {
  font-weight: 600;
  font-size: 13px;
}

.hourly-detail,
.hourly-share {
  color: var(--muted);
  font-size: 12px;
}

.hourly-bar-track {
  height: 14px;
  background: var(--line-strong);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.hourly-bar-fill {
  height: 100%;
  min-width: 5px;
  border-radius: inherit;
  background: var(--cyan);
  transform-origin: left center;
  animation: funnelGrow 0.8s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.hourly-bar-fill.is-dim { background: var(--cyan-chart-bar); }
.hourly-peak-chip {
  display: inline-block;
  font: 700 8px var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
  background: var(--cyan-soft);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  vertical-align: middle;
}
.hourly-row:nth-child(1) .hourly-bar-fill { animation-delay: 0s; }
.hourly-row:nth-child(2) .hourly-bar-fill { animation-delay: 0.05s; }
.hourly-row:nth-child(3) .hourly-bar-fill { animation-delay: 0.1s; }
.hourly-row:nth-child(4) .hourly-bar-fill { animation-delay: 0.15s; }
.hourly-row:nth-child(5) .hourly-bar-fill { animation-delay: 0.2s; }
.hourly-row:nth-child(6) .hourly-bar-fill { animation-delay: 0.25s; }
.hourly-row:nth-child(7) .hourly-bar-fill { animation-delay: 0.3s; }
.hourly-row:nth-child(8) .hourly-bar-fill { animation-delay: 0.35s; }
@media (prefers-reduced-motion: reduce) { .hourly-bar-fill { animation: none; } }

.signal-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.signal-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}

.signal {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  background: var(--muted-2);
}

.signal-green {
  background: var(--green);
}

.signal-amber {
  background: var(--amber);
}

.signal-red {
  background: var(--red);
}
.signal-cyan { background: var(--cyan); }

.signal-summary {
  align-items: center;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  margin-bottom: 4px;
}
.signal-summary .signal { margin-top: 0; }
.signal-summary strong { font: 600 12px var(--sans); color: var(--text); }
.signal-summary p { margin-top: 1px; font-size: 11px; }
.signal-summary.tone-red { background: var(--red-soft); }
.signal-summary.tone-amber { background: var(--amber-soft); }
.signal-summary.tone-green { background: var(--green-soft); }
.signal-summary.tone-red .signal-summary-state { color: var(--red); }
.signal-summary.tone-amber .signal-summary-state { color: var(--amber); }
.signal-summary.tone-green .signal-summary-state { color: var(--green); }
.signal-body { min-width: 0; }
.signal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.signal-metric { font: 600 13px var(--mono); color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0; }

.decision-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.decision-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
}
.status-pill { flex-shrink: 0; font: 700 9px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 8px; border-radius: var(--radius-pill); white-space: nowrap; }
.status-pill.pill-muted { background: var(--bg-elev-2); color: var(--muted); }
.status-pill.pill-amber { background: var(--amber-soft); color: var(--amber); }
.status-pill.pill-cyan { background: var(--cyan-soft); color: var(--cyan); }

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: var(--bg-elev-2);
}

/* Panel que contiene tabla o grid de cards: transparente (los cards son los que contrastan) */
.panel:has(.data-table),
.panel:has(.summary-grid),
.panel:has(.funnel),
.panel:has(.signal-list) {
  background: transparent;
  box-shadow: none;
  border: none;
}
/* Embudo v2: barras sobre ancho original + fuga + total */
.funnel { display: grid; gap: 14px; }
.funnel-total { text-align: right; flex-shrink: 0; }
.funnel-total-val { font: 700 22px var(--kpi-num); color: var(--green); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1; }
.funnel-total-lbl { font: 700 8px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-2); margin-top: 3px; }
.funnel-step-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.funnel-step-name { font: 500 11px var(--sans); color: var(--text); }
.funnel-step-count { font: 500 11px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.funnel-leak { font: 600 10px var(--mono); color: var(--red); }
.funnel-leak.is-ok { color: var(--green); }
.funnel-track { height: 16px; border-radius: var(--radius-pill); background: var(--line-strong); overflow: hidden; }
.funnel-fill { height: 100%; min-width: 5px; border-radius: var(--radius-pill); background: var(--cyan); }
.funnel-fill.is-end { background: var(--green); }
.funnel-note { margin: 4px 0 0; font-size: 11px; line-height: 1.5; color: var(--muted-2); }
.funnel-note strong { color: var(--red); font-weight: 600; }
.funnel-empty { margin: 0; font-size: 12px; color: var(--muted-2); }
.progress-empty { margin: 0; padding: 4px 0; font-size: 12px; color: var(--muted-2); }

/* animaciones de entrada */
@keyframes funnelGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.funnel-fill { transform-origin: left center; animation: funnelGrow 0.85s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
@media (prefers-reduced-motion: reduce) { .funnel-fill { animation: none; } }


/* Headers sortables (patrón DS) */
.data-table th {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 30px;
}
.data-table th::after {
  content: "\2195";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font: 700 11px var(--mono);
  color: var(--muted-2);
  opacity: 0.5;
}
.data-table th.sorted-asc::after { content: "\2191"; color: var(--cyan); opacity: 1; }
.data-table th.sorted-desc::after { content: "\2193"; color: var(--cyan); opacity: 1; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  transition: background-color 0.2s ease;
}

.data-table th {
  font: 700 10px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-2);
  background: var(--bg-elev);
}

.data-table tbody tr {
  transition: all 0.2s ease;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background-color: rgba(127, 136, 150, 0.04);
}

.data-table th.num,
.data-table td.num { text-align: right; }
.data-table td.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* 1ª columna (nombre) envuelve; las numéricas quedan nowrap → sin side-scroll */
.data-table th:first-child,
.data-table td:first-child { white-space: normal; }

/* Mobile: tabla apilada como tarjetas (sin scroll horizontal) */
@media (max-width: 640px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .data-table tbody tr:last-child { border-bottom: none; }
  .data-table td { padding: 3px 0; border: none; text-align: left; }
  .data-table td.num {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-align: right;
    margin-top: 2px;
  }
  .data-table td.num::before {
    content: attr(data-label);
    font: 700 9px var(--mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-2);
    align-self: center;
  }
}

.product-title {
  font-weight: 600;
}

.product-sku {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted-2);
  font-family: var(--mono);
}

.highlight-cards {
  display: grid;
  gap: 10px;
}

.panel:has(> .highlight-cards),
.panel:has(> .watchlist-grid) { background: var(--bg); }

.highlight-card {
  background: var(--bg-elev-2);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: grid;
  gap: 4px;
}

.highlight-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 700 10px var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.highlight-metric {
  margin-top: 2px;
  font-family: var(--kpi-num);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.highlight-card p {
  margin: 0;
  font: 400 12px var(--sans);
  color: var(--muted-2);
  line-height: 1.4;
}

.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.watchlist-grid-compact {
  grid-template-columns: 1fr;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-elev-2);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow: visible;
}

.summary-label {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
}

.summary-value {
  font-family: var(--kpi-num);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.summary-label .mock-chip {
  margin-left: 0;
}

.summary-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.progress-list {
  display: grid;
  gap: 12px;
}

.progress-row {
  display: grid;
  grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.progress-meta {
  display: grid;
  gap: 4px;
}

.progress-name {
  font-size: 13px;
  font-weight: 600;
}

.progress-detail,
.progress-value {
  color: var(--muted);
  font-size: 12px;
}

.progress-bar {
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
}

.watchlist-card {
  padding: 18px 18px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-elev-2);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 8px;
  align-content: start;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.watchlist-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.wl-bar {
  height: 6px;
  margin-top: 2px;
  border-radius: var(--radius-pill);
  background: var(--bg-elev);
  overflow: hidden;
}
.wl-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
}
.watchlist-card.tone-green .wl-bar span { background: var(--green); }
.watchlist-card.tone-amber .wl-bar span { background: var(--amber); }
.watchlist-card.tone-blue .wl-bar span  { background: var(--cyan); }

.watchlist-card p {
  margin: 0;
  font: 400 12px var(--sans);
  color: var(--muted-2);
  line-height: 1.4;
}


.watchlist-card.tone-green .metric-icon {
  color: var(--green);
  border-color: var(--green-a25);
  background: var(--green-a12);
}

.watchlist-card.tone-amber .metric-icon {
  color: var(--amber);
  border-color: var(--amber-a25);
  background: var(--amber-a12);
}

.watchlist-card.tone-blue .metric-icon {
  color: var(--cyan);
  border-color: var(--cyan-a25);
  background: var(--cyan-a12);
}

.watchlist-metric {
  font-family: var(--kpi-num);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

@keyframes yiqi-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* ─── Menú hamburguesa (off-canvas ≤980 px) ─── */
.nav-hamburger {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-tools {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.sidebar-tools:empty { display: none; }
.sidebar-tools .range-filter,
.sidebar-tools .btn-refresh,
.sidebar-tools .btn-exit { width: 100%; }

/* Cuenta + esquema: bloque apilado (no pill) */
.sidebar-tools .account-chip {
  display: grid;
  gap: 10px;
  width: 100%;
  height: auto;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-elev-2);
  overflow: visible;
}
.sidebar-tools .account-user-block {
  height: auto;
  padding: 0;
  border-right: none;
}
.sidebar-tools .schema-toggle {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.sidebar-tools .schema-menu {
  position: static;
  width: 100%;
  max-height: none;
  overflow: visible;
  box-shadow: none;
  margin-top: 0;
}

/* Período: segmentado vertical */
.sidebar-tools .range-filter {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  height: auto;
  padding: 0;
  background: transparent;
  border-radius: 0;
  flex-wrap: nowrap;
}
.sidebar-tools .range-btn {
  justify-content: center;
  height: 40px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--bg-elev-2);
}
.sidebar-tools .range-btn.is-active { background: var(--cyan-soft); }
.nav-hamburger svg { width: 20px; height: 20px; }
.nav-overlay { display: none; }
html[data-theme="light"] .nav-overlay { background: rgba(40, 42, 48, 0.35); }

/* bp: 1200 — 3–4 col → 2 col */
@media (max-width: 1200px) {
  .kpi-grid,
  .pulse-grid,
  .dashboard-grid,
  .summary-grid,
  .decision-grid,
  .watchlist-grid,
  .login-gate-benefits {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-wide,
  .hero-card,
  .login-gate {
    grid-column: auto;
  }

  .hero-card,
  .login-gate {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    right: 0;
    left: auto;
    bottom: 0;
    z-index: 90;
    width: min(var(--sidebar-w), 86vw);
    height: calc(100dvh - var(--topbar-h));
    border-left: 1px solid var(--line);
    border-right: 0;
    border-bottom: 0;
    padding: 20px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .nav-hamburger {
    display: inline-flex;
  }

  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s ease;
  }

  .nav-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .content {
    padding: 20px;
  }

  .login-screen {
    padding: 20px 16px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .app-topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas: "logo ham";
    align-items: center;
  }

  .topbar-l { grid-area: logo; }
  .nav-hamburger { grid-area: ham; justify-self: end; align-self: center; }

  .topbar-c,
  .topbar-r {
    display: none;
  }

  .section-container { grid-template-columns: 1fr; }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .login-form {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .login-input {
    min-width: 0;
  }
}

/* ─── SIDEBAR TOGGLES Y ACORDEÓN ─── */
/* Secciones del acordeón */
[data-section-id] {
  max-height: 10000px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  opacity: 1;
  margin-bottom: 20px;
}

[data-section-id].expanded {
  max-height: 10000px;
  opacity: 1;
  margin-bottom: 20px;
}

[data-section-id].collapsed {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  pointer-events: none;
}

/* Mostrar/ocultar con aria-hidden también */
[data-section-id][aria-hidden="true"] {
  display: none;
}

/* Secciones agrupadas para el toggle del sidebar: sin acordeón ni margen extra
   (el espaciado lo dan los gaps del shell/grilla; el ocultado va por aria-hidden). */
.dashboard-shell > [data-section-id],
.dashboard-grid > [data-section-id] {
  margin-bottom: 0;
  overflow: visible;
  max-height: none;
}

/* bp: 640 — stacks + espaciados reducidos */
@media (max-width: 640px) {
  .kpi-grid,
  .pulse-grid,
  .dashboard-grid,
  .summary-grid,
  .decision-grid,
  .watchlist-grid,
  .login-gate-benefits {
    grid-template-columns: 1fr;
  }

  .hero-status,
  .hero-chips,
  .branch-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hourly-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "meta share"
      "bar bar";
    gap: 4px 12px;
    align-items: center;
  }
  .hourly-meta { grid-area: meta; }
  .hourly-share { grid-area: share; }
  .hourly-bar-track { grid-area: bar; }

  .progress-row {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 18px 16px 28px;
  }
}

/* bp: 420 — mobile pequeño, stacks totales */
@media (max-width: 420px) {
  .content {
    padding: 14px 12px 24px;
    gap: 14px;
  }

  .sidebar {
    padding: 14px;
  }

  .trend-chart {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-actions {
    gap: 8px;
  }
}

/* A11y: red global de foco visible (fallback; las reglas específicas la sobreescriben) */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}


/* Estado vacío consolidado de esquema (sin ventas / error de fuente) */
.schema-empty {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 10px;
  max-width: 460px;
  margin: 40px auto;
  padding: 32px 28px;
  background: var(--bg-elev-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.schema-empty[hidden] { display: none; }
.schema-empty-ico { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--cyan-soft); color: var(--cyan); }
.schema-empty-ico svg { width: 22px; height: 22px; }
.schema-empty-title { margin: 0; font: 600 16px var(--sans); color: var(--text); }
.schema-empty-msg { margin: 0; font: 400 13px/1.55 var(--sans); color: var(--muted); max-width: 40ch; }
.schema-empty-cta { margin-top: 6px; }
.schema-empty[data-kind="error"] .schema-empty-ico { background: var(--red-soft); color: var(--red); }
