/* Cuaderno: capa de diseño común a los tres estilos (clásico, ónix y alba).
   No cambia la paleta de cada estilo; define tipografía, escala, espaciado y forma de los componentes.
   Va después de app.css y themes.css, por eso pisa a ambos. */

:root {
  --serif: 'Literata', Georgia, serif;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: var(--serif);
  --accent: var(--gold);
  --on-accent: #17120a;
  --focus: rgba(217, 174, 85, 0.22);

  --t-xs: 11px; --t-sm: 13px; --t-md: 15px; --t-lg: 17px; --t-xl: 22px; --t-2xl: clamp(28px, 4vw, 42px);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --radius: 10px;
  --radius-sm: 8px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}
.refined { --font: 'Figtree', system-ui, sans-serif; --display: var(--serif); --radius: 10px; --radius-sm: 8px; }

body, .refined body { font: 400 var(--t-md)/1.6 var(--font); }
::selection { background: var(--focus); }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }

/* Iconos de trazo en los tres estilos */
.ic-e, .refined .ic-e { display: none; }
.ic-s, .refined .ic-s { display: inline-block; }

/* Títulos sin degradado */
.gold-text { background: none; -webkit-background-clip: initial; background-clip: initial; color: var(--title, var(--text)); }
.display { font-family: var(--serif); letter-spacing: 0; }

/* ---------- Componentes ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 500; padding: 9px var(--s4); }
.btn-sm { padding: 6px var(--s3); font-size: var(--t-sm); }
.btn-gold, .refined .btn-gold { background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); font-weight: 500; }
.btn-gold:hover, .refined .btn-gold:hover { filter: none; opacity: .9; }
.btn:hover { border-color: var(--muted); }
.btn-ghost:hover { border-color: transparent; }
.input, .textarea, .select { border-radius: var(--radius-sm); padding: 10px var(--s3); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--gold-3); box-shadow: 0 0 0 3px var(--focus); }
.field label { font-size: var(--t-sm); }
.badge { border-radius: 6px; }
.alert { border-radius: var(--radius-sm); }
.modal, .refined .modal { border-radius: 14px; padding: var(--s5); box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.modal h2 { font: 400 var(--t-xl)/1.25 var(--serif); }
.menu-pop { border-radius: var(--radius); }
.toast { border-radius: var(--radius-sm); }
.ivi-sign strong, .refined .ivi-sign strong { text-transform: none; letter-spacing: 0; font-size: var(--t-xs); font-weight: 500; }

/* ---------- Acceso ---------- */
.auth-page, .refined .auth-page { background: var(--bg); }
.auth-card, .refined .auth-card { background: var(--panel); border-radius: 16px; box-shadow: none; backdrop-filter: none; padding: var(--s6) var(--s6) var(--s5); }
.auth-logo, .refined .auth-logo { width: 132px; filter: none; margin-bottom: var(--s3); }
.auth-title, .refined .auth-title { font: 400 var(--t-xl)/1.3 var(--serif); letter-spacing: 0; text-transform: none; color: var(--text); margin-bottom: var(--s5); }
.auth-or { letter-spacing: .12em; font-size: var(--t-xs); }

/* ---------- Barra lateral ---------- */
.side-head { padding: var(--s5) var(--s4) var(--s4); }
.side-head img { width: 34px; height: 34px; }
.side-head .name, .refined .side-head .name { font: 400 var(--t-lg)/1.15 var(--serif); letter-spacing: 0; background: none; color: var(--text); }
.side-head .sub, .refined .side-head .sub { font-size: var(--t-xs); letter-spacing: 0; text-transform: none; color: var(--muted); }
.side-nav { padding: 0 var(--s3) var(--s3); }
.side-link { border-radius: var(--radius-sm); padding: var(--s2); font-size: var(--t-sm); gap: var(--s3); }
.side-new { padding: 0 var(--s4) var(--s4); }
.side-new .btn { background: transparent; border: 1px solid var(--line-2); font-size: var(--t-sm); padding: 10px; }
.side-new .btn:hover { border-color: var(--gold); color: var(--gold-2); }
.conv-list { padding: 0 var(--s3); }
.conv-group, .refined .conv-group { font-size: var(--t-xs); letter-spacing: .12em; text-transform: uppercase; padding: var(--s5) var(--s2) var(--s2); }
.conv-item, .refined .conv-item { border-radius: var(--radius-sm); padding: var(--s2); font-size: var(--t-sm); border: 0; }
.conv-item.active { background: var(--panel); }
.side-foot { padding: var(--s4); gap: var(--s4); }
.usage .bar { height: 2px; border-radius: 0; margin-top: var(--s2); }
.usage .bar > i, .refined .usage .bar > i { background: var(--gold); }
.avatar, .refined .avatar { width: 30px; height: 30px; background: transparent; border: 1px solid var(--line-2); color: var(--gold-2); font: 400 var(--t-sm)/1 var(--serif); }

/* ---------- Barra superior ---------- */
.main, .refined .main { background: var(--bg); }
.topbar { padding: var(--s3) var(--s6); gap: var(--s4); min-height: 60px; }
.topbar .title, .refined .topbar .title { font-size: var(--t-sm); font-weight: 400; color: var(--text-2); }
.topbar .btn-sm { border-color: transparent; background: transparent; color: var(--text-2); }
.topbar .btn-sm:hover { color: var(--text); background: var(--panel); }
.process-chip, .refined .process-chip { border-radius: 999px; background: transparent; padding: 6px var(--s3); font-size: var(--t-sm); gap: var(--s2); }
.process-chip:hover { border-color: var(--gold); }
.process-chip .ic-s { color: var(--gold); }
.help-btn { width: 30px; height: 30px; border-color: var(--line-2) !important; font-weight: 500; }
.topbar { padding-top: calc(var(--s3) + env(safe-area-inset-top)); min-height: calc(60px + env(safe-area-inset-top)); }

/* ---------- Conversación ---------- */
.thread-inner { max-width: 760px; padding: var(--s7) var(--s6) var(--s6); }
.msg { gap: var(--s5); margin-bottom: var(--s6); }
.msg .ico, .msg.assistant .ico, .refined .msg.assistant .ico { width: 28px; height: 28px; background: none; border: 0; border-radius: 0; margin-top: 2px; }
.msg.assistant .ico img { width: 28px; height: 28px; }
.msg.assistant .body { font: 400 var(--t-lg)/1.65 var(--serif); padding-top: 0; text-wrap: pretty; }
.body p { margin: 0 0 var(--s4); }
.body ul, .body ol { margin: 0 0 var(--s4); }
.body li { margin: var(--s1) 0; }
.body strong, .refined .body strong { color: var(--gold-2); font-weight: 500; }
.body code { font-family: ui-monospace, Menlo, monospace; font-size: .85em; }
.body blockquote, .refined .body blockquote { border-left: 1px solid var(--gold); background: transparent; border-radius: 0; padding: 0 0 0 var(--s4); font-style: italic; }
.msg.user .bubble, .refined .msg.user .bubble { background: var(--panel); border: 1px solid var(--line); border-radius: 16px 16px 4px 16px; padding: var(--s3) var(--s4); max-width: 78%; }
.typing i, .refined .typing i { width: 6px; height: 6px; background: var(--gold); }

.proposal, .refined .proposal { margin-top: var(--s4); padding: var(--s4); border: 1px solid var(--line-2); border-radius: var(--radius); background: transparent; font-family: var(--font); }
.pc-k, .refined .pc-k { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-xs); font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-2); margin-bottom: var(--s2); }
.pc-t { font: italic 400 var(--t-md)/1.5 var(--serif); margin-bottom: var(--s4); }
.pc-a { gap: var(--s2); }
.msg-actions { margin-top: var(--s3); gap: var(--s1); opacity: .6; }
.vote, .refined .vote { filter: none; color: var(--muted); border: 0; border-radius: 6px; padding: 6px; display: inline-grid; place-items: center; }
.vote .ic-s { width: 14px; height: 14px; }
.vote:hover { background: var(--panel); color: var(--text); }
.vote.on, .refined .vote.on { background: transparent; color: var(--gold-2); border: 0; }

/* Pantalla de inicio */
.empty, .refined .empty { text-align: left; padding: 6vh 0 var(--s4); max-width: 640px; }
.empty img, .refined .empty img { width: 52px; max-width: none; filter: none; margin: 0 0 var(--s5); }
.empty h1, .refined .empty h1 { font: 300 var(--t-2xl)/1.12 var(--serif); letter-spacing: -.015em; margin: 0 0 var(--s4); color: var(--text); text-wrap: balance; }
.empty h1 em { font-style: italic; color: var(--text-2); }
.empty p, .refined .empty p { color: var(--text-2); font-size: var(--t-md); max-width: 50ch; margin: 0 0 var(--s6); }
.chips, .refined .chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; max-width: none; margin: 0; border-top: 1px solid var(--line); }
.chip, .refined .chip { display: grid; grid-template-columns: 32px 1fr; align-items: baseline; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: var(--s4) var(--s4) var(--s4) 0; color: var(--text); font-size: var(--t-md); min-height: 0; }
.chip:nth-child(odd) { border-right: 1px solid var(--line); }
.chip:nth-child(even) { padding-left: var(--s4); }
.chip:hover, .refined .chip:hover { background: transparent; }
.chip em { font: italic 400 var(--t-md)/1 var(--serif); color: var(--gold); }
.chip b { display: block; font-weight: 500; margin: 0; transition: color .2s; }
.chip:hover b { color: var(--gold-2); }
.chip small { display: block; color: var(--muted); font-size: var(--t-sm); line-height: 1.45; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chip > span { display: block; }

/* Composer */
.composer-wrap { padding: 0 var(--s6) var(--s4); }
.composer, .refined .composer { max-width: 760px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2); padding: var(--s2) var(--s2) var(--s2) var(--s4); }
.composer:focus-within, .refined .composer:focus-within { border-color: var(--gold); box-shadow: none; }
.composer textarea { font: 400 var(--t-lg)/1.5 var(--serif); padding: 6px 0; }
.composer textarea::placeholder { color: var(--muted); font-style: italic; }
.send, .refined .send { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--on-accent); }
.send:disabled, .refined .send:disabled { background: var(--line-2); color: var(--muted); }
.send svg { width: 16px; height: 16px; }
.disclaimer { font-size: var(--t-xs); margin-top: var(--s2); }
.banner { max-width: 760px; }

/* Tutorial y lámina */
.tour-card { border-radius: 14px; border-color: var(--line-2); padding: var(--s5); }
.tour-card h2 { font: 400 var(--t-xl)/1.25 var(--serif); }
.tour-step { letter-spacing: .12em; }
.tour-spot { border-radius: var(--radius); box-shadow: 0 0 0 1px var(--gold), 0 0 0 9999px rgba(3, 4, 8, .78); }
.lamina-toolbar h2 { font: 400 var(--t-lg)/1.2 var(--serif); }

/* ---------- Panel de administración ---------- */
.admin-head .brand, .refined .admin-head .brand { font: 400 var(--t-lg)/1.15 var(--serif); letter-spacing: 0; }
.admin-head .brand span, .refined .admin-head .brand span { font-size: var(--t-xs); letter-spacing: 0; text-transform: none; }
.tab.active, .refined .tab.active { color: var(--text); border-bottom: 1px solid var(--gold); }
.stat, .card { border-radius: var(--radius); }
.stat .k, .refined .stat .k, th, .refined th { font-size: var(--t-xs); letter-spacing: .1em; }
.stat .v { font: 300 28px/1.15 var(--serif); }
.card h3 { font: 400 var(--t-lg)/1.3 var(--serif); }
.chart .b, .refined .chart .b { background: var(--gold); border-radius: 2px 2px 0 0; }

/* ---------- Móvil ---------- */
@media (max-width: 860px) {
  .topbar { padding-inline: var(--s4); gap: var(--s3); }
  .thread-inner { padding: var(--s5) var(--s4) var(--s5); }
  .composer-wrap { padding: 0 var(--s3) max(var(--s3), env(safe-area-inset-bottom)); }
  .composer textarea { font-size: 17px; }
  .send, .refined .send { width: 40px; height: 40px; }
}
@media (max-width: 480px) {
  .msg { display: block; margin-bottom: var(--s5); }
  .msg .ico, .msg.assistant .ico { width: 22px; height: 22px; margin: 0 0 var(--s2); }
  .msg.assistant .ico img { width: 22px; height: 22px; }
  .msg.user { display: flex; }
  .msg.assistant .body { font-size: 17px; }
  .msg.user .bubble { font-size: 16px; max-width: 88%; }
  .empty, .refined .empty { padding: var(--s2) 0 var(--s2); }
  .empty img, .refined .empty img { width: 40px; margin-bottom: var(--s4); }
  .empty h1, .refined .empty h1 { font-size: 28px; margin-bottom: var(--s3); }
  .empty p, .refined .empty p { font-size: var(--t-md); margin-bottom: var(--s5); }
  .chips, .refined .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  .chip, .refined .chip { display: grid; padding-block: var(--s3); min-height: 0; }
  .chip small { display: none; }
  .chip b { line-height: 1.35; }
  .auth-card, .refined .auth-card { padding: var(--s5) var(--s5) var(--s4); }
}
@media (pointer: coarse) {
  .vote, .refined .vote { padding: 10px; }
}
