/* RamoListo — estilos compartidos */
:root {
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f6fb;
  --card: #ffffff;
  --soft: #f1f2f9;
  --accent: #4f46e5;
  --accent-2: #4338ca;
  --accent-ink: #ffffff;
  --accent-soft: #e0e7ff;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .05), 0 10px 30px rgba(17, 24, 39, .07);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e5e7eb; --ink-2: #d1d5db; --muted: #9ca3af; --line: #2a3142;
    --bg: #0d111c; --card: #151a28; --soft: #1c2234;
    --accent: #818cf8; --accent-2: #a5b4fc; --accent-ink: #111827; --accent-soft: #272d55;
    --ok: #86efac; --ok-bg: #0f2e1a; --bad: #fca5a5; --bad-bg: #3a1414; --warn: #fcd34d; --warn-bg: #362a0b;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; font-size: 16px; }
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 54px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.12rem; letter-spacing: -.01em; white-space: nowrap; }
.brand b { color: var(--accent); }
.brand-mark { width: 28px; height: 28px; flex: none; }
.main-nav { display: flex; gap: 4px; }
.main-nav a { text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .9rem; padding: 7px 11px; border-radius: 999px; white-space: nowrap; }
.main-nav a:hover { background: var(--soft); }
.main-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-2); }
@media (max-width: 400px) { .main-nav a { padding: 6px 8px; font-size: .84rem; } .brand span { font-size: 1rem; } }

/* Hero (compacto: la herramienta va arriba) */
.hero { padding: 16px 16px 10px; }
.hero h1 { font-size: clamp(1.35rem, 4.4vw, 2.1rem); letter-spacing: -.02em; margin-bottom: .2em; }
.lede { margin: 0; color: var(--ink-2); font-size: clamp(.9rem, 2vw, 1rem); }

/* Tarjeta de la herramienta */
.tool-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 14px; }
@media (min-width: 760px) { .tool-card { padding: 22px; } }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--soft); padding: 5px; border-radius: 14px; margin-bottom: 14px; }
.tab { border: none; background: transparent; border-radius: 10px; padding: 9px 8px; font-weight: 700; font-size: .88rem; cursor: pointer; color: var(--ink-2); line-height: 1.25; }
.tab[aria-selected="true"] { background: var(--card); color: var(--accent-2); box-shadow: 0 1px 4px rgba(17,24,39,.1); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .label { font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.input, .field input, .field select {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 11px; background: var(--card); font-size: 1rem; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.is-invalid, .field input.is-invalid { border-color: var(--bad); background: var(--bad-bg); }
.hint { margin: 0; font-size: .8rem; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 480px) { .grid3 { grid-template-columns: 1fr 1fr; } .grid3 > .span-all-sm { grid-column: 1 / -1; } }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 11px; padding: 10px 15px; font-weight: 700; font-size: .92rem; cursor: pointer; border: 1.5px solid transparent; text-decoration: none; transition: transform .08s, background .15s, border-color .15s; line-height: 1.2; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-2); }
.btn-soft { background: var(--accent-soft); color: var(--accent-2); }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--line); }
.btn-sm { padding: 7px 11px; font-size: .84rem; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; height: 42px; padding: 0; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; font-size: 1.1rem; flex: none; }
.btn-icon:hover { color: var(--bad); border-color: var(--bad); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Resultado */
.result { border-radius: 16px; padding: 14px 16px; background: var(--soft); border: 1.5px solid var(--line); }
.result.is-ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.result.is-bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.result.is-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.result-label { font-size: .8rem; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.result-big { font-size: clamp(2.4rem, 9vw, 3.2rem); font-weight: 800; line-height: 1; letter-spacing: -.03em; margin: 4px 0; }
.is-ok .result-big, .is-ok .badge { color: var(--ok); }
.is-bad .result-big, .is-bad .badge { color: var(--bad); }
.is-warn .result-big { color: var(--warn); }
.result-msg { margin: 0; font-size: .92rem; color: var(--ink-2); }
.badge { display: inline-block; font-weight: 800; font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: var(--card); margin-left: 6px; vertical-align: middle; }

.copied { font-size: .84rem; color: var(--ok); font-weight: 700; }
.privacy { text-align: center; font-size: .86rem; color: var(--ink-2); margin: 12px 0 0; }

/* Anuncios (solo huecos) */
.ad-slot { display: grid; place-items: center; border: 2px dashed #c7cbd6; border-radius: 12px; color: #9aa1b1;
  background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(148,163,184,.08) 10px 20px); }
.ad-slot span { font-size: .76rem; font-weight: 800; letter-spacing: .2em; }
.ad-leaderboard { min-height: 90px; max-width: 970px; margin: 24px auto 0; }
.ad-incontent { min-height: 250px; max-width: 728px; margin: 34px auto 0; }
.ad-box { width: 300px; max-width: 100%; height: 250px; margin: 12px auto 14px; }
.ad-mini { width: 100%; height: 90px; }
.ad-modal { position: fixed; border: none; border-radius: 18px; padding: 22px 18px 16px; width: min(360px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.35); text-align: center; }
.ad-modal::backdrop { background: rgba(17, 24, 39, .55); }
.ad-modal-title { margin: 0 26px 0 0; font-weight: 800; }
.ad-close { position: absolute; top: 8px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--soft); font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--ink); }
.ad-toast { position: fixed; right: 12px; bottom: 12px; width: 300px; max-width: calc(100vw - 24px); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 26px 10px 10px; box-shadow: var(--shadow); z-index: 40; animation: toast-in .35s ease-out; }
.ad-toast .ad-close { top: 2px; right: 4px; width: 26px; height: 26px; font-size: 1.05rem; }
@keyframes toast-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Secciones de contenido */
.section { padding-top: 46px; }
.section > h2 { font-size: clamp(1.25rem, 3.4vw, 1.7rem); letter-spacing: -.01em; margin-bottom: 18px; }
.steps3 { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); counter-reset: s; }
.steps3 li, .cases article, .more a { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.steps3 li::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-2); font-weight: 800; margin-bottom: 10px; }
.steps3 h3, .cases h3 { font-size: 1.02rem; }
.steps3 p, .cases p { margin: 0; color: var(--ink-2); font-size: .93rem; }
.cases { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.case-ico { font-size: 1.6rem; display: block; margin-bottom: 6px; }
@media (max-width: 760px) { .steps3 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .cases { grid-template-columns: 1fr; } }
.prose { max-width: 780px; }
.prose p, .prose li { color: var(--ink-2); }
.formula { background: var(--soft); border-radius: 12px; padding: 12px 14px; font-weight: 700; overflow-x: auto; }
.faq { display: flex; flex-direction: column; gap: 10px; max-width: 820px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 0 16px; }
.faq summary { cursor: pointer; font-weight: 700; padding: 14px 26px 14px 0; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: 10px; font-size: 1.4rem; color: var(--accent); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 14px; color: var(--ink-2); }
.more { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.more a { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); transition: border-color .15s; }
.more a:hover { border-color: var(--accent); }
.more .more-ico { font-size: 1.8rem; }
.more b { display: block; } .more small { color: var(--muted); }
.more a[aria-current="page"] { opacity: .6; pointer-events: none; }
@media (max-width: 560px) { .more { grid-template-columns: 1fr; } }

.site-footer { margin-top: 56px; padding: 24px 0 110px; border-top: 1px solid var(--line); background: var(--card); font-size: .86rem; color: var(--muted); }
.footer-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.footer-row p { margin: 0; }
.footer-row nav { display: flex; flex-wrap: wrap; gap: 14px; }
.footer-row a { color: var(--ink-2); }
.legal { max-width: 760px; padding-top: 26px; }
.legal p, .legal li { color: var(--ink-2); }

/* ============ Calculadora de notas ============ */
.notas-layout { display: grid; gap: 14px; }
@media (min-width: 860px) { .notas-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }
.ramo-row { display: flex; gap: 8px; align-items: end; margin-bottom: 10px; }
.ramo-row .field { flex: 1; }
.rows-head, .grade-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(64px, .8fr) minmax(64px, .8fr) 38px; gap: 8px; align-items: center; }
.rows-head { font-size: .76rem; font-weight: 700; color: var(--muted); padding: 0 2px 4px; }
.grade-row { margin-bottom: 8px; }
.grade-row .input { padding: 10px 10px; }
.grade-row .in-nota, .grade-row .in-pct { text-align: center; font-weight: 700; }
.pct-wrap { position: relative; }
.pct-wrap .input { padding-right: 24px; }
.pct-wrap::after { content: "%"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; font-size: .9rem; pointer-events: none; }
.sumbar { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: .84rem; color: var(--ink-2); margin: 4px 0 12px; flex-wrap: wrap; }
.sum-pill { font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--soft); }
.sum-pill.ok { background: var(--ok-bg); color: var(--ok); }
.sum-pill.bad { background: var(--bad-bg); color: var(--bad); }
.sum-pill.warn { background: var(--warn-bg); color: var(--warn); }
.side { display: flex; flex-direction: column; gap: 12px; }
.inline-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .86rem; font-weight: 700; color: var(--ink-2); }
.inline-field input { width: 84px; text-align: center; font-weight: 700; padding: 8px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); }
.saved { display: flex; flex-direction: column; gap: 6px; }
.saved-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); }
.saved-item button.load { flex: 1; text-align: left; background: none; border: none; cursor: pointer; padding: 0; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-item .avg { font-weight: 800; font-size: .9rem; }
.saved-item .avg.ok { color: var(--ok); } .saved-item .avg.bad { color: var(--bad); }
.saved-item .del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.05rem; }
.saved-empty { font-size: .84rem; color: var(--muted); margin: 0; }
.exam-table { width: 100%; border-collapse: collapse; font-size: .84rem; margin-top: 10px; }
.exam-table th, .exam-table td { padding: 5px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.exam-table td.ok { color: var(--ok); font-weight: 700; } .exam-table td.bad { color: var(--bad); }
.exam-table tr.hl { background: var(--accent-soft); }

/* ============ Citas APA ============ */
.apa-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.apa-layout > *, .notas-layout > *, .form-stack > *, .grid2 > *, .grid3 > * { min-width: 0; }
@media (min-width: 900px) { .apa-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.types { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: thin; }
.type { flex: none; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 12px; font-weight: 700; font-size: .85rem; cursor: pointer; white-space: nowrap; }
.type[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.form-stack { display: flex; flex-direction: column; gap: 10px; }
.author { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 38px; gap: 8px; align-items: end; }
.author.is-group { grid-template-columns: minmax(0, 1fr) 38px; }
.author-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.check { display: inline-flex; gap: 7px; align-items: center; font-size: .84rem; color: var(--ink-2); cursor: pointer; font-weight: 600; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.output { position: sticky; top: 66px; display: flex; flex-direction: column; gap: 12px; }
.out-box { background: var(--soft); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.out-box h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin-bottom: 8px; }
.ref { font-family: "Times New Roman", Times, Georgia, serif; font-size: 1.05rem; line-height: 1.7; padding-left: 2.2em; text-indent: -2.2em; margin: 0 0 10px; overflow-wrap: anywhere; color: var(--ink); }
.ref.placeholder { color: var(--muted); font-family: var(--font); font-size: .9rem; text-indent: 0; padding-left: 0; }
.cite-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--line); }
.cite-row:first-of-type { border-top: none; }
.cite-row small { display: block; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cite-row span.cite { font-family: "Times New Roman", Times, Georgia, serif; font-size: 1.02rem; overflow-wrap: anywhere; }
.biblio-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; }
.biblio-list li { display: flex; gap: 6px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 8px 8px 10px; }
.biblio-list .ref { margin: 0; flex: 1; font-size: .95rem; }
.biblio-list .del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.05rem; flex: none; }
.warn-line { font-size: .8rem; color: var(--warn); background: var(--warn-bg); padding: 6px 10px; border-radius: 9px; margin: 0 0 8px; }
