/* ResponYa Inicio: composición basada en la referencia, datos y acciones actuales */
#view-dashboard.view-section.active {
  display: flex !important;
  flex-direction: column;
  gap: 18px;
}
#dashboard-topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 0;
}
#dashboard-topbar h1 {
  margin: 0;
  color: #101a36;
  font-size: clamp(25px, 2.1vw, 34px);
  line-height: 1.1;
  letter-spacing: -.045em;
}
#dashboard-topbar p { margin: 6px 0 0; color: #75839c; font-size: 14px; font-weight: 500; }
#dashboard-topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
#dashboard-search-box {
  width: clamp(220px, 26vw, 360px);
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: #8090aa;
  background: #fff;
  border: 1px solid #e4eaf3;
  border-radius: 14px;
  box-shadow: 0 4px 15px rgba(28, 49, 86, .035);
}
#dashboard-search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  box-shadow: none;
  background: transparent;
  color: #14213e;
  font: inherit;
  font-size: 12px;
}
#dashboard-search-box input::placeholder { color: #98a4b7; }
#dashboard-notifications {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #e4eaf3;
  border-radius: 14px;
  background: #fff;
  color: #576782;
  box-shadow: 0 4px 15px rgba(28, 49, 86, .035);
}
#dashboard-notifications:hover { color: #176b50; background: #f0fbf6; }
#badge-notif-topbar {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  border-radius: 99px;
  background: #f0445f;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}
#dashboard-profile {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 12px 3px 4px;
  border: 1px solid #e4eaf3;
  border-radius: 15px;
  background: #fff;
  color: #182541;
  box-shadow: 0 4px 15px rgba(28, 49, 86, .035);
  white-space: nowrap;
}
#dashboard-profile #dashboard-avatar {
  width: 38px;
  height: 38px;
  border: 0;
  background: #079768;
  font-size: 14px;
}
#dashboard-profile #dashboard-user-name { color: #15213b; font-size: 12px; }
#dashboard-profile .dashboard-profile-role { display: block; margin-top: 4px; color: #8490a5; font-size: 9px; font-weight: 700; letter-spacing: .06em; }
#dashboard-profile .dashboard-profile-chevron { width: 15px; height: 15px; color: #8490a5; margin-left: 6px; }
#dashboard-date-range {
  min-height: 30px;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid #e4eaf3;
  border-radius: 10px;
  background: rgba(255,255,255,.88);
  color: #65748f;
  font-size: 10px;
  font-weight: 650;
}

#dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
.dashboard-metric {
  min-width: 0;
  min-height: 144px;
  position: relative;
  overflow: hidden;
  padding: 16px 16px 14px;
  border: 1px solid #e8edf5;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 7px 22px rgba(30, 51, 87, .045);
  text-align: left;
  display: block;
  color: inherit;
  text-decoration: none;
}
button.dashboard-metric { width: 100%; cursor: pointer; }
.dashboard-metric::after {
  content: "";
  position: absolute;
  right: -10px;
  bottom: -25px;
  width: 108px;
  height: 64px;
  border: 2px solid color-mix(in srgb, var(--metric-color, #08b77a) 32%, transparent);
  border-width: 2px 0 0;
  border-radius: 50%;
  transform: rotate(-15deg);
  opacity: .75;
}
.dashboard-metric:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(30, 51, 87, .085); }
.dashboard-metric-top { display: flex; align-items: center; gap: 9px; min-height: 34px; }
.dashboard-metric-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 11px;
  color: var(--metric-color, #08a774);
  background: var(--metric-bg, #e9fbf4);
}
.dashboard-metric-label { color: #65748f; font-size: 11px; font-weight: 700; line-height: 1.25; }
.dashboard-metric-value { display: block; position: relative; z-index: 1; margin: 12px 0 3px; color: #121d3a; font-size: clamp(22px, 1.65vw, 30px); font-weight: 850; line-height: 1; letter-spacing: -.045em; overflow-wrap: anywhere; }
.dashboard-metric-note { position: relative; z-index: 1; margin: 0; color: #8995a9; font-size: 10px; font-weight: 550; }
.dashboard-metric[data-tone="green"] { --metric-color: #06a875; --metric-bg: #e6fbf3; }
.dashboard-metric[data-tone="blue"] { --metric-color: #2473eb; --metric-bg: #eaf3ff; }
.dashboard-metric[data-tone="amber"] { --metric-color: #e69a12; --metric-bg: #fff5df; }
.dashboard-metric[data-tone="violet"] { --metric-color: #7547db; --metric-bg: #f3edff; }
.dashboard-metric[data-tone="red"] { --metric-color: #e75d70; --metric-bg: #fff0f2; }
.dashboard-metric[data-tone="green"] .dashboard-metric-value { color: #087c5a; }
.dashboard-metric[data-tone="green"] .dashboard-metric-value#dash-cobros-monto { color: #101a36; }
.dashboard-metric-status { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: #079768; font-size: 18px; font-weight: 850; }
.dashboard-metric-status .status-light { width: 11px; height: 11px; border-radius: 50%; background: #11bd7d; box-shadow: 0 0 0 5px #e6fbf3; }

#dashboard-hero {
  min-height: 250px;
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 29px 34px;
  border: 1px solid rgba(134, 255, 212, .27);
  border-radius: 22px;
  background: radial-gradient(ellipse at 77% 38%, rgba(14, 203, 133, .42), transparent 38%), linear-gradient(110deg, #034e3e 0%, #006a4d 45%, #063d42 100%);
  box-shadow: 0 18px 42px rgba(0, 67, 54, .18);
  color: #fff;
}
#dashboard-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, rgba(2, 66, 51, .9) 0%, rgba(3, 78, 61, .8) 38%, rgba(2, 69, 56, .08) 78%);
}
#dashboard-hero .dashboard-hero-art {
  position: absolute;
  z-index: -1;
  top: -5%;
  right: -2%;
  width: min(68%, 930px);
  height: 110%;
  object-fit: contain;
  object-position: right center;
  opacity: .98;
  pointer-events: none;
}
.dashboard-hero-copy { position: relative; z-index: 1; width: min(610px, 61%); }
.dashboard-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 31px;
  padding: 6px 12px;
  border: 1px solid rgba(211, 255, 240, .25);
  border-radius: 99px;
  background: rgba(1, 55, 43, .43);
  color: #d7fff1;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}
.dashboard-hero-badge .status-light { width: 9px; height: 9px; border-radius: 50%; background: #10d88e; box-shadow: 0 0 0 5px rgba(16,216,142,.15), 0 0 15px #10d88e; }
.dashboard-hero-copy h2 { margin: 16px 0 8px; color: #fff; font-size: clamp(24px, 2.2vw, 34px); line-height: 1.12; letter-spacing: -.04em; font-weight: 850; }
.dashboard-hero-copy p { max-width: 540px; margin: 0; color: rgba(237,255,249,.78); font-size: 14px; line-height: 1.6; font-weight: 500; }
.dashboard-hero-points { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.dashboard-hero-points span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid rgba(220,255,244,.14); border-radius: 9px; background: rgba(0,39,31,.28); color: #d5fff0; font-size: 10px; font-weight: 650; }
#dashboard-hero .dashboard-hero-cta {
  min-height: 46px;
  margin-top: 17px;
  padding: 0 19px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #effaf5);
  color: #08734f;
  box-shadow: 0 7px 23px rgba(0,0,0,.16);
  font-size: 13px;
  font-weight: 800;
}
#dashboard-hero .dashboard-hero-cta:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(0,0,0,.2); }

#dashboard-main-grid { display: grid; grid-template-columns: minmax(0, 1.78fr) minmax(300px, .92fr); gap: 17px; align-items: stretch; }
#dashboard-chart-card, .dashboard-activity-card {
  min-width: 0;
  border: 1px solid #e7edf5;
  border-radius: 19px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(30, 51, 87, .045);
}
#dashboard-chart-card { min-height: 340px; padding: 19px 21px 14px; }
#dashboard-chart-card .dashboard-card-heading,
.dashboard-activity-card .dashboard-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dashboard-card-title { display: flex; align-items: center; gap: 9px; margin: 0; color: #14203c; font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.dashboard-card-title > i { color: #05a875; }
.dashboard-chart-legend { display: flex; align-items: center; gap: 14px; color: #7b879c; font-size: 10px; font-weight: 600; }
.dashboard-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dashboard-chart-legend i { width: 8px; height: 8px; border-radius: 50%; background: #08b77a; }
.dashboard-chart-legend span + span i { background: #8be4c3; }
#dashboard-chart-card .dashboard-chart-area { height: 265px; margin-top: 15px; }
#dashboard-chart-card canvas { width: 100% !important; height: 100% !important; }
#dashboard-activity-column { display: flex; flex-direction: column; gap: 15px; min-width: 0; }
.dashboard-activity-card { overflow: hidden; }
.dashboard-activity-card .dashboard-card-heading { min-height: 52px; padding: 0 16px; border-bottom: 1px solid #eef1f6; }
.dashboard-activity-card .dashboard-card-title { font-size: 13px; }
.dashboard-activity-card .dashboard-card-heading a { color: #2473eb; font-size: 10px; font-weight: 700; text-decoration: none; white-space: nowrap; }
#dynamic-conversions-list { min-height: 200px; }
#dynamic-conversions-list > div { min-height: 58px; padding: 10px 14px; border-color: #f0f3f7; }
#dynamic-conversions-list > div > div:first-child > div:first-child { border-radius: 11px; }
#dynamic-conversions-list > div > div:first-child > div:last-child p:first-child { font-size: 11px; max-width: 180px; }
#dynamic-conversions-list > div > p { font-size: 11px; }
#dashboard-live-card { padding-bottom: 11px; background: linear-gradient(145deg, #101c3b, #172953); color: #fff; }
#dashboard-live-card .dashboard-card-heading { border-color: rgba(255,255,255,.1); }
#dashboard-live-card .dashboard-card-title { color: #fff; }
#dashboard-live-card .dashboard-card-title > i { color: #4be3b1; }
#dashboard-live-card #live-system-feed { padding: 7px 13px 0; }
#dashboard-live-card #live-system-feed > div { min-height: 56px; margin-bottom: 8px; padding: 10px; border-color: rgba(255,255,255,.09); border-radius: 12px; background: rgba(255,255,255,.055); }
#dashboard-live-card #live-system-feed p { color: #eff5ff; font-size: 10px; line-height: 1.45; }
#dashboard-live-card #live-system-feed p span { color: #69e5bd; }
#upsell-block { margin: 0 13px 13px; border-radius: 14px; }

/* Barra lateral: el enlace de negocio abre la configuración ya conectada a Firebase */
@media (min-width: 1024px) {
  body:has(#dashboard-topbar) > nav > div > div { padding-top: 18px; }
  body:has(#dashboard-topbar) > nav > div > div > div:first-child { margin-bottom: 23px; }
  body:has(#dashboard-topbar) #desktop-nav a { min-height: 43px; font-size: 12px; }
  body:has(#dashboard-topbar) #desktop-nav a[data-view="dashboard"] { color: #08744f; background: #e3f8ee; }
  body:has(#dashboard-topbar) #desktop-nav a[data-view="dashboard"]::before { content: none; }
  body:has(#dashboard-topbar) #desktop-nav a[href="configuracion-negocio.html"] { color: #334866; }
  body:has(#dashboard-topbar) #desktop-nav a[href="configuracion-negocio.html"]:hover { color: #08744f; }
  #desktop-account-nav { display: flex; flex-direction: column; gap: 5px; padding: 16px 0 0; border-top: 1px solid #e8edf4; }
  #desktop-account-nav a { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 10px 12px; border-radius: 12px; color: #6c7a92; font-size: 12px; font-weight: 650; text-decoration: none; }
  #desktop-account-nav a:hover { color: #156b50; background: #effaf5; }
  body:has(#dashboard-topbar) > main { padding-top: 25px; }
}

@media (max-width: 1279px) {
  #dashboard-topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; }
  #dashboard-topbar-actions { grid-column: 1 / -1; justify-content: flex-start; }
  #dashboard-search-box { width: auto; flex: 1 1 auto; }
  #dashboard-date-range { grid-column: 2; grid-row: 1; }
  #dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #dashboard-main-grid { grid-template-columns: minmax(0, 1.4fr) minmax(270px, .9fr); }
  .dashboard-metric { min-height: 130px; }
}

@media (max-width: 767px) {
  #dashboard-topbar { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 13px 9px; align-items: start; }
  #dashboard-topbar h1 { font-size: 25px; }
  #dashboard-topbar p { margin-top: 4px; font-size: 11px; line-height: 1.4; }
  #dashboard-topbar-actions { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) 42px auto; gap: 8px; width: 100%; }
  #dashboard-search-box { grid-column: 1; width: 100%; min-height: 42px; border-radius: 13px; }
  #dashboard-search-box input { font-size: 12px; }
  #dashboard-notifications { width: 42px; height: 42px; border-radius: 13px; }
  #dashboard-profile { min-height: 42px; width: 42px; padding: 2px; justify-content: center; border-radius: 50%; }
  #dashboard-profile #dashboard-avatar { width: 36px; height: 36px; }
  #dashboard-profile > .dashboard-profile-copy, #dashboard-profile .dashboard-profile-chevron { display: none; }
  #dashboard-date-range { grid-column: 1 / -1; justify-self: start; align-self: auto; min-height: 27px; }
  #view-dashboard.view-section.active { gap: 14px; }
  #dashboard-hero { order: 2; min-height: 273px; align-items: flex-start; padding: 20px 17px; border-radius: 20px; }
  #dashboard-hero::before { background: linear-gradient(90deg, rgba(2, 61, 48, .94), rgba(2, 65, 51, .78) 72%, rgba(3,63,51,.42)); }
  #dashboard-hero .dashboard-hero-art { top: 8%; right: -16%; width: 95%; height: 88%; opacity: .38; object-position: right center; }
  .dashboard-hero-copy { width: 100%; }
  .dashboard-hero-badge { font-size: 10px; }
  .dashboard-hero-copy h2 { max-width: 310px; margin-top: 15px; font-size: 25px; }
  .dashboard-hero-copy p { max-width: 360px; font-size: 12px; }
  .dashboard-hero-points { gap: 6px; margin-top: 11px; }
  .dashboard-hero-points span { font-size: 9px; }
  #dashboard-hero .dashboard-hero-cta { min-height: 43px; margin-top: 13px; font-size: 12px; }
  #dashboard-metrics { order: 3; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dashboard-metric { min-height: 112px; padding: 12px; border-radius: 16px; }
  .dashboard-metric-top { gap: 7px; }
  .dashboard-metric-icon { width: 30px; height: 30px; border-radius: 10px; }
  .dashboard-metric-label { font-size: 10px; }
  .dashboard-metric-value { margin-top: 11px; font-size: clamp(21px, 7vw, 27px); }
  .dashboard-metric-note { font-size: 9px; }
  .dashboard-metric-status { font-size: 16px; }
  #dashboard-main-grid { order: 4; grid-template-columns: minmax(0, 1fr); gap: 13px; }
  #dashboard-chart-card { min-height: 300px; padding: 16px 14px 12px; border-radius: 18px; }
  .dashboard-card-title { font-size: 14px; }
  .dashboard-chart-legend { gap: 9px; font-size: 9px; }
  #dashboard-chart-card .dashboard-chart-area { height: 230px; margin-top: 14px; }
  #dashboard-activity-column { gap: 12px; }
  #dashboard-activity-column .dashboard-activity-card { border-radius: 17px; }
  #dashboard-activity-column .dashboard-card-heading { min-height: 49px; padding: 0 13px; }
  #dynamic-conversions-list { min-height: 130px; }
  #dynamic-conversions-list > div { padding: 10px 12px; }
  body:has(#dashboard-topbar) > main { padding: 14px 12px 28px; }
  body:has(#dashboard-topbar) > nav { min-height: 59px; }
  body:has(#dashboard-topbar) > nav > div { padding: 6px 12px; }
  body:has(#dashboard-topbar) > nav > div > div { min-height: 48px; align-items: center; }
  body:has(#dashboard-topbar) > nav > div > div > div:first-child { min-height: 45px; margin: 0; }
  body:has(#dashboard-topbar) > nav > div > div > div:first-child > span { font-size: 21px; }
  body:has(#dashboard-topbar) > nav > div > div > div:nth-child(3) { border: 0; margin: 0; padding: 0; }
  #mobile-nav > * { flex: 1 1 0; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #dashboard-hero *, #dashboard-metrics *, #dashboard-main-grid * { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
