/* Claude para Contadores · estilos
   Paleta "papel de trabajo": papel cálido, tinta verde contable, ámbar de marcas. */
:root {
  --paper: #f6f3ec;
  --card: #fffdf8;
  --ink: #1d2421;
  --muted: #5d6662;
  --line: #e2ddd1;
  --green: #173f35;
  --green-2: #23604f;
  --green-soft: #e3efe9;
  --amber: #b7791f;
  --amber-soft: #fbf1dc;
  --red: #a63d2f;
  --red-soft: #f8e4e0;
  --blue: #2d5b88;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 36, 33, .06), 0 8px 24px rgba(29, 36, 33, .06);
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: var(--green-2); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; font-family: var(--sans); font-weight: 650; }
code, pre { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
[hidden] { display: none !important; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid transparent; border-radius: 10px; padding: .7rem 1.15rem; font: 600 .95rem/1.2 var(--sans); cursor: pointer; text-decoration: none; transition: transform .08s ease, background .15s ease; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-2); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: #fff; }
.btn.sm { padding: .45rem .8rem; font-size: .85rem; }
.btn.xs { padding: .3rem .6rem; font-size: .78rem; border-radius: 7px; background: var(--green); color: #fff; }
.btn.xs.ghost { background: transparent; color: #e9efe9; border-color: rgba(255,255,255,.25); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: progress; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* Marca */
.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--green); color: #f3efe6; font: 700 18px var(--serif); }
.brand-txt em { font-style: normal; color: var(--green-2); font-family: var(--serif); font-weight: 400; }
.brand.big .brand-mark { width: 44px; height: 44px; font-size: 24px; border-radius: 12px; background: #f3efe6; color: var(--green); }
.brand.big .brand-txt, .brand.big .brand-txt em { color: #f3efe6; font-size: 1.2rem; }
.boot { display: flex; gap: .7rem; align-items: center; justify-content: center; min-height: 100vh; color: var(--muted); }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-brand { background: var(--green); color: #f3efe6; padding: clamp(2rem, 6vw, 5rem); display: flex; flex-direction: column; justify-content: center; gap: 1.5rem; position: relative; overflow: hidden; }
.auth-brand h1 { color: #fff; max-width: 18ch; font-size: clamp(1.8rem, 3.6vw, 2.8rem); }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.auth-points li { padding-left: 1.6rem; position: relative; color: #d6e3dc; }
.auth-points li::before { content: "✓"; position: absolute; left: 0; color: #f0c674; font-weight: 700; }
.auth-points strong { color: #fff; }
.ledger { display: grid; grid-template-columns: 1fr 1fr; max-width: 320px; border-top: 2px solid rgba(255,255,255,.35); font: 500 .9rem var(--mono); color: #cfe0d8; }
.ledger span { padding: .45rem .6rem; border-bottom: 1px solid rgba(255,255,255,.15); }
.ledger span:nth-child(odd) { border-right: 1px solid rgba(255,255,255,.15); }
.ledger span:nth-child(-n+2) { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
.auth-card { padding: clamp(1.5rem, 5vw, 4rem); display: flex; flex-direction: column; justify-content: center; max-width: 480px; width: 100%; margin: 0 auto; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #ebe6da; border-radius: 12px; padding: 4px; margin-bottom: 1.5rem; }
.tabs button { border: 0; background: transparent; padding: .65rem; border-radius: 9px; font: 600 .95rem var(--sans); color: var(--muted); cursor: pointer; }
.tabs button.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
form label, .widget label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 1rem; }
input, select, textarea { display: block; width: 100%; margin-top: .35rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: 400 1rem var(--sans); color: var(--ink); }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-2); box-shadow: 0 0 0 3px var(--green-soft); }
.hint { font-size: .82rem; color: var(--muted); margin: -.3rem 0 1rem; }
.form-error { color: var(--red); font-size: .9rem; min-height: 1.2em; margin: .2rem 0 .8rem; }
.demo-note { margin-top: 1.5rem; font-size: .82rem; color: #7a5a16; background: var(--amber-soft); padding: .7rem .9rem; border-radius: 10px; }

/* Layout */
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(246,243,236,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: .7rem 1.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.topbar-right { display: flex; align-items: center; gap: .6rem; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: .35rem .75rem; font: 600 .82rem var(--sans); cursor: pointer; }
.user { font-size: .85rem; color: var(--muted); padding-left: .4rem; }
.container { max-width: 1120px; margin: 0 auto; padding: 1.8rem 1.2rem 3rem; }
.container.narrow { max-width: 780px; }
.foot { text-align: center; font-size: .8rem; color: var(--muted); padding: 2rem 1rem 3rem; border-top: 1px solid var(--line); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 700; color: var(--amber); margin: 0 0 .3rem; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 56ch; }

/* Dashboard */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 2rem; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: clamp(1.4rem, 4vw, 2.4rem); box-shadow: var(--shadow); margin-bottom: 1.4rem; }
.hero-txt .btn { margin-top: .6rem; }
.ring { --p: 0; flex: none; width: 148px; height: 148px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green-2) calc(var(--p) * 1%), #e8e3d7 0); }
.ring > div { width: 116px; height: 116px; border-radius: 50%; background: var(--card); display: grid; place-content: center; text-align: center; }
.ring strong { font: 700 1.9rem var(--serif); color: var(--green); }
.ring small { color: var(--muted); font-size: .75rem; }
.callout { border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.4rem; display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between; }
.callout.accent { background: var(--amber-soft); border: 1px solid #ecd6a6; }
.certificate { display: flex; gap: 1.2rem; align-items: center; background: linear-gradient(135deg, #fffaf0, #f4ead2); border: 1px solid #e3cf9f; border-radius: 20px; padding: 1.5rem; margin-bottom: 1.4rem; }
.certificate .seal { font-size: 2.6rem; }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.1rem; }
.module { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.module.is-locked { opacity: .72; }
.module-top { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; font-size: .8rem; }
.mnum { color: var(--muted); font-weight: 600; }
.lock { margin-left: auto; color: var(--muted); }
.mdesc { color: var(--muted); font-size: .92rem; margin: 0 0 .8rem; }
.mmeta { font-size: .8rem; color: var(--muted); margin: .4rem 0 .6rem; }
.level { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: .2rem .55rem; border-radius: 999px; }
.level-p { background: var(--green-soft); color: var(--green); }
.level-i { background: #e5edf6; color: var(--blue); }
.level-a { background: var(--amber-soft); color: #8a5a10; }
.bar { height: 6px; background: #ece7db; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--green-2); border-radius: 99px; transition: width .4s ease; }
.lesson-list { list-style: none; padding: 0; margin: .2rem 0 0; border-top: 1px dashed var(--line); }
.lesson-list li { border-bottom: 1px dashed var(--line); }
.lesson-list a, .lesson-list .row { display: grid; grid-template-columns: 28px 1fr auto; gap: .6rem; align-items: center; padding: .6rem .2rem; text-decoration: none; color: var(--ink); font-size: .92rem; }
.lesson-list a:hover { background: #faf7ef; }
.lesson-list .status { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: #efebe1; color: var(--muted); }
.lesson-list li.done .status { background: var(--green); color: #fff; }
.lesson-list li.locked { color: var(--muted); }
.lesson-list li.locked .row { color: #9aa29e; }
.lesson-list .dur { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.quiz-row .lt { font-weight: 700; }
.quiz-row.done .status { background: var(--amber); color: #fff; }

/* Lección */
.back { display: inline-block; margin-bottom: 1rem; text-decoration: none; font-size: .9rem; }
.crumb { font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0 0 .5rem; }
.area-tag { background: var(--green-soft); color: var(--green); padding: .1rem .5rem; border-radius: 6px; font-weight: 600; }
.meta { color: var(--muted); font-size: .9rem; margin: 0 0 1rem; }
.meta .ok { color: var(--green-2); font-weight: 700; }
.goal { background: var(--green-soft); border-left: 4px solid var(--green-2); padding: .9rem 1.1rem; border-radius: 0 10px 10px 0; margin-bottom: 1.6rem; }
.block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; margin-bottom: 1.1rem; box-shadow: var(--shadow); }
.block > h2 { font-size: 1.15rem; margin-bottom: .8rem; }
.essentials { margin: 0; padding-left: 1.2rem; }
.essentials li { margin-bottom: .45rem; }
.downloads { display: grid; gap: .6rem; }
.file { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: center; text-align: left; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; color: inherit; }
.file:hover { border-color: var(--green-2); }
.file small { display: block; color: var(--muted); font-family: var(--mono); font-size: .75rem; }
.ficon { font: 700 .7rem var(--mono); background: var(--amber-soft); color: #8a5a10; border-radius: 6px; padding: .45rem .4rem; }
.dl { font-size: .85rem; font-weight: 700; white-space: nowrap; color: var(--green-2); }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: .9rem; padding: .9rem 0; border-top: 1px dashed var(--line); }
.step:first-child { border-top: 0; padding-top: 0; }
.step-n { width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.step-b p { margin: .1rem 0 .6rem; color: #39423e; }
.step-b > :last-child { margin-bottom: 0; }
.prompt { background: #1f2a26; color: #e9efe9; border-radius: 12px; overflow: hidden; margin-top: .4rem; }
.prompt-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .45rem .6rem .45rem .9rem; background: #18221f; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: #9fb5ab; }
.prompt-head div { display: flex; gap: .35rem; }
.prompt-head .btn.xs { background: #2f7a64; }
.prompt pre { margin: 0; padding: .9rem; white-space: pre-wrap; word-break: break-word; font-size: .84rem; line-height: 1.55; max-height: 380px; overflow: auto; }
.check .q { font-weight: 600; margin-top: 0; }
.opts { display: grid; gap: .5rem; }
.opt { text-align: left; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; cursor: pointer; color: inherit; }
.opt:hover:not(:disabled) { border-color: var(--green-2); }
.opt.right { background: var(--green-soft); border-color: var(--green-2); }
.opt.wrong { background: var(--red-soft); border-color: var(--red); }
.opt:disabled { cursor: default; }
.explain { margin: .8rem 0 0; padding: .7rem .9rem; background: #faf7ef; border-radius: 10px; }
.challenge { border-color: #ecd6a6; background: linear-gradient(#fffdf8, #fffaf0); }
.notes-l { display: block; font-weight: 600; font-size: .9rem; margin-top: .8rem; }
.solution { margin-top: .9rem; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; background: #fff; }
.solution summary { cursor: pointer; font-weight: 600; color: var(--green-2); }
.lesson-nav { display: flex; justify-content: space-between; gap: .8rem; margin-top: 1.5rem; flex-wrap: wrap; }

/* Widgets */
.widget-head { margin-bottom: 1rem; }
.widget-tag { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--blue); background: #e5edf6; padding: .15rem .5rem; border-radius: 6px; margin-bottom: .4rem; }
.pb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.pb-grid .full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; margin: 0 0 1rem; }
legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.chk { display: flex !important; gap: .5rem; align-items: center; font-weight: 400 !important; margin: .3rem 0 !important; }
.chk input { width: auto; margin: 0; }
.map { margin-top: .8rem; }
.map table { width: 100%; border-collapse: collapse; margin-top: .5rem; font-size: .88rem; }
.map td, .map th { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--line); }

/* Test */
.qcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.qcard legend { font-weight: 600; font-size: 1rem; display: flex; gap: .6rem; padding: 0; margin-bottom: .7rem; float: left; width: 100%; }
.qcard legend + * { clear: both; }
.qn { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--amber); color: #fff; display: grid; place-items: center; font-size: .8rem; }
.qopt { display: flex !important; gap: .6rem; align-items: flex-start; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; margin: 0 0 .45rem !important; font-weight: 400 !important; cursor: pointer; background: #fff; }
.qopt:hover { border-color: var(--green-2); }
.qopt input { width: auto; margin: .3rem 0 0; accent-color: var(--green); }
.qopt:has(input:checked) { background: var(--green-soft); border-color: var(--green-2); }
.result { display: flex; gap: 1.4rem; align-items: center; border-radius: 20px; padding: 1.5rem; margin-bottom: 1.1rem; }
.result.pass { background: var(--green-soft); border: 1px solid #b9d6c9; }
.result.fail { background: var(--red-soft); border: 1px solid #e9bdb5; }
.result p { margin: .2rem 0 0; }
.score { flex: none; width: 110px; height: 110px; border-radius: 50%; background: #fff; display: grid; place-content: center; text-align: center; box-shadow: var(--shadow); }
.score strong { font: 700 2.4rem/1 var(--serif); }
.pass .score strong { color: var(--green); }
.fail .score strong { color: var(--red); }
.score small { color: var(--muted); }
.feedback ul { margin-top: 0; }
.review { border-left: 4px solid var(--line); padding: .4rem 0 .4rem .9rem; margin-bottom: 1rem; }
.review.ok { border-color: var(--green-2); }
.review.bad { border-color: var(--red); }
.review p { margin: .15rem 0; }
.rq { font-weight: 600; display: flex; gap: .4rem; }
.mark { font-weight: 800; }
.review.ok .mark { color: var(--green-2); }
.review.bad .mark { color: var(--red); }
.ra { font-size: .92rem; }
.wrong { color: var(--red); text-decoration: line-through; }
.re { font-size: .88rem; color: var(--muted); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 28, 25, .55); display: grid; place-items: center; padding: 1rem; z-index: 50; animation: fade .2s ease; }
.modal { background: var(--card); border-radius: 20px; padding: clamp(1.2rem, 4vw, 2rem); max-width: 760px; width: 100%; max-height: 92vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .7rem; margin: 1rem 0; }
.area-opt { position: relative; display: flex; flex-direction: column; gap: .2rem; padding: 1rem; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; background: #fff; }
.area-opt input { position: absolute; opacity: 0; pointer-events: none; }
.area-opt:has(input:checked) { border-color: var(--green-2); background: var(--green-soft); }
.area-opt:has(input:focus-visible) { outline: 3px solid var(--amber); }
.area-opt .ai { font-size: 1.6rem; }
.area-opt small { color: var(--muted); font-size: .8rem; line-height: 1.4; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: var(--green); color: #fff; padding: .75rem 1.2rem; border-radius: 12px; font-weight: 600; font-size: .92rem; box-shadow: 0 10px 30px rgba(0,0,0,.2); transition: transform .25s ease; z-index: 60; max-width: calc(100% - 2rem); }
#toast.show { transform: translate(-50%, 0); }
#toast.error { background: var(--red); }
@keyframes fade { from { opacity: 0; } }

/* Responsive */
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 2rem 1.4rem; }
  .ledger { display: none; }
}
@media (max-width: 640px) {
  .hero { flex-direction: column-reverse; align-items: flex-start; }
  .ring { width: 110px; height: 110px; }
  .ring > div { width: 86px; height: 86px; }
  .ring strong { font-size: 1.4rem; }
  .modules { grid-template-columns: 1fr; }
  .pb-grid { grid-template-columns: 1fr; }
  .hide-sm, .user { display: none; }
  .result { flex-direction: column; text-align: center; }
  .lesson-nav .btn { flex: 1 1 100%; }
  .prompt-head { flex-wrap: wrap; }
  .block { padding: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
