/* Identidad BotXit (docs/brand/botxit): azul oscuro para textos y fondos, verde para acciones,
   azul para acentos, celeste y gris para superficies. El verde no sirve como texto sobre blanco:
   para eso está --accent-text. Ámbar y rojo de los estados no están en el manual (a validar). */
:root {
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --ink: #0A2342;
  --muted: #52627A;
  --line: #DCE3EE;
  --accent: #00E676;
  --accent-ink: #0A2342;
  --accent-soft: #DDFBE9;
  --accent-text: #0B5E33;
  --link: #2E6BFF;
  --info-soft: #E3F2FF;
  --warn: #7A4A00;
  --warn-soft: #FFF1D6;
  --danger: #9B2C1F;
  --danger-soft: #FDECEA;
  --customer: #FFFFFF;
  --side-bg: #0A2342;
  --side-ink: #C9D6EA;
  --side-muted: #9FB1CC;
  --font: "Poppins", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1626;
    --surface: #12233A;
    --ink: #E6EDF7;
    --muted: #9FB1CC;
    --line: #24395A;
    --accent-soft: #0F3B2B;
    --accent-text: #5CF0A4;
    --link: #7FA6FF;
    --info-soft: #17325A;
    --warn: #F2B65C;
    --warn-soft: #3A2C1A;
    --danger: #F08A7A;
    --danger-soft: #3B221E;
    --customer: #18304D;
    --side-bg: #071629;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: inherit; }
h1, h2 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.75rem; }
p { margin: 0 0 0.5rem; }
code { font-size: 0.9em; background: var(--accent-soft); padding: 0 4px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.right { text-align: right; }
.actions { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.ok-text { color: var(--accent-text); font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* layout: barra lateral de BotXit (la plataforma); cada sitio lleva su identidad arriba del contenido */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-ink); padding: 1.6rem 0.9rem; display: flex; flex-direction: column; gap: 1.6rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: block; padding: 0 0.5rem; }
.brand img { display: block; height: 34px; width: auto; }
.side a:not(.brand) { display: flex; align-items: center; gap: 0.6rem; min-height: 40px; padding: 0 0.75rem; border-radius: 10px; text-decoration: none; color: var(--side-ink); }
.side a:not(.brand):hover { color: #FFFFFF; background: rgba(255, 255, 255, 0.05); }
.side a.on { background: rgba(255, 255, 255, 0.10); color: #FFFFFF; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.side-nav { display: grid; gap: 2px; }
.side-group { display: grid; gap: 2px; }
.side-title { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--side-muted); padding: 0 0.75rem; margin-bottom: 0.35rem; }
.side .muted { color: var(--side-muted); }
.side-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { width: 26px; height: 26px; border-radius: 7px; background: #FFFFFF; color: #0A2342; display: grid; place-items: center; font-size: 0.68rem; font-weight: 700; flex: none; }
.mono.lg { width: 56px; height: 56px; border-radius: 14px; font-size: 1.1rem; background: var(--info-soft); color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3A5272; flex: none; }
.dot.live { background: var(--accent); }
.side-foot { margin-top: auto; display: grid; gap: 0.25rem; padding: 0 0.75rem; }
.side-foot button.link { color: #FFFFFF; }
.main { padding: 2rem clamp(1rem, 3vw, 2.5rem) 3rem; max-width: 1760px; width: 100%; }
/* con la página más ancha, los textos largos no pasan de un ancho cómodo de leer */
.main > p, .panel > p, .callout p { max-width: 90ch; }
.page-title { margin-bottom: 1.25rem; }

.t-head { display: flex; flex-direction: column; gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem 1.5rem 0; margin-bottom: 1.5rem; }
.t-id { display: flex; align-items: center; gap: 1rem; }
.t-id p { margin: 0.2rem 0 0; }
/* las pestañas bajan a otra fila si no entran, en vez de desplazarse */
.tabs { display: flex; flex-wrap: wrap; column-gap: clamp(0.9rem, 1.6vw, 1.5rem); font-size: 0.93rem; }
.tabs a { text-decoration: none; color: var(--muted); padding: 0.6rem 0 0.75rem; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-color: var(--accent); font-weight: 600; }
/* sub-menús de una pestaña (Configuración): botones redondeados; en el celular se deslizan de costado */
.subtabs { display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none; padding: 0.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a { flex: none; text-decoration: none; color: var(--muted); font-size: 0.9rem; padding: 0.45rem 0.9rem; border-radius: 9px; white-space: nowrap; }
.subtabs a:hover { color: var(--ink); background: var(--bg); }
.subtabs a.on { color: var(--accent-text); background: var(--accent-soft); font-weight: 600; }
.cfg:not(.js) .subtabs { display: none; }  /* sin JavaScript se ven todos los grupos, uno abajo del otro */
.cfg-group[hidden] { display: none; }
.cfg-group > .row-between { margin-bottom: 0; }

/* forms */
label { display: grid; gap: 0.3rem; font-size: 0.9rem; font-weight: 500; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #C7D2E3; border-radius: 10px; padding: 0.6rem 0.8rem; width: 100%; }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
input[type=file] { padding: 0.4rem; }
label.check { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-weight: 400; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.82rem; }
.stack { display: grid; gap: 1rem; }
.stack-tight { display: grid; gap: 0.4rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.two-col { display: grid; grid-template-columns: 3fr 2fr; gap: 1rem; margin-bottom: 1.5rem; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 1rem; align-items: end; margin-bottom: 1.5rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem; }
.panel + .panel { margin-top: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 600; font-size: 0.9rem; min-height: 40px; padding: 0.5rem 1rem; border-radius: 10px; border: 1px solid #C7D2E3; background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(0.95); }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; }
button.link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 0.85rem; text-align: left; cursor: pointer; text-decoration: underline; }

.flash { padding: 0.8rem 1rem; border-radius: 12px; margin-bottom: 1rem; background: var(--accent-soft); color: var(--accent-text); }
.flash.error { background: var(--danger-soft); color: var(--danger); }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid th { font-size: 0.78rem; font-weight: 600; color: var(--muted); background: var(--bg); }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid td a { text-decoration: none; }
.badge { display: inline-block; min-width: 1.8rem; text-align: center; padding: 0.1rem 0.5rem; border-radius: 999px; font-weight: 700; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

.empty { padding: 2rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; list-style: none; }
.empty .btn { margin-top: 0.5rem; }

/* knowledge */
.kb-notes { margin-bottom: 1rem; }
.search { margin-bottom: 0.75rem; max-width: 420px; }
.kb-list { display: grid; gap: 0.5rem; }
.kb-item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.kb-item.off { opacity: 0.65; }
.kb-item summary { cursor: pointer; padding: 0.75rem 1rem; display: flex; gap: 0.75rem; align-items: baseline; list-style: none; }
.kb-item summary::-webkit-details-marker { display: none; }
.kb-item[open] summary { border-bottom: 1px solid var(--line); }
.kb-item form { padding: 1rem; }
.kb-cat { font-size: 0.8rem; color: var(--link); font-weight: 600; flex: none; min-width: 6rem; }
.kb-q { font-weight: 500; }

/* resources */
.res-head { margin-bottom: 1rem; }
.res-head .row-between { margin-bottom: 0; }
.res-list { margin-top: 1rem; }
.res-list .kb-cat { min-width: 9.5rem; }
.kb-item summary .res-meta { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-item summary .tag { margin-left: 0; flex: none; }
.res-file { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; }
.res-file label { flex: 1 1 260px; }
.res-link { display: grid; gap: 0.3rem; }
.res-link .row { align-items: center; }
.res-link code { flex: 1 1 260px; min-width: 0; padding: 0.55rem 0.8rem; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; font-size: 0.85rem; word-break: break-all; }
details.more summary { cursor: pointer; font-size: 0.9rem; font-weight: 500; color: var(--link); }
details.more[open] summary { margin-bottom: 0.5rem; }
@media (max-width: 720px) { .res-list summary { flex-wrap: wrap; row-gap: 0.25rem; } .res-list .kb-cat, .res-list .kb-q, .res-list summary .res-meta { flex-basis: 100%; min-width: 0; } .res-list summary .res-meta { order: 3; } }

/* conversations */
.filters { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters a { display: inline-flex; align-items: center; min-height: 36px; text-decoration: none; padding: 0 0.9rem; border-radius: 999px; background: var(--info-soft); color: var(--ink); font-size: 0.9rem; }
.filters a.on { background: var(--ink); color: var(--surface); font-weight: 600; }
.inbox { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.inbox li + li { border-top: 1px solid var(--line); }
.inbox .empty { border: 0; }
.inbox + .panel { margin-top: 1.5rem; }
.inbox-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.15rem 1rem; padding: 0.9rem 1.1rem; text-decoration: none; }
.inbox-row:hover { background: var(--bg); }
.inbox-row .who { font-weight: 600; }
.inbox-row .preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-row .state { text-align: right; color: var(--muted); }
.inbox-row.human .state { justify-self: end; padding: 0.1rem 0.6rem; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }

.conv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.conv-head h2 { margin-bottom: 0.2rem; }

/* the transcript: who said what must be readable at a glance */
.thread { display: flex; flex-direction: column; gap: 0.6rem; padding: 1.25rem; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; max-height: max(320px, calc(100vh - 380px)); overflow-y: auto; margin-bottom: 1rem; }
.bubble { max-width: min(720px, 85%); padding: 0.6rem 0.85rem 0.45rem; border-radius: 12px; }
.bubble p { margin: 0 0 0.2rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .meta { font-size: 0.75rem; color: var(--muted); }
.bubble-media { display: inline-block; max-width: 100%; margin: 0.1rem 0 0.4rem; line-height: 0; border-radius: 8px; overflow: hidden; }
.bubble-media img { display: block; width: auto; height: auto; max-width: min(100%, 360px); max-height: 270px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; }
.bubble-media:hover img, .bubble-media:focus-visible img { opacity: 0.9; }
.bubble-media.sticker img { max-width: 140px; max-height: 140px; border: 0; }
.bubble-file { display: inline-flex; align-items: center; gap: 0.45rem; max-width: 100%; margin: 0.1rem 0 0.4rem; padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: 0.9rem; font-weight: 600; }
.bubble-file span { overflow-wrap: anywhere; }
.bubble-file svg { flex: none; color: var(--muted); }
.bubble-file:hover, .bubble-file:focus-visible { border-color: var(--muted); }
.bubble p strong { font-weight: 700; }
.bubble p code { font-size: 0.85em; padding: 0.05rem 0.3rem; border-radius: 4px; background: var(--bg); }
.bubble p a { overflow-wrap: anywhere; }
.bubble .meta + .meta { display: block; margin-top: 0.15rem; }
.bubble .trash-form { display: flex; justify-content: flex-end; margin-top: 0.25rem; }
.bubble .trash { background: none; border: 0; padding: 0.2rem; color: var(--muted); cursor: pointer; border-radius: 6px; line-height: 0; }
.bubble .trash:hover, .bubble .trash:focus-visible { color: var(--danger); background: var(--danger-soft); }
.bubble.customer { align-self: flex-start; background: var(--customer); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.bubble.bot { align-self: flex-end; background: var(--info-soft); border-bottom-right-radius: 3px; }
.bubble.agent { align-self: flex-end; background: var(--warn-soft); border-bottom-right-radius: 3px; }
.note { align-self: center; font-size: 0.8rem; color: var(--muted); text-align: center; margin: 0.25rem 0; }

.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.75rem; align-items: start; }
.composer-attach { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-top: -0.25rem; }
.composer-attach .attach-btn { gap: 0.4rem; min-height: 36px; padding: 0.35rem 0.8rem; font-weight: 600; }
.composer-attach select { width: auto; min-width: 0; max-width: min(100%, 22rem); min-height: 36px; padding: 0.35rem 0.6rem; font-size: 0.9rem; }
.attach-chosen { display: inline-flex; align-items: center; gap: 0.3rem; max-width: 100%; padding: 0.2rem 0.3rem 0.2rem 0.65rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 0.85rem; font-weight: 600; }
.attach-chosen[hidden], .attach-hint[hidden] { display: none; }
.attach-name { overflow-wrap: anywhere; }
.attach-clear { border: 0; background: none; color: inherit; font-size: 1.1rem; line-height: 1; padding: 0.1rem 0.35rem; border-radius: 999px; cursor: pointer; }
.attach-clear:hover, .attach-clear:focus-visible { background: rgba(0, 0, 0, 0.08); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.report-card { display: block; text-decoration: none; color: inherit; }
.report-card:hover { border-color: var(--link); }
.report-card h2 { margin: 0; }
.filters select { width: auto; }

.qr-box { display: grid; justify-items: start; gap: 0.5rem; }
.qr-box img { width: 280px; height: 280px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 8px; image-rendering: pixelated; }

/* página pública de prueba */
.demo { width: min(760px, 100%); margin: 0 auto; padding: 2rem 1rem; }
.demo-head { margin-bottom: 1rem; }
.demo-head h1 { margin: 0 0 0.25rem; }
.login-box { width: min(400px, 100%); display: grid; gap: 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 2.25rem 2rem; }
.login-box .btn { min-height: 48px; font-size: 0.95rem; }

/* acceso a la plataforma: marca BotXit a la izquierda, formulario a la derecha */
.signin { min-height: 100vh; display: flex; flex-wrap: wrap; }
.signin > * { flex: 1 1 440px; }
.signin .login { min-height: auto; padding: 3rem 1rem; }
.signin-brand { background: var(--side-bg); color: #FFFFFF; padding: 3rem clamp(1.5rem, 5vw, 4.5rem); display: flex; flex-direction: column; justify-content: space-between; gap: 3rem; }
.signin-logo { height: 44px; width: auto; align-self: flex-start; }
.signin-pitch { display: grid; gap: 1.25rem; max-width: 460px; }
.signin-claim { margin: 0; font-size: clamp(1.9rem, 3.4vw, 2.75rem); line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
.signin-claim span { color: var(--accent); }
.signin-sub { margin: 0; color: var(--side-ink); line-height: 1.6; }
.signin-bar { height: 6px; width: 120px; border-radius: 999px; background: var(--accent); }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side-nav, .side-group { flex: 1 1 100%; }
  .side a:not(.brand) { min-height: 36px; }
  .signin-brand { gap: 1.5rem; padding: 1.5rem 1rem; }
  .signin-pitch img, .signin-sub, .signin-bar { display: none; }
  .side { position: static; height: auto; border-right: 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.75rem 1rem; }
  .side-nav, .side-group { display: flex; flex-wrap: wrap; gap: 0.25rem; }
  .side-title { display: none; }
  .side-foot { margin: 0 0 0 auto; padding: 0; }
  .two, .three, .two-col, .inline-form { grid-template-columns: 1fr; }
  .composer { grid-template-columns: minmax(0, 1fr); }
  .composer-attach { margin-top: 0; }
  .composer > .btn.primary { order: 1; }  /* en el celular, «Enviar» va después de los adjuntos */
  .composer-attach select { flex: 1 1 100%; max-width: 100%; }
  .tabs a { padding: 0.45rem 0 0.5rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* numbers */
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.row-between p { margin: 0; max-width: 60ch; }
.number-row { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 1rem; padding: 0.85rem 1rem; text-decoration: none; }
.number-row:hover { background: var(--bg); }
.number-row .detail { grid-column: 1 / -1; }
.number-row .pill, .number-row .right { justify-self: end; }
.danger-text { color: var(--danger); font-weight: 600; }
.btn:disabled { opacity: 0.55; cursor: progress; }
.pill { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 0.1rem 0.6rem; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; }
.pill.connected { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.pill.error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill.pending { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.method-choice { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.method-choice legend { font-weight: 600; margin-bottom: 0.5rem; }
.choice { display: flex; gap: 0.75rem; align-items: flex-start; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400; }
.choice:has(input:checked) { border-color: var(--link); box-shadow: inset 0 0 0 1px var(--link); }
.choice input { margin-top: 0.2rem; flex: none; }
.callout { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 0.8rem 1rem; }
.callout p:last-child { margin-bottom: 0; }
.callout code { word-break: break-all; }
[hidden] { display: none !important; }
@media (max-width: 820px) { .method-choice { grid-template-columns: 1fr; } }

/* "Procesando…": bloquea la pantalla mientras el servidor responde un formulario */
.busy { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(16, 22, 28, 0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); cursor: progress;
  animation: busy-in 0.15s ease-out; }
.busy[hidden] { display: none; }
.busy-box { display: grid; justify-items: center; gap: 0.6rem; width: min(340px, 100%); padding: 2rem 1.75rem 1.6rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28); text-align: center; }
.busy-title { margin: 0.4rem 0 0; font-size: 1.15rem; font-weight: 700; }
.busy-sub { margin: 0; color: var(--muted); font-size: 0.88rem; }
.loader { display: flex; gap: 0.5rem; height: 2.4rem; align-items: center; }
.loader span { width: 0.85rem; height: 0.85rem; border-radius: 50%; background: var(--accent); animation: bounce 0.9s ease-in-out infinite; }
.loader span:nth-child(2) { animation-delay: 0.15s; }
.loader span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.45; } 40% { transform: translateY(-0.9rem); opacity: 1; } }
@keyframes busy-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .loader span { animation-duration: 2s; } }

/* flujo de tomar pedido y pedidos */
.flow-steps { list-style: decimal; padding-left: 1.4rem; margin: 0; display: grid; gap: 0.75rem; }
.flow-step { padding-left: 0.4rem; }
.flow-fields { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 0.75rem; align-items: end; }
.flow-actions { margin-top: 0.4rem; }
.order.nuevo { border-left: 3px solid var(--warn); }
.order-head { margin-bottom: 0.5rem; }
.order-head h2 { margin: 0; }
.order-head select { width: auto; }
.order-push { margin: 0.8rem 0 0; padding-top: 0.6rem; border-top: 1px solid var(--line); }
.order-push p { margin: 0; }
.order-push .row-between { margin-bottom: 0; }
.order-json { margin-top: 0.6rem; }
.orders-bar { align-items: flex-start; }
.orders-bar .filters { margin-bottom: 0; }
.orders-bar .btn:disabled { cursor: default; }
.conv-orders { margin-bottom: 1rem; padding: 0.9rem 1.1rem; }
.conv-orders h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.conv-order { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem 1rem; flex-wrap: wrap; padding: 0.5rem 0; border-top: 1px solid var(--line); }
.conv-order:first-of-type { border-top: 0; padding-top: 0; }
.conv-order p { margin: 0; }
.order-json pre { margin: 0.5rem 0 0; padding: 0.8rem; max-height: 22rem; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font-size: 0.8rem; white-space: pre-wrap; word-break: break-word; }
.order-items { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0; }
.order-items dt { color: var(--muted); font-size: 0.9rem; }
.order-items dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.stack > .order { min-width: 0; }
@media (max-width: 720px) { .flow-fields { grid-template-columns: 1fr; } }

.tag { display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.45rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: var(--accent-soft); color: var(--accent-text); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

.access { border: 0; padding: 0; margin: 0; }
.access legend { font-weight: 600; margin-bottom: 0.3rem; padding: 0; }
.access-sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.3rem 1rem; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 8px; }
.access-sites[hidden] { display: none; }
.grid tr.row-error td { background: var(--danger-soft); }
.error-text { color: var(--danger); font-weight: 600; }
.small.ok { color: var(--accent-text); font-weight: 600; }

.pair-code { font: 600 2rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.15em; margin: 0.5rem 0; }

/* Referidos: panel del sitio y portal del referente (este con el color del sitio en --accent). */
.ref-nav { margin-bottom: 0.4rem; }
.ref-state { margin-bottom: 1rem; }
.ref-kpis, .portal-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.ref-kpis .panel p, .portal-kpis .panel p { margin: 0; }
.ref-num { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.ref-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.75rem 1rem; }
.ref-kv > div { display: flex; flex-direction: column; }
.ref-actions { align-items: center; }
.ref-actions form.row input { width: auto; min-width: 12rem; }
.ref-inline { display: inline; margin-left: 0.5rem; }
.ref-more summary { cursor: pointer; color: var(--link); font-size: 0.9rem; padding: 0.25rem 0; }
.ref-more[open] summary { margin-bottom: 0.6rem; }
.ref-url, .ref-secret { word-break: break-all; }
.ref-secret { display: block; padding: 0.5rem 0.6rem; font-size: 0.85rem; }
.ref-currencies { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.5rem 1rem; }
.ref-currency { display: flex; flex-direction: column; gap: 0.25rem; }
.ref-logo-preview { max-height: 48px; max-width: 180px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; }
.ref-two { grid-template-columns: 3fr 2fr; }
.portal { min-height: 100vh; }
.portal .grid .num { white-space: nowrap; }
.portal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.portal-brand { display: flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; }
.portal-brand img { max-height: 40px; max-width: 200px; }
.portal-main { max-width: 860px; margin: 0 auto; padding: 1.25rem 16px 3rem; display: flex; flex-direction: column; gap: 1rem; }
.portal-card { max-width: 520px; width: 100%; margin: 1rem auto 0; }
.portal-code { font-size: 1.15rem; letter-spacing: 0.08em; padding: 0.1rem 0.45rem; }
.portal-link { display: flex; gap: 0.5rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.portal-terms summary { cursor: pointer; font-weight: 600; }
.portal-text { white-space: pre-line; font-size: 0.92rem; max-height: 320px; overflow: auto; padding: 0.5rem 0; }
@media (max-width: 820px) {
  .ref-two { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .ref-actions form.row input { min-width: 0; width: 100%; }
}
