/* CIRA — Cockpit Oscuro. Tokens + primitivos globales. */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0B1220;
  --bg-2: #0F1830;
  --surface: #141F3A;
  --surface-2: #1A2847;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.12);
  --text: #E7ECF5;
  --text-dim: #8A95AE;
  --text-muted: #5A6684;
  --accent: #5EEAD4;
  --accent-glow: rgba(94,234,212,0.25);
  --accent-glow-strong: rgba(94,234,212,0.35);
  --warn: #FBBF24;
  --danger: #F87171;
  --ok: #4ADE80;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 12px;
  --r-xl: 14px;
  --r-full: 999px;

  --shadow-orb-idle: 0 0 24px var(--accent-glow);
  --shadow-orb-active: 0 0 40px var(--accent-glow-strong), 0 0 80px var(--accent-glow);
  --shadow-kpi-accent: 0 0 0 3px var(--accent-glow);
  --shadow-orb-panel: 0 12px 40px rgba(0,0,0,0.4), 0 0 40px rgba(94,234,212,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

.serif { font-family: 'Instrument Serif', serif; font-weight: 400; letter-spacing: -0.01em; }
.mono  { font-family: 'JetBrains Mono', monospace; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(120,120,120,0.25); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ───── Shell layout ───── */
.cira-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.cira-sidebar {
  width: 220px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.cira-sidebar .logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px;
}
.cira-sidebar .logo-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), oklch(0.5 0.12 200));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 20px var(--accent-glow);
}
.cira-sidebar .logo-title { font-family: 'Instrument Serif', serif; font-size: 20px; line-height: 1; letter-spacing: -0.01em; }
.cira-sidebar .logo-sub   { font-size: 9.5px; color: var(--text-muted); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 2px; }

.cira-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--text-dim);
  font-size: 13.5px; font-weight: 400;
  transition: background 0.15s, color 0.15s;
  text-align: left; width: 100%;
}
.cira-nav-item:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.cira-nav-item .icon { color: var(--text-muted); display: inline-flex; }
.cira-nav-item.active { background: var(--surface); color: var(--text); font-weight: 500; }
.cira-nav-item.active .icon { color: var(--accent); }

.cira-sidebar .footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  padding-left: 8px; padding-right: 8px;
}
.cira-sidebar .footer .name  { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cira-sidebar .footer .clin  { font-size: 10.5px; color: var(--text-muted); }

.cira-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cira-topbar {
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 20px;
  flex-shrink: 0;
  background: var(--bg);
  position: sticky; top: 0; z-index: 5;
}
.cira-topbar .title-block { flex: 1; min-width: 0; }
.cira-topbar .crumbs      { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; letter-spacing: 0.02em; }
.cira-topbar .title       { font-size: 15px; font-weight: 500; color: var(--text); }

.cira-search {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  min-width: 320px; color: var(--text-dim); font-size: 12.5px;
  cursor: pointer;
}
.cira-search:hover { border-color: var(--border-strong); }
.cira-search .placeholder { flex: 1; }
.cira-search .kbd {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-muted);
  padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px;
}

.cira-topbar-right { display: flex; align-items: center; gap: 10px; }

.cira-content {
  flex: 1;
  padding: 28px 28px 120px;
  min-width: 0;
}

/* ───── Primitivos ───── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.card.accent { border-color: var(--accent); box-shadow: var(--shadow-kpi-accent); }
.card.ghost  { background: transparent; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 500;
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  letter-spacing: 0.02em;
}
.pill.accent { color: var(--accent); background: rgba(94,234,212,0.08); border-color: rgba(94,234,212,0.25); }
.pill.warn   { color: var(--warn);   background: rgba(251,191,36,0.08); border-color: rgba(251,191,36,0.25); }
.pill.danger { color: var(--danger); background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.25); }
.pill.ok     { color: var(--ok);     background: rgba(74,222,128,0.08);  border-color: rgba(74,222,128,0.25); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover   { background: var(--surface-2); border-color: var(--border-strong); }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover { background: #3dd5be; }
.btn-danger  { background: transparent; color: var(--danger); border-color: rgba(248,113,113,0.3); }
.btn-ghost   { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }

.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 13.5px;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.input::placeholder { color: var(--text-muted); }
textarea.input { min-height: 80px; resize: vertical; font-family: inherit; }

.label { font-size: 11px; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px; display: block; }

.avatar {
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; color: var(--text);
  flex-shrink: 0; letter-spacing: -0.02em;
}

.hero-title { font-family: 'Instrument Serif', serif; font-size: 38px; line-height: 1.05; letter-spacing: -0.02em; }
.hero-label { font-size: 11px; color: var(--text-muted); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 10px; }
.kpi-number { font-family: 'Instrument Serif', serif; font-size: 30px; line-height: 1; letter-spacing: -0.02em; }

/* ───── Voice Orb (flotante) ───── */
.voice-orb-pill {
  position: fixed; bottom: 20px; right: 20px; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px 10px 10px;
  background: rgba(15, 24, 48, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow: var(--shadow-orb-panel);
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s;
}
.voice-orb-pill:hover { transform: translateY(-1px); }
.voice-orb-pill .label { font-size: 11px; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }
.voice-orb-pill .hint  { font-size: 12.5px; color: var(--text); display: flex; align-items: center; gap: 6px; }

.orb {
  position: relative;
  flex-shrink: 0;
  border-radius: 50%;
}
.orb .orb-core {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #5EEAD4, oklch(0.55 0.14 180) 70%, oklch(0.35 0.1 200));
  box-shadow: var(--shadow-orb-idle);
  transition: box-shadow 0.4s;
}
.orb.listening .orb-core,
.orb.thinking  .orb-core { box-shadow: var(--shadow-orb-active); }
.orb .orb-highlight {
  position: absolute; top: 15%; left: 18%;
  width: 30%; height: 25%; border-radius: 50%;
  background: rgba(255,255,255,0.4); filter: blur(4px);
  pointer-events: none;
}
.orb .ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid var(--accent);
  opacity: 0;
  pointer-events: none;
}
.orb.listening .ring { animation: pulse-ring 1.8s infinite ease-out; }
.orb.listening .ring:nth-child(2) { animation-delay: 0.6s; }
.orb.listening .ring:nth-child(3) { animation-delay: 1.2s; }

.waveform { display: flex; align-items: center; gap: 2px; height: 10px; }
.waveform .bar {
  width: 2px; height: 100%; background: var(--accent); border-radius: 1px;
  transform-origin: center;
  animation: wave 0.8s infinite ease-in-out;
}
.waveform .bar:nth-child(2) { animation-delay: 0.12s; }
.waveform .bar:nth-child(3) { animation-delay: 0.24s; }
.waveform .bar:nth-child(4) { animation-delay: 0.36s; }
.waveform .bar:nth-child(5) { animation-delay: 0.48s; }
.waveform .bar:nth-child(6) { animation-delay: 0.60s; }
.waveform .bar:nth-child(7) { animation-delay: 0.72s; }
.waveform .bar:nth-child(8) { animation-delay: 0.84s; }
.waveform .bar:nth-child(9) { animation-delay: 0.96s; }
.waveform .bar:nth-child(10) { animation-delay: 1.08s; }
.waveform .bar:nth-child(11) { animation-delay: 1.20s; }
.waveform.idle .bar { animation-play-state: paused; transform: scaleY(0.3); }

/* ───── Animaciones ───── */
@keyframes pulse-ring {
  0%   { transform: scale(0.85); opacity: 1; }
  100% { transform: scale(1.8);  opacity: 0; }
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.4; }
}
@keyframes wave {
  0%,100% { transform: scaleY(0.3); }
  50%     { transform: scaleY(1); }
}
@keyframes float-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.float-in { animation: float-in 0.4s ease both; }

/* ───── Command palette (⌘K) ───── */
.cmdk-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5, 8, 17, 0.7);
  backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 15vh;
}
.cmdk-backdrop.active { display: flex; }
.cmdk-box {
  width: min(560px, 90vw);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  overflow: hidden;
}
.cmdk-input {
  width: 100%; padding: 16px 18px;
  background: transparent; border: none;
  color: var(--text); font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.cmdk-input:focus { outline: none; }
.cmdk-list { max-height: 360px; overflow-y: auto; padding: 6px; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  font-size: 13px; color: var(--text-dim);
  cursor: pointer;
}
.cmdk-item:hover, .cmdk-item.active { background: var(--surface-2); color: var(--text); }
.cmdk-item .icon { color: var(--text-muted); }
.cmdk-item.active .icon { color: var(--accent); }
.cmdk-section { font-size: 10px; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; padding: 8px 12px 4px; }

/* ───── Responsive (< 1024px) ───── */
@media (max-width: 1024px) {
  .cira-sidebar { width: 64px; padding: 18px 8px; }
  .cira-sidebar .logo-title,
  .cira-sidebar .logo-sub,
  .cira-nav-item .lbl,
  .cira-sidebar .footer .name,
  .cira-sidebar .footer .clin { display: none; }
  .cira-nav-item { justify-content: center; padding: 10px; }
  .cira-sidebar .footer { padding: 14px 0 0; justify-content: center; }
  .cira-search { min-width: 180px; }
  .voice-orb-pill .hint span:not(.waveform) { display: none; }
}
@media (max-width: 640px) {
  .cira-content { padding: 20px 16px 120px; }
  .cira-search { display: none; }
}

/* ───── Helpers ───── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.grid { display: grid; }
.w-full { width: 100%; }
.text-dim { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-warn { color: var(--warn); }
.text-danger { color: var(--danger); }
.text-ok { color: var(--ok); }
