:root {
  --bg: #14110d;
  --bg-soft: #1b1712;
  --bg-card: #221d16;
  --border: #3a332a;
  --text: #ece7df;
  --text-dim: #a69d8d;
  --accent: #d97757;
  --accent-soft: rgba(217, 119, 87, 0.14);
  --ok: #58a86e;
  --ok-soft: rgba(88, 168, 110, 0.14);
  --warn: #d9a441;
  --warn-soft: rgba(217, 164, 65, 0.14);
  --bad: #e0605a;
  --bad-soft: rgba(224, 96, 90, 0.14);
  --mono: "SF Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
}

/* En modo lectura el mismo acento, en su tono profundo para fondo claro */
body.reading { --accent: #b0562f; --accent-soft: rgba(176, 86, 47, 0.12); }

* { box-sizing: border-box; }

/* El atributo hidden siempre gana, aunque la clase defina display propio */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; }

/* ---- Shell ---- */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { font-size: 17px; color: var(--text); display: flex; align-items: center; padding: 4px 10px; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); font-size: 20px; }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-radius: 8px; color: var(--text-dim); font-weight: 500;
}
.nav-link:hover { background: var(--bg-card); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.nav-badge {
  background: var(--accent); color: #fff; border-radius: 10px;
  font-size: 11px; padding: 0 7px; line-height: 18px; font-weight: 700;
}
.sidebar-foot { margin-top: auto; font-size: 11.5px; color: var(--text-dim); padding: 0 10px; }

.content { padding: 28px 36px 60px; max-width: 1200px; width: 100%; }

.flash {
  background: var(--ok-soft); border: 1px solid var(--ok); color: var(--ok);
  padding: 9px 14px; border-radius: 8px; margin-bottom: 18px; font-size: 14px;
}
.flash-alert { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

/* ---- Cards / badges / pills ---- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px;
}
.card h3 { margin: 0 0 6px; }
.card h3 a { color: var(--text); }
.card p { color: var(--text-dim); font-size: 14px; margin: 4px 0 12px; }

.badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 6px; vertical-align: middle;
}
.badge-mid { background: var(--accent-soft); color: var(--accent); }
.badge-adv { background: var(--warn-soft); color: var(--warn); }
.badge-exp { background: var(--bad-soft); color: var(--bad); }

.pill { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-try { background: var(--warn-soft); color: var(--warn); }
.pill-todo { background: var(--bg-soft); color: var(--text-dim); border: 1px solid var(--border); }

.progress {
  background: var(--bg-soft); border-radius: 999px; height: 8px; overflow: hidden;
  border: 1px solid var(--border); flex: 1;
}
.progress-fill { background: linear-gradient(90deg, var(--accent), #e8a180); height: 100%; }
.progress-label { font-size: 12px; color: var(--text-dim); margin-left: 8px; }
.progress-row { display: flex; align-items: center; }

/* ---- Stats (dashboard) ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 18px 0 26px; }
.stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .num small { font-size: 15px; color: var(--text-dim); font-weight: 500; }
.stat .lbl { color: var(--text-dim); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat.stat-due .num { color: var(--accent); }

/* ---- Listas de lecciones / ejercicios ---- */
.item-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.item-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 16px;
}
.item-row .title { flex: 1; }
.item-row .title a { color: var(--text); font-weight: 500; }
.item-row .meta { color: var(--text-dim); font-size: 13px; white-space: nowrap; }
.check { color: var(--ok); font-weight: 700; }
.check-empty { color: var(--border); font-weight: 700; }

/* ---- Prosa markdown ---- */
.prose { max-width: 760px; }
.prose h1 { font-size: 28px; margin-bottom: 4px; }
.prose h2 { font-size: 21px; margin-top: 34px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.prose h3 { font-size: 17px; margin-top: 26px; }
.prose code {
  font-family: var(--mono); font-size: 13px;
  background: var(--bg-soft); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 5px;
}
.prose pre {
  background: #171310; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; line-height: 1.5;
}
.prose pre code { background: none; border: none; padding: 0; font-size: 13px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 14px 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 7px 12px; text-align: left; }
.prose th { background: var(--bg-soft); }
.prose blockquote {
  border-left: 3px solid var(--accent); margin: 14px 0; padding: 4px 16px;
  background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--text);
}
.prose blockquote p { margin: 6px 0; }

/* ---- Workspace de práctica ---- */
.workspace { display: grid; grid-template-columns: minmax(380px, 46%) 1fr; gap: 20px; align-items: start; }
.workspace-left { max-height: calc(100vh - 60px); overflow-y: auto; padding-right: 6px; }
.statement { font-size: 14.5px; }
.statement h1 { font-size: 22px; }

.schema-box { margin-top: 18px; }
.schema-box details {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 6px; padding: 6px 12px;
}
.schema-box summary { cursor: pointer; font-family: var(--mono); font-size: 13px; color: var(--accent); }
.schema-box summary .rows { color: var(--text-dim); font-family: inherit; font-size: 12px; }
.schema-cols { margin: 6px 0 4px; font-family: var(--mono); font-size: 12.5px; }
.schema-cols div { display: flex; justify-content: space-between; padding: 1px 0; }
.schema-cols .type { color: var(--text-dim); }

.editor-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.editor-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg-soft);
}
.editor-toolbar .spacer { flex: 1; }
.editor-toolbar .hint-kbd { color: var(--text-dim); font-size: 12px; }
kbd {
  font-family: var(--mono); font-size: 11px; background: var(--bg); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px;
}

.cm-host { font-size: 13.5px; }
.cm-host .cm-scroller { overflow: auto; font-family: var(--mono); }
.editor-fallback {
  width: 100%; min-height: 260px; background: #171310; color: var(--text);
  border: none; padding: 14px; font-family: var(--mono); font-size: 13.5px; resize: vertical;
}

.btn {
  display: inline-block; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-card); color: var(--text); font-size: 13.5px; font-weight: 600;
  padding: 7px 16px; cursor: pointer; font-family: inherit;
}
.btn:hover { border-color: var(--text-dim); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); border-color: var(--accent); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { filter: brightness(1.1); }
.btn-sm { padding: 4px 12px; font-size: 12.5px; }

/* ---- Resultados ---- */
.results { margin-top: 16px; }
.result-status { border-radius: 10px; padding: 12px 16px; font-weight: 600; margin-bottom: 12px; border: 1px solid; }
.result-passed { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.result-failed { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.result-error { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); font-family: var(--mono); font-size: 13px; white-space: pre-wrap; font-weight: 400; }
.result-meta { color: var(--text-dim); font-size: 12.5px; margin-bottom: 8px; }
.compat-notes { color: var(--text-dim); font-size: 12px; margin-top: 8px; }
.compat-notes li { margin: 1px 0; }

.result-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; max-height: 420px; overflow-y: auto; }
.result-table { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.result-table th {
  background: var(--bg-soft); position: sticky; top: 0; text-align: left;
  padding: 8px 12px; border-bottom: 2px solid var(--border); color: var(--accent);
}
.result-table td { padding: 6px 12px; border-bottom: 1px solid var(--border); }
.result-table tr:last-child td { border-bottom: none; }
.result-table td.null { color: var(--text-dim); font-style: italic; }

/* ---- Flashcards / repaso ---- */
.review-stage { max-width: 640px; margin: 40px auto; text-align: center; }
.review-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  padding: 40px 36px; margin: 22px 0; min-height: 180px;
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
  text-align: left;
}
.review-card .front { font-size: 18px; font-weight: 600; }
.review-card .back { border-top: 1px dashed var(--border); padding-top: 16px; margin-top: 8px; }
.review-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.grade-btn { min-width: 110px; }
.grade-otra_vez { border-color: var(--bad); color: var(--bad); }
.grade-dificil { border-color: var(--warn); color: var(--warn); }
.grade-bien { border-color: var(--accent); color: var(--accent); }
.grade-facil { border-color: var(--ok); color: var(--ok); }
.grade-btn small { display: block; font-weight: 400; font-size: 11px; color: var(--text-dim); }
.review-empty { color: var(--text-dim); padding: 60px 0; }
.review-count { color: var(--text-dim); font-size: 13px; }

.flashcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin: 14px 0 28px; }
.flashcard {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; font-size: 14px;
}
.flashcard .front { font-weight: 600; margin-bottom: 8px; }
.flashcard .back { color: var(--text-dim); display: none; border-top: 1px dashed var(--border); padding-top: 8px; }
.flashcard.revealed .back { display: block; }
.flashcard .due { font-size: 11.5px; color: var(--text-dim); margin-top: 8px; }

/* ---- Rouge (resaltado SQL) ---- */
.highlight .k, .highlight .kr, .highlight .kd { color: #ff7b72; font-weight: 600; }
.highlight .nb, .highlight .nf { color: #d2a8ff; }
.highlight .s, .highlight .s1, .highlight .s2 { color: #a5d6ff; }
.highlight .mi, .highlight .mf, .highlight .m { color: #79c0ff; }
.highlight .c, .highlight .c1, .highlight .cm { color: #8b949e; font-style: italic; }
.highlight .o, .highlight .ow { color: #ff7b72; }
.highlight .n { color: #e6e8eb; }
.highlight .p { color: #9aa4af; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .workspace-left { max-height: none; }
}

/* ---- Respuesta escrita + feedback IA ---- */
.answer-form { display: flex; flex-direction: column; gap: 10px; }
.answer-box {
  width: 100%; background: #171310; color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-family: var(--mono); font-size: 13.5px; resize: vertical;
}
.answer-box:focus { outline: none; border-color: var(--accent); }
.answer-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.ia-hint { color: var(--text-dim); font-size: 12.5px; text-align: center; margin: 0; }

.section-label {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 6px;
}
.your-answer { margin-top: 4px; }
.answer-echo {
  background: #171310; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; font-family: var(--mono); font-size: 13px;
  white-space: pre-wrap; margin: 0; color: var(--text);
}

.feedback { border: 1px solid; border-radius: 10px; padding: 12px 16px; font-size: 14px; }
.feedback p { margin: 6px 0 0; }
.fb-correcto { background: var(--ok-soft); border-color: var(--ok); }
.fb-parcial { background: var(--warn-soft); border-color: var(--warn); }
.fb-incorrecto { background: var(--bad-soft); border-color: var(--bad); }
.fb-error { background: var(--bg-soft); border-color: var(--border); color: var(--text-dim); }

.grade-btn.suggested { box-shadow: 0 0 0 2px var(--accent); position: relative; }
.ia-tag {
  display: block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--accent);
}

/* ---- Lectura estilo libro (lecciones) ---- */
.lesson-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.lesson-side { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }

.side-card {
  background: #f7f2e9; color: #2d2a24; border: 1px solid #e5dcc9;
  border-radius: 14px; padding: 18px 18px 14px;
}
.side-card h4 {
  margin: 0 0 4px; font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: 19px; font-weight: 700;
}
.side-card a { color: #2d2a24; }
.side-sub { color: #8a8172; font-size: 12.5px; margin: 0 0 12px; }
.side-sub a { color: #b0562f; }

.chapter-list { display: flex; flex-direction: column; gap: 8px; }
.chapter {
  display: block; background: #fdfaf4; border: 1px solid #e5dcc9; border-radius: 10px;
  padding: 10px 14px; text-decoration: none;
}
.chapter:hover { border-color: #c9bda2; text-decoration: none; }
.chapter.current { background: #f0e2d0; border-color: #d8b894; }
.chapter-num {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: #b0562f;
}
.chapter-title { display: block; font-weight: 600; font-size: 14px; margin: 1px 0; }
.chapter-meta { display: block; font-size: 12px; color: #8a8172; }

.side-toc ul { list-style: none; margin: 0; padding: 0; }
.side-toc > ul > li { margin: 7px 0; font-weight: 600; font-size: 13.5px; }
.side-toc ul ul { padding-left: 14px; }
.side-toc ul ul li { font-weight: 400; margin: 4px 0; font-size: 13px; }
.side-toc a:hover { color: #b0562f; text-decoration: none; }

/* Pane de lectura tipo papel */
.paper {
  background: #fbf7ef; color: #2d2a24; border: 1px solid #e5dcc9;
  border-radius: 16px; padding: 40px 48px 34px; max-width: 850px;
  font-size: 15.5px; line-height: 1.75;
}
.paper h1, .paper h2, .paper h3 {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; color: #211e18;
}
.paper h1 { font-size: 30px; margin-top: 0; }
.paper h2 { border-bottom: 1px solid #e5dcc9; }
.paper a { color: #b0562f; }
/* Los enlaces-botón no heredan el color de enlace del papel */
.paper a.btn-primary, .paper a.btn-ok, body.reading .btn-primary, body.reading .btn-ok { color: #fff; }
.paper a.btn-paper { color: #2d2a24; }
.paper-meta { color: #8a8172; font-size: 13px; margin-top: 2px; }
.paper code { background: #f1e9da; border: 1px solid #e2d7c0; color: #4a3b2a; }
.paper pre { background: #f4eee1; border: 1px solid #e2d7c0; }
.paper pre code { background: none; border: none; color: #2d2a24; }
.paper table th { background: #f1e9da; }
.paper th, .paper td { border-color: #e2d7c0; }
.paper blockquote { background: #f4e9db; border-left-color: #b0562f; color: #2d2a24; }
.paper .check, .paper strong { color: inherit; }
.paper-nav { display: flex; gap: 10px; align-items: center; margin-top: 34px; border-top: 1px solid #e5dcc9; padding-top: 20px; }
.btn-paper { background: #fdfaf4; border-color: #d8cdb4; color: #2d2a24; }
.btn-paper:hover { border-color: #b0562f; }

/* ---- Panel lateral de contenido relacionado en el repaso ---- */
/* Tarjeta anclada a la izquierda y panel pegado a ella (overlay fijo que
   arranca donde termina la tarjeta: sidebar 230 + padding 36 + tarjeta 680 +
   gap 20 ≈ 966px). Crece hacia la derecha, así que el espacio sobrante queda
   en el extremo y la tarjeta jamás se mueve. */
.review-layout .review-stage { margin-left: 0; }
.review-side {
  position: fixed; left: 966px; top: 96px; z-index: 5;
  width: min(280px, calc(100vw - 988px));
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 16px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
.review-side[open] { width: min(800px, calc(100vw - 988px)); }
.review-chat[open] { width: min(560px, calc(100vw - 988px)); display: flex; flex-direction: column; padding-bottom: 0; }
.review-chat .chat-log { height: min(56vh, 520px); text-align: left; }
.review-chat .chat-form { margin: 0 -16px; border-radius: 0 0 12px 12px; }
.review-chat .chat-tools { padding: 8px 0 0; justify-content: space-between; align-items: baseline; }
.review-chat-context { font-size: 11.5px; color: var(--text-dim); }
.source-excerpt.side { font-size: 14px; }
.source-excerpt.side pre { font-size: 12.5px; }
.review-side summary {
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-dim);
  list-style: none;
}
.review-side summary::-webkit-details-marker { display: none; }
.review-side summary:hover { color: var(--text); }
.review-side[open] summary { color: var(--accent); margin-bottom: 6px; }
.source-excerpt.side { max-height: calc(100vh - 220px); }
@media (max-width: 1150px) {
  .review-side, .review-side[open] { position: static; width: auto; margin: 20px auto 0; max-width: 680px; box-shadow: none; }
}

/* ---- Origen de la tarjeta en el repaso ---- */
.source-box { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 10px; text-align: left; }
.source-box summary { cursor: pointer; color: var(--text-dim); font-size: 12.5px; }
.source-box summary:hover { color: var(--text); }
.source-meta { font-size: 13px; color: var(--text-dim); margin: 8px 0 4px; }
.source-excerpt {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px;
  padding: 4px 16px 10px; margin-top: 8px; font-size: 13.5px;
  max-height: 340px; overflow-y: auto;
}
.source-excerpt h2 { font-size: 15px; }
.source-excerpt pre { font-size: 12px; }

/* ---- Blacklist del repaso ---- */
.review-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.review-card-actions { display: flex; align-items: center; gap: 4px; }
.review-suspend {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font: inherit; font-size: 11.5px; padding: 3px 6px; border-radius: 6px;
}
.review-suspend:hover { color: var(--bad); background: var(--bad-soft); }
.flashcard .due.suspended { color: var(--bad); display: flex; align-items: center; gap: 8px; }
.flashcard .due.suspended .review-suspend { color: var(--accent); }
.flashcard .due.suspended .review-suspend:hover { background: var(--accent-soft); }

/* ---- Buscador fuzzy de funciones ---- */
.fn-search { width: 100%; }
.fn-results { overflow-y: auto; padding: 10px 14px 16px; }
.fn-empty { color: var(--text-dim); font-size: 13px; }
.fn-cat {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent); font-weight: 700; margin: 14px 0 4px;
}
.fn-cat:first-child { margin-top: 2px; }
.fn-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 6px 0; background: var(--bg-soft); }
.fn-head { display: flex; align-items: baseline; gap: 8px; }
.fn-name { font-weight: 700; font-size: 13px; color: var(--accent); }
.fn-chip { font-size: 10.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; margin-left: auto; }
.fn-sig { font-family: ui-monospace, "SF Mono", monospace; font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.fn-desc { font-size: 12.5px; margin: 6px 0; color: var(--text); }
.fn-example {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 11.5px; overflow-x: auto; margin: 6px 0;
  font-family: ui-monospace, "SF Mono", monospace; white-space: pre;
}
.fn-insert { font-size: 11px; }

/* ---- Code review de calidad ---- */
.quality-card {
  margin-top: 14px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px;
}
.quality-error { color: var(--bad); border-color: var(--bad); font-size: 13.5px; padding: 12px 16px; }
.quality-loading {
  color: var(--text-dim); font-size: 13.5px; padding: 14px 16px;
  animation: quality-pulse 1.3s ease-in-out infinite;
}
@keyframes quality-pulse { 50% { opacity: 0.45; } }
.quality-bar {
  display: flex; gap: 12px; align-items: center; cursor: pointer; list-style: none;
}
.quality-bar::-webkit-details-marker { display: none; }
.quality-hint { color: var(--text-dim); font-size: 11px; margin-left: auto; }
details[open] > .quality-bar { margin-bottom: 10px; }
.quality-global {
  font-size: 15px; font-weight: 800; padding: 6px 10px; border-radius: 8px; line-height: 1;
  background: var(--accent-soft); color: var(--accent);
}
.quality-global.g5, .quality-global.g4 { background: var(--ok-soft); color: var(--ok); }
.quality-global.g2, .quality-global.g1 { background: var(--bad-soft); color: var(--bad); }
.quality-summary { margin: 4px 0 0; color: var(--text-dim); font-size: 13.5px; }
.quality-grain {
  margin: 8px 0 2px; font-size: 12.5px; color: var(--text-dim);
  background: var(--accent-soft); border-radius: 8px; padding: 6px 10px; display: inline-block;
}
.quality-grain-label { color: var(--accent); font-weight: 700; text-transform: uppercase; font-size: 10.5px; letter-spacing: .05em; }
.quality-grain strong { color: var(--text); }
.quality-dims { display: grid; gap: 10px; }
.quality-dim { border-top: 1px solid var(--border); padding-top: 9px; }
.quality-dim-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.quality-dim-name { font-weight: 600; font-size: 13px; }
.quality-dots { color: var(--accent); letter-spacing: 2px; font-size: 12px; white-space: nowrap; }
.quality-comment { font-size: 13px; color: var(--text-dim); }
.quality-comment p { margin: 4px 0 0; }
.quality-suggestions { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; font-size: 13.5px; }
.quality-suggestions ol { margin: 6px 0 0; padding-left: 20px; }
.quality-improved { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; font-size: 13.5px; }
.quality-improved .prose pre { font-size: 12.5px; max-height: 320px; overflow: auto; margin: 8px 0; }
.quality-suggestions li { margin: 4px 0; }
.quality-suggestions li p { margin: 0; display: inline; }

/* ---- Versiones guardadas y comparación ---- */
.save-bar { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.save-label {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 12.5px; font-family: inherit;
}
.save-label:focus { outline: none; border-color: var(--accent); }
.versions-box {
  margin-top: 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
}
.versions-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin: 0 0 8px; }
.versions-notice { color: var(--ok); font-size: 12.5px; margin: 4px 0 8px; }
.versions-empty { color: var(--text-dim); font-size: 12.5px; margin: 4px 0; }
.version { border-top: 1px solid var(--border); padding: 7px 0; }
.version summary { cursor: pointer; display: flex; gap: 8px; align-items: center; list-style: none; }
.version summary::-webkit-details-marker { display: none; }
.version-label { font-weight: 600; font-size: 13px; flex: 1; }
.version-date { color: var(--text-dim); font-size: 11.5px; }
.version-code .prose pre, .version-code pre { font-size: 11.5px; max-height: 260px; overflow: auto; }
.version-actions { display: flex; gap: 8px; margin: 6px 0 4px; }
.versions-compare { margin-top: 10px; width: 100%; }

.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .compare-grid { grid-template-columns: 1fr; } }
.compare-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.compare-head span { color: var(--text-dim); font-size: 12px; font-weight: 400; }
.compare-head.old { color: var(--bad); }
.compare-head.new { color: var(--ok); }
.diff-block {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 0; overflow-x: auto; font-family: ui-monospace, "SF Mono", monospace; font-size: 12.5px;
}
.diff-line { white-space: pre; padding: 1px 14px; line-height: 1.55; }
.diff-line.del { background: var(--bad-soft); color: #f0b6b3; }
.diff-line.add { background: var(--ok-soft); color: #a9d8b6; }
.diff-sign { display: inline-block; width: 18px; color: var(--text-dim); }
.diff-line.del .diff-sign { color: var(--bad); }
.diff-line.add .diff-sign { color: var(--ok); }
.diff-legend.del { color: var(--bad); }
.diff-legend.add { color: var(--ok); }

/* ---- Tablas requeridas y preview en el workspace ---- */
.tables-needed {
  display: flex; gap: 7px; flex-wrap: wrap; align-items: center;
  margin: 14px 0 0; font-size: 13px; color: var(--text-dim);
}
.table-chip {
  background: var(--accent-soft); color: var(--accent);
  padding: 2px 10px; border-radius: 999px; font-size: 12px;
}
.req-dot { color: var(--accent); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; margin-left: 4px; }
.schema-preview { overflow-x: auto; margin: 8px 0 4px; }
.schema-preview table {
  border-collapse: collapse; font-family: ui-monospace, "SF Mono", monospace;
  font-size: 11px; white-space: nowrap;
}
.schema-preview th, .schema-preview td { border: 1px solid var(--border); padding: 3px 8px; text-align: left; }
.schema-preview th { background: var(--bg-soft); color: var(--text); font-weight: 600; }
.schema-preview td { color: var(--text-dim); }
.null-cell { opacity: .45; font-style: italic; }

/* ---- Botón copiar en bloques de código ---- */
.prose pre { position: relative; }
.code-copy {
  position: absolute; top: 8px; right: 8px;
  font-family: inherit; font-size: 11px; line-height: 1; padding: 5px 9px;
  background: var(--bg-card); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; opacity: 0; transition: opacity .12s; user-select: none;
}
.prose pre:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: var(--text); border-color: var(--accent); }
.code-copy.done { opacity: 1; color: var(--ok); border-color: var(--ok); }
body.reading .code-copy { background: #fdfaf4; border-color: #d8cdb4; color: #8a8172; }
body.reading .code-copy:hover { color: #2d2a24; border-color: #b0562f; }
body.reading .code-copy.done { color: #3e7d52; border-color: #3e7d52; }

/* ---- Quiz de fin de capítulo ---- */
.quiz { margin-top: 38px; border-top: 1px solid #e5dcc9; padding-top: 26px; }
.quiz-title { margin-top: 0; }
.quiz-sub { color: #8a8172; font-size: 13.5px; }
.quiz-q { margin: 26px 0; }
.quiz-qhead {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em;
  color: #b0562f; font-weight: 700; margin-bottom: 6px;
}
.quiz-prompt p { margin: 0 0 10px; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-option {
  display: flex; align-items: baseline; gap: 12px; width: 100%; text-align: left;
  background: #fdfaf4; border: 1px solid #d8cdb4; border-radius: 10px;
  padding: 10px 14px; font: inherit; color: inherit; cursor: pointer; line-height: 1.55;
}
.quiz-option:hover:not(:disabled) { border-color: #b0562f; }
.quiz-option:disabled { cursor: default; }
.quiz-letter { font-weight: 700; color: #8a8172; font-size: 13px; }
.quiz-choice p { margin: 0; display: inline; }
.quiz-option.is-correct { border-color: #3e7d52; background: rgba(88, 168, 110, 0.16); }
.quiz-option.is-correct .quiz-letter { color: #3e7d52; }
.quiz-option.is-wrong { border-color: #b3423d; background: rgba(224, 96, 90, 0.12); }
.quiz-option.is-wrong .quiz-letter { color: #b3423d; }
.quiz-option.is-muted { opacity: .55; }
.quiz-explain {
  margin-top: 10px; border-left: 3px solid #d8cdb4; background: #f4eee0;
  border-radius: 0 10px 10px 0; padding: 10px 16px; font-size: 14.5px;
}
.quiz-explain p { margin: 6px 0 0; }
.quiz-verdict { font-weight: 700; }
.quiz-verdict.ok { color: #3e7d52; }
.quiz-verdict.bad { color: #b3423d; }
.quiz-score {
  margin-top: 24px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #f4eee0; border: 1px solid #d8cdb4; border-radius: 12px;
  padding: 14px 18px; font-weight: 600;
}

/* Rouge sobre fondo claro */
.paper .highlight .k, .paper .highlight .kr, .paper .highlight .kd { color: #a3341f; font-weight: 700; }
.paper .highlight .nb, .paper .highlight .nf { color: #6f42c1; }
.paper .highlight .s, .paper .highlight .s1, .paper .highlight .s2 { color: #1a7f37; }
.paper .highlight .mi, .paper .highlight .mf, .paper .highlight .m { color: #0550ae; }
.paper .highlight .c, .paper .highlight .c1, .paper .highlight .cm { color: #9a8f7c; font-style: italic; }
.paper .highlight .o, .paper .highlight .ow { color: #a3341f; }
.paper .highlight .n { color: #2d2a24; }
.paper .highlight .p { color: #6e6555; }

/* ---- Chat flotante del tutor ---- */
.chat-fab {
  position: fixed; right: 26px; bottom: 26px; width: 54px; height: 54px;
  border-radius: 50%; border: none; background: var(--accent); color: #fff;
  font-size: 24px; cursor: pointer; box-shadow: 0 6px 24px rgba(0,0,0,0.45); z-index: 40;
}
.chat-fab:hover { filter: brightness(1.1); }
.chat-panel {
  position: fixed; right: 26px; bottom: 92px; width: 400px; max-width: calc(100vw - 40px);
  height: 560px; max-height: calc(100vh - 130px);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden; z-index: 40;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
}
.chat-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg-card);
}
.chat-sub { color: var(--text-dim); font-size: 12px; }
.chat-close { background: none; border: none; color: var(--text-dim); font-size: 15px; cursor: pointer; }
.chat-close:hover { color: var(--text); }
.chat-clear { font-size: 13px; opacity: .7; }
.chat-clear:hover { opacity: 1; }
.chat-tools { display: flex; justify-content: flex-end; padding: 8px 10px 0; }
.chat-clear-link {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font: inherit; font-size: 12px; padding: 2px 6px; border-radius: 6px;
}
.chat-clear-link:hover { color: var(--text); background: var(--bg-soft); }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 92%; border-radius: 12px; padding: 9px 13px; font-size: 13.5px; }
.chat-msg .prose { max-width: none; }
.chat-msg .prose p { margin: 4px 0; }
.chat-msg .prose pre { padding: 10px 12px; margin: 8px 0; }
.chat-msg.user { align-self: flex-end; background: var(--accent); color: #fff; }
.chat-msg.user .prose { color: #fff; }
.chat-msg.assistant { align-self: flex-start; background: var(--bg-card); border: 1px solid var(--border); }
.chat-msg.typing { color: var(--text-dim); font-style: italic; }
.chat-msg.error { border-color: var(--bad); color: var(--bad); }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: var(--bg-card); }
.chat-form textarea {
  flex: 1; background: #171310; color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-family: inherit; font-size: 13.5px; resize: none;
}
.chat-form textarea:focus { outline: none; border-color: var(--accent); }

/* ---- Repaso: pulido ---- */
.review-stage { max-width: 680px; }
.review-stage h1 { font-size: 24px; display: flex; align-items: baseline; justify-content: center; gap: 10px; }
.review-card { padding: 30px 32px; gap: 14px; box-shadow: 0 8px 30px rgba(0,0,0,0.35); }
.review-card .front { font-size: 19px; line-height: 1.5; }
.review-card .front p { margin: 0 0 6px; }
.topic-chip {
  align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
  border-radius: 6px; padding: 3px 9px;
}
.review-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 4px; }
.grade-btn { min-width: 0; width: 100%; padding: 9px 6px; }
.grade-btn small { margin-top: 2px; }
.grade-btn.suggested { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: none; }
.grade-btn.suggested small, .grade-btn.suggested .ia-tag { color: rgba(255,255,255,0.85); }
.answer-buttons { justify-content: flex-start; }

@media (max-width: 1100px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-side { position: static; max-height: none; }
  .paper { padding: 26px 22px; }
  .review-actions { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Modo lectura: toda la superficie de contenido en papel ---- */
body.reading .content {
  background: #ece4d4;
  max-width: none;
  min-height: 100vh;
}
body.reading .lesson-layout { max-width: 1200px; margin: 0 auto; }
body.reading .flash {
  background: #e7f0e2; border-color: #3fa060; color: #2c6e43;
}
body.reading .flash-alert { background: #f5e0dd; border-color: #c4453f; color: #a03530; }

/* Cards de papel sobre página de papel: borde más marcado y sombra suave */
body.reading .paper,
body.reading .side-card {
  box-shadow: 0 2px 10px rgba(90, 70, 40, 0.08);
  border-color: #ddd2bc;
}

/* Acento terracota consistente dentro del modo lectura */
body.reading .btn-primary { background: #b0562f; border-color: #b0562f; }
body.reading .btn-primary:hover { filter: brightness(1.08); }
body.reading .btn-ok { background: #3f7d4e; border-color: #3f7d4e; }

/* Chat del tutor en papel */
body.reading .chat-fab { background: #b0562f; box-shadow: 0 6px 20px rgba(90, 70, 40, 0.35); }
body.reading .chat-panel {
  background: #fdfaf4; border-color: #ddd2bc;
  box-shadow: 0 12px 40px rgba(90, 70, 40, 0.3);
}
body.reading .chat-head { background: #f1e9da; border-color: #e2d7c0; color: #2d2a24; }
body.reading .chat-sub { color: #8a8172; }
body.reading .chat-close { color: #8a8172; }
body.reading .chat-close:hover { color: #2d2a24; }
body.reading .chat-msg.assistant { background: #fff; border-color: #e2d7c0; color: #2d2a24; }
body.reading .chat-msg.assistant .prose {
  color: #2d2a24;
  /* Redefine las variables del tema oscuro dentro de la burbuja clara: así
     blockquotes, tablas y demás markdown heredan colores legibles. */
  --text: #2d2a24; --text-dim: #8a8172;
  --border: #e2d7c0; --bg-soft: #f1e9da; --bg-card: #faf6ec;
  --accent-soft: rgba(176, 86, 47, 0.10);
}
body.reading .chat-msg.assistant .prose code { background: #f1e9da; border-color: #e2d7c0; color: #4a3b2a; }
body.reading .chat-msg.assistant .prose pre { background: #f4eee1; border-color: #e2d7c0; }
body.reading .chat-msg.assistant .prose a { color: #b0562f; }
body.reading .chat-msg.user { background: #b0562f; }
body.reading .chat-msg.typing { color: #8a8172; }
body.reading .chat-msg.error { border-color: #c4453f; color: #a03530; }
body.reading .chat-form { background: #f1e9da; border-color: #e2d7c0; }
body.reading .chat-form textarea { background: #fff; color: #2d2a24; border-color: #d8cdb4; }
body.reading .chat-form textarea:focus { border-color: #b0562f; }
body.reading .chat-form .btn-primary { background: #b0562f; border-color: #b0562f; }

/* Rouge claro también dentro del chat en modo lectura */
body.reading .chat-msg.assistant .highlight .k { color: #a3341f; font-weight: 700; }
body.reading .chat-msg.assistant .highlight .s, body.reading .chat-msg.assistant .highlight .s1 { color: #1a7f37; }
body.reading .chat-msg.assistant .highlight .mi, body.reading .chat-msg.assistant .highlight .mf { color: #0550ae; }
body.reading .chat-msg.assistant .highlight .c1, body.reading .chat-msg.assistant .highlight .c { color: #9a8f7c; }
body.reading .chat-msg.assistant .highlight .n { color: #2d2a24; }

/* ---- Pistas del analizador y diagnóstico IA ---- */
.error-hint {
  background: var(--warn-soft); border: 1px solid var(--warn); border-radius: 10px;
  padding: 10px 14px; font-size: 13.5px; margin-top: 10px;
}
.error-hint p { margin: 4px 0; display: inline; }
.error-hint code { background: rgba(0,0,0,0.25); }
.explain-form { margin-top: 10px; }
.explanation {
  background: var(--bg-card); border: 1px solid var(--accent); border-radius: 10px;
  padding: 12px 16px; font-size: 14px; margin-top: 10px;
}
.explanation p { margin: 6px 0; }

/* ---- Chat acoplado al layout de lectura ---- */
/* El bloque de lectura se alinea hacia el menú, sin hueco muerto en medio */
body.reading .lesson-layout { margin: 0; max-width: 1680px; }

.lesson-layout.chat-open { grid-template-columns: 260px minmax(0, 1fr) 460px; }
.lesson-layout.chat-open .chat-fab { display: none; }

.chat-dock { position: sticky; top: 24px; height: calc(100vh - 48px); min-height: 420px; }
.chat-dock .chat-panel {
  position: static; width: 100%; height: 100%; max-width: none; max-height: none;
}

/* En pantallas medianas el panel vuelve a flotar sobre el contenido */
@media (max-width: 1360px) {
  .lesson-layout.chat-open { grid-template-columns: 300px minmax(0, 1fr); }
  .chat-dock {
    position: fixed; right: 20px; bottom: 20px; z-index: 40;
    width: 400px; max-width: calc(100vw - 40px); height: 560px; max-height: calc(100vh - 40px);
  }
  .lesson-layout.chat-open .chat-fab { display: block; }
}
@media (max-width: 1100px) {
  .lesson-layout.chat-open { grid-template-columns: 1fr; }
}

/* ---- Filtros por pista y búsqueda ---- */
.filter-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 16px 0 18px; }
.track-tabs { display: flex; gap: 4px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.track-tab {
  padding: 5px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--text-dim);
}
.track-tab:hover { color: var(--text); text-decoration: none; }
.track-tab.active { background: var(--accent); color: #fff; }
.search-form { flex: 1; min-width: 220px; max-width: 380px; }
.search-input {
  width: 100%; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); padding: 7px 14px; font-size: 13.5px; font-family: inherit;
}
.search-input:focus { outline: none; border-color: var(--accent); }

.badge-track-bigquery { background: var(--accent-soft); color: var(--accent); }
.badge-track-polars { background: rgba(91, 158, 148, 0.16); color: #63b0a6; }

.filter-select {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 7px 12px; font-size: 13.5px; font-family: inherit; cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--accent); }

/* ---- Workspace ancho con panel de documentación ---- */
body.wide .content { max-width: none; }

.cm-host .cm-editor { height: clamp(420px, 52vh, 720px); }

.vim-toggle { opacity: .7; letter-spacing: .03em; }
.vim-toggle.active { opacity: 1; border-color: var(--accent); color: var(--accent); font-weight: 700; }
/* Barra de estado de Vim (modo, comandos :) al pie del editor */
.cm-vim-panel { background: var(--bg-soft); color: var(--text); padding: 2px 10px; font-family: ui-monospace, monospace; }
.cm-vim-panel input { color: var(--text); font-family: inherit; }
.editor-fallback { min-height: 420px; }

.docs-panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
  position: sticky; top: 24px; max-height: calc(100vh - 48px);
}
.docs-head { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.docs-head .section-label { margin-bottom: 8px; }
.docs-select { width: 100%; }
.docs-body { overflow-y: auto; padding: 6px 18px 18px; font-size: 14px; }
.docs-body .prose { max-width: none; }
.docs-body .prose h1 { font-size: 20px; }
.docs-body .prose h2 { font-size: 16.5px; margin-top: 24px; }
.docs-body .prose h3 { font-size: 14.5px; }
.docs-body .prose pre { font-size: 12px; padding: 10px 12px; }
.docs-body .prose table { font-size: 12.5px; }
.docs-body .prose th, .docs-body .prose td { padding: 5px 8px; }

@media (min-width: 1500px) {
  .workspace { grid-template-columns: minmax(340px, 25%) minmax(0, 1fr) minmax(440px, 32%); gap: 24px; }
  .docs-body .prose pre { font-size: 12.5px; }
}
@media (max-width: 1499px) {
  .docs-panel { grid-column: 1 / -1; position: static; max-height: 480px; }
}

/* ---- Scrollbars del tema (finas y oscuras en toda la app) ---- */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
*::-webkit-scrollbar-thumb:hover { background: #4a4136; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-corner { background: transparent; }

body.reading * { scrollbar-color: #d8cdb4 transparent; }
body.reading *::-webkit-scrollbar-thumb { background: #d8cdb4; }
body.reading *::-webkit-scrollbar-thumb:hover { background: #c4b696; }

/* ---- Pestañas del panel del workspace ---- */
.panel-tabs { display: flex; gap: 2px; padding: 8px 10px 0; background: var(--bg-soft); border-bottom: 1px solid var(--border); }
.panel-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-dim); font-size: 13px; font-weight: 600; font-family: inherit;
  padding: 6px 14px 8px; cursor: pointer;
}
.panel-tab:hover { color: var(--text); }
.panel-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.panel-pane { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.tutor-pane .chat-log { flex: 1; min-height: 260px; }
.docs-panel { min-height: 420px; }

/* ---- Acceso privado ---- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-shell { width: min(100%, 430px); }
.auth-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  padding: 34px; box-shadow: 0 24px 80px rgba(0, 0, 0, .32);
}
.auth-card h1 { margin: 2px 0 4px; font-size: 28px; }
.auth-mark { color: var(--accent); font-size: 34px; line-height: 1; }
.auth-card .eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .1em; font-size: 11px; font-weight: 700; margin: 18px 0 0; }
.auth-card .muted { color: var(--text-dim); margin: 0 0 24px; }
.auth-form { display: grid; gap: 16px; }
.auth-form .field { display: grid; gap: 6px; }
.auth-form label { color: var(--text-dim); font-size: 13px; font-weight: 600; }
.auth-form input:not([type="submit"]) {
  width: 100%; background: var(--bg-soft); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 12px; font: inherit;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-submit { width: 100%; margin-top: 4px; }
.logout-button {
  margin-top: 14px; padding: 5px 9px; width: 100%; background: transparent;
  color: var(--text-dim); border: 1px solid var(--border); border-radius: 7px; cursor: pointer;
}
.logout-button:hover { color: var(--text); border-color: var(--text-dim); }
