/* Business OS — tablero. Tema oscuro, sobrio, editorial. */
:root {
  --bg: #0b0e14;
  --panel: #141925;
  --panel-2: #1b2230;
  --ink: #f2f4f8;
  --muted: #9aa4b2;
  --faint: #6b7280;
  --line: #2a3344;
  --accent: #7ba0b5;
  --green: #38d39f;
  --red: #ff5c6c;
  --amber: #ffb454;
  --gold: #c9a227;
  --radius: 12px;
  --sidebar-w: 232px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 500; margin: 0; }
a { color: var(--accent); }
button { font-family: inherit; cursor: pointer; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 32px;
}
.login-card h1 { font-size: 26px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.field { display: block; margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: .04em; text-transform: uppercase; }
input[type=password], input[type=text] {
  width: 100%; padding: 11px 13px; background: var(--bg); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 8px; font-size: 15px; outline: none;
}
input:focus { border-color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 16px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink); font-size: 14px; font-weight: 500;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #07121a; border-color: var(--accent); width: 100%; }
.btn-primary:hover { filter: brightness(1.08); }
.err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 4px; }

/* ---------- Layout ---------- */
.app { display: none; }
.app.show { display: block; }
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 20;
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: rgba(11,14,20,.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: 'Fraunces', serif; font-size: 18px; letter-spacing: .01em; }
.brand b { color: var(--gold); font-weight: 600; }
.topbar .spacer { flex: 1; }
.pill {
  font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); display: inline-flex; align-items: center; gap: 6px;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.tier .dot { background: var(--green); }
.pill.paused .dot { background: var(--amber); }
.muted-sm { color: var(--faint); font-size: 12px; }

.sidebar {
  position: fixed; top: 56px; bottom: 0; left: 0; width: var(--sidebar-w);
  border-right: 1px solid var(--line); padding: 16px 12px; overflow-y: auto; background: var(--bg);
}
.nav-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 14px 8px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 8px; border: none; background: transparent;
  color: var(--muted); font-size: 14px; margin-bottom: 2px;
}
.nav-link .ico { width: 18px; text-align: center; opacity: .9; }
.nav-link:hover { background: var(--panel); color: var(--ink); }
.nav-link.active { background: var(--panel-2); color: var(--ink); }
.nav-link .soon { margin-left: auto; font-size: 10px; color: var(--faint); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; }

.main { margin-left: var(--sidebar-w); padding: 78px 28px 60px; max-width: 1280px; }
.view { display: none; }
.view.show { display: block; }
.view-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.view-head h2 { font-size: 24px; }
.view-sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }

/* ---------- Cards ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-card.warn { border-color: #5a4326; }
.stat-card .label { font-size: 12px; color: var(--muted); letter-spacing: .03em; margin-bottom: 8px; }
.stat-card .num { font-size: 28px; font-family: 'Fraunces', serif; font-weight: 500; letter-spacing: -.01em; }
.stat-card .num.sm { font-size: 20px; }
.stat-card .delta { font-size: 12px; margin-top: 6px; color: var(--faint); }
.stat-card .delta.good { color: var(--green); }
.stat-card .delta.bad { color: var(--red); }
.biz-tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 22px; }
.card h3 { font-size: 17px; margin-bottom: 14px; }
.card .hint { color: var(--muted); font-size: 13px; }

/* ---------- Tables ---------- */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px; border-bottom: 1px solid rgba(42,51,68,.5); }
table.t tr:last-child td { border-bottom: none; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.block { color: var(--amber); border-color: #5a4326; }
.badge.open { color: var(--accent); border-color: #2c4a59; }
.badge.live { color: var(--green); border-color: #1d5a44; }
.badge.pre { color: var(--faint); }

.soon-note { color: var(--faint); font-size: 13px; border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; }
.demo-banner {
  background: #2a2310; border: 1px solid #5a4326; color: var(--amber);
  font-size: 13px; padding: 9px 14px; border-radius: 8px; margin-bottom: 18px; display: none;
}
.demo-banner.show { display: block; }
.src { color: var(--faint); font-size: 11px; }

/* ========================================================================
   HUD layer — Command Center (Phase 1.7). Striking but honest:
   mono labels, corner-bracket panels, subtle glow. Motion only where it
   encodes data (caret blink, "needs you" pulse). No decorative radar.
======================================================================== */
.mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }
.eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.eyebrow .slash { color: var(--accent); }

.cc-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cc-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* Panel with two opposite corner brackets + faint glow */
.hud-panel {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px 18px;
}
.hud-panel::before, .hud-panel::after {
  content: ''; position: absolute; width: 13px; height: 13px;
  border: 1.5px solid var(--accent); opacity: .55; pointer-events: none;
}
.hud-panel::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.hud-panel::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.hud-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.hud-tag { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }

/* Vitals (clickable rows) */
.vital { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid rgba(42,51,68,.45); cursor: pointer; }
.cc-col .vital:last-child { border-bottom: 0; }
.vital .v-label { font-size: 13px; color: var(--muted); }
.vital .v-val { font-family: 'Fraunces', serif; font-size: 21px; color: var(--ink); transition: color .12s; }
.vital:hover .v-val { color: var(--accent); }
.vital .v-arrow { color: var(--faint); font-size: 12px; }
.vital:hover .v-arrow { color: var(--accent); }

/* System health lights */
.sys-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13px; }
.status-light { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.status-light.ok  { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-light.warn{ background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.status-light.err { background: var(--red);   box-shadow: 0 0 8px var(--red); }
.sys-row .sys-name { color: var(--ink); }
.sys-row .sys-meta { margin-left: auto; color: var(--faint); font-size: 11px; font-family: 'JetBrains Mono', monospace; }

/* Quick links */
.qlink { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 13px; text-decoration: none; margin-bottom: 8px; transition: border-color .12s, color .12s; }
.qlink:last-child { margin-bottom: 0; }
.qlink:hover { border-color: var(--accent); color: var(--ink); }
.qlink .ext { margin-left: auto; color: var(--faint); font-size: 11px; }

/* Jarvis command (centerpiece) */
.cmd-wrap { box-shadow: 0 0 0 1px rgba(123,160,181,.14), 0 0 44px rgba(123,160,181,.07); }
.jarvis-answer { font-size: 14.5px; line-height: 1.6; color: var(--ink); min-height: 60px; margin-bottom: 14px; }
.jarvis-answer .k { color: var(--accent); font-weight: 600; }
.jarvis-answer strong { color: var(--accent); font-weight: 600; }
.jarvis-answer.fase2 { color: var(--muted); }
.jarvis-answer.loading { color: var(--muted); }
.jarvis-answer a { color: var(--accent); }
.jarvis-thinking { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--accent); }
.jarvis-thinking .dots { animation: bos-blink 1.1s steps(1) infinite; }
.jarvis-sources { margin-top: 10px; font-family: 'JetBrains Mono', monospace; font-size: 10.5px; letter-spacing: .03em; color: var(--faint); }
.jarvis-sources a { color: var(--muted); text-decoration: none; }
.jarvis-sources a:hover { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: .04em; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.cmd-bar { display: flex; align-items: center; gap: 10px; border: 1px solid var(--accent); border-radius: 10px; padding: 11px 13px; background: rgba(123,160,181,.06); }
.cmd-bar .caret { width: 8px; height: 16px; background: var(--accent); animation: bos-blink 1.1s steps(1) infinite; flex: none; }
.cmd-bar input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--ink); font-family: 'JetBrains Mono', monospace; font-size: 13px; padding: 0; }
.cmd-bar input::placeholder { color: var(--faint); }
.cmd-bar .mic { color: var(--faint); font-size: 14px; cursor: default; }
@keyframes bos-blink { 50% { opacity: 0; } }

/* Action queue */
.act-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 9px; }
.act-item:last-child { margin-bottom: 0; }
.act-item .act-body { min-width: 0; }
.act-item .act-title { font-size: 13.5px; color: var(--ink); }
.act-item .act-sub { font-size: 11px; color: var(--faint); font-family: 'JetBrains Mono', monospace; margin-top: 2px; }
.act-item .btn-xs { margin-left: auto; flex: none; padding: 6px 12px; border-radius: 7px; border: 1px solid var(--accent); background: rgba(123,160,181,.08); color: var(--ink); font-size: 12px; text-decoration: none; }
.act-item .btn-xs:hover { background: rgba(123,160,181,.18); }
.needs-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--amber); color: #1a1205; font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600; }
.needs-badge.live { animation: bos-pulse 2s ease-in-out infinite; }
@keyframes bos-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,180,84,.5); } 50% { box-shadow: 0 0 0 6px rgba(255,180,84,0); } }

/* Per-business status */
.biz-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(42,51,68,.45); font-size: 13px; }
.cc-col .biz-row:last-child { border-bottom: 0; }
.biz-row .biz-name { color: var(--ink); }
.biz-row .biz-metric { margin-left: auto; color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.biz-row a.biz-name:hover { color: var(--accent); }

/* RT-LOG */
.rtlog { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; max-height: 320px; overflow-y: auto; }
.rtlog .row { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(42,51,68,.35); color: var(--muted); text-decoration: none; }
.rtlog .row:hover { color: var(--ink); }
.rtlog .ts { color: var(--faint); flex: none; }
.rtlog .src { color: var(--accent); flex: none; }

@media (prefers-reduced-motion: reduce) {
  .cmd-bar .caret { animation: none; }
  .needs-badge.live { animation: none; }
  .jarvis-thinking .dots { animation: none; }
}

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

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; z-index: 25; box-shadow: 0 0 40px rgba(0,0,0,.5); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding: 74px 16px 60px; }
  .menu-btn { display: inline-flex !important; }
  .topbar { gap: 8px; padding: 0 12px; }
  .brand { white-space: nowrap; font-size: 16px; }
  #refresh-pill, #tier-pill { display: none; }   /* la frescura y el tier se ven dentro del tablero */
  #refresh-btn, #logout-btn { padding: 8px 11px; font-size: 13px; }
}
.menu-btn { display: none; }
