/* AMT Journal — shell de la aplicación y componentes compartidos por todas las vistas. */

html, body { height: 100%; overflow: hidden; }

/* ============================================================
   Arranque
   ============================================================ */
.boot { height: 100dvh; display: grid; place-items: center; }
.boot .logo-mark { color: var(--text); animation: boot-pulse 1.8s ease-in-out infinite; }
@keyframes boot-pulse { 0%, 100% { opacity: .25; } 50% { opacity: .9; } }

/* ============================================================
   Shell
   ============================================================ */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100dvh;
  animation: fade-in .35s ease both;
}

/* ---------- sidebar ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line-soft);
  background: #070707;
}
.sb-brand {
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--line-soft);
}

.sb-account {
  flex: none;
  margin: 14px 12px 6px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .008));
  text-align: left;
  transition: border-color .16s, background .16s;
}
.sb-account:hover { border-color: var(--line-strong); }
.sb-account .acc-ic {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0d0d0e;
  color: var(--text-2);
}
.sb-account .acc-name { font-size: 13px; font-weight: 600; color: var(--text); }
.sb-account .acc-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.sb-account .ic-chevrons-up-down { color: var(--text-3); }

.sb-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px 16px; }
.sb-group { margin-top: 18px; }
.sb-group:first-child { margin-top: 6px; }
.sb-group > .cap { display: block; padding: 0 10px 8px; color: var(--text-4); }
.sb-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 34px;
  padding: 0 10px;
  margin-bottom: 1px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .14s, color .14s;
}
.sb-link .ic { color: var(--text-3); transition: color .14s; }
.sb-link:hover { background: var(--hover); color: var(--text); }
.sb-link:hover .ic { color: var(--text-2); }
.sb-link.is-active { background: var(--active); color: var(--text); }
.sb-link.is-active .ic { color: var(--text); }
.sb-link.is-active::before {
  content: "";
  position: absolute;
  left: -12px; top: 9px; bottom: 9px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--blue);
  box-shadow: 0 0 12px 1px rgba(61, 123, 255, .8);
}
.sb-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--blue);
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--blue-soft);
  border: 1px solid rgba(61, 123, 255, .22);
}

.sb-lock { margin-left: auto; display: grid; place-items: center; color: var(--text-4); }
/* secciones de la Beta 2.0: candado y etiqueta, en tono apagado */
.sb-link > span:first-of-type { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-link.is-soon > span:first-of-type { color: var(--text-3); }
.sb-link.is-soon > .ic { opacity: .55; }
.sb-soon {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px; flex: none;
  padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03);
  font-size: 10px; font-weight: 600; letter-spacing: .04em; color: var(--text-3); white-space: nowrap;
}
.sb-soon .ic { width: 11px; height: 11px; color: var(--text-3); }

/* pantalla «disponible en la Beta 2.0» */
.page-soon { display: grid; place-items: center; min-height: calc(100vh - var(--topbar-h) - 80px); }
.soon { display: flex; flex-direction: column; align-items: center; max-width: 520px; padding: 40px 24px; text-align: center; }
.soon-ic {
  display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 22px; border-radius: 16px;
  border: 1px solid var(--blue-line); background: var(--blue-soft); color: var(--blue); box-shadow: 0 0 40px rgba(61, 123, 255, .18);
}
.soon h1 { margin-top: 10px; font-size: 26px; font-weight: 600; letter-spacing: -.03em; line-height: 1.2; }
.soon p { margin-top: 12px; font-size: 14.5px; line-height: 1.6; color: var(--text-2); }
.soon-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 26px; }
.sb-lock .ic { color: var(--text-4); }

.sb-foot { flex: none; padding: 10px 12px 12px; border-top: 1px solid var(--line-soft); }
.sb-user {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  margin-top: 4px;
  border-radius: 9px;
  text-align: left;
  transition: background .14s;
}
.sb-user:hover { background: var(--hover); }
.avatar {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: linear-gradient(140deg, #1b1b1e, #0e0e10);
  font-size: 12px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.sb-user .u-name { font-size: 12.5px; font-weight: 500; color: var(--text); }
.sb-user .u-sub { font-size: 11.5px; color: var(--text-3); }
.sb-user .ic { color: var(--text-3); }

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100dvh; }
.topbar {
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line-soft);
}
.tb-menu { display: none; }
.tb-crumbs { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 13.5px; }
.tb-crumbs .crumb-acc { color: var(--text-3); }
.tb-crumbs .crumb-sep { color: var(--text-4); }
.tb-crumbs .crumb-page { color: var(--text); font-weight: 600; white-space: nowrap; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tb-divider { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }
.tb-show-sm { display: none; }

/* aviso de premium para el plan gratuito */
.upsell {
  flex: none;
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 6px 28px;
  border-bottom: 1px solid rgba(61, 123, 255, .22);
  background: linear-gradient(90deg, rgba(31, 94, 255, .16), rgba(31, 94, 255, .04) 55%, transparent);
  font-size: 13px; color: var(--text-2);
}
.upsell-tag { display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: #8fb2ff; }
.upsell-msg { flex: 1; min-width: 0; }
.upsell-msg b { font-weight: 600; color: var(--text); }
.upsell-cta { flex: none; border-color: rgba(61, 123, 255, .45); background: rgba(31, 94, 255, .18); color: #fff; }
.upsell-cta:hover { background: rgba(31, 94, 255, .3); border-color: rgba(110, 156, 255, .7); }

.view { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; }
.page { max-width: 1440px; margin: 0 auto; padding: 28px 32px 80px; animation: fade-up .45s var(--ease) both; }
.page.no-anim { animation: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -.03em; line-height: 1.2; }
.page-sub { margin-top: 4px; font-size: 13px; color: var(--text-3); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   Layout helpers
   ============================================================ */
.grid { display: grid; gap: 16px; }
.cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; } .span-12 { grid-column: span 12; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }

/* ============================================================
   Card
   ============================================================ */
.card {
  position: relative;
  min-width: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, .004)), var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 0; min-height: 46px; }
.card-title { font-size: 13px; font-weight: 600; letter-spacing: -.005em; color: var(--text); }
.card-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.card-tools { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 14px 18px 18px; }
.card-body.flush { padding: 8px 0 0; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--text-3); }
.card-link { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--text-2); transition: color .14s; }
.card-link:hover { color: var(--text); }

/* ============================================================
   KPI
   ============================================================ */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, .004)), var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.kpi-strip > .kpi + .kpi { border-left: 1px solid var(--line-soft); }
.kpi { min-width: 0; padding: 16px 18px 15px; }
.kpi-label { font-size: 10.5px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 10px; min-width: 0; }
.kpi-value { font-size: 24px; font-weight: 600; letter-spacing: -.035em; line-height: 1.1; white-space: nowrap; }
.kpi-spark { flex: 0 1 auto; min-width: 0; overflow: hidden; opacity: .95; }
.kpi-foot { display: flex; align-items: center; gap: 7px; margin-top: 8px; min-height: 18px; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); }
.delta.pos { color: var(--pos); }
.delta.neg { color: var(--neg); }
.kpi-sub { overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   Tabla
   ============================================================ */
.tbl-wrap { overflow-x: auto; }
.tbl th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10.5px; font-weight: 600; letter-spacing: .11em; text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
  border-bottom: 1px solid var(--line-soft);
}
.tbl td {
  padding: 11px 14px;
  font-size: 13px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.tbl th:first-child, .tbl td:first-child { padding-left: 18px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 18px; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: rgba(255, 255, 255, .025); }
.tbl tr.is-clickable { cursor: pointer; }
.tbl .r { text-align: right; }
.tbl .c { text-align: center; }
.tbl td.muted { color: var(--text-3); }
.tbl td.strong { font-weight: 600; }
.tbl th[data-sort] { cursor: pointer; user-select: none; }
.tbl th[data-sort]:hover { color: var(--text-2); }
.tbl th.is-sorted { color: var(--text); }
.sym { font-weight: 600; letter-spacing: .01em; }

/* ============================================================
   Pills, etiquetas, estados
   ============================================================ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  white-space: nowrap;
}
.pill-pos { color: var(--pos); background: var(--pos-soft); border-color: rgba(62, 207, 142, .2); }
.pill-neg { color: var(--neg); background: var(--neg-soft); border-color: rgba(240, 97, 109, .2); }
.pill-warn { color: var(--warn); background: var(--warn-soft); border-color: rgba(227, 169, 79, .2); }
.pill-blue { color: #7aa5ff; background: var(--blue-soft); border-color: rgba(61, 123, 255, .24); }
.pill-neutral { color: var(--text-2); background: rgba(255, 255, 255, .045); border-color: var(--line); }
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }

.side { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; }
.side i { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; }
.side-long i { border-bottom: 6px solid var(--pos); }
.side-short i { border-top: 6px solid var(--neg); }

.tag {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 11.5px; font-weight: 500; color: var(--text-2);
  white-space: nowrap;
}

.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); flex: none; }
.status-dot.live { background: var(--pos); box-shadow: 0 0 0 3px rgba(62, 207, 142, .14), 0 0 10px rgba(62, 207, 142, .7); }
.status-dot.paper { background: var(--blue); box-shadow: 0 0 0 3px rgba(61, 123, 255, .14); }
.status-dot.paused { background: var(--warn); }
.status-dot.stopped { background: var(--text-4); }

/* ============================================================
   Control segmentado y pestañas
   ============================================================ */
.seg {
  display: inline-flex;
  padding: 2px; gap: 2px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(255, 255, 255, .025);
}
.seg button {
  height: 26px; padding: 0 10px;
  border-radius: 7px;
  font-size: 12px; font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  transition: color .14s, background .14s;
}
.seg button:hover { color: var(--text); }
.seg button.is-active { background: rgba(255, 255, 255, .085); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line-soft); }
.tabs button {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px;
  font-size: 13.5px; font-weight: 500;
  color: var(--text-3);
  transition: color .14s;
}
.tabs button:hover { color: var(--text-2); }
.tabs button.is-active { color: var(--text); }
.tabs button.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1.5px; background: var(--text); }
.tab-count { font-size: 11px; color: var(--text-3); padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, .05); }

/* ============================================================
   Medidor, listas de datos
   ============================================================ */
.meter { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--blue); transition: width .6s var(--ease); }
.meter-pos i { background: var(--pos); }
.meter-neg i { background: var(--neg); }
.meter-warn i { background: var(--warn); }

.stat-list { display: flex; flex-direction: column; }
.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.stat-row:last-child { border-bottom: none; }
.stat-row > span:first-child { color: var(--text-2); }
.stat-row > span:last-child { font-weight: 500; font-variant-numeric: tabular-nums; }

/* ============================================================
   Estado vacío
   ============================================================ */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 44px 24px; }
.empty-ic {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  margin-bottom: 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .025);
  color: var(--text-2);
}
.empty-title { font-size: 14px; font-weight: 600; }
.empty-text { max-width: 380px; margin-top: 6px; font-size: 13px; line-height: 1.6; color: var(--text-3); }
.empty-actions { display: flex; gap: 8px; margin-top: 18px; }

/* ============================================================
   Formularios dentro de la app
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { margin: 22px 0 12px; }
.form-section:first-child { margin-top: 0; }
.form-section .cap { display: block; }

/* ============================================================
   Overlays: modal y drawer
   ============================================================ */
.overlay { position: fixed; inset: 0; z-index: 100; }
.overlay-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s ease; }
.overlay.is-open .overlay-backdrop { opacity: 1; }
.overlay.is-closing .overlay-backdrop { opacity: 0; }

.modal {
  position: absolute;
  left: 50%; top: 11vh;
  width: min(540px, calc(100vw - 32px));
  max-height: 78vh;
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-modal);
  opacity: 0;
  transform: translate(-50%, 10px) scale(.985);
  transition: opacity .2s ease, transform .28s var(--ease);
}
.modal-sm { width: min(420px, calc(100vw - 32px)); }
.modal-lg { width: min(780px, calc(100vw - 32px)); }
.overlay.is-open .modal { opacity: 1; transform: translate(-50%, 0) scale(1); }
.overlay.is-closing .modal { opacity: 0; transform: translate(-50%, 6px) scale(.99); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 4px; }
.modal-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.modal-sub { margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.modal-body { padding: 12px 20px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-soft); }

.drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(var(--w, 520px), 100vw);
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-modal);
  opacity: 0;
  transform: translateX(28px);
  transition: opacity .2s ease, transform .32s var(--ease);
}
.overlay.is-open .drawer { opacity: 1; transform: none; }
.overlay.is-closing .drawer { opacity: 0; transform: translateX(20px); }
.drawer-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 16px; border-bottom: 1px solid var(--line-soft); }
.drawer-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.drawer-sub { margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px 24px; }
.drawer-foot { flex: none; display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-soft); }

/* ============================================================
   Menú contextual y toasts
   ============================================================ */
.menu {
  position: fixed; z-index: 200;
  min-width: 200px; max-width: 320px; max-height: 70vh; overflow-y: auto;
  padding: 5px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-4px);
  transition: opacity .14s ease, transform .18s var(--ease);
}
.menu.is-open { opacity: 1; transform: none; }
.menu-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  min-height: 32px; padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px; color: var(--text-2);
  text-align: left;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--active); color: var(--text); outline: none; }
.menu-item:disabled { opacity: .4; cursor: not-allowed; background: none; }
.menu-item.is-danger { color: var(--neg); }
.menu-item.is-danger:hover { background: var(--neg-soft); color: var(--neg); }
.menu-ic { display: grid; place-items: center; color: var(--text-3); }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.menu-check { color: var(--blue); flex: none; }
.menu-sep { height: 1px; margin: 5px -5px; background: var(--line-soft); }
.menu-heading { padding: 8px 10px 5px; }

#toasts { position: fixed; left: 50%; bottom: 26px; z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: #161617;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  font-size: 13px;
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s ease, transform .28s var(--ease);
}
.toast.is-open { opacity: 1; transform: none; }
.toast-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 8px var(--pos); }
.toast-error .toast-dot { background: var(--neg); box-shadow: 0 0 8px var(--neg); }
.toast-info .toast-dot { background: var(--blue); box-shadow: 0 0 8px var(--blue); }

/* ============================================================
   Onboarding (sin cuentas todavía) y error de vista
   ============================================================ */
.onboard { max-width: 560px; margin: 9vh auto 0; text-align: center; }
.onboard .logo-mark { margin: 0 auto 28px; }
.onboard h1 { font-size: 26px; font-weight: 600; letter-spacing: -.035em; }
.onboard p { margin: 10px auto 0; max-width: 440px; font-size: 14px; line-height: 1.65; color: var(--text-2); }
.onboard-actions { display: flex; justify-content: center; gap: 10px; margin-top: 30px; }
.onboard-note { margin-top: 18px; font-size: 12.5px; color: var(--text-3); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1180px) {
  .span-3 { grid-column: span 6; }
  .span-4, .span-5, .span-7, .span-8, .span-9 { grid-column: span 12; }
  .page { padding: 24px 24px 72px; }
  .topbar { padding: 0 20px; }
}
@media (max-width: 920px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 90; top: 0; bottom: 0; left: 0;
    width: 264px;
    transform: translateX(-100%);
    transition: transform .3s var(--ease);
  }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-modal); }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .6); }
  .tb-menu { display: inline-flex; }
  .crumb-acc, .crumb-sep { display: none; }
  .kpi-strip { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-strip > .kpi + .kpi { border-left: none; }
  .kpi-strip > .kpi { border-bottom: 1px solid var(--line-soft); }
  .kpi-strip > .kpi:nth-child(even) { border-left: 1px solid var(--line-soft); }
}
@media (max-width: 640px) {
  .span-3, .span-6 { grid-column: span 12; }
  .page { padding: 18px 16px 64px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .upsell { padding: 6px 12px; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .tb-hide-sm { display: none !important; }
  .tb-show-sm { display: inline-flex; }
  .modal { top: 6vh; max-height: 88vh; }
}

/* ============================================================
   Bienvenida
   ============================================================ */
.welcome {
  position: fixed; inset: 0; z-index: 500;
  display: grid; place-items: center;
  background:
    radial-gradient(60% 45% at 50% 50%, rgba(31, 94, 255, .26) 0%, rgba(31, 94, 255, .08) 45%, transparent 75%),
    radial-gradient(90% 60% at 50% 115%, rgba(61, 123, 255, .18), transparent 70%),
    #030407;
  transition: opacity 1.4s ease, filter 1.4s ease, transform 1.4s ease;
  cursor: pointer;
}
.welcome.is-out { opacity: 0; filter: blur(8px); transform: scale(1.015); pointer-events: none; }
.welcome-glow {
  position: absolute; inset: 0;
  background: radial-gradient(30% 22% at 50% 50%, rgba(120, 160, 255, .22), transparent 72%);
  opacity: 0; transition: opacity 3s ease 1s;
}
.welcome.is-in .welcome-glow { opacity: 1; }
.welcome-inner { position: relative; text-align: center; padding: 0 24px; }
.welcome-title { font-size: clamp(34px, 5vw, 66px); font-weight: 500; letter-spacing: -.035em; line-height: 1.12; color: #d9dcE4; }
.welcome-title .w {
  display: inline-block; opacity: 0; filter: blur(16px); transform: translateY(14px) scale(.98);
  transition: opacity var(--wdur) cubic-bezier(.2, .7, .1, 1), filter var(--wdur) cubic-bezier(.2, .7, .1, 1), transform var(--wdur) cubic-bezier(.2, .7, .1, 1);
  transition-delay: var(--d);
}
.welcome-title .l { transform: translateY(8px); }
.welcome-name { color: #fff; font-weight: 600; white-space: nowrap; }
.welcome.is-in .w { opacity: 1; filter: none; transform: none; }
.welcome-sub { margin-top: 20px; font-size: 14px; letter-spacing: .04em; color: #8e98b3; opacity: 0; transition: opacity 1.6s ease; transition-delay: var(--d); }
.welcome.is-in .welcome-sub { opacity: 1; }
/* una vez formado: respira con una luz tenue */
.welcome.is-hold .welcome-title { animation: welcome-breathe 1.8s ease-in-out infinite; }
.welcome.is-hold .welcome-glow { animation: welcome-glow 1.8s ease-in-out infinite; }
@keyframes welcome-breathe {
  0%, 100% { text-shadow: 0 0 0 rgba(170, 195, 255, 0); opacity: 1; }
  50% { text-shadow: 0 0 24px rgba(140, 175, 255, .55), 0 0 70px rgba(61, 123, 255, .35); opacity: .9; }
}
@keyframes welcome-glow { 0%, 100% { opacity: .7; } 50% { opacity: 1.25; filter: brightness(1.4); } }
