:root {
  --bg: #0a0b0d; --rail: #0d0f12; --panel: #111317; --surface: #161920; --surface-2: #1c2028; --hover: #20252e;
  --line: #232833; --line-2: #2e3440;
  --text: #e8eaee; --text-2: #b4bac5; --muted: #7d8593;
  --accent: #fc596f; --accent-2: #beb9b9; --accent-soft: rgba(174, 167, 167, .12); --accent-line: rgba(174, 167, 167, .45);
  --grad: linear-gradient(135deg, #fc596f, #b8b2b2);
  --ok: #34c38f; --warn: #f1b44c; --bad: #f46a6a;
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.35);
  --font: "Inter", system-ui, "Segoe UI", sans-serif; --mono: "JetBrains Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #262b35; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #333a47; background-clip: padding-box; border: 3px solid transparent; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { position: relative; overflow: hidden; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(900px 500px at 20% 10%, rgba(174, 167, 167, .28), transparent 60%), radial-gradient(700px 500px at 90% 90%, rgba(184, 178, 178, .22), transparent 60%), var(--rail);
  border-right: 1px solid var(--line); }
.auth-hero h2 { font-size: 40px; line-height: 1.1; letter-spacing: -.03em; margin: 0 0 16px; max-width: 520px; }
.auth-hero p { color: var(--text-2); font-size: 16px; max-width: 460px; margin: 0; }
.auth-feats { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 12px; margin-top: 32px; }
.auth-feat { border: 1px solid var(--line); background: rgba(17,19,23,.7); border-radius: var(--r); padding: 14px; font-size: 13px; color: var(--text-2); }
.auth-feat b { display: flex; align-items: center; gap: 8px; color: var(--text); margin-bottom: 4px; font-size: 13.5px; }
.auth-feat svg.i { color: var(--accent-2); }
.auth-side { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.02em; }
.auth-card > p { color: var(--muted); margin: 0 0 24px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .primary { width: 100%; padding: 12px; }
.auth-switch { margin-top: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.auth-switch button { background: none; border: 0; color: var(--accent-2); cursor: pointer; font-weight: 600; padding: 0; }
.legal { font-size: 12px; color: var(--muted); margin-top: 22px; text-align: center; }
.brandline { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 84px minmax(0, 1fr); height: 100vh; }
.rail { background: var(--rail); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 16px 0 14px; gap: 4px; overflow-y: auto; }
.brand { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 16px; flex: none;
  background: var(--grad); font-weight: 700; font-size: 18px; letter-spacing: -.02em; box-shadow: 0 6px 18px rgba(174, 167, 167, .35); color: #fff; }
.nav { width: 68px; border: 0; background: none; border-radius: var(--r); padding: 9px 0 7px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 500; transition: .15s; flex: none; }
.nav svg.i { width: 21px; height: 21px; }
.nav:hover { color: var(--text); background: var(--surface); }
.nav.on { color: var(--text); background: var(--accent-soft); }
.nav.on svg.i { stroke: var(--accent-2); }
.rail .sep { flex: 1; }
.me-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer; font-weight: 700; font-size: 13px; flex: none; }
.me-btn:hover { border-color: var(--accent-line); }
.shell { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { height: 64px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--panel); }
.top h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.top p { margin: 1px 0 0; font-size: 12.5px; color: var(--muted); }
.kpis { margin-left: auto; display: flex; gap: 8px; }
.kpi { display: flex; flex-direction: column; padding: 6px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); min-width: 104px; }
.kpi span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.kpi b { font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi.low b { color: var(--warn); }
.kpi.clickable { cursor: pointer; } .kpi.clickable:hover { border-color: var(--accent-line); }
.view { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; }
.view.single { display: block; overflow-y: auto; }
.page { max-width: 1180px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- Paneles laterales ---------- */
.panel { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.panel.catalog { border-right: 1px solid var(--line); }
.panel.history { border-left: 1px solid var(--line); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; }
.panel-head h2 { margin: 0; font-size: 13px; font-weight: 600; }
.count { font-size: 11.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 1px 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.panel-head .btn, .panel-head .right { margin-left: auto; }
.search { position: relative; margin: 0 18px 12px; }
.search svg.i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search input { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px 8px 34px; outline: none; transition: .15s; }
.search input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 10px; }
.fchip { border: 1px solid var(--line); background: var(--surface); border-radius: 20px; padding: 4px 11px; cursor: pointer; font-size: 12px; font-weight: 500; color: var(--text-2); display: inline-flex; gap: 6px; align-items: center; transition: .15s; }
.fchip small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fchip:hover { border-color: var(--line-2); color: var(--text); }
.fchip.on { background: var(--accent-soft); border-color: var(--accent-line); color: #fff; }
.fchip.on small { color: var(--accent-2); }
.fhint { margin: 0 18px 12px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); line-height: 1.55; }
.fhint p { margin: 0 0 6px; } .fhint p:last-child { margin: 0; }
.fhint b { color: var(--text); font-weight: 600; }
.list { flex: 1; overflow-y: auto; padding: 4px 10px 16px; display: flex; flex-direction: column; gap: 2px; }
.mcard { text-align: left; border: 1px solid transparent; background: none; border-radius: var(--r-sm); padding: 9px 10px; cursor: pointer; display: flex; gap: 10px; align-items: center; transition: background .12s; }
.mcard:hover { background: var(--surface); }
.mcard.on { background: var(--accent-soft); border-color: var(--accent-line); }
.mcard .mtxt { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mcard .tick { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-2); flex: none; display: grid; place-items: center; }
.mcard .tick.on { background: var(--accent); border-color: var(--accent); }
.mcard .tick svg.i { width: 12px; height: 12px; stroke-width: 3; color: #fff; }
.mname { font-weight: 500; font-size: 13.5px; }
.mmeta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.mmeta code { font-family: var(--mono); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mmeta .price { margin-left: auto; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty-list { color: var(--muted); font-size: 12.5px; padding: 20px 10px; text-align: center; }
.compare-bar { margin: 0 18px 12px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 12.5px; display: flex; gap: 8px; align-items: center; }
.compare-bar b { font-weight: 600; }
.compare-bar .btn { margin-left: auto; }

/* ---------- Controles ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); border-radius: var(--r-sm);
  padding: 7px 12px; cursor: pointer; font-size: 12.5px; font-weight: 500; text-decoration: none; transition: .15s; white-space: nowrap; }
.btn:hover { border-color: var(--line-2); color: var(--text); background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.on { background: var(--accent-soft); border-color: var(--accent-line); color: #fff; }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover { background: var(--surface); border-color: var(--line); }
.btn.danger:hover { color: var(--bad); border-color: rgba(244,106,106,.45); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn svg.i { width: 16px; height: 16px; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: var(--r-sm); padding: 10px 18px; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 13.5px; box-shadow: 0 6px 16px rgba(174, 167, 167, .28); transition: .15s; white-space: nowrap; }
.primary:hover { background: var(--accent-2); }
.primary:disabled { opacity: .55; cursor: not-allowed; }
.primary.stop { background: var(--surface-2); color: var(--text); box-shadow: none; border: 1px solid var(--line-2); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
select, .input { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; outline: none; transition: .15s; }
textarea.input { resize: vertical; }
select { cursor: pointer; padding-right: 28px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d8593' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }
select:focus, .input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none; line-height: 1.45; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 1px 0 0; flex: none; }
input[type=range] { accent-color: var(--accent); width: 100%; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--muted); padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 12.5px; font-weight: 500; }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.err { color: var(--bad); }
.pill { font-size: 11.5px; font-weight: 500; padding: 3px 10px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: rgba(52,195,143,.35); } .pill.warn { color: var(--warn); border-color: rgba(241,180,76,.35); } .pill.bad { color: var(--bad); border-color: rgba(244,106,106,.35); }

/* ---------- Zona de trabajo ---------- */
.work { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.pad-work { padding: 20px 24px; gap: 14px; overflow-y: auto; }
.stage { flex: 1; min-height: 300px; border: 1px solid var(--line); border-radius: var(--r-lg); background:
  radial-gradient(circle at 1px 1px, rgba(255,255,255,.035) 1px, transparent 0) 0 0 / 22px 22px, var(--panel);
  display: grid; place-items: center; overflow: hidden; position: relative; }
.stage > img, .stage > video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.stage-grid { width: 100%; height: 100%; display: grid; gap: 10px; padding: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-content: center; overflow-y: auto; }
.stage-grid figure { margin: 0; position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); cursor: pointer; background: var(--surface); }
.stage-grid figure.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.stage-grid img { width: 100%; max-height: 52vh; object-fit: contain; display: block; }
.stage-grid figcaption { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.72); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 5px; }
.stage-grid .fail { padding: 30px 14px; text-align: center; color: var(--bad); font-size: 12.5px; }
.stage-empty { text-align: center; color: var(--muted); max-width: 420px; padding: 30px; }
.stage-empty .ic { width: 52px; height: 52px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; margin: 0 auto 14px; }
.stage-empty .ic svg.i { width: 24px; height: 24px; color: var(--text-2); }
.stage-empty h3 { margin: 0 0 6px; color: var(--text); font-size: 15px; font-weight: 600; }
.stage-empty p { margin: 0; font-size: 13px; }
.spinner { width: 38px; height: 38px; border: 3px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.stagebar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stagebar .meta { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.composer { padding: 14px; display: flex; flex-direction: column; gap: 12px; flex: none; }
.composer textarea.prompt { width: 100%; min-height: 84px; max-height: 260px; resize: vertical; border: 0; background: none; outline: none; padding: 2px 4px; font-size: 14.5px; line-height: 1.55; }
textarea::placeholder, input::placeholder { color: #5f6773; }
.refs { display: flex; gap: 8px; flex-wrap: wrap; }
.refs:empty { display: none; }
.ref { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); background: var(--surface); flex: none; }
.ref img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref .n { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.72); font-size: 10px; padding: 1px 5px; border-radius: 4px; font-weight: 600; }
.ref button { position: absolute; right: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.72); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; }
.ref button svg.i { width: 12px; height: 12px; }
.ref.unused { opacity: .35; }
.comp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.comp-row .spacer { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 0 -14px; }
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.more { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.more .full { grid-column: 1 / -1; }
.note { font-size: 12.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 12px; display: flex; gap: 8px; align-items: flex-start; }
.note svg.i { width: 16px; height: 16px; margin-top: 1px; color: var(--accent-2); }
.note.warn { border-color: rgba(241,180,76,.4); } .note.warn svg.i { color: var(--warn); }
.drop-over .composer { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.frames { display: flex; gap: 10px; flex-wrap: wrap; }
.frame { width: 132px; height: 92px; border-radius: 10px; border: 1.5px dashed var(--line-2); background: var(--surface); display: grid; place-items: center; cursor: pointer; position: relative; overflow: hidden; color: var(--muted); font-size: 12px; text-align: center; padding: 6px; }
.frame:hover { border-color: var(--accent-line); color: var(--text); }
.frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.frame .lbl { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.72); color: #fff; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.frame .x { position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.72); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; z-index: 1; }
.frame .x svg.i { width: 12px; height: 12px; }
.gallery { flex: 1; overflow-y: auto; padding: 0 14px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; }
.gallery figure { margin: 0; position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); cursor: pointer; aspect-ratio: 1; background: var(--surface); }
.gallery figure.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.gallery img, .gallery video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.gallery figure:hover img, .gallery figure:hover video { transform: scale(1.04); }
.tag { position: absolute; left: 5px; top: 5px; background: rgba(0,0,0,.7); font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.jobs { display: flex; flex-direction: column; gap: 8px; padding: 0 14px 12px; }
.job { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 10px 12px; font-size: 12.5px; }
.job b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .bar { height: 4px; border-radius: 4px; background: var(--line); margin-top: 8px; overflow: hidden; }
.job .bar i { display: block; height: 100%; background: var(--grad); border-radius: 4px; transition: width 1s linear; }
.job .bar.indet i { width: 35%; animation: indet 1.6s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.job .sub { color: var(--muted); font-size: 11.5px; margin-top: 4px; display: flex; gap: 8px; }

/* ---------- Chat ---------- */
.chat-head { height: 60px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 22px; border-bottom: 1px solid var(--line); background: var(--panel); }
.chat-head .who { min-width: 0; }
.chat-head .who b { display: block; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who span { font-size: 12px; color: var(--muted); }
.chat-head .acts { margin-left: auto; display: flex; gap: 6px; }
.chat-settings { flex: none; padding: 16px 22px; border-bottom: 1px solid var(--line); background: var(--panel); display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.chat-settings textarea { min-height: 64px; }
.chat-settings .row2 { grid-column: 1 / -1; display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.msgs { flex: 1; overflow-y: auto; padding: 28px 24px; }
.msgs-inner { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.msg { display: flex; gap: 12px; }
.avatar { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.msg.user .avatar { background: var(--surface-2); color: var(--text-2); }
.msg.assistant .avatar { background: var(--grad); color: #fff; }
.msg .content { min-width: 0; flex: 1; }
.msg .name { font-size: 12.5px; font-weight: 600; margin-bottom: 4px; color: var(--text-2); }
.md { overflow-wrap: anywhere; line-height: 1.65; font-size: 14.5px; }
.msg.user .md { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; display: inline-block; max-width: 100%; }
.md p { margin: 0 0 10px; } .md > :last-child { margin-bottom: 0; }
.md h3, .md h4 { margin: 16px 0 8px; font-size: 15px; } .md h2 { margin: 18px 0 8px; font-size: 17px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; } .md li { margin: 3px 0; }
.md blockquote { margin: 0 0 10px; padding: 4px 14px; border-left: 3px solid var(--line-2); color: var(--text-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.md table { border-collapse: collapse; margin: 0 0 12px; font-size: 13.5px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.md th { background: var(--surface); font-weight: 600; }
.md pre { background: #07080a; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; overflow-x: auto; font: 12.5px/1.6 var(--mono); margin: 0 0 10px; position: relative; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.md pre code { background: none; padding: 0; }
.md img { max-width: 200px; border-radius: 8px; margin: 8px 8px 0 0; border: 1px solid var(--line); }
.think { margin-bottom: 10px; font-size: 13px; color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); }
.think summary { cursor: pointer; padding: 7px 12px; user-select: none; font-weight: 500; }
.think div { white-space: pre-wrap; padding: 0 12px 10px; max-height: 320px; overflow-y: auto; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.foot { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.foot .stat { margin-right: 6px; }
.chat-empty { max-width: 560px; margin: 8vh auto 0; text-align: center; }
.chat-empty .logo { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 18px; display: grid; place-items: center; background: var(--grad); font-weight: 700; font-size: 22px; box-shadow: 0 10px 30px rgba(174, 167, 167, .3); color: #fff; }
.chat-empty h3 { margin: 0 0 8px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.chat-empty p { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chat-input { flex: none; padding: 0 24px 18px; }
.chat-input .box { max-width: 820px; margin: 0 auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.chat-input textarea { width: 100%; border: 0; background: none; outline: none; resize: none; font-size: 14.5px; line-height: 1.55; padding: 6px 8px; max-height: 240px; min-height: 26px; }
.chat-input .row { display: flex; align-items: center; gap: 8px; }
.chat-input .row .hint { font-size: 11.5px; color: var(--muted); margin-left: 4px; }
.chat-input .row .primary { margin-left: auto; padding: 8px 16px; }
.chat-foot { max-width: 820px; margin: 8px auto 0; font-size: 11.5px; color: var(--muted); text-align: center; }
.compare-cols { flex: 1; min-height: 0; display: grid; gap: 12px; padding: 16px; overflow-x: auto; }
.ccol { display: flex; flex-direction: column; min-height: 0; min-width: 260px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.ccol-head { padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.ccol-head b { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ccol-body { flex: 1; overflow-y: auto; padding: 14px; }
.ccol-foot { padding: 8px 12px; border-top: 1px solid var(--line); display: flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--muted); }
.ccol-foot .btn { margin-left: auto; }
.convs { flex: 1; overflow-y: auto; padding: 0 10px 16px; display: flex; flex-direction: column; gap: 2px; }
.conv { display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; border: 1px solid transparent; }
.conv:hover { background: var(--surface); }
.conv.on { background: var(--accent-soft); border-color: var(--accent-line); }
.conv .t { flex: 1; min-width: 0; }
.conv .t b { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .t span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.conv .x { opacity: 0; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 3px; border-radius: 6px; display: grid; }
.conv:hover .x { opacity: 1; }
.conv .x:hover { color: var(--text); background: var(--surface-2); }
.conv .x.del:hover { color: var(--bad); }
.conv .x svg.i { width: 14px; height: 14px; }

/* ---------- Galería ---------- */
.gtools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gtools .search { margin: 0; flex: 1; min-width: 220px; }
.gtools select { width: auto; min-width: 170px; }
.masonry { columns: 5 240px; column-gap: 12px; }
.masonry figure { break-inside: avoid; margin: 0 0 12px; position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); cursor: zoom-in; background: var(--surface); }
.masonry img, .masonry video { width: 100%; display: block; }
.masonry figcaption { position: absolute; inset: auto 0 0 0; padding: 26px 10px 8px; font-size: 11.5px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.8)); opacity: 0; transition: .2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.masonry figure:hover figcaption { opacity: 1; }
.masonry .fav { position: absolute; right: 8px; top: 8px; color: #ffd166; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.masonry .fav svg.i { fill: #ffd166; stroke: #ffd166; }
.lightbox { position: fixed; inset: 0; background: rgba(5,6,8,.94); z-index: 40; display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.lb-stage { position: relative; overflow: hidden; display: grid; place-items: center; cursor: zoom-in; }
.lb-stage.zoomed { cursor: grab; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100vh; object-fit: contain; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(17,19,23,.8); color: #fff; cursor: pointer; display: grid; place-items: center; z-index: 2; }
.lb-nav.prev { left: 16px; } .lb-nav.next { right: 16px; }
.lb-close { position: absolute; top: 14px; left: 14px; z-index: 2; }
.lb-zoom { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 2; display: flex; gap: 6px; }
.lb-side { background: var(--panel); border-left: 1px solid var(--line); padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.lb-side h3 { margin: 0; font-size: 15px; }
.lb-prompt { font-size: 13px; color: var(--text-2); white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; max-height: 240px; overflow-y: auto; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 12.5px; }
.kv span { color: var(--muted); } .kv b { font-weight: 500; text-align: right; }
.lb-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lb-actions .btn { justify-content: center; }

/* ---------- Gastos / Créditos / Admin ---------- */
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.page-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.stat { padding: 16px 18px; }
.stat span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stat b { display: block; font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 12px; }
.stat.good b { color: var(--ok); }
.section { padding: 18px; }
.section h3 { margin: 0 0 14px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chart { width: 100%; height: 220px; display: block; }
.chart .bar { fill: var(--accent); } .chart .bar:hover { fill: var(--accent-2); }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart line { stroke: var(--line); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .neg { color: var(--bad); } .tbl .pos { color: var(--ok); }
.tbl-wrap { overflow-x: auto; }
.meter { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; min-width: 60px; }
.meter i { display: block; height: 100%; background: var(--grad); border-radius: 6px; }
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.pack { padding: 22px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.pack.best { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line), var(--shadow); }
.pack .badge { position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 600; color: #fff; background: var(--grad); padding: 2px 9px; border-radius: 20px; }
.pack .price { font-size: 32px; font-weight: 700; letter-spacing: -.03em; }
.pack .cr { font-size: 15px; font-weight: 600; }
.pack ul { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.checkout { display: grid; grid-template-columns: 220px 1fr; gap: 26px; align-items: start; border-color: var(--accent-line); }
.checkout .qr { background: #fff; border-radius: 14px; padding: 8px; aspect-ratio: 1; }
.checkout .qr svg { width: 100%; height: 100%; display: block; }
.co-kv { grid-template-columns: 150px 1fr; align-items: center; gap: 12px 16px; }
.co-kv > span { font-size: 13px; }
.co-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.co-row b { text-align: left; }
.addr { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; background: var(--surface); padding: 6px 9px; border-radius: 6px; border: 1px solid var(--line); }
@media (max-width: 760px) { .checkout { grid-template-columns: 1fr; } .checkout .qr { max-width: 220px; } .co-kv { grid-template-columns: 1fr; } }
.value-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.value-row { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.value-row .vr-ic { width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--accent-soft); }
.value-row .vr-ic svg.i { width: 19px; height: 19px; color: var(--accent-2); }
.value-row .vr-txt { min-width: 0; display: flex; flex-direction: column; }
.value-row .vr-txt b { font-size: 15px; font-weight: 600; }
.value-row .vr-txt span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-info { white-space: pre-wrap; font-size: 14px; color: var(--text-2); line-height: 1.6; }

/* ---------- Modal y avisos ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(5,6,8,.7); z-index: 60; display: grid; place-items: center; padding: 20px; backdrop-filter: blur(3px); }
.modal { width: 100%; max-width: 440px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal h3 { margin: 0; font-size: 16px; }
.modal p { margin: 0; color: var(--text-2); font-size: 13.5px; }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; }
.menu { position: fixed; z-index: 55; min-width: 240px; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .who b { display: block; font-size: 13.5px; } .menu .who span { font-size: 12px; color: var(--muted); }
.menu button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--text-2); }
.menu button:hover { background: var(--surface); color: var(--text); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 10px); background: var(--surface-2); border: 1px solid var(--line-2); padding: 10px 16px; border-radius: 10px;
  max-width: 600px; font-size: 13px; opacity: 0; transition: .2s; pointer-events: none; box-shadow: var(--shadow); z-index: 70; display: flex; gap: 10px; align-items: center; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.toast.err::before { background: var(--bad); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1280px) {
  .view { grid-template-columns: 290px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .panel.catalog { grid-row: 1 / 3; }
  .panel.history { border-left: 0; border-top: 1px solid var(--line); max-height: 260px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .lightbox { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .lb-side { max-height: 40vh; }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; } .auth-hero { display: none; }
  .app { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: auto; min-height: 100vh; }
  .rail { flex-direction: row; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .brand { margin: 0 8px 0 0; } .rail .sep { display: none; }
  .top { height: auto; padding: 12px 16px; flex-wrap: wrap; }
  .kpis { margin-left: 0; }
  .view { grid-template-columns: 1fr; grid-template-rows: auto; }
  .panel.catalog { grid-row: auto; max-height: 360px; border-right: 0; border-bottom: 1px solid var(--line); }
  .pad-work { padding: 16px; }
  .msgs { min-height: 50vh; }
  .chat-settings, .grid2 { grid-template-columns: 1fr; }
  .page { padding: 16px; }
}

/* ¿Olvidaste tu contraseña? (inicio de sesión) */
.lx-forgot { align-self: flex-end; margin: -4px 2px 2px auto; padding: 2px 0; border: 0; background: none; cursor: pointer; font: 12.5px "Outfit", sans-serif; color: rgba(255, 255, 255, .7); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, .3); }
.lx-forgot:hover { color: #fff; text-decoration-color: #ff8a9b; }
.lx-forgot[hidden] { display: none; }
