/* ═══════════════════════════════════════════════════════════
   OPERATYX OS — Design System v1.0
   Sistema operativo empresarial-creativo con IA
   ═══════════════════════════════════════════════════════════ */

:root {
  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --r-xs: 8px; --r-sm: 12px; --r-md: 16px; --r-lg: 22px; --r-xl: 28px; --r-full: 999px;
  --ease: cubic-bezier(.22,.68,.35,1);
  --t-fast: .18s var(--ease);
  --t-med: .32s var(--ease);
  --t-slow: .55s var(--ease);
  --sidebar-w: 264px;
  --topbar-h: 64px;
}

/* ── THEME: AURORA (default, dark) ── */
:root, [data-theme="aurora"] {
  --bg-0: #07080f;
  --bg-1: #0c0e18;
  --bg-2: #12152233;
  --surface: rgba(255,255,255,.035);
  --surface-2: rgba(255,255,255,.06);
  --surface-3: rgba(255,255,255,.09);
  --stroke: rgba(255,255,255,.08);
  --stroke-2: rgba(255,255,255,.14);
  --text-1: #f2f4fb;
  --text-2: #9aa3bd;
  --text-3: #5d6580;
  --accent: #7c6cff;
  --accent-2: #38e1c6;
  --accent-3: #ff7ab8;
  --accent-soft: rgba(124,108,255,.14);
  --accent-glow: transparent;
  --grad-hero: #7c6cff;
  --grad-card: var(--surface-2);
  --ok: #34d399; --warn: #fbbf24; --err: #f87171; --info: #60a5fa;
  --shadow-1: 0 4px 16px rgba(0,0,0,.35);
  --shadow-glow: none;
  --glass-blur: none;
  color-scheme: dark;
}
[data-theme="obsidian"] {
  --bg-0: #050505; --bg-1: #0b0b0d;
  --accent: #e8b34b; --accent-2: #f5e6c8; --accent-3: #b0783a;
  --accent-soft: rgba(232,179,75,.13);
  --grad-hero: #e8b34b;
}
[data-theme="ivory"] {
  --bg-0: #f4f3ef; --bg-1: #ffffff;
  --surface: rgba(20,22,40,.035); --surface-2: rgba(20,22,40,.06); --surface-3: rgba(20,22,40,.09);
  --stroke: rgba(20,22,40,.1); --stroke-2: rgba(20,22,40,.18);
  --text-1: #171928; --text-2: #4d5468; --text-3: #8a90a5;
  --accent: #4f46e5; --accent-2: #0d9488; --accent-3: #db2777;
  --accent-soft: rgba(79,70,229,.1);
  --grad-hero: #4f46e5;
  --shadow-1: 0 4px 14px rgba(23,25,40,.1);
  color-scheme: light;
}
[data-theme="quantum"] {
  --bg-0: #030b12; --bg-1: #06131d;
  --accent: #22d3ee; --accent-2: #818cf8; --accent-3: #34d399;
  --accent-soft: rgba(34,211,238,.12);
  --grad-hero: #0e7490;
}
[data-theme="sunset"] {
  --bg-0: #0f0708; --bg-1: #180b0d;
  --accent: #fb7185; --accent-2: #fbbf24; --accent-3: #c084fc;
  --accent-soft: rgba(251,113,133,.13);
  --grad-hero: #e11d48;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg-0);
  color: var(--text-1);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background .5s var(--ease), color .5s var(--ease);
}
body::before { content: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── BOOT SCREEN ── */
#boot-screen {
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center;
  background: var(--bg-0); transition: opacity .6s var(--ease), visibility .6s;
}
#boot-screen.done { opacity: 0; visibility: hidden; }
.boot-inner { text-align: center; }
.boot-mark {
  width: 84px; height: 84px; margin: 0 auto 22px; position: relative;
  display: grid; place-items: center; font-size: 30px;
  color: var(--accent);
}
.boot-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid transparent; border-top-color: var(--accent); border-right-color: var(--accent-2);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-word { font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: .28em; }
.boot-word span { color: var(--accent); }
.boot-bar { width: 200px; height: 3px; margin: 26px auto 14px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 40%; border-radius: 99px; background: var(--grad-hero); animation: bootbar 1.1s var(--ease) infinite; }
@keyframes bootbar { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
.boot-caption { font-size: 12px; color: var(--text-3); letter-spacing: .08em; }

/* ── APP LAYOUT ── */
#app { display: none; }
#app.ready { display: block; }
.os-shell { display: flex; min-height: 100dvh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; position: fixed; top: 0; bottom: 0; left: 0; z-index: 90;
  display: flex; flex-direction: column;
  background: var(--bg-1); border-right: 1px solid var(--stroke);
  transition: transform var(--t-med);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px; padding: 20px 22px 16px;
}
.brand-mark {
  width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center;
  background: var(--grad-hero); color: #fff; font-size: 16px; flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: .12em; }
.brand-name em { font-style: normal; color: var(--accent); }
.brand-tag { font-size: 10px; color: var(--text-3); letter-spacing: .14em; text-transform: uppercase; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.nav-section { margin-top: 16px; }
.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--text-3); padding: 0 12px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; margin-bottom: 2px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  transition: all var(--t-fast); position: relative; text-align: left;
}
.nav-item i { width: 20px; text-align: center; font-size: 14px; opacity: .8; }
.nav-item:hover { background: var(--surface-2); color: var(--text-1); }
.nav-item.active { background: var(--accent-soft); color: var(--text-1); }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 20%; bottom: 20%; width: 3px;
  border-radius: 99px; background: var(--grad-hero);
}
.nav-item.active i { opacity: 1; color: var(--accent); }
.nav-item .nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent);
}
.nav-item.disabled { opacity: .35; pointer-events: none; }

.sidebar-foot { padding: 14px; border-top: 1px solid var(--stroke); }
.user-chip {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--stroke); cursor: pointer;
  transition: all var(--t-fast); width: 100%;
}
.user-chip:hover { border-color: var(--stroke-2); background: var(--surface-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: var(--grad-hero); color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-chip .uc-name { font-size: 13px; font-weight: 600; }
.user-chip .uc-role { font-size: 11px; color: var(--text-3); }

/* MAIN */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }

/* TOPBAR */
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 80;
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  background: color-mix(in srgb, var(--bg-0) 72%, transparent);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--stroke);
}
.tb-menu { display: none; }
.tb-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; white-space: nowrap; }
.tb-crumb { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.tb-search {
  flex: 1; max-width: 430px; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-full);
  padding: 8px 16px; transition: all var(--t-fast); margin-left: auto;
}
.tb-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tb-search input { flex: 1; background: none; border: none; outline: none; font-size: 13px; min-width: 0; }
.tb-search i { color: var(--text-3); font-size: 13px; }
.tb-search kbd {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-3);
  border: 1px solid var(--stroke-2); border-radius: 6px; padding: 2px 6px;
}
.tb-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r-sm); display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--stroke); color: var(--text-2);
  transition: all var(--t-fast); position: relative; font-size: 14px;
}
.icon-btn:hover { color: var(--text-1); border-color: var(--stroke-2); transform: translateY(-1px); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-3); box-shadow: 0 0 8px var(--accent-3);
}
.operatyx-fab-top {
  display: inline-flex; align-items: center; gap: 9px; padding: 9px 16px; border-radius: var(--r-full);
  background: var(--grad-hero); color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: var(--shadow-glow); transition: all var(--t-fast); white-space: nowrap;
}
.operatyx-fab-top:hover { transform: translateY(-1px) scale(1.02); filter: brightness(1.08); }

/* CONTENT */
.content { flex: 1; padding: 26px 26px 110px; max-width: 1560px; width: 100%; margin: 0 auto; }
.view-enter { animation: viewIn .45s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ── PAGE HEADER ── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-size: clamp(22px, 3vw, 30px); font-weight: 800; letter-spacing: -.02em; }
.page-head .ph-sub { color: var(--text-2); font-size: 13.5px; margin-top: 5px; max-width: 640px; line-height: 1.55; }
.ph-eyebrow {
  display: inline-flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}
.ph-eyebrow::before { content: ''; width: 22px; height: 2px; border-radius: 99px; background: var(--grad-hero); }
.ph-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 10px 18px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600;
  border: 1px solid var(--stroke); background: var(--surface); color: var(--text-1);
  transition: all var(--t-fast); white-space: nowrap;
}
.btn:hover { border-color: var(--stroke-2); background: var(--surface-2); transform: translateY(-1px); }
.btn-primary { background: var(--grad-hero); border: none; color: #fff; box-shadow: 0 6px 22px var(--accent-glow); }
.btn-primary:hover { filter: brightness(1.1); background: var(--grad-hero); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text-1); background: var(--surface-2); }
.btn-danger { border-color: rgba(248,113,113,.3); color: var(--err); }
.btn-danger:hover { background: rgba(248,113,113,.1); }
.btn-sm { padding: 7px 13px; font-size: 12px; border-radius: 10px; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* ── CARDS & GRIDS ── */
.card {
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-lg);
  padding: 22px; transition: all var(--t-med); position: relative;
}
.card.hoverable:hover { border-color: var(--stroke-2); transform: translateY(-3px); box-shadow: var(--shadow-1); }
.card-glow { background: var(--grad-card); }
.card h3 { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head .ch-icon {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 15px;
}
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-23 { grid-template-columns: 2fr 1fr; }
.g-32 { grid-template-columns: 1fr 2fr; }
@media (max-width: 1100px) { .g-4 { grid-template-columns: repeat(2, 1fr); } .g-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .g-2, .g-3, .g-4, .g-23, .g-32 { grid-template-columns: 1fr; } }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 8px; }
.kpi .k-label { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.kpi .k-value { font-family: var(--font-display); font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.kpi .k-delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.k-delta.up { color: var(--ok); } .k-delta.down { color: var(--err); }

/* ── BADGES / STATUS ── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600; border: 1px solid var(--stroke);
  background: var(--surface-2); color: var(--text-2);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.st-active { color: var(--ok); border-color: rgba(52,211,153,.3); background: rgba(52,211,153,.08); }
.badge.st-inactive { color: var(--text-3); }
.badge.st-testing { color: var(--warn); border-color: rgba(251,191,36,.3); background: rgba(251,191,36,.08); }
.badge.st-hidden { color: var(--text-3); border-style: dashed; }
.badge.st-restricted { color: var(--err); border-color: rgba(248,113,113,.3); background: rgba(248,113,113,.08); }
.badge.st-scheduled { color: var(--info); border-color: rgba(96,165,250,.3); background: rgba(96,165,250,.08); }
.badge.no-dot::before { display: none; }

/* ── FORMS ── */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: .03em; }
.input, .textarea, .select {
  width: 100%; background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-sm);
  padding: 11px 14px; font-size: 13.5px; outline: none; transition: all var(--t-fast); color: var(--text-1);
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
.select option { background: var(--bg-1); color: var(--text-1); }

/* SWITCH */
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3);
  border: 1px solid var(--stroke); transition: all var(--t-fast);
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-2); transition: all var(--t-fast);
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 14px var(--accent-glow); }
.switch input:checked + .track::after { transform: translateX(20px); background: #fff; }

/* ── TABLES / LISTS ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--stroke); border-radius: var(--r-md); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.tbl th {
  text-align: left; padding: 12px 16px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--text-3);
  border-bottom: 1px solid var(--stroke); background: var(--surface);
}
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background var(--t-fast); }
.tbl tbody tr:hover { background: var(--surface); }

.list-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px;
  border-radius: var(--r-md); border: 1px solid var(--stroke); background: var(--surface);
  margin-bottom: 10px; transition: all var(--t-fast);
}
.list-row:hover { border-color: var(--stroke-2); background: var(--surface-2); }
.list-row .lr-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 15px; flex-shrink: 0;
}
.list-row .lr-body { flex: 1; min-width: 0; }
.list-row .lr-title { font-size: 13.5px; font-weight: 600; }
.list-row .lr-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .lr-end { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ── TABS ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--stroke); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 11px 16px; font-size: 13px; font-weight: 600; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all var(--t-fast); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--text-1); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Pills */
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 7px 14px; border-radius: 99px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--stroke); background: var(--surface); color: var(--text-2); transition: all var(--t-fast);
}
.pill:hover { color: var(--text-1); border-color: var(--stroke-2); }
.pill.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ── MODAL ── */
.modal-veil {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 18px;
  background: rgba(3,4,10,.66); 
  animation: fadeIn .25s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto;
  background: var(--bg-1); border: 1px solid var(--stroke-2); border-radius: var(--r-xl);
  padding: 26px; box-shadow: var(--shadow-1); animation: modalIn .35s var(--ease);
}
.modal.wide { max-width: 780px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-head h3 { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ── TOASTS ── */
#toasts { position: fixed; bottom: 24px; right: 24px; z-index: 500; display: flex; flex-direction: column; gap: 10px; max-width: 92vw; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-radius: var(--r-md);
  background: var(--bg-1); border: 1px solid var(--stroke-2); box-shadow: var(--shadow-1);
  font-size: 13px; font-weight: 500; animation: toastIn .4s var(--ease); max-width: 380px;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }
.toast.out { animation: toastOut .35s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
.toast i { font-size: 15px; }
.toast.ok i { color: var(--ok); } .toast.err i { color: var(--err); }
.toast.info i { color: var(--info); } .toast.warn i { color: var(--warn); }

/* ═══════════════ OPERATYX AGENT DOCK ═══════════════ */
.operatyx-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 250;
  width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center;
  background: var(--grad-hero); color: #fff; font-size: 21px;
  box-shadow: 0 10px 36px var(--accent-glow); transition: all var(--t-fast);
}
.operatyx-fab:hover { transform: translateY(-3px) scale(1.05); }
.operatyx-fab .pulse {
  position: absolute; inset: -4px; border-radius: 24px; border: 2px solid var(--accent);
  animation: pulse 2.2s var(--ease) infinite; opacity: .5;
}
@keyframes pulse { 0% { transform: scale(.94); opacity: .55; } 70% { transform: scale(1.14); opacity: 0; } 100% { opacity: 0; } }

.operatyx-panel {
  position: fixed; z-index: 260; bottom: 0; right: 0; top: 0;
  width: min(460px, 100vw); display: flex; flex-direction: column;
  background: var(--bg-1); border-left: 1px solid var(--stroke-2);
  box-shadow: -18px 0 60px rgba(0,0,0,.4);
  transform: translateX(105%); transition: transform var(--t-med);
}
.operatyx-panel.open { transform: none; }
.hp-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px;
  border-bottom: 1px solid var(--stroke); flex-shrink: 0;
}
.hp-avatar {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  background: var(--grad-hero); color: #fff; font-size: 17px; box-shadow: var(--shadow-glow); position: relative;
}
.hp-avatar .status-dot {
  position: absolute; bottom: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--ok); border: 2px solid var(--bg-1);
}
.hp-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.hp-sub { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.hp-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.hmsg { display: flex; gap: 10px; max-width: 100%; animation: msgIn .35s var(--ease); }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.hmsg .m-av {
  width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center;
  font-size: 12px; background: var(--grad-hero); color: #fff;
}
.hmsg.user { flex-direction: row-reverse; }
.hmsg.user .m-av { background: var(--surface-3); color: var(--text-2); }
.hmsg .m-bubble {
  padding: 12px 15px; border-radius: 16px; font-size: 13.5px; line-height: 1.65;
  background: var(--surface-2); border: 1px solid var(--stroke); max-width: 82%;
  overflow-wrap: break-word; white-space: pre-wrap;
}
.hmsg.user .m-bubble { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.m-bubble strong { color: var(--accent-2); }
.m-bubble code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }
.m-action-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 7px 13px;
  border-radius: 10px; font-size: 12px; font-weight: 600;
  background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.3); color: var(--ok);
}
.typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; transform: translateY(-3px); } }

.hp-suggestions { display: flex; gap: 8px; padding: 0 18px 10px; flex-wrap: wrap; flex-shrink: 0; }
.hp-sug {
  font-size: 11.5px; font-weight: 600; padding: 7px 12px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--stroke); color: var(--text-2); transition: all var(--t-fast);
}
.hp-sug:hover { color: var(--accent); border-color: var(--accent); }
.hp-input-zone { padding: 12px 16px 16px; border-top: 1px solid var(--stroke); flex-shrink: 0; }
.hp-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-md); padding: 8px;
  transition: all var(--t-fast);
}
.hp-input-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hp-input-row textarea {
  flex: 1; background: none; border: none; outline: none; resize: none;
  font-size: 13.5px; line-height: 1.5; max-height: 110px; padding: 7px 8px; color: var(--text-1);
}
.hp-mic, .hp-send {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 14px;
  transition: all var(--t-fast); flex-shrink: 0;
}
.hp-mic { background: var(--surface-2); color: var(--text-2); }
.hp-mic:hover { color: var(--accent); }
.hp-mic.rec { background: rgba(248,113,113,.15); color: var(--err); animation: pulse 1.4s infinite; }
.hp-send { background: var(--grad-hero); color: #fff; box-shadow: 0 4px 14px var(--accent-glow); }
.hp-engine-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.hp-engine-row .select { padding: 6px 10px; font-size: 11.5px; width: auto; border-radius: 9px; }
.hp-voice-note { font-size: 10.5px; color: var(--text-3); }

/* ═══════════════ CALENDAR ═══════════════ */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); text-align: center; padding: 8px 0; }
.cal-day {
  aspect-ratio: 1/.82; border-radius: var(--r-sm); border: 1px solid var(--stroke); background: var(--surface);
  padding: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); cursor: pointer;
  transition: all var(--t-fast); display: flex; flex-direction: column; gap: 4px; overflow: hidden; text-align: left;
}
.cal-day:hover { border-color: var(--accent); }
.cal-day.other { opacity: .3; }
.cal-day.today { border-color: var(--accent); background: var(--accent-soft); color: var(--text-1); }
.cal-day .cd-ev {
  font-size: 9.5px; font-weight: 600; padding: 2px 6px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ═══════════════ INBOX / MESSAGING ═══════════════ */
.inbox-layout { display: grid; grid-template-columns: 340px 1fr; gap: 0; border: 1px solid var(--stroke); border-radius: var(--r-lg); overflow: hidden; height: calc(100dvh - 240px); min-height: 480px; background: var(--surface); }
.inbox-list { border-right: 1px solid var(--stroke); overflow-y: auto; }
.conv-item {
  display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--stroke);
  cursor: pointer; transition: background var(--t-fast); width: 100%; text-align: left;
}
.conv-item:hover, .conv-item.active { background: var(--surface-2); }
.conv-item .ci-av { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0; position: relative; }
.ci-av.wa { background: #25d366; }
.ci-av.tg { background: #0088cc; }
.ci-av .ch-ico { position: absolute; bottom: -3px; right: -3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; border: 2px solid var(--bg-1); }
.ci-av.wa .ch-ico { background: #25d366; } .ci-av.tg .ch-ico { background: #34aadf; }
.conv-item .ci-body { flex: 1; min-width: 0; }
.conv-item .ci-name { font-size: 13.5px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.conv-item .ci-time { font-size: 10.5px; color: var(--text-3); font-weight: 500; }
.conv-item .ci-prev { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.conv-item .ci-unread { background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; min-width: 19px; height: 19px; border-radius: 99px; display: grid; place-items: center; }
.chat-zone { display: flex; flex-direction: column; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--stroke); }
.chat-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.chat-bubble { max-width: 68%; padding: 10px 14px; border-radius: 15px; font-size: 13px; line-height: 1.55; background: var(--surface-2); border: 1px solid var(--stroke); align-self: flex-start; }
.chat-bubble.mine { align-self: flex-end; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.chat-bubble .cb-time { display: block; font-size: 9.5px; color: var(--text-3); margin-top: 4px; text-align: right; }
.chat-input { display: flex; gap: 10px; padding: 13px 16px; border-top: 1px solid var(--stroke); }
.chat-input input { flex: 1; }

/* ═══════════════ OODA ═══════════════ */
.ooda-ring { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.ooda-stage {
  padding: 20px; border-radius: var(--r-lg); border: 1px solid var(--stroke); background: var(--surface);
  position: relative; overflow: hidden; transition: all var(--t-med);
}
.ooda-stage:hover { transform: translateY(-3px); border-color: var(--stroke-2); }
.ooda-stage::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad-hero); opacity: .8; }
.ooda-stage .os-num { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.ooda-stage .os-name { font-family: var(--font-display); font-weight: 800; font-size: 17px; margin: 6px 0 8px; }
.ooda-stage .os-desc { font-size: 12px; color: var(--text-2); line-height: 1.6; }
.ooda-stage .os-icon { position: absolute; right: 16px; top: 16px; font-size: 22px; opacity: .16; }
@media (max-width: 900px) { .ooda-ring { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .ooda-ring { grid-template-columns: 1fr; } }

/* ═══════════════ ADMIN ═══════════════ */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.admin-nav { position: sticky; top: calc(var(--topbar-h) + 20px); display: flex; flex-direction: column; gap: 3px; }
.admin-nav .an-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 13px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500; color: var(--text-2); transition: all var(--t-fast); text-align: left;
}
.admin-nav .an-item:hover { background: var(--surface-2); color: var(--text-1); }
.admin-nav .an-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.admin-nav .an-item i { width: 18px; text-align: center; font-size: 13px; }
@media (max-width: 860px) { .admin-layout { grid-template-columns: 1fr; } .admin-nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 8px; } .admin-nav .an-item { white-space: nowrap; } }

.theme-swatch {
  border-radius: var(--r-md); border: 2px solid var(--stroke); padding: 14px; cursor: pointer;
  transition: all var(--t-fast); text-align: left; background: var(--surface);
}
.theme-swatch:hover { transform: translateY(-2px); }
.theme-swatch.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-swatch .ts-preview { height: 46px; border-radius: 10px; margin-bottom: 10px; }
.theme-swatch .ts-name { font-size: 12.5px; font-weight: 700; }
.theme-swatch .ts-sub { font-size: 10.5px; color: var(--text-3); }

/* ═══════════════ STUDIO ═══════════════ */
.studio-tool {
  padding: 22px; border-radius: var(--r-lg); border: 1px solid var(--stroke); background: var(--surface);
  transition: all var(--t-med); cursor: pointer; position: relative; overflow: hidden; text-align: left; width: 100%;
}
.studio-tool:hover { transform: translateY(-4px); border-color: var(--stroke-2); box-shadow: var(--shadow-1); }
.studio-tool .st-icon {
  width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-size: 19px;
  margin-bottom: 14px; color: #fff;
}
.studio-tool h3 { font-family: var(--font-display); font-size: 15px; margin-bottom: 6px; }
.studio-tool p { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.studio-tool .st-arrow { position: absolute; top: 20px; right: 20px; color: var(--text-3); transition: all var(--t-fast); }
.studio-tool:hover .st-arrow { color: var(--accent); transform: translate(3px, -3px); }

/* Editor canvas */
.gen-output {
  min-height: 180px; border: 1px dashed var(--stroke-2); border-radius: var(--r-md);
  padding: 18px; font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; background: var(--surface);
}
.gen-output:empty::before { content: 'El resultado aparecerá aquí…'; color: var(--text-3); }

/* ═══════════════ OFFICE / SHEETS ═══════════════ */
.sheet-wrap { overflow: auto; border: 1px solid var(--stroke); border-radius: var(--r-md); max-height: 480px; }
table.sheet { border-collapse: collapse; font-size: 12.5px; min-width: 700px; }
.sheet th { background: var(--surface-2); font-size: 10.5px; font-weight: 700; color: var(--text-3); padding: 7px 10px; border: 1px solid var(--stroke); text-align: center; min-width: 96px; position: sticky; top: 0; }
.sheet td { border: 1px solid var(--stroke); padding: 0; }
.sheet td input { width: 100%; border: none; background: transparent; outline: none; padding: 8px 10px; font-size: 12.5px; }
.sheet td.focus { outline: 2px solid var(--accent); outline-offset: -2px; }

.doc-editor {
  min-height: 460px; background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-lg);
  padding: 40px clamp(22px, 6%, 64px); font-size: 15px; line-height: 1.85; outline: none;
}
.doc-editor:focus { border-color: var(--stroke-2); }
.doc-editor h1, .doc-editor h2 { font-family: var(--font-display); margin: .7em 0 .4em; }

/* Slides */
.slide-canvas {
  aspect-ratio: 16/9; border-radius: var(--r-lg); border: 1px solid var(--stroke-2);
  background: var(--grad-card); padding: clamp(18px, 5%, 52px);
  display: flex; flex-direction: column; justify-content: center; gap: 14px; overflow: hidden;
}
.slide-canvas h2 { font-family: var(--font-display); font-size: clamp(20px, 3.4vw, 36px); font-weight: 800; outline: none; }
.slide-canvas .sc-body { font-size: clamp(13px, 1.6vw, 17px); color: var(--text-2); line-height: 1.7; outline: none; white-space: pre-wrap; }
.slide-thumb {
  aspect-ratio: 16/9; border-radius: 10px; border: 2px solid var(--stroke); background: var(--surface-2);
  font-size: 9px; padding: 8px; cursor: pointer; overflow: hidden; transition: all var(--t-fast); text-align: left; width: 100%;
}
.slide-thumb.active { border-color: var(--accent); }
.slide-thumb b { display: block; font-size: 9.5px; margin-bottom: 3px; }

/* ═══════════════ INVOICE ═══════════════ */
.invoice-paper {
  background: var(--bg-1); border: 1px solid var(--stroke-2); border-radius: var(--r-lg); padding: clamp(20px, 4%, 42px);
}
.invoice-paper .inv-brandline { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.inv-num { font-family: var(--font-mono); color: var(--accent); font-size: 13px; }
.inv-totals { margin-left: auto; max-width: 280px; margin-top: 18px; }
.inv-totals .row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; color: var(--text-2); }
.inv-totals .row.total { border-top: 1px solid var(--stroke-2); font-size: 17px; font-weight: 800; color: var(--text-1); font-family: var(--font-display); }

/* ═══════════════ KANBAN (CRM) ═══════════════ */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.kb-col { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--r-md); padding: 13px; min-height: 200px; }
.kb-col h4 { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px; display: flex; justify-content: space-between; }
.kb-card { background: var(--surface-2); border: 1px solid var(--stroke); border-radius: 12px; padding: 12px; margin-bottom: 9px; cursor: grab; transition: all var(--t-fast); }
.kb-card:hover { border-color: var(--stroke-2); transform: translateY(-2px); }
.kb-card .kc-name { font-size: 13px; font-weight: 600; }
.kb-card .kc-sub { font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* ═══════════════ EMPTY STATES ═══════════════ */
.empty {
  text-align: center; padding: 48px 22px; color: var(--text-3);
  border: 1px dashed var(--stroke-2); border-radius: var(--r-lg);
}
.empty i { font-size: 30px; margin-bottom: 12px; opacity: .5; display: block; }
.empty .e-title { font-weight: 600; color: var(--text-2); font-size: 14px; margin-bottom: 4px; }
.empty .e-sub { font-size: 12.5px; }

/* ═══════════════ COMMAND PALETTE ═══════════════ */
.cmdk { position: fixed; inset: 0; z-index: 400; display: grid; place-items: start center; padding-top: 12vh; background: rgba(3,4,10,.6); animation: fadeIn .2s var(--ease); }
.cmdk-box { width: min(600px, 92vw); background: var(--bg-1); border: 1px solid var(--stroke-2); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); animation: modalIn .3s var(--ease); }
.cmdk-input { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--stroke); }
.cmdk-input input { flex: 1; background: none; border: none; outline: none; font-size: 15px; color: var(--text-1); }
.cmdk-results { max-height: 340px; overflow-y: auto; padding: 8px; }
.cmdk-item { display: flex; align-items: center; gap: 13px; width: 100%; padding: 11px 14px; border-radius: var(--r-sm); font-size: 13.5px; color: var(--text-2); transition: all var(--t-fast); text-align: left; }
.cmdk-item:hover, .cmdk-item.sel { background: var(--accent-soft); color: var(--text-1); }
.cmdk-item i { width: 20px; text-align: center; color: var(--accent); }

/* ═══════════════ MOBILE ═══════════════ */
.mobile-tabbar { display: none; }
@media (max-width: 980px) {
  .sidebar { transform: translateX(-105%); box-shadow: var(--shadow-1); width: min(300px, 84vw); }
  .sidebar.open { transform: none; }
  .sidebar-veil { position: fixed; inset: 0; z-index: 85; background: rgba(0,0,0,.5);  }
  .main { margin-left: 0; }
  .tb-menu { display: grid; }
  .tb-crumb, .tb-search kbd { display: none; }
  .tb-search { max-width: none; }
  .content { padding: 18px 16px 130px; }
  .operatyx-panel { width: 100vw; border-left: none; }
  .inbox-layout { grid-template-columns: 1fr; height: auto; }
  .inbox-list { max-height: 300px; border-right: none; border-bottom: 1px solid var(--stroke); }
  .chat-zone { min-height: 420px; }
  .operatyx-fab { bottom: 86px; right: 16px; }
  #toasts { bottom: 152px; right: 16px; }

  .mobile-tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
    background: color-mix(in srgb, var(--bg-1) 88%, transparent);
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--stroke); padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  }
  .mtab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; font-size: 10px; font-weight: 600; color: var(--text-3); border-radius: 12px; transition: all var(--t-fast); }
  .mtab i { font-size: 17px; }
  .mtab.active { color: var(--accent); }
  .mtab.operatyx-mtab { color: #fff; }
  .mtab.operatyx-mtab i { background: var(--grad-hero); width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; margin-top: -18px; box-shadow: var(--shadow-glow); font-size: 16px; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Utility */
.muted { color: var(--text-3); } .small { font-size: 12px; }
.flex { display: flex; } .aic { align-items: center; } .jcb { justify-content: space-between; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; } .mb16 { margin-bottom: 16px; }
.w100 { width: 100%; }
.grad-text { color: var(--accent); }
.mono { font-family: var(--font-mono); }
canvas { max-width: 100%; }

/* ── METAS & OKRs ── */
.goal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.goal-title { font-size: 17px; margin-top: 6px; }
.goal-meta { display: flex; align-items: center; gap: 8px; }
.goal-pct { font-size: 20px; font-weight: 700; color: var(--accent); }
.progress-track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 14px; }
.progress-fill { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s var(--ease); }
.kr-list { display: flex; flex-direction: column; gap: 10px; }
.kr-row { display: grid; grid-template-columns: 1fr 120px 70px 32px; align-items: center; gap: 12px; }
.kr-text { font-size: 13px; color: var(--text-2); }
.kr-track { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.kr-track span { display: block; height: 100%; background: var(--accent-2); border-radius: 99px; }
.kr-nums { font-size: 11px; color: var(--text-3); text-align: right; }
@media (max-width: 700px) { .kr-row { grid-template-columns: 1fr 60px 32px; } .kr-track { display: none; } }

/* ── NOTAS ── */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.note-card { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius, 14px); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.note-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.note-actions { display: flex; gap: 2px; }
.note-body { font-size: 13px; color: var(--text-2); line-height: 1.55; white-space: pre-wrap; flex: 1; }
.note-foot { font-size: 10px; color: var(--text-3); }
.note-colors { display: flex; gap: 8px; }
.nc-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; }
.nc-dot.active { border-color: var(--text-1); }

/* ── NOTIFICACIONES ── */
.notif-row { cursor: pointer; }
.notif-row.is-read { opacity: .55; }
