:root {
  --bg-deep: #06070b;
  --bg-1: #0a0c12;
  --bg-card: rgba(255, 255, 255, 0.045);
  --bg-card-2: rgba(255, 255, 255, 0.025);
  --bg-solid: rgba(15, 17, 23, 0.82);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);
  --text: #edeff4;
  --muted: #868c9b;
  --accent: #7aa2ff;
  --accent-glow: #a8c4ff;
  --cyan: #5bc7d4;
  --danger: #ff6b7e;
  --ok: #5bd6a6;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --radius: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-deep);
  color-scheme: dark; /* date pickers / selects / nativos en modo oscuro */
}

/* ===== Scrollbars custom (finas, oscuras) ===== */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
  background-clip: padding-box;
}
*::-webkit-scrollbar-corner {
  background: transparent;
}

/* Inputs de fecha: ícono del calendario visible sobre fondo oscuro */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.85);
  opacity: 0.6;
  cursor: pointer;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

body {
  overflow-x: hidden;
}

.stars {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255, 255, 255, 0.28), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(255, 255, 255, 0.2), transparent),
    radial-gradient(1px 1px at 50% 50%, rgba(200, 215, 255, 0.16), transparent),
    radial-gradient(1px 1px at 80% 10%, rgba(255, 255, 255, 0.22), transparent),
    radial-gradient(1px 1px at 90% 60%, rgba(200, 220, 255, 0.18), transparent);
  background-size: 200% 200%;
  animation: drift 160s linear infinite;
  pointer-events: none;
  z-index: 0;
}

.nebula {
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(122, 162, 255, 0.1), transparent 55%),
    radial-gradient(ellipse at 15% 90%, rgba(60, 75, 120, 0.14), transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(40, 60, 90, 0.12), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

@keyframes drift {
  to {
    background-position: 200% 200%;
  }
}

.hidden {
  display: none !important;
}

.glass {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* Login */
.login-screen {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(400px, 100%);
  padding: 32px;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin: 12px 0 4px;
  letter-spacing: 0.12em;
}

.login-brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.logo-orbit {
  display: inline-block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.9), rgba(150, 168, 210, 0.25) 32%, transparent 56%),
    radial-gradient(circle at 50% 55%, #2b3450, #0a0d16 78%);
  box-shadow: 0 0 22px rgba(122, 162, 255, 0.2), inset 0 0 16px rgba(0, 0, 0, 0.55);
}

.logo-orbit.sm {
  width: 32px;
  height: 32px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.field-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}

input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: rgba(8, 6, 20, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-glow);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2);
}

.btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
}

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

.btn-primary {
  background: rgba(122, 162, 255, 0.16);
  color: #e2eaff;
  border: 1px solid rgba(122, 162, 255, 0.4);
  width: 100%;
  margin-top: 16px;
}

.btn-primary:hover {
  background: rgba(122, 162, 255, 0.26);
  border-color: rgba(122, 162, 255, 0.62);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border-strong);
}

.btn-accent {
  background: rgba(91, 199, 212, 0.16);
  color: #d8f6fa;
  border: 1px solid rgba(91, 199, 212, 0.4);
}

.btn-accent:hover {
  background: rgba(91, 199, 212, 0.26);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
}

/* App shell */
.app-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  border-left: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand strong {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.sidebar-brand small {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(124, 92, 255, 0.15);
  color: var(--text);
}

.nav-icon {
  font-size: 1rem;
  opacity: 0.9;
}

.sidebar-logout {
  margin-top: auto;
  width: 100%;
}

.main {
  padding: 28px 32px 40px;
  overflow: auto;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.panel-header h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 4px;
  letter-spacing: 0.06em;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  padding: 16px 20px;
  margin: 20px 0 12px;
}

.toolbar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 140px;
}

.toolbar .btn {
  width: auto;
  margin-top: 0;
}

.table-meta {
  margin-bottom: 10px;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 280px);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(140, 120, 255, 0.12);
  white-space: nowrap;
}

th {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-glow);
  position: sticky;
  top: 0;
  background: rgba(12, 10, 28, 0.95);
}

tr:hover td {
  background: rgba(124, 92, 255, 0.06);
}

td.editable {
  cursor: pointer;
  text-decoration: underline dotted var(--cyan);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 16px;
}

/* Howard chat */
.howard-toolbar {
  padding: 12px 16px;
  margin-bottom: 12px;
  max-width: 200px;
}

.chat-messages {
  min-height: 360px;
  max-height: calc(100vh - 320px);
  overflow-y: auto;
  padding: 20px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 0.92rem;
  white-space: pre-wrap;
}

.msg.user {
  align-self: flex-end;
  background: rgba(124, 92, 255, 0.25);
  border: 1px solid var(--border);
}

.msg.howard {
  align-self: flex-start;
  background: rgba(8, 6, 20, 0.5);
  border-left: 3px solid var(--cyan);
}

.msg.system {
  align-self: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.chat-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-form textarea {
  flex: 1;
  resize: vertical;
  min-height: 48px;
}

.chat-form .btn {
  width: auto;
  flex-shrink: 0;
}

/* Actions */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.action-card {
  padding: 20px;
}

.action-card h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  margin: 0 0 8px;
}

.action-card input {
  margin: 12px 0;
}

.action-card .btn {
  width: 100%;
}

.action-log {
  margin-top: 24px;
  padding: 16px;
  min-height: 120px;
  font-size: 0.8rem;
  overflow: auto;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  padding: 14px 20px;
  border-radius: 10px;
  background: rgba(18, 14, 42, 0.95);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  max-width: 360px;
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

/* ===== App shell (override grid -> full bleed para órbita/paneles) ===== */
.app-shell {
  display: block;
  grid-template-columns: none;
}

/* ===== Hub orbital 3D ===== */
.orbit-view {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#orbit-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

#orbit-canvas:active {
  cursor: grabbing;
}

.orbit-ui {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.orbit-ui > * {
  pointer-events: auto;
}

.orbit-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
}

.orbit-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.orbit-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.18em;
}

.orbit-brand small {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}

.orbit-focus {
  margin-top: auto;
  margin-bottom: 6vh;
  align-self: center;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.orbit-focus-kicker {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}

.orbit-focus-label {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.08em;
  color: var(--text);
  text-shadow: 0 0 24px rgba(124, 92, 255, 0.6);
}

.orbit-focus-sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.orbit-enter-btn {
  pointer-events: auto;
  width: auto;
  margin-top: 12px;
  padding: 12px 32px;
}

.orbit-hint {
  text-align: center;
  padding: 0 24px 22px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.orbit-hint span {
  color: var(--accent-glow);
  margin: 0 6px;
}

.orbit-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  letter-spacing: 0.14em;
  color: var(--muted);
  font-size: 0.85rem;
  pointer-events: none;
}

/* ===== Modo Howard vs Órbita (toggles) ===== */
.howard-only {
  display: none;
}
.howard-mode .howard-only {
  display: revert;
}
.howard-mode .orbit-only {
  display: none;
}

/* Dock inferior: barra para hablar con Howard */
.orbit-dock {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 24px 26px;
  pointer-events: none;
}
.orbit-dock > * {
  pointer-events: auto;
}

.orbit-focus {
  pointer-events: none;
}
.orbit-enter-btn {
  pointer-events: auto;
}

.howard-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(640px, 94%);
  padding: 7px 7px 7px 10px;
  border-radius: 999px;
}
.howard-bar input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 6px;
}
.howard-bar input:focus {
  box-shadow: none;
}
.howard-bar select {
  width: auto;
  border: none;
  background: rgba(8, 6, 20, 0.55);
  font-size: 0.72rem;
  padding: 7px 8px;
  border-radius: 8px;
}
.howard-bar .btn {
  width: auto;
  margin: 0;
  padding: 9px 15px;
  border-radius: 999px;
}

.howard-mic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(8, 6, 20, 0.55);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.howard-mic:hover {
  color: var(--text);
  border-color: var(--accent-glow);
}
.howard-mic.listening {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--danger));
  border-color: transparent;
  animation: micpulse 1s ease-in-out infinite;
}
@keyframes micpulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 107, 138, 0.5);
  }
  50% {
    box-shadow: 0 0 0 9px rgba(255, 107, 138, 0);
  }
}

/* Conversación: mensajes flotando a la derecha, sin fondo */
.howard-stream {
  position: absolute;
  right: 4%;
  top: 13%;
  bottom: 140px;
  width: min(46%, 540px);
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  overflow-y: auto;
  padding: 8px 2px;
  text-align: right;
  pointer-events: auto;
  scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 48px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 48px);
}
.howard-mode .howard-stream {
  display: flex;
}
.hmsg {
  max-width: 100%;
  font-size: 1.02rem;
  line-height: 1.5;
  white-space: pre-wrap;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.7);
  animation: hmsg-in 0.35s ease both;
}
.hmsg.user {
  color: var(--accent-glow);
  font-weight: 500;
}
.hmsg.howard {
  color: var(--text);
}
.hmsg.howard::before {
  content: "HOWARD";
  display: block;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  color: var(--cyan);
  margin-bottom: 3px;
}
.hmsg.sys {
  color: var(--muted);
  font-size: 0.82rem;
}
.hmsg.pending {
  color: var(--muted);
  font-style: italic;
}
.hmsg.error {
  color: var(--danger);
}
@keyframes hmsg-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ===== Host de paneles ===== */
.panel-host {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.panel-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  position: sticky;
  top: 0;
  z-index: 5;
}

.panel-topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-topbar-title strong {
  font-family: var(--font-display);
  letter-spacing: 0.1em;
  font-size: 1rem;
}

.panel-topbar .btn {
  width: auto;
}

@media (max-width: 768px) {
  .orbit-focus-label {
    font-size: 1.5rem;
  }

  .orbit-hint {
    font-size: 0.7rem;
  }

  .main {
    padding: 18px 16px 32px;
  }
}

/* ===== Dashboard (widgets reordenables / redimensionables) ===== */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.dash-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-tools select {
  width: auto;
}
.dash-tools .btn {
  width: auto;
}

.dash-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 20px;
}
.dash-cells {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 150px;
  gap: 16px;
}
.w-section {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.6;
  padding: 16px 2px 2px;
  user-select: none;
}
.w-section:first-child {
  padding-top: 2px;
}

.widget {
  position: relative;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  grid-column: span 1;
  grid-row: span 1;
  transition: box-shadow 0.15s, transform 0.12s;
}
.widget.w-m {
  grid-column: span 2;
}
.widget.w-l {
  grid-column: span 2;
  grid-row: span 2;
}

.w-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.w-title {
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-glow);
  flex: 1;
}
.w-drag {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: grab;
  font-size: 0.95rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  touch-action: none;
  opacity: 0.55;
  transition: opacity 0.15s, background 0.15s;
}
.w-drag:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.06);
}
.w-drag:active {
  cursor: grabbing;
}
.w-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}
.w-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1.05;
  color: var(--text);
}
.w-value.sm {
  font-size: 1.3rem;
}
.w-sub {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 4px;
}
.w-foot {
  font-size: 0.74rem;
  margin-top: auto;
  padding-top: 8px;
}

/* Botón de redimensionar (sólo en modo edición) */
.w-resize {
  opacity: 0;
  pointer-events: none;
  background: rgba(122, 162, 255, 0.18);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  transition: opacity 0.15s, background 0.15s;
}
.dash-grid.editing .w-resize {
  opacity: 1;
  pointer-events: auto;
}
.dash-grid.editing .widget {
  cursor: grab;
  touch-action: none;
  animation: jiggle 0.28s ease-in-out infinite;
}
.dash-grid.editing .widget:nth-child(2n) {
  animation-delay: 0.12s;
}
.dash-grid.editing .widget:nth-child(3n) {
  animation-delay: 0.06s;
}
/* placeholder mientras se arrastra */
.w-placeholder {
  background: rgba(122, 162, 255, 0.08);
  border: 1.5px dashed rgba(122, 162, 255, 0.5);
  border-radius: var(--radius);
}
.widget.dragging {
  animation: none !important;
  opacity: 0.95;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.6);
  cursor: grabbing;
}
@keyframes jiggle {
  0%, 100% {
    transform: rotate(-0.9deg) translate(-0.6px, 0.3px);
  }
  50% {
    transform: rotate(0.9deg) translate(0.6px, -0.3px);
  }
}

/* Reparto socios */
.socios-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.socio {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.socio span {
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.socio strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot-mati {
  background: var(--accent-glow);
}
.dot-tiago {
  background: var(--cyan);
}

/* Canales (barra) */
.bar2 {
  height: 10px;
  border-radius: 999px;
  background: var(--cyan);
  overflow: hidden;
  margin: 10px 0;
}
.bar2-shopify {
  height: 100%;
  background: var(--accent);
}

/* Tendencia (chart) */
.trend-svg {
  width: 100%;
  flex: 1;
  min-height: 0;
}
.lg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
}
.lg::before {
  content: "";
  width: 12px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}
.lg-bruto::before {
  background: var(--accent-glow);
}
.lg-neto::before {
  background: var(--cyan);
}

/* Notas y tareas (widgets de lista) */
.widget.w-list .w-body {
  justify-content: flex-start;
  gap: 8px;
}
.nt-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  scrollbar-width: thin;
}
.nt-empty {
  padding: 6px 0;
  font-size: 0.85rem;
}
.nt-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(8, 6, 20, 0.4);
  border: 1px solid rgba(140, 120, 255, 0.12);
}
.nt-text {
  flex: 1;
  font-size: 0.88rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
}
.nt-task {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(8, 6, 20, 0.4);
  border: 1px solid rgba(140, 120, 255, 0.12);
  cursor: pointer;
}
.nt-task input[type="checkbox"] {
  width: auto;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.nt-task-text {
  flex: 1;
  font-size: 0.9rem;
}
.nt-task.done .nt-task-text {
  text-decoration: line-through;
  color: var(--muted);
}
.nt-del {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 4px;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s;
}
.nt-del:hover {
  opacity: 1;
  color: var(--danger);
}
.nt-add {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.nt-add input {
  flex: 1;
  padding: 8px 10px;
}
.nt-add-btn {
  flex-shrink: 0;
  width: 38px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #5a3fd4);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .dash-cells {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Rediseño: overrides estructurales ===== */
.orbit-topbar {
  justify-content: flex-start;
  gap: 10px;
}
.orbit-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 12px;
  color: var(--text);
  transition: background 0.15s;
}
.orbit-brand:hover {
  background: rgba(255, 255, 255, 0.05);
}
.orbit-brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}

/* foco de la pestaña: arriba, no abajo */
.orbit-focus {
  margin-top: 12px;
  margin-bottom: 0;
  gap: 8px;
}
.orbit-focus-label {
  font-size: 1.5rem;
  text-shadow: 0 0 30px rgba(122, 162, 255, 0.35);
}
.orbit-focus-sub {
  display: none;
}
.orbit-enter-btn {
  pointer-events: auto;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 22px;
  font-size: 0.82rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.orbit-enter-btn:hover {
  background: rgba(122, 162, 255, 0.16);
  border-color: rgba(122, 162, 255, 0.5);
}

/* panel topbar */
.panel-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-home {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 4px 8px;
  border-radius: 10px;
  transition: background 0.15s;
}
.brand-home:hover {
  background: rgba(255, 255, 255, 0.05);
}
.brand-home strong {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* toolbars de dashboard / tablas */
.dash-tools input[type="search"],
.dash-tools input[type="date"],
.dash-tools select {
  width: auto;
}
.dash-tools input[type="search"] {
  min-width: 150px;
}

/* tabla premium */
#data-table th {
  text-transform: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0;
  color: var(--muted);
  background: rgba(10, 12, 18, 0.96);
}
#data-table th.num,
#data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#data-table td.pos {
  color: var(--ok);
}
#data-table td.neg {
  color: var(--danger);
}
#data-table td.editable {
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px solid rgba(122, 162, 255, 0.25);
}
#data-table td.editable:hover {
  background: rgba(122, 162, 255, 0.1);
}

/* segmented presets de rango */
.seg {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  background: transparent;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seg button:hover {
  color: var(--text);
}
.seg button.active {
  background: rgba(122, 162, 255, 0.18);
  color: #e2eaff;
}

/* botón + popover de calendario */
.cal-wrap {
  position: relative;
}
#dash-cal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#dash-cal-btn.active {
  color: var(--text);
  border-color: rgba(122, 162, 255, 0.5);
  background: rgba(122, 162, 255, 0.12);
}
.cal-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 300px;
  padding: 14px;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-head strong {
  font-family: var(--font-display);
  font-size: 0.95rem;
}
.cal-nav {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  width: 30px;
  height: 30px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.cal-nav:hover {
  background: rgba(122, 162, 255, 0.16);
}
.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 4px;
}
.cal-dow span {
  text-align: center;
  font-size: 0.66rem;
  color: var(--muted);
  padding: 4px 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-d {
  aspect-ratio: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s;
}
.cal-d.empty {
  pointer-events: none;
}
.cal-d:hover {
  background: rgba(255, 255, 255, 0.07);
}
.cal-d.today {
  box-shadow: inset 0 0 0 1px rgba(122, 162, 255, 0.55);
}
.cal-d.in-range {
  background: rgba(122, 162, 255, 0.14);
  border-radius: 0;
}
.cal-d.sel {
  background: var(--accent);
  color: #07101f;
  font-weight: 600;
}
.cal-d.sel.start {
  border-radius: 9px 0 0 9px;
}
.cal-d.sel.end {
  border-radius: 0 9px 9px 0;
}
.cal-d.sel.start.end {
  border-radius: 9px;
}
.cal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.cal-sel {
  flex: 1;
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
}
.cal-quick,
.cal-apply {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 9px;
  cursor: pointer;
}
.cal-apply {
  background: rgba(122, 162, 255, 0.18);
  border-color: rgba(122, 162, 255, 0.4);
  color: #e2eaff;
}
.cal-apply:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .dash-tools {
    flex-wrap: wrap;
  }
  .cal-pop {
    width: min(300px, 92vw);
  }
}
@media (max-width: 600px) {
  .orbit-topbar {
    padding: 14px 16px;
  }
  .panel-topbar {
    flex-wrap: wrap;
  }
  .panel-header.dash-header {
    flex-direction: column;
    align-items: stretch;
  }
  .dash-grid {
    grid-auto-rows: 132px;
    gap: 12px;
  }
  .w-value {
    font-size: 1.55rem;
  }
  .cal-pop {
    left: 0;
    right: auto;
  }
  /* Howard en mobile: el chat va abajo, ancho completo */
  .howard-stream {
    top: auto;
    bottom: 150px;
    left: 5%;
    right: 5%;
    width: auto;
    max-height: 42vh;
    text-align: left;
  }
}
@media (max-width: 430px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .widget.w-m,
  .widget.w-l {
    grid-column: span 1;
  }
  .seg {
    flex-wrap: wrap;
  }
  .orbit-focus-label {
    font-size: 1.3rem;
  }
}

/* ===== Analizador de anuncios ===== */
.ads-drop {
  margin-top: 18px;
  padding: 40px 24px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.ads-drop.drag {
  border-color: var(--accent);
  background: rgba(122, 162, 255, 0.08);
}
.ads-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.ads-drop-inner strong {
  color: var(--text);
  font-size: 1.05rem;
}
.linklike {
  background: none;
  border: none;
  color: var(--accent-glow);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  padding: 0;
}
.ads-loading {
  margin-top: 24px;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}

.ads-summary {
  padding: 18px 20px;
  margin: 18px 0;
}
.ads-sum-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.ads-sum-head strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.ads-sum-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 14px;
}
.ads-quick {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 0.9rem;
}
.ads-quick li {
  margin: 4px 0;
}

.ads-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ads-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
/* bandas de score colapsables */
.ads-band {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  padding: 4px 14px 14px;
}
.ads-band[open] {
  background: rgba(255, 255, 255, 0.03);
}
.ads-band-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  padding: 12px 4px;
  list-style: none;
  font-family: var(--font-display);
  font-size: 0.92rem;
}
.ads-band-head::-webkit-details-marker { display: none; }
.ads-band-head::before {
  content: "▸";
  color: var(--muted);
  transition: transform 0.15s;
  margin-right: 4px;
}
.ads-band[open] .ads-band-head::before { transform: rotate(90deg); }
.ads-band-count {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 10px;
  border-radius: 999px;
}
.ad-card {
  position: relative;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* checkbox de selección, arriba a la derecha */
.ad-check {
  position: absolute;
  top: 14px;
  right: 14px;
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border-strong);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.ad-check:hover { border-color: var(--accent); }
.ad-check:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.ad-check:checked::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #07101f;
  font-size: 14px;
  font-weight: 700;
}
.ad-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding-right: 30px;
}
.ad-score {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  border: 1px solid var(--border);
}
.sc-green { background: rgba(91, 214, 166, 0.16); color: #8af0c4; border-color: rgba(91, 214, 166, 0.4); }
.sc-amber { background: rgba(255, 196, 105, 0.16); color: #ffd089; border-color: rgba(255, 196, 105, 0.4); }
.sc-red { background: rgba(255, 107, 126, 0.16); color: #ff9aa8; border-color: rgba(255, 107, 126, 0.4); }
.sc-gray { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.ad-head-t { min-width: 0; }
.ad-name {
  display: block;
  font-size: 0.98rem;
  line-height: 1.25;
  word-break: break-word;
}
.ad-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.ad-pill {
  font-size: 0.66rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(122, 162, 255, 0.14);
  color: var(--accent-glow);
}
.ad-sub {
  font-size: 0.74rem;
  color: var(--muted);
}
.ad-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ad-tag {
  font-size: 0.68rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px solid var(--border);
}
.ad-tag.tag-win { background: rgba(91, 214, 166, 0.16); color: #8af0c4; border-color: transparent; }
.ad-tag.tag-warn { background: rgba(255, 196, 105, 0.14); color: #ffd089; border-color: transparent; }

.ad-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ad-kpi { display: flex; flex-direction: column; }
.ad-kpi-v { font-family: var(--font-display); font-size: 1.15rem; }
.ad-kpi-l { font-size: 0.7rem; color: var(--muted); }
.ad-kpi-s { font-size: 0.68rem; color: var(--muted); opacity: 0.85; }

.ad-action {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.ad-act-chip {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
}
.act-up { background: rgba(91, 214, 166, 0.18); color: #8af0c4; }
.act-hold { background: rgba(122, 162, 255, 0.16); color: var(--accent-glow); }
.act-down { background: rgba(255, 196, 105, 0.16); color: #ffd089; }
.act-kill { background: rgba(255, 107, 126, 0.18); color: #ff9aa8; }
.act-learn { background: rgba(255, 255, 255, 0.07); color: var(--muted); }
.ad-act-d { font-size: 0.82rem; color: var(--text); line-height: 1.4; }

.ad-creative {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.ad-band { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; }
.ad-band .dot { width: 8px; height: 8px; border-radius: 50%; }
.b-good { background: #5bd6a6; }
.b-mid { background: #ffc469; }
.b-bad { background: var(--danger); }
.ad-band-l { color: var(--muted); }
.ad-fix {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-left: 2px solid var(--accent);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
}
.ad-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.8rem;
}
.ad-detgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  margin-top: 10px;
}
.ad-detrow { display: flex; justify-content: space-between; font-size: 0.78rem; gap: 8px; }
.ad-detl { color: var(--muted); }
.ad-detv { color: var(--text); text-align: right; }

/* vistas creativo / media buying */
.view-creativo .ad-mediaonly { display: none; }
.view-media .ad-creativeonly { display: none; }
.view-media #ads-gems { display: none; }

.ad-card.is-gem {
  border-color: rgba(91, 214, 166, 0.4);
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(91, 214, 166, 0.15);
}
.gem-pill { background: rgba(91, 214, 166, 0.16); color: #8af0c4; }

.ad-why {
  margin: 4px 0 0;
  padding-left: 16px;
  font-size: 0.84rem;
  color: var(--text);
}
.ad-why li { margin: 3px 0; }
.ad-angles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ad-angle {
  font-size: 0.66rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid var(--border);
}
.ad-gemwhy { margin-top: 8px; }
.ad-gemwhy p { margin: 3px 0; font-size: 0.82rem; color: #a9e8cc; }

/* fix países */
.ad-paises { flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 6px; }
.ad-paises-v { text-align: left; word-break: break-word; line-height: 1.4; }

/* joyas ocultas */
.ads-sec-title { font-family: var(--font-display); font-size: 1.05rem; margin: 6px 0 2px; }
.ads-sec-sub { margin: 0 0 12px; }
.ads-gems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.gem-card { padding: 14px 16px; border-color: rgba(91, 214, 166, 0.3); }
.gem-name { display: block; font-size: 0.92rem; }
.gem-cei { font-size: 0.72rem; color: #8af0c4; }
.gem-reasons { margin: 8px 0 0; padding-left: 16px; font-size: 0.8rem; color: var(--muted); }
.gem-reasons li { margin: 2px 0; }

/* barra de selección IA */
.ads-aibar {
  position: sticky;
  top: 8px;
  margin: 0 auto 16px;
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 18px;
  border-radius: 999px;
  background: var(--bg-solid);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 20;
}
.ads-aibar .btn { width: auto; margin: 0; }
.ads-aibar #ads-ai-btn:disabled { opacity: 0.5; cursor: default; }
#ads-sel-count { font-size: 0.85rem; color: var(--muted); }

/* card de Análisis IA */
.ads-ai { position: relative; padding: 20px 22px; margin: 18px 0; }
.ai-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s, color 0.15s;
}
.ai-close:hover { background: rgba(255, 107, 126, 0.18); color: var(--danger); }
.ads-ai.thinking {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 36px 22px;
}
.ai-spin {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(122, 162, 255, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ai-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.ai-head strong { font-family: var(--font-display); font-size: 1.05rem; color: var(--accent-glow); }
.ai-sintesis { font-size: 0.95rem; line-height: 1.5; }
.ai-sec { font-family: var(--font-display); font-size: 0.82rem; letter-spacing: 0.04em; margin: 16px 0 6px; color: var(--text); }
.ai-list { margin: 0; padding-left: 18px; font-size: 0.88rem; line-height: 1.5; }
.ai-list li { margin: 4px 0; }
.ai-brief { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.ai-brief-col { background: rgba(255, 255, 255, 0.03); border-radius: 12px; padding: 12px 14px; }
.ai-brief-t { font-size: 0.72rem; color: var(--accent-glow); text-transform: uppercase; letter-spacing: 0.06em; }
.ai-brief-col ul { margin: 6px 0 0; padding-left: 16px; font-size: 0.84rem; line-height: 1.45; }

/* widget Acciones */
.acts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.act label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.act-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.act-row input,
.act-row select {
  width: auto;
  padding: 8px 10px;
}
.act-row input[type="number"] {
  flex: 1 1 80px;
  min-width: 70px;
}
.act-row input[type="text"] {
  flex: 1 1 140px;
}
.act-row input[type="date"] {
  flex: 1 1 auto;
}
.act-row select {
  flex: 0 1 auto;
}
.act-row .btn {
  width: auto;
  flex: 0 0 auto;
}

/* Widget Últimas órdenes */
.ord-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  scrollbar-width: thin;
}
.ord-item {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(8, 6, 20, 0.4);
  border: 1px solid rgba(140, 120, 255, 0.12);
}
.ord-id {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.ord-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.ord-badge.ok { background: rgba(91, 214, 166, 0.16); color: var(--ok); }
.ord-badge.rf { background: rgba(255, 107, 126, 0.16); color: var(--danger); }
.ord-badge.pd { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.ord-when { font-size: 0.78rem; text-align: right; }
.ord-tot { font-size: 0.9rem; font-weight: 600; color: var(--text); white-space: nowrap; }

/* Fix modo edición desktop: sin selección de texto, cursor de arrastre */
.dash-grid.editing { user-select: none; -webkit-user-select: none; }
.dash-grid.editing .widget { cursor: grab; touch-action: none; }
.dash-grid.editing .widget .w-resize { cursor: pointer; }
.widget.dragging { cursor: grabbing; }

/* Widget Gasto por cuenta */
.acc-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 0; scrollbar-width: thin; }
.acc-item { padding: 9px 11px; border-radius: 8px; background: rgba(8, 6, 20, 0.4); border: 1px solid rgba(140, 120, 255, 0.12); }
.acc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.acc-name { font-size: 0.86rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-spend { font-size: 0.9rem; font-weight: 600; color: var(--text); white-space: nowrap; }
.acc-bar { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); margin: 7px 0 5px; overflow: hidden; }
.acc-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-glow)); border-radius: 4px; }
.acc-foot { font-size: 0.75rem; }
.acc-total { margin-top: 2px; padding-top: 7px; font-size: 0.82rem; font-weight: 600; color: var(--muted); border-top: 1px solid var(--border); }

/* Camino de compra en Últimas órdenes */
.ord-item-j { grid-template-columns: auto auto auto 1fr auto; row-gap: 6px; }
.ord-new { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.ord-new.yes { background: rgba(91,199,212,0.16); color: var(--cyan); }
.ord-new.no { background: rgba(255,255,255,0.06); color: var(--muted); }
.ord-cam-btn { grid-column: 1 / -1; justify-self: start; background: transparent; border: none; color: var(--accent); font-size: 0.76rem; cursor: pointer; padding: 0; font-family: inherit; }
.ord-cam-btn:hover { text-decoration: underline; }
.ord-cam { grid-column: 1 / -1; font-size: 0.76rem; color: var(--muted); background: rgba(8,6,20,0.5); border-radius: 6px; padding: 7px 9px; line-height: 1.4; }
.ord-cam.hidden { display: none; }

/* Anuncios: barra de origen API */
.ads-source { padding: 16px 18px; margin-bottom: 14px; }
.ads-source-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ads-source-row label { font-size: 0.82rem; color: var(--muted); }
.ads-source select { background: rgba(8,6,20,0.5); border: 1px solid var(--border); color: var(--text); padding: 8px 11px; border-radius: 9px; font-family: inherit; font-size: 0.88rem; cursor: pointer; }
.ads-source select:focus { outline: none; border-color: var(--accent); }
.ads-source small { display: block; margin-top: 9px; }
.ads-source #ads-fetch { margin-left: auto; }
@media (max-width: 560px){ .ads-source #ads-fetch { margin-left: 0; width: 100%; } }

/* Anuncios origen: override del width:100% global en la fila inline */
.ads-source-row select { width: auto; min-width: 150px; }
.ads-source-row #ads-fetch { width: auto; margin-top: 0; margin-left: auto; }
@media (max-width: 560px){ .ads-source-row select, .ads-source-row #ads-fetch { width: 100%; margin-left: 0; } }

/* Anuncios · vista editor (creativo) */
.ad-cei.ad-creativeonly { }
.ad-quadconv { font-size: 0.8rem; font-weight: 600; padding: 7px 11px; border-radius: 9px; margin-bottom: 10px; border: 1px solid var(--border); }
.qc-estrella { background: rgba(91,214,166,0.14); color: var(--ok); border-color: rgba(91,214,166,0.3); }
.qc-vende_feo { background: rgba(91,199,212,0.14); color: var(--cyan); border-color: rgba(91,199,212,0.3); }
.qc-entretiene_no_vende { background: rgba(255,196,90,0.12); color: #ffce7a; border-color: rgba(255,196,90,0.28); }
.qc-retirar { background: rgba(255,255,255,0.05); color: var(--muted); }
.ad-sems { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.ad-sem { display: flex; flex-direction: column; gap: 2px; padding: 8px 9px; border-radius: 9px; background: rgba(8,6,20,0.4); border: 1px solid var(--border); }
.ad-sem .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ad-sem-l { font-size: 0.72rem; color: var(--muted); }
.ad-sem-v { font-size: 1rem; font-weight: 600; color: var(--text); }
.ad-sem-p { font-size: 0.66rem; color: var(--muted-2, var(--muted)); }
.ad-curve-wrap { margin: 4px 0 12px; }
.ad-curve { width: 100%; height: 56px; display: block; }
.ad-curve .curve-seg { stroke: var(--accent-glow); stroke-width: 2.4; fill: none; vector-effect: non-scaling-stroke; }
.ad-curve .curve-seg.worst { stroke: var(--danger); stroke-width: 3; }
.ad-curve .curve-dot { fill: var(--accent-glow); }
.ad-curve-x { display: flex; justify-content: space-between; padding: 2px 2px 0; }
.ad-curve-x span { font-size: 0.64rem; color: var(--muted-2, var(--muted)); }
.ad-ref { font-size: 0.78rem; color: var(--cyan); margin: 8px 0 0; }
.ad-why { font-size: 0.92rem; line-height: 1.45; }

/* Anuncios origen: checkbox incluir países */
.ads-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.ads-chk input[type="checkbox"] { width: auto; margin: 0; cursor: pointer; }

/* Anuncios · tendencia / fatiga real */
.ad-tend { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.ad-tend-chip { font-size: 0.74rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.ad-tend-chip.tend-bad { background: rgba(255,107,126,0.16); color: var(--danger); }
.ad-tend-chip.tend-good { background: rgba(91,214,166,0.16); color: var(--ok); }
.ad-tend-chip.tend-mid { background: rgba(255,255,255,0.06); color: var(--muted); }
.ad-tend-chip.tend-new { background: rgba(255,255,255,0.04); color: var(--muted-2, var(--muted)); }
.ad-tend-d { font-size: 0.72rem; color: var(--muted); }
.ad-spark { height: 22px; width: 72px; margin-left: auto; }
.ad-spark .spark-line { fill: none; stroke: var(--accent-glow); stroke-width: 1.6; vector-effect: non-scaling-stroke; }

/* Anuncios · selector de período (pills + calendario) */
.ads-period-row { gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.ads-period-lbl { font-size: 0.82rem; color: var(--muted); }
.ads-periods button { padding: 7px 12px; font-size: 0.82rem; }
#ads-cal-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; }
#ads-cal-btn.active { background: rgba(122,162,255,0.16); color: #e2eaff; border-color: rgba(122,162,255,0.4); }
.cal-ico { width: 13px; height: 12px; border: 1.5px solid currentColor; border-radius: 3px; position: relative; display: inline-block; opacity: 0.85; }
.cal-ico::before { content: ""; position: absolute; top: -3px; left: 2px; right: 2px; height: 3px; border-left: 1.5px solid currentColor; border-right: 1.5px solid currentColor; }

/* Fix: barra de origen (con el popover del calendario) por encima del drop de CSV */
.ads-source { position: relative; z-index: 30; }

.ad-period { background: rgba(122,162,255,0.12); color: #bcd0ff; border: 1px solid rgba(122,162,255,0.22); }
