/* Poema Academy: one small stylesheet, no web fonts (fast on slow connections). */
:root {
  --ink: #1f2430; --muted: #5b6270; --paper: #fbf8f2; --card: #ffffff; --line: #e4ddd0;
  --navy: #1d3557; --navy-2: #274472; --gold: #b08d3c; --wine: #7a2e3a; --green: #2f6b3f;
  --amber: #9a6a00; --red: #a12a2a; --radius: 10px;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--sans); }
h1, h2, h3, h4 { font-family: var(--serif); color: var(--navy); line-height: 1.25; margin: 1.2em 0 .5em; }
h1 { font-size: 2rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.15rem; }
a { color: var(--navy-2); }
p { margin: .6em 0; }
small, .muted { color: var(--muted); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }
[hidden] { display: none !important; }

/* header / footer */
.site-header { background: var(--navy); color: #fff; }
.site-header .wrap { display: flex; align-items: center; gap: 18px; min-height: 60px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-family: var(--serif); font-size: 1.3rem; letter-spacing: .02em; display: flex; align-items: center; gap: 10px; }
.brand .mark { width: 30px; height: 30px; border: 2px solid var(--gold); border-radius: 50%; display: inline-grid; place-items: center; font-size: .95rem; color: var(--gold); }
.site-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.site-nav a { color: #e9eef7; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .95rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; }
.site-nav .cta { background: var(--gold); color: #1b1b1b; font-weight: 600; }
.site-nav .cta:hover { background: #c7a24c; color: #000; }
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 36px; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }

/* hero + sections */
.hero { background: linear-gradient(180deg, #23406a 0%, var(--navy) 100%); color: #f4f1ea; padding: 56px 0 48px; }
.hero h1 { color: #fff; font-size: 2.4rem; margin-top: 0; }
.hero p { font-size: 1.12rem; max-width: 720px; color: #e6e1d6; }
.hero .verse { font-family: var(--serif); font-style: italic; color: #d9c48e; margin-top: 18px; }
.section { padding: 8px 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card h3 { margin-top: 0; }
.editable { border-left: 4px solid var(--gold); background: #fffaf0; padding: 10px 14px; border-radius: 6px; font-size: .92rem; color: #6b5a2c; margin: 14px 0; }
.notice { border: 1px solid var(--line); background: #f4f1ea; border-radius: 8px; padding: 10px 14px; font-size: .93rem; }
.notice.warn { background: #fff6e5; border-color: #ecd29c; }
.notice.error { background: #fdeeee; border-color: #ebb9b9; color: #6d1f1f; }
.notice.ok { background: #edf7ef; border-color: #b9dcc1; color: #234d2e; }

/* buttons + forms */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--navy); background: var(--navy); color: #fff; padding: 9px 16px; border-radius: 8px; font: 600 .95rem var(--sans); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--navy-2); }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.secondary:hover { background: #eef2f8; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1b1b1b; }
.btn.danger { background: #fff; color: var(--red); border-color: #d9a3a3; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
label { display: block; font-weight: 600; font-size: .93rem; margin: 12px 0 4px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
label.check input { margin-top: 4px; flex: none; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfc6b5; border-radius: 7px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #9fb3d6; border-color: var(--navy-2); }
textarea { min-height: 80px; resize: vertical; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 18px 16px; margin: 18px 0; background: #fff; }
legend { font-family: var(--serif); color: var(--navy); font-size: 1.1rem; padding: 0 6px; }
.child { border: 1px dashed #cfc6b5; border-radius: 8px; padding: 4px 14px 12px; margin: 12px 0; background: #fdfbf7; }
.child h4 { margin: 10px 0 0; display: flex; justify-content: space-between; align-items: center; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* tables, chips, progress */
table { width: 100%; border-collapse: collapse; font-size: .93rem; background: #fff; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; background: #faf7f1; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eceff4; color: #3a4252; white-space: nowrap; }
.chip.mastered, .chip.correct, .chip.approved, .chip.reviewed { background: #e3f1e6; color: var(--green); }
.chip.in_progress, .chip.partial, .chip.needs_info, .chip.medium { background: #fff1d6; color: var(--amber); }
.chip.available, .chip.pending, .chip.open { background: #e5ecf8; color: var(--navy-2); }
.chip.locked, .chip.dismissed { background: #efefef; color: #777; }
.chip.incorrect, .chip.declined, .chip.high { background: #fbe4e4; color: var(--red); }
.chip.low { background: #eef2f5; color: #556; }
.bar { height: 10px; background: #ece6da; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #d3b25d); }
.stat { display: flex; gap: 22px; flex-wrap: wrap; margin: 8px 0; }
.stat div { min-width: 90px; }
.stat b { display: block; font-size: 1.3rem; font-family: var(--serif); color: var(--navy); }
.stat span { font-size: .82rem; color: var(--muted); }

/* app layout */
.app-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin: 20px 0 6px; }
.app-head h1 { margin: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 16px 0; }
.tabs button { border: 0; background: none; padding: 10px 14px; font: 600 .95rem var(--sans); color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--gold); }
.tabs .count { background: var(--wine); color: #fff; border-radius: 99px; font-size: .72rem; padding: 1px 7px; margin-left: 4px; }
.units { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.units li { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.units li .n { font-family: var(--serif); color: var(--gold); font-weight: 700; width: 34px; flex: none; }
.units li .t { flex: 1; }
.units li.locked { opacity: .6; }
.units a { text-decoration: none; color: var(--ink); font-weight: 600; }
.units a:hover { color: var(--navy-2); text-decoration: underline; }

/* unit page */
.unit-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); grid-template-areas: "text chat" "mastery chat"; gap: 20px; align-items: start; }
.unit-layout .text-pane { grid-area: text; } .unit-layout .mastery { grid-area: mastery; margin-top: 0; } .unit-layout .chat { grid-area: chat; align-self: start; }
.jump { display: none; }
@media (max-width: 900px) { .unit-layout { grid-template-columns: 1fr; grid-template-areas: "text" "chat" "mastery"; } .jump { display: inline-flex; } }
.text-pane { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 22px 18px; }
.goals { margin: 6px 0 4px; padding-left: 20px; }
.item { border-top: 1px solid var(--line); padding: 14px 0 6px; font-family: var(--serif); font-size: 1.04rem; }
.item:first-of-type { border-top: 0; }
.item h3 { margin: 0 0 6px; font-size: 1.08rem; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.item h3 .cite { font: 400 .8rem var(--sans); color: var(--muted); }
.item .enun { font-style: italic; }
.item details { margin-top: 6px; }
.item summary { cursor: pointer; font: 600 .88rem var(--sans); color: var(--navy-2); }
.item .proof p { margin: .45em 0; }
.item .refs { font: .8rem var(--sans); color: var(--muted); }
.chat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; height: min(78vh, 760px); position: sticky; top: 12px; }
@media (max-width: 900px) { .chat { position: static; height: 70vh; } }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.chat-head h2 { margin: 0; font-size: 1.1rem; }
.chat-note { font-size: .8rem; color: var(--muted); padding: 6px 16px; background: #faf7f1; border-bottom: 1px solid var(--line); }
.msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 9px 13px; border-radius: 12px; font-size: .96rem; white-space: normal; overflow-wrap: anywhere; }
.msg p { margin: .3em 0; }
.msg ul, .msg ol { margin: .3em 0; padding-left: 20px; }
.msg.tutor { background: #f3efe6; align-self: flex-start; border-bottom-left-radius: 4px; font-family: var(--serif); }
.msg.student { background: var(--navy); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.system { align-self: center; background: #fff6e5; color: #6b5a2c; font-size: .86rem; }
.msg .meta { display: block; font: .72rem var(--sans); opacity: .65; margin-top: 4px; }
.msg.thinking { color: var(--muted); font-style: italic; }
.chat form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat textarea { min-height: 56px; height: 56px; max-height: 140px; }
.mastery { margin-top: 20px; }
.q { border-top: 1px solid var(--line); padding: 12px 0; }
.q:first-of-type { border-top: 0; }
.q .prompt { font-weight: 600; }
.q .fb { margin-top: 8px; font-size: .92rem; }
.transcript { max-height: 420px; overflow-y: auto; background: #fcfaf6; border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.transcript .msg { max-width: 92%; }
.flag-badge { color: var(--red); font-weight: 600; font-size: .85rem; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: .92rem; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 90vw; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.pillars { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.pillar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; border-top: 4px solid var(--navy); }
.pillar.foundation { border-top-color: var(--wine); }
.pillar h3 { margin: 0 0 4px; font-size: 1.05rem; }
.pillar ol { padding-left: 18px; margin: 8px 0 0; font-size: .92rem; }
.pillar li { margin: 4px 0; }
.pillar .soon { color: var(--muted); font-size: .8rem; }
.pillar .live { color: var(--green); font-weight: 700; font-size: .8rem; }
.loading { color: var(--muted); font-style: italic; padding: 12px 0; }
@media (max-width: 600px) { h1 { font-size: 1.6rem; } .hero h1 { font-size: 1.9rem; } .site-nav { margin-left: 0; } }
/* small utilities (inline style attributes are blocked by the Content-Security-Policy) */
main.w-560 { max-width: 560px; } main.w-520 { max-width: 520px; } main.w-wide { max-width: 1260px; }
.mt-0 { margin-top: 0; } .mt-4 { margin-top: 4px; } .mt-12 { margin-top: 12px; } .mt-20 { margin-top: 20px; }
.unit-ol { padding-left: 20px; margin: 0; font-size: .95rem; } .h-small { font-size: 1.1rem; } .fs-sm { font-size: .88rem; } .or { margin: 14px 0 6px; }
.mini-transcript { margin: 10px 0 4px; }
.mini-transcript h4 { margin: 0 0 6px; font-size: 1rem; }
tr.collapsed td { color: var(--muted); font-style: italic; }
.pillar .soon, .pillar .live { display: block; }

/* free sample (sample.html) */
.narrow-p { max-width: 72ch; }
.mt-lg { margin-top: 24px; }
.sample-units { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.sample-units li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.sample-units li .u-title { flex: 1 1 260px; font-weight: 600; }
.sample-units li.locked { background: #f7f7f5; color: #777; }
.sample-units li.locked .u-title { font-weight: 500; }
.sample-units li.locked-note { padding: 0; border: 0; background: none; }
.sample-units li.locked-note .notice { flex: 1; margin: 6px 0; }
.hero .actions .btn.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); }
.hero .actions .btn.ghost:hover { background: rgba(255,255,255,.08); }
.unit-ol .live { color: var(--green); font-weight: 700; font-size: .8rem; }
