:root {
  /* Mismos colores que Métricas (metricas.automationpro-ai.com, imagen de Real Estate Luxi):
     menú negro, dorado metálico en lo activo, botones dorados y grises cálidos. */
  --bg: #f9f8f5; --surface: #ffffff; --ink: #2a2622; --muted: #766d63; --line: #e1dcd4;
  --navy: #9a7b2e; --gold: #c8a33c; --gold-soft: #f4e9c6; --gold-dark: #7d6325; --black: #0b0b0b;
  --metal: linear-gradient(120deg, #B8943F 0%, #D8BD69 35%, #F6E5A5 55%, #C9AA58 100%);
  --ok: #16a34a; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --bad: #dc2626; --bad-soft: #fee2e2;
  --radius: 14px; --shadow: 0 1px 2px rgba(42,38,34,.05), 0 4px 16px rgba(42,38,34,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font: 600 28px/1.2 "Playfair Display", Georgia, serif; margin: 0; }
h2 { font-family: "Playfair Display", Georgia, serif; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
small { font-size: 12.5px; }
.right { float: right; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; min-width: 0; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Menú lateral (como Métricas: barra blanca fija, iconos de línea) */
[hidden] { display: none !important; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 256px; background: var(--black); color: #e1dcd4; display: flex; flex-direction: column; padding: 18px 14px; z-index: 20; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 2px 6px 18px; margin-bottom: 12px; border-bottom: 1px solid rgba(200,163,60,.25); }
.sidebar .brand small { color: #d8bd69; }
.brand:hover { text-decoration: none; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.logo { width: 40px; height: 40px; border-radius: 50%; background: var(--metal); color: #1f1b16; display: grid; place-items: center; font: 700 15px "Playfair Display", Georgia, serif; flex: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a, .sidebar .logout { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; color: #e1dcd4; font-size: 14px; font-weight: 500; }
.sidebar nav a:hover { background: var(--metal); color: #1f1b16; font-weight: 600; text-decoration: none; }
.sidebar .logout:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--metal); color: #1f1b16; font-weight: 600; }
.sidebar .logout { border-top: 1px solid rgba(200,163,60,.25); border-radius: 0; padding-top: 14px; }
.sidebar .logout { color: #a39a8e; }
.project-picker { padding: 0 6px 14px; margin-bottom: 10px; border-bottom: 1px solid rgba(200,163,60,.25); }
.project-picker label { color: #d8bd69; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.project-picker select { background: #1a1815; color: #fff; border-color: rgba(200,163,60,.45); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 14px; }
.project-picker.mobile { display: none; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding: 10px 0; }
.files li:first-child { border-top: 0; }
.icon { width: 18px; height: 18px; flex: none; }
.content { margin-left: 256px; min-width: 0; }
.tabbar, .sheet { display: none; }

main { max-width: 1180px; margin: 0 auto; padding: 24px; }
main.wide { max-width: none; padding: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

/* Tarjetas y KPIs */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.kpi span { color: var(--muted); font-size: 13px; display: block; }
.kpi strong { font: 600 32px/1.1 "Playfair Display", Georgia, serif; display: block; margin: 6px 0 2px; color: var(--ink); }
.kpi.alert { border-color: #f3b4ae; background: var(--bad-soft); }
.kpi.alert strong { color: var(--bad); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > *, .kpis > *, .grid3 > * { min-width: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.alert-card { border-color: #f3b4ae; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); padding: 10px 0; }
.list li:first-child { border-top: 0; }
.list a { display: block; color: inherit; }
.list a:hover { text-decoration: none; background: #faf8f3; }
.visit-row { display: flex; gap: 14px; align-items: center; }
.when { min-width: 92px; display: flex; flex-direction: column; }
.when strong { font: 600 20px Georgia, serif; color: var(--navy); }
.empty { color: var(--muted); padding: 10px 0; }

/* Formularios */
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfc8bd; border-radius: 10px; padding: 8px 10px; width: 100%; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 10px; border: 1px solid #cfc8bd; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f9f8f5; text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--gold-dark); border-color: var(--gold-dark); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 200px; }
.filters select { width: auto; }

/* Avisos y etiquetas */
.flash { padding: 10px 14px; border-radius: 9px; margin-bottom: 14px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #eceae4; color: var(--muted); white-space: nowrap; vertical-align: middle; }
.pill.ok, .pill.confirmada, .pill.realizada { background: var(--ok-soft); color: var(--ok); }
.pill.off, .pill.no_presentado { background: #eceae4; color: #555; }
.pill.warn, .pill.pendiente { background: var(--warn-soft); color: var(--warn); }
.pill.alert, .pill.cancelada { background: var(--bad-soft); color: var(--bad); }
.badge { background: var(--gold); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.warn-text { color: var(--warn); font-size: 13px; margin-top: 4px; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 16px 10px; }

/* Tablas */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f9f8f5; }
tr:last-child td { border-bottom: 0; }
.schedule input[type=time] { width: 120px; display: inline-block; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--black); padding: 16px; }
.login-card { background: #fff; padding: 28px; border-radius: 16px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.login-brand strong { font-size: 17px; font-weight: 700; display: block; }
.login-brand small { color: var(--muted); }

/* Móvil */
@media (max-width: 960px) {
  .sidebar { display: none; }
  .project-picker.mobile { display: block; background: var(--black); padding: 10px 16px; margin: 0; }
  .content { margin-left: 0; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; inset: auto 0 0 0; z-index: 20; background: var(--black); border-top: 1px solid rgba(200,163,60,.25); padding: 4px 4px env(safe-area-inset-bottom); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font: inherit; font-size: 11px; color: #cfc8bd; background: none; border: 0; border-radius: 9px; cursor: pointer; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar .active { color: #d8bd69; font-weight: 600; }
  .tabbar .icon { width: 20px; height: 20px; }
  .sheet:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 30; }
  .sheet-backdrop { position: absolute; inset: 0; background: rgba(20,33,61,.4); border: 0; }
  .sheet-panel { position: absolute; inset: auto 0 0 0; background: var(--black); color: #e1dcd4; border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
  .sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
  .icon-btn { background: none; border: 0; padding: 6px; border-radius: 8px; color: var(--muted); cursor: pointer; }
  .sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .sheet-grid a { display: flex; align-items: center; gap: 10px; padding: 12px; border: 0; background: rgba(255,255,255,.05); border-radius: 12px; color: #e1dcd4; font-weight: 500; font-size: 14px; }
  .sheet-grid a.active { background: var(--metal); color: #1f1b16; font-weight: 600; }
  .sheet-grid a:hover { text-decoration: none; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  main { padding: 16px; }
  .kpi strong { font-size: 26px; }
}

.connect-card { border-color: #ead592; background: #fbf7ea; }
.steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.steps .btn { align-self: flex-start; }
.paste { display: flex; gap: 8px; width: 100%; flex-wrap: wrap; }
.paste input { flex: 1; min-width: 240px; }
code { background: #f1eee6; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }


/* ─── Agente de ventas ─────────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); }
.tabs a.active { background: var(--metal); color: #1f1b16; border-color: #c8a33c; font-weight: 600; }
.tabs a:hover { text-decoration: none; }
.pill.cita, .pill.interesado, .pill.completada, .pill.activa, .pill.aprobado, .pill.alto { background: var(--ok-soft); color: var(--ok); }
.pill.pendiente, .pill.volver_a_llamar, .pill.sonando, .pill.iniciando, .pill.pausada, .pill.medio, .pill.no_contesta, .pill.llamando { background: var(--warn-soft); color: var(--warn); }
.pill.no_llamar, .pill.fallida, .pill.error, .pill.descartado { background: var(--bad-soft); color: var(--bad); }
.pill.en_curso { background: #e1ecfb; color: #1d4f9a; }
.pill.contactado, .pill.borrador { background: #e6eefb; color: #24467f; }
.pill.dir { background: #f1eee6; color: #6b5a33; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #faf8f3; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.checklist li { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.checklist .dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; flex: none; background: #eceae4; color: var(--muted); }
.checklist .ok .dot { background: var(--ok-soft); color: var(--ok); }
.checklist .ok a { color: var(--muted); }

/* Centralita */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.line { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 6px; position: relative; }
.line.en_curso { border-color: #9cc0f0; box-shadow: 0 0 0 3px #e1ecfb; }
.line.sonando, .line.iniciando { border-color: #f0d08a; }
.line .who { font-weight: 600; font-size: 15px; }
.line .timer { font: 600 22px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); }
.line .acts { display: flex; gap: 6px; margin-top: 4px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #2f80ed; display: inline-block; animation: blink 1.2s infinite; margin-right: 6px; }
@keyframes blink { 50% { opacity: .3; } }
.keypad { display: grid; grid-template-columns: 54px 1fr 190px 1fr 70px; gap: 8px; align-items: center; }
.keypad .key { width: 44px; height: 44px; border-radius: 50%; background: var(--metal); color: #1f1b16; display: grid; place-items: center; font: 700 18px "Playfair Display", Georgia, serif; }
.keypad input, .keypad select { padding: 7px 9px; }
.keypad-head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.events { list-style: none; margin: 0; padding: 0; font-size: 13px; max-height: 360px; overflow-y: auto; }
.events li { padding: 6px 0; border-top: 1px solid #f0ede5; display: flex; gap: 10px; }
.events li:first-child { border-top: 0; }
.events time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; width: 44px; }
.events .warn { color: var(--warn); } .events .error { color: var(--bad); }

/* Llamada */
.transcript { display: flex; flex-direction: column; gap: 8px; max-height: 620px; overflow-y: auto; padding: 4px; }
.turn { max-width: 80%; padding: 8px 12px; border-radius: 12px; }
.turn.agent { align-self: flex-start; background: #f2efe9; border-top-left-radius: 4px; }
.turn.user { align-self: flex-end; background: var(--gold-soft); border-top-right-radius: 4px; }
.turn small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
audio { width: 100%; }
dl.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* Cerebro */
.know { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; background: #fff; }
.know textarea { min-height: 70px; }
.know .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.know .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
pre.prompt { white-space: pre-wrap; background: #faf8f3; border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 13px; max-height: 520px; overflow-y: auto; }

/* Voces */
.voices { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.voice { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 6px; }
.voice.current { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.voice .tags { display: flex; gap: 4px; flex-wrap: wrap; }
.voice .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.rank { counter-reset: r; }
.compare td:first-child { font-weight: 600; }
details summary { cursor: pointer; font-weight: 600; }
.secret-note { font-size: 12px; color: var(--muted); }
@media (max-width: 960px) {
  .checklist { grid-template-columns: 1fr; }
  .keypad { grid-template-columns: 44px 1fr; }
  .keypad .wide { grid-column: 1 / -1; }
  .keypad-head { display: none; }
}

/* ─── UGC Factory ─────────────────────────────────────────────────────────── */
.logo { font-size: 12px; letter-spacing: .02em; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--gold-dark); font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.interrumpido { background: #eceae4; color: #555; }
.row-btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.steps-plain { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* Tarjetas de proyecto */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.pcard:hover { text-decoration: none; border-color: var(--gold); }
.pthumb { aspect-ratio: 4 / 3; background: #15130f; display: grid; place-items: center; color: #d8bd69; font: 600 18px "Playfair Display", Georgia, serif; overflow: hidden; }
.pthumb img { width: 100%; height: 100%; object-fit: cover; }
.pbody { padding: 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pmeta { margin-top: 6px; }
.tcard { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.tcard h2 { margin: 2px 0; }
.tcard.selected { border-color: var(--gold); }

/* Nuevo anuncio */
.kind-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kind-opt { flex-direction: row; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; color: var(--ink); }
.kind-opt input { width: auto; margin-top: 3px; }
.kind-opt span { display: flex; flex-direction: column; gap: 3px; }
.kind-opt small { color: var(--muted); }
.kind-opt:has(input:checked) { border-color: var(--gold); background: #fbf7ea; }

/* Chat con el director */
.chat { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.bubble { max-width: 860px; padding: 12px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; overflow-wrap: anywhere; }
.bubble.user { align-self: flex-end; background: #15130f; color: #f1ece2; border-color: #15130f; max-width: 720px; }
.bubble.user .md a { color: #f6e5a5; }
.bubble.bot { align-self: flex-start; width: 100%; }
.bubble.sys { align-self: center; background: #fbf7ea; border-color: #ead592; font-size: 14px; }
.bubble.thinking { color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chip { display: inline-block; font-size: 12.5px; background: #f1eee6; color: #6b5a33; border-radius: 8px; padding: 3px 9px; margin: 4px 6px 4px 0; max-width: 100%; overflow-wrap: anywhere; }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.action-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid #ead592; background: #fbf7ea; border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
.chat-form { position: sticky; bottom: 12px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 0; }
.chat-actions { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.chat-actions details { flex: 1; min-width: 0; }
.chat-actions summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 8px 0; }
.attach-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.attach-grid label { font-size: 12px; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px 4px 4px; }
.attach-grid img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }

/* Markdown */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; } .md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md h1, .md h2, .md h3 { margin: 16px 0 8px; font-size: 17px; } .md h1 { font-size: 22px; }
.md table { margin: 8px 0 12px; font-size: 13.5px; display: block; overflow-x: auto; }
.md th, .md td { padding: 6px 9px; border: 1px solid var(--line); }
.md pre { background: #15130f; color: #eae4d8; padding: 12px; border-radius: 10px; overflow-x: auto; font-size: 12.5px; }
.md pre code { background: none; padding: 0; color: inherit; }
.md blockquote { margin: 0 0 10px; padding: 4px 12px; border-left: 3px solid var(--gold); color: var(--muted); }
.bubble.user .md code { background: #2a261f; color: #f6e5a5; }
.doc { max-width: 920px; }

/* Producción */
.phase-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.joblog { margin-top: 12px; }
.joblog summary { cursor: pointer; font-size: 13.5px; }
.joblog pre, pre.code { background: #15130f; color: #eae4d8; padding: 12px; border-radius: 10px; max-height: 360px; overflow: auto; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
pre.code { max-height: 70vh; }
textarea.code { font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.finals { display: flex; gap: 16px; flex-wrap: wrap; }
.final { display: flex; flex-direction: column; gap: 8px; width: 300px; max-width: 100%; }
.final video { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 9 / 16; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.media-grid.small { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.media { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; min-width: 0; }
.media img, .media video { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: #15130f; display: block; }
.media-grid.small img, .media-grid.small video { aspect-ratio: 1; }
.media audio { width: 100%; margin: 8px 0 0; }
.media .ph { aspect-ratio: 9 / 16; display: grid; place-items: center; background: #f1eee6; color: var(--muted); font-size: 13px; }
.media-body { padding: 10px; display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 14px; }
.media-body summary { cursor: pointer; font-size: 12.5px; color: var(--gold-dark); }
.prompt { display: block; white-space: pre-wrap; color: var(--muted); max-height: 220px; overflow: auto; margin-top: 4px; }
.guion { color: var(--ink); font-style: italic; }
.regen textarea { font-size: 13px; }
.regen form { margin-top: 6px; gap: 6px; }
.danger-zone { border-color: #f3b4ae; }
.log li.error { color: var(--bad); } .log li.warn { color: var(--warn); }
details.card > summary { cursor: pointer; }

@media (max-width: 960px) {
  .kind-pick { grid-template-columns: 1fr; }
  .chat-form { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .action-card { flex-direction: column; align-items: stretch; }
  .final { width: 100%; }
}
