:root {
  --ground: #F4F2EC;
  --surface: #FFFFFF;
  --ink: #15171C;
  --text-2: #3A3D45;
  --muted: #5B5F68;
  --line: #E2DFD6;
  --line-soft: #EDEAE2;
  --border: #DAD6CB;
  --dashed: #C9C4B8;
  --side: #111318;
  --side-2: #23262E;
  --side-text: #C9CCD3;
  --side-muted: #8A8F99;
  --voice: #0F6E68;
  --agents: #3B4BC8;
  --danger: #A12C2C;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); background: var(--ground); color: var(--ink); font-size: 15px; line-height: 1.5; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font-family: inherit; }
[hidden] { display: none !important; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.5px; }
.mono { font-family: var(--mono); letter-spacing: 1px; }
.muted { color: var(--muted); }
.muted-dark { color: var(--side-muted); }
.small { font-size: 13px; }
.push { margin-left: auto; }

/* Logo */
.logo { display: flex; align-items: baseline; gap: 8px; }
.logo-word { font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--ground); }
.logo-ai { font-family: var(--mono); font-size: 12px; letter-spacing: 3px; color: var(--side-muted); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dot-outline { border: 1.5px solid var(--side-muted); background: transparent; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-lg { min-height: 48px; font-size: 15px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-primary { color: #fff; background: var(--ink); }
.btn-dark { color: #fff; background: var(--ink); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--ink); font-weight: 500; }
.btn:focus-visible, .input:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--agents); outline-offset: 2px; }

.input { height: 48px; width: 100%; padding: 0 14px; border-radius: 10px; border: 1px solid var(--dashed); background: var(--surface); font: inherit; color: var(--ink); }
.field-label { font-size: 14px; font-weight: 500; }

/* ---------- Login ---------- */
body.login { display: flex; min-height: 100vh; }
.login-brand { width: 43%; max-width: 620px; padding: 56px 64px; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; justify-content: space-between; }
.login-brand .logo-word { font-size: 40px; }
.login-pitch { display: flex; flex-direction: column; gap: 28px; }
.login-pitch h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 5vw, 64px); line-height: 1.02; color: var(--ground); }
.login-products { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.login-products li { display: flex; align-items: center; gap: 12px; }
.login-products strong { color: #fff; font-weight: 500; }
.login-products span:last-child { color: var(--side-muted); }
.login-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.login-form { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; }
.login-form h2 { font-size: 44px; line-height: 1.05; margin-bottom: 8px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-msg { min-height: 20px; font-size: 14px; color: var(--voice); }
.login-msg.is-error { color: var(--danger); }

/* ---------- App ---------- */
body.app { display: flex; min-height: 100vh; }
.sidebar { width: 264px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 28px 16px 20px; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; gap: 28px; }
.sidebar .logo { padding: 0 12px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 0 12px 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; color: var(--side-muted); }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--side-text); text-decoration: none; font-size: 14px; font-weight: 500; }
a.nav-item:hover { background: #1A1D23; }
.nav-item.is-active { background: var(--side-2); color: #fff; }
.nav-item.is-dim { color: var(--side-muted); min-height: 40px; font-weight: 400; }
.nav-badge { margin-left: auto; padding: 2px 6px; border-radius: 4px; background: var(--side-2); color: #AEB6FF; font-family: var(--mono); font-size: 10px; letter-spacing: 1px; }
.nav-item.is-active .nav-badge { background: #2F3340; }
.spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 12px; padding: 16px 12px 0; margin-top: 10px; border-top: 1px solid var(--side-2); }
.avatar { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; background: var(--ground); color: var(--side); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; background: var(--side); color: var(--ground); font-family: var(--serif); font-size: 28px; font-weight: 400; }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { color: #fff; font-size: 14px; font-weight: 500; }
.user-mail { color: var(--side-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.view { flex: 1; min-width: 0; padding: 48px 56px; display: flex; flex-direction: column; gap: 36px; outline: none; }
.view-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.view-header > div { display: flex; flex-direction: column; gap: 10px; }
.view-header h1 { font-size: 52px; line-height: 1; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 1.5px; color: var(--muted); }
.section-title { font-size: 15px; font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.card-dashed { background: transparent; border: 1px dashed var(--dashed); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.upcoming-head { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.upcoming-head strong { color: var(--ink); font-size: 16px; }

.product-card { display: flex; flex-direction: column; gap: 20px; }
.product-head { display: flex; align-items: center; gap: 14px; }
.product-icon { width: 48px; height: 48px; border-radius: 12px; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.product-title { flex: 1; display: flex; flex-direction: column; }
.product-title h3 { font-size: 20px; font-weight: 600; }
.product-desc { color: var(--text-2); }
.product-meta { padding: 16px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.product-meta > div { display: flex; flex-direction: column; gap: 4px; }
.meta-label { font-size: 12px; color: var(--muted); }
.meta-value { font-weight: 500; }

.pill { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-active { background: #E3F2F0; color: #0B524D; }
.pill-beta { background: #E8EAFB; color: #2A3799; }
.pill-draft { background: #EDEAE2; color: var(--text-2); }
.pill-paused { background: #FBEBDD; color: #8A4B12; }

.empty { display: flex; align-items: center; gap: 20px; padding: 24px 28px; }
.empty-icon { width: 48px; height: 48px; flex-shrink: 0; border-radius: 12px; background: #E8EAFB; color: var(--agents); display: flex; align-items: center; justify-content: center; }
.template { display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.template h3 { font-size: 18px; font-weight: 600; }
.template p { flex: 1; color: var(--text-2); }
.template .btn { align-self: flex-start; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.inline-form { display: flex; flex-direction: column; gap: 8px; padding: 20px; }
.inline-form .input { height: 44px; }

.list { padding: 8px 28px; }
.agent-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 110px auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.agent-row:last-child { border-bottom: 0; }
.agent-name { display: flex; flex-direction: column; }

.account-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 24px; align-items: start; }
.profile { display: flex; align-items: center; gap: 14px; }
.note { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 10px; background: var(--ground); font-size: 14px; color: var(--text-2); }
.sub-row { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.sub-head { padding: 6px 0; }
.sub-product { display: flex; align-items: center; gap: 12px; }
.alert { padding: 14px 16px; border-radius: 10px; background: #FBE9E9; color: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  body.login { flex-direction: column; }
  .login-brand { width: 100%; max-width: none; padding: 32px 16px; gap: 28px; }
  body.app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 16px; gap: 16px; }
  .sidebar .spacer, .nav-label { display: none; }
  .nav-group { flex-direction: row; flex-wrap: wrap; }
  .user-chip { display: none; }
  .view { padding: 28px 16px; gap: 28px; }
  .view-header { flex-direction: column; align-items: flex-start; }
  .view-header h1 { font-size: 40px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .agent-row { grid-template-columns: 1fr auto; }
  .sub-row { grid-template-columns: 1fr 1fr; }
  .sub-head { display: none; }
}
