:root {
  --ink: #25302a;
  --muted: #6b746d;
  --paper: #fbfaf6;
  --canvas: #f1eee6;
  --line: #ddd8cb;
  --sage: #476b58;
  --sage-soft: #dbe6dc;
  --clay: #a9583f;
  --clay-soft: #f2ddd5;
  --blue: #416777;
  --blue-soft: #d9e7eb;
  --sand: #9c7836;
  --sand-soft: #eee4c9;
  --danger: #9b3f3f;
  --danger-soft: #f4dada;
  --shadow: 0 12px 38px rgba(55, 50, 38, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 80% -10%, #faf7ec 0, transparent 34rem), var(--canvas); }
a { color: inherit; }
button, input, select { font: inherit; }

.site-header { max-width: 1240px; margin: 0 auto; padding: 25px 30px 17px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: var(--ink); color: white; font-weight: 800; letter-spacing: -.05em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: -.02em; }
.brand small { color: var(--muted); margin-top: 2px; font-size: 12px; }
.header-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.user-menu { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.user-menu form { margin: 0; }
.logout-button { min-height: 38px; padding: 7px 13px; border-radius: 11px; background: rgba(251, 250, 246, .72); box-shadow: 0 3px 12px rgba(55, 50, 38, .04); }
.logout-button:hover { color: var(--clay); border-color: #d4b3a7; background: var(--clay-soft); }
.logout-button:focus-visible { outline: 3px solid rgba(169, 88, 63, .2); outline-offset: 2px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #5f8a66; box-shadow: 0 0 0 4px #dfe9df; }

.main-nav { max-width: 1180px; margin: 0 auto 22px; padding: 5px; display: flex; gap: 3px; background: rgba(251, 250, 246, .78); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 4px 18px rgba(55, 50, 38, .04); overflow-x: auto; scrollbar-width: none; }
.main-nav a { text-decoration: none; padding: 10px 16px; border-radius: 11px; color: var(--muted); white-space: nowrap; font-size: 14px; font-weight: 650; }
.main-nav a:hover { color: var(--ink); background: #f2efe7; }
.main-nav a.active { color: white; background: var(--ink); }

.page-shell { max-width: 1180px; min-height: calc(100vh - 230px); margin: 0 auto; padding: 24px 0 70px; }
.page-heading, .section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-heading { margin-bottom: 28px; }
.hero-heading { padding: 26px 0 12px; }
.page-heading h1 { margin: 4px 0 8px; max-width: 760px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(36px, 5vw, 58px); line-height: 1.02; letter-spacing: -.035em; font-weight: 500; }
.page-heading p, .profile-heading p { color: var(--muted); margin: 0; }
.eyebrow { color: var(--clay) !important; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 800; }
.count-badge { min-width: 62px; height: 62px; padding: 0 14px; border-radius: 22px; display: grid; place-items: center; background: var(--ink); color: white; font-size: 23px; font-weight: 750; }

.button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 11px; background: var(--paper); color: var(--ink); padding: 9px 16px; text-decoration: none; font-weight: 700; font-size: 14px; cursor: pointer; }
.button:hover { border-color: #bcb5a5; }
.button.primary { background: var(--clay); border-color: var(--clay); color: white; box-shadow: 0 8px 24px rgba(169, 88, 63, .2); }
.button.ghost { background: transparent; }
.text-link, .back-link { color: var(--sage); font-weight: 750; text-decoration: none; }
.back-link { display: inline-block; margin-bottom: 25px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0 54px; }
.metric-card { min-height: 170px; padding: 22px; border: 1px solid transparent; border-radius: 20px; text-decoration: none; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .16s ease; }
.metric-card:hover { transform: translateY(-3px); }
.metric-card span { font-size: 13px; font-weight: 750; }
.metric-card strong { margin: auto 0 0; font-family: Georgia, serif; font-size: 47px; line-height: 1; font-weight: 500; }
.metric-card small { margin-top: 6px; color: rgba(37, 48, 42, .68); }
.accent-sage { background: var(--sage-soft); border-color: #c9dacb; }
.accent-clay { background: var(--clay-soft); border-color: #e9cec4; }
.accent-blue { background: var(--blue-soft); border-color: #c5dce2; }
.accent-sand { background: var(--sand-soft); border-color: #e5d9b9; }
.accent-alert { background: var(--danger-soft); border-color: #ebc4c4; color: #672e2e; }

.section-heading { margin: 38px 0 16px; }
.section-heading.small { margin: 0 0 18px; align-items: flex-start; }
.section-heading h2 { margin: 4px 0 0; font-family: Georgia, serif; font-size: 29px; font-weight: 500; letter-spacing: -.02em; }

.observation-list { display: grid; gap: 13px; }
.compact-list { grid-template-columns: repeat(2, 1fr); }
.observation-card { background: var(--paper); border: 1px solid var(--line); border-radius: 17px; padding: 20px 22px; box-shadow: 0 5px 18px rgba(55, 50, 38, .035); }
.observation-card.withdrawn { opacity: .62; }
.card-meta { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 12px; }
.observation-card h3 { margin: 14px 0 0; }
.observation-text { margin: 15px 0; font-size: 16px; line-height: 1.55; white-space: pre-wrap; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 9px; border-radius: 999px; background: #ece9e0; font-size: 12px; font-weight: 700; text-decoration: none; }
.tag.person { color: #315844; background: #e1ebe2; }
.tag.scope { color: #365b68; background: #e0e9ec; }
.tag.danger { color: #7f3535; background: var(--danger-soft); }
.tag.success { color: #315844; background: var(--sage-soft); }
.tag.neutral { color: var(--muted); }
.byline { color: var(--muted); font-size: 12px; margin-top: 13px; }
.source-details { margin-top: 15px; border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted); font-size: 14px; }
.source-details summary { cursor: pointer; color: var(--sage); font-weight: 750; }
.source-details p { white-space: pre-wrap; line-height: 1.5; }
.source-details h4 { color: var(--ink); margin-bottom: 0; }

.filter-bar { display: flex; align-items: flex-end; gap: 10px; padding: 15px; margin-bottom: 22px; border: 1px solid var(--line); border-radius: 15px; background: rgba(251, 250, 246, .76); }
.filter-bar label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.filter-bar .grow { flex: 1; }
.search-field { flex: 1; max-width: 520px; }
input, select { min-height: 43px; min-width: 0; border: 1px solid #cec8b9; border-radius: 10px; padding: 9px 12px; color: var(--ink); background: white; outline: none; }
input:focus, select:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(71, 107, 88, .13); }
.checkbox { display: flex !important; flex-direction: row; align-items: center; min-height: 43px; padding: 0 8px; white-space: nowrap; }
.checkbox input { min-height: 0; }

.child-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.child-card { min-height: 87px; display: flex; align-items: center; gap: 14px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); text-decoration: none; box-shadow: 0 4px 15px rgba(55, 50, 38, .03); }
.child-card:hover { border-color: #b9b1a0; }
.avatar, .profile-avatar { display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--sage-soft); color: var(--sage); font-family: Georgia, serif; font-size: 23px; }
.avatar { width: 52px; height: 52px; }
.child-card-body { flex: 1; min-width: 0; }
.child-card-body strong, .child-card-body small { display: block; }
.child-card-body strong { font-size: 16px; }
.child-card-body small { color: var(--muted); margin-top: 5px; }
.arrow { color: var(--sage); font-size: 20px; }

.profile-heading { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; }
.profile-avatar { width: 78px; height: 78px; font-size: 36px; }
.profile-heading h1 { font-family: Georgia, serif; font-size: 42px; font-weight: 500; margin: 4px 0; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel { border: 1px solid var(--line); border-radius: 17px; background: var(--paper); padding: 21px; box-shadow: 0 5px 20px rgba(55, 50, 38, .035); }
.timeline { display: grid; gap: 16px; }
.timeline-row { position: relative; display: flex; gap: 12px; }
.timeline-dot { margin-top: 5px; width: 11px; height: 11px; border: 3px solid var(--sage); border-radius: 50%; flex: 0 0 auto; }
.timeline-row p, .timeline-row small { margin: 3px 0 0; color: var(--muted); display: block; }
.stack-list { display: grid; gap: 10px; }
.stack-list > div { padding: 11px 12px; border-radius: 10px; background: #f1efe8; }
.stack-list strong, .stack-list small { display: block; }
.stack-list small { color: var(--muted); margin-top: 4px; }
.muted { color: var(--muted); }

.progress-list { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; background: var(--paper); }
.progress-row { min-height: 62px; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 12px 17px; border-bottom: 1px solid var(--line); }
.progress-row:last-child { border-bottom: 0; }
.progress-row small { display: block; color: var(--muted); margin-top: 4px; }
.progress-pill { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: #e8e5dc; color: var(--muted); white-space: nowrap; font-size: 11px; font-weight: 800; }
.status-presented { background: var(--blue-soft); color: var(--blue); }
.status-in_progress { background: var(--sand-soft); color: #75591f; }
.status-mastered { background: var(--sage-soft); color: var(--sage); }

.notice, .attention-panel { margin: 14px 0; border-radius: 13px; padding: 14px 17px; }
.notice { background: var(--sage-soft); color: #315844; }
.attention-panel { background: var(--sand-soft); border: 1px solid #dfd0a9; }
.attention-panel p { margin: 5px 0 0; color: #745d2f; }
.curriculum-filter select { min-width: 310px; }
.curriculum-tree { padding: 12px; }
.topic-level { list-style: none; margin: 0; padding: 0; }
.topic-level .topic-level { margin: 4px 0 7px 18px; padding-left: 12px; border-left: 1px solid var(--line); }
.topic-level details > summary, .topic-leaf { min-height: 41px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 9px; border-radius: 8px; }
.topic-level details > summary { cursor: pointer; font-weight: 750; }
.topic-level details > summary:hover, .topic-leaf:hover { background: #f0eee7; }
.topic-level details > summary::marker { color: var(--sage); }
.level-0 > li > details > summary { min-height: 50px; font-family: Georgia, serif; font-size: 20px; }
.topic-count { min-width: 25px; padding: 3px 7px; text-align: center; border-radius: 999px; background: #e9e6de; color: var(--muted); font: 700 11px Inter, sans-serif; }
.topic-leaf { font-size: 14px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 12px 15px; color: var(--muted); background: #eeece5; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
td { padding: 14px 15px; border-top: 1px solid var(--line); vertical-align: top; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.nowrap { white-space: nowrap; }
.summary-cell { max-width: 440px; line-height: 1.4; }
.error-cell { max-width: 420px; color: var(--muted); overflow-wrap: anywhere; }
.empty-cell { padding: 30px; text-align: center; color: var(--muted); }
.job-status { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: #e6e4dd; font-size: 11px; font-weight: 800; white-space: nowrap; }
.job-pending { background: var(--sand-soft); color: #75591f; }
.job-running { background: var(--blue-soft); color: var(--blue); }
.job-succeeded { background: var(--sage-soft); color: var(--sage); }
.job-failed { background: var(--danger-soft); color: var(--danger); }
.status-tabs { display: flex; gap: 5px; margin-bottom: 13px; overflow-x: auto; }
.status-tabs a { padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--muted); background: rgba(251,250,246,.7); border: 1px solid var(--line); white-space: nowrap; font-size: 13px; font-weight: 700; }
.status-tabs a.active { color: white; background: var(--ink); border-color: var(--ink); }

.empty-state { padding: 34px; border: 1px dashed #c9c2b3; border-radius: 14px; text-align: center; color: var(--muted); background: rgba(251,250,246,.45); }
.empty-state.wide { grid-column: 1 / -1; }
.site-footer { max-width: 1180px; margin: 0 auto; padding: 22px 0 35px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 12px; }

.auth-body { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-shell { width: min(100%, 480px); margin: auto; }
.auth-brand { width: fit-content; margin: 0 auto 20px; }
.auth-card { padding: 34px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.auth-card h1 { margin: 5px 0 12px; font-family: Georgia, serif; font-size: 36px; line-height: 1.08; font-weight: 500; letter-spacing: -.03em; }
.auth-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.5; }
.auth-form { display: grid; gap: 16px; margin: 24px 0 16px; }
.auth-form label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 750; }
.auth-form input { width: 100%; min-height: 50px; font-size: 16px; }
.auth-form .button { min-height: 50px; }
.code-input { text-align: center; font-size: 28px !important; font-weight: 750; letter-spacing: .22em; font-variant-numeric: tabular-nums; }
.auth-note { display: block; color: var(--muted); line-height: 1.45; }
.auth-back { display: inline-block; color: var(--sage); text-decoration: none; font-size: 14px; font-weight: 700; }
.form-error, .auth-warning { margin-top: 17px; padding: 12px 14px; border-radius: 11px; }
.form-error { color: var(--danger); background: var(--danger-soft); }
.auth-warning { color: #75591f; background: var(--sand-soft); }

@media (max-width: 1220px) {
  .main-nav, .page-shell, .site-footer { margin-left: 20px; margin-right: 20px; }
}
@media (max-width: 820px) {
  .site-header { padding: 18px 16px 12px; }
  .header-meta { display: none; }
  .user-menu > span { display: none; }
  .main-nav { margin: 0 12px 10px; border-radius: 13px; }
  .main-nav a { padding: 9px 12px; }
  .page-shell { margin: 0 14px; padding-top: 20px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 39px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); margin-bottom: 40px; }
  .metric-card { min-height: 145px; }
  .compact-list, .two-column { grid-template-columns: 1fr; }
  .filter-bar.multi { flex-wrap: wrap; }
  .filter-bar.multi .search-field { flex-basis: 100%; max-width: none; }
  .site-footer { margin: 0 14px; }
}
@media (max-width: 560px) {
  .brand small { display: none; }
  .page-heading, .section-heading { gap: 12px; }
  .hero-heading { display: block; }
  .hero-heading .button { margin-top: 18px; width: 100%; }
  .metric-grid { gap: 9px; }
  .metric-card { min-height: 132px; padding: 16px; border-radius: 16px; }
  .metric-card strong { font-size: 39px; }
  .child-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .search-field, .filter-bar .grow { flex-basis: 100%; max-width: none; }
  .filter-bar .button { flex: 1; }
  .count-badge { min-width: 50px; height: 50px; border-radius: 17px; font-size: 19px; }
  .observation-card { padding: 17px; }
  .card-meta { display: grid; gap: 5px; }
  .profile-heading { gap: 13px; }
  .profile-avatar { width: 58px; height: 58px; font-size: 28px; }
  .profile-heading h1 { font-size: 32px; }
  .progress-row { align-items: flex-start; }
  .curriculum-filter select { min-width: 0; width: 100%; }
  .curriculum-tree { padding: 6px; }
  .topic-level .topic-level { margin-left: 8px; padding-left: 6px; }
  .topic-leaf { align-items: flex-start; }
  .site-footer { display: grid; }
  .auth-body { padding: 14px; }
  .auth-card { padding: 25px 20px; border-radius: 19px; }
  .auth-card h1 { font-size: 32px; }
}
