/* BotForce Lite · hoja única (sitio, cuentas, panel y superadmin). Móvil primero. Sin fuentes ni recursos externos.
   --brand y --on-brand los fija el <style nonce> de cada layout (BRAND_COLOR del .env, validado en servidor). */

:root {
  --brand: #0F766E;
  --on-brand: #FFFFFF;
  --paper: #F6F8F7;
  --tint: #EAF2F0;
  --card: #FFFFFF;
  --ink: #0B1F1C;
  --text-2: #3D504C;
  --muted: #5B6B68;
  --line: #D9E3E0;
  --link: color-mix(in srgb, var(--brand) 80%, #000);
  --focus: #0E7490;
  --danger: #B42318;
  --radius: 18px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(11, 31, 28, .06), 0 14px 34px -14px rgba(11, 31, 28, .22);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: 16px;
}
@media (min-width: 768px) { :root { --gutter: 32px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow-wrap: anywhere; }
img, svg { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.15; text-wrap: balance; letter-spacing: -.02em; }
p { margin: 0 0 1em; text-wrap: pretty; }
a { color: var(--link); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code, pre { font-family: var(--font-mono); font-size: .875rem; }
small { color: var(--muted); }

.container { width: 100%; max-width: 1440px; margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: 860px; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; }
.skip-link:focus { top: 8px; }

/* ---------- Botones (44 px de alto mínimo) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 44px; padding: 10px 20px; border: 1.5px solid transparent; border-radius: 999px; font: 600 1rem/1.2 var(--font); text-decoration: none; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 8px 22px -10px var(--brand); }
.btn--ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn--light { background: #fff; color: var(--ink); }
.btn--danger { background: var(--card); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, #fff); }
.btn--small { min-height: 36px; padding: 6px 14px; font-size: .9375rem; }
.btn--big { padding: 14px 26px; font-size: 1.0625rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: wait; transform: none; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 750; font-size: 1.125rem; letter-spacing: -.02em; }
.brand img { border-radius: 8px; }

/* ---------- Sitio público ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header__bar { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 12px; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav__link { display: none; align-items: center; min-height: 44px; padding: 0 12px; color: var(--text-2); text-decoration: none; border-radius: 999px; font-weight: 550; }
.site-nav__link:hover { background: var(--tint); color: var(--ink); }
.site-nav__link--login { display: inline-flex; }
@media (min-width: 900px) { .site-nav__link { display: inline-flex; } }
@media (max-width: 420px) { .site-header .brand span { font-size: 1rem; } .site-header .btn--small { padding: 6px 12px; } }

.hero { position: relative; overflow: hidden; padding: 48px 0 56px; background:
  radial-gradient(60% 70% at 85% 10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
  radial-gradient(50% 60% at 0% 100%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 70%); }
.hero__grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 1024px) { .hero { padding: 88px 0 96px; } .hero__grid { grid-template-columns: 1.15fr .85fr; gap: 64px; } }
.eyebrow, .kicker { margin: 0 0 14px; font-size: .8125rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--link); }
.hero h1 { font-size: clamp(2.2rem, 1.3rem + 4.2vw, 4.4rem); line-height: 1.02; letter-spacing: -.04em; }
.hero h1 em { font-style: normal; color: var(--link); }
.hero__lead { max-width: 36em; font-size: clamp(1.0625rem, 1rem + .35vw, 1.25rem); color: var(--text-2); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero__note { margin-top: 16px; font-size: .9375rem; color: var(--muted); }

.chatmock { width: min(400px, 100%); margin-inline: auto; border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.chatmock__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--brand); color: var(--on-brand); }
.chatmock__head small { display: block; color: inherit; opacity: .8; font-size: .75rem; }
.chatmock__dot { width: 34px; height: 34px; flex: none; border-radius: 50%; background: color-mix(in srgb, var(--on-brand) 25%, transparent); }
.chatmock__body { display: flex; flex-direction: column; gap: 10px; padding: 16px; min-height: 280px; background: var(--paper); }
.chatmock__foot { display: flex; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9375rem; }
.chatmock__foot b { color: var(--link); }
.msg { max-width: 85%; margin: 0; padding: 9px 13px; border-radius: 16px; font-size: .9375rem; line-height: 1.45; white-space: pre-wrap; }
.msg--user { align-self: flex-end; background: var(--brand); color: var(--on-brand); border-bottom-right-radius: 4px; }
.msg--bot, .msg--agent { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg--agent { border-color: color-mix(in srgb, var(--brand) 45%, #fff); }
.msg__meta { display: block; margin-top: 4px; font-size: .75rem; opacity: .7; }

.section { padding: 64px 0; }
.section--tint { background: var(--tint); }
.section__title { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.75rem); max-width: 22em; }
.section__lead { max-width: 44em; color: var(--text-2); font-size: 1.0625rem; }
.section__note { margin-top: 20px; color: var(--muted); font-size: .9375rem; }

.steps { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 16px; }
@media (min-width: 900px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 24px; } }
.steps li { padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.steps__n { display: inline-grid; place-items: center; width: 40px; height: 40px; margin-bottom: 14px; border-radius: 12px; background: var(--brand); color: var(--on-brand); font-weight: 800; }
.steps h3, .bento h3 { font-size: 1.25rem; }
.steps p, .bento p { margin: 0; color: var(--text-2); }

.bento { display: grid; gap: 16px; margin-top: 32px; }
@media (min-width: 900px) { .bento { grid-template-columns: repeat(3, 1fr); } .bento__item--wide { grid-column: span 2; } }
.bento__item { padding: 26px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.bento__item--wide { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 10%, var(--card)), var(--card)); }

.plans { display: grid; gap: 16px; margin-top: 32px; }
@media (min-width: 900px) { .plans { grid-template-columns: repeat(3, 1fr); gap: 24px; } }
.plan { display: flex; flex-direction: column; padding: 28px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.plan--featured { border: 2px solid var(--brand); box-shadow: var(--shadow); }
.plan__name { font-size: 1.25rem; margin-bottom: 4px; }
.plan__price { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; }
.plan .btn { margin-top: auto; }
.ticks { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 8px; }
.ticks li { position: relative; padding-left: 26px; color: var(--text-2); }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--link); font-weight: 800; }

.faq { display: grid; gap: 10px; margin-top: 24px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0 18px; }
.faq summary { cursor: pointer; padding: 16px 0; font-weight: 650; min-height: 44px; }
.faq details p { color: var(--text-2); }

.cta { padding: 64px 0; background: var(--brand); color: var(--on-brand); text-align: center; }
.cta h2 { font-size: clamp(1.6rem, 1.1rem + 2vw, 2.5rem); max-width: 22em; margin: 0 auto 24px; }

.page-head { padding: 48px 0 24px; }
.page-head h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); }
.prose { max-width: 860px; padding-bottom: 64px; }
.prose h2 { margin-top: 1.8em; font-size: 1.375rem; }
.prose li { margin-bottom: .35em; }
.draft-note { padding: 14px 16px; border-radius: var(--radius-s); background: #FFF7E0; border: 1px solid #F2D27A; color: #5C4300; }
mark.pendiente { background: #FFE7A3; color: #5C4300; padding: 0 4px; border-radius: 4px; }

.site-footer { padding: 48px 0 20px; background: var(--ink); color: #D7E2DF; }
.site-footer a { color: #fff; }
.footer-grid { display: grid; gap: 28px; padding-bottom: 28px; }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h2 { font-size: .8125rem; letter-spacing: .1em; text-transform: uppercase; color: #9FB3AE; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-brand .brand { color: #fff; margin-bottom: 10px; }
.site-credit { margin: 0; padding: 16px var(--gutter) 0; text-align: center; font-size: .875rem; color: var(--muted); border-top: 1px solid rgba(255, 255, 255, .1); }
.site-footer .site-credit { color: #9FB3AE; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
th, td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th { background: var(--tint); font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tbody tr:last-child > * { border-bottom: 0; }

/* ---------- Formularios ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; }
.field input:not([type=checkbox]):not([type=radio]):not([type=color]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-s); background: var(--card); color: var(--ink); font: inherit; }
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.field input[type=color] { width: 64px; height: 44px; padding: 2px; border: 1.5px solid var(--line); border-radius: var(--radius-s); background: var(--card); }
.field--check label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.field--check input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--brand); }
.field__hint { margin: 6px 0 0; font-size: .875rem; color: var(--muted); }
.field__hint--error { color: var(--danger); font-weight: 600; }
[aria-invalid=true] { border-color: var(--danger) !important; }
.form-row { display: grid; gap: 0 16px; }
@media (min-width: 700px) { .form-row { grid-template-columns: 1fr 1fr; } }
.form-narrow { max-width: 560px; }
.flash { padding: 12px 16px; border-radius: var(--radius-s); background: color-mix(in srgb, var(--brand) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); }
.flash--error { background: #FDECEA; border-color: #F5B5AE; color: #7A1A12; }
.notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; padding: 12px 16px; border-radius: var(--radius-s); background: #FFF7E0; border: 1px solid #F2D27A; color: #5C4300; }
.notice p { margin: 0; }

/* ---------- Cuentas (layout mínimo) ---------- */
.layout-minimal { display: flex; flex-direction: column; min-height: 100vh; background: radial-gradient(70% 50% at 50% 0%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 70%), var(--paper); }
.minimal { flex: 1; width: 100%; max-width: 480px; margin: 0 auto; padding: 32px var(--gutter); }
.minimal__brand { margin: 0 auto 20px; display: flex; justify-content: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
@media (min-width: 560px) { .card { padding: 32px; } }
.minimal__card h1 { font-size: 1.625rem; }
.lead { color: var(--text-2); }
.minimal__alt { margin: 18px 0 0; text-align: center; }
.minimal__footer { padding: 16px 0 24px; }
.minimal__footer .site-credit { border: 0; }

/* ---------- Panel y superadmin ---------- */
.panel-header { background: var(--card); border-bottom: 1px solid var(--line); }
.panel-header__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.panel-header .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52vw; }
.panel-logout { margin: 0; }
.panel-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
.panel-nav::-webkit-scrollbar { display: none; }
.panel-nav__link { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; color: var(--text-2); text-decoration: none; font-weight: 600; }
.panel-nav__link:hover { background: var(--tint); }
.panel-nav__link[aria-current=page] { background: var(--brand); color: var(--on-brand); }
.panel-main { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }
.panel-main h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); }
.panel-main h2 { font-size: 1.25rem; margin-top: 1.6em; }
.panel-footer { padding: 16px 0 24px; }
.panel-footer .site-credit { border: 0; }
.page-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-title h1 { margin: 0; }
.muted { color: var(--muted); }
.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.box > :last-child { margin-bottom: 0; }
.box h2:first-child { margin-top: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }
.snippet { display: block; padding: 14px; border-radius: var(--radius-s); background: var(--ink); color: #D7F5EE; white-space: pre-wrap; word-break: break-all; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8125rem; font-weight: 700; background: var(--tint); color: var(--text-2); }
.badge--alert { background: #FDECEA; color: #7A1A12; }
.badge--human { background: #FFF1D6; color: #6B4600; }
.badge--wa { background: #DCF8E8; color: #0B5A33; }
.transcript { white-space: pre-wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 16px; font-family: var(--font); font-size: .9375rem; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 12px; align-items: baseline; }
.checklist .done { color: var(--link); font-weight: 800; }

/* Bandeja */
.inbox { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.inbox li + li { border-top: 1px solid var(--line); }
.inbox a { display: grid; gap: 4px; padding: 14px 16px; color: inherit; text-decoration: none; }
.inbox a:hover { background: var(--tint); }
.inbox__top { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.inbox__who { font-weight: 700; }
.inbox__when { margin-left: auto; font-size: .8125rem; color: var(--muted); }
.inbox__last { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread { display: flex; flex-direction: column; gap: 10px; padding: 16px; min-height: 240px; max-height: 60vh; overflow-y: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.thread .msg { max-width: min(85%, 640px); }
.thread .msg--user { align-self: flex-start; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; }
.thread .msg--bot, .thread .msg--agent { align-self: flex-end; background: color-mix(in srgb, var(--brand) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); border-radius: 16px 16px 4px 16px; }
.thread .msg--agent { background: var(--brand); color: var(--on-brand); }
.reply { display: grid; gap: 10px; }
.reply textarea { min-height: 90px; }

/* Agente de ayuda */
.help-thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.help-thread .msg--user { align-self: flex-end; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
