:root {
  --ink: #17342f;
  --ink-2: #244942;
  --paper: #f5f1e8;
  --paper-2: #fffdf7;
  --line: #d8d2c5;
  --muted: #6e776f;
  --coral: #e46f51;
  --coral-dark: #c84d31;
  --sage: #9ab29f;
  --sun: #eabf62;
  --red: #b64233;
  --yellow: #9a6b12;
  --green: #27745f;
  --shadow: 0 18px 50px rgba(23, 52, 47, .08);
  --radius: 22px;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Songti SC", "STSong", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--paper); color: var(--ink); }
body { margin: 0; min-height: 100vh; font-family: var(--sans); background: radial-gradient(circle at 85% 4%, rgba(234,191,98,.15), transparent 26rem), var(--paper); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid rgba(228,111,81,.45); outline-offset: 3px; }

.site-header { height: 78px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1260px) / 2)); border-bottom: 1px solid rgba(23,52,47,.11); background: rgba(245,241,232,.9); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; letter-spacing: .08em; }
.brand b { display: block; font-size: 13px; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .15em; }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50% 50% 48% 52% / 46% 54% 46% 54%; background: var(--coral); color: #fffaf0; font: italic 700 30px/1 var(--serif); box-shadow: 8px 8px 0 rgba(23,52,47,.08); transform: rotate(-4deg); }
.brand-mark.small { width: 38px; height: 38px; font-size: 20px; box-shadow: 4px 4px 0 rgba(23,52,47,.08); }
.header-actions { display: flex; align-items: center; gap: 14px; }
.role-badge { border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.text-button { border: 0; background: none; color: var(--muted); padding: 8px 0; font-size: 12px; }
.text-button:hover { color: var(--coral-dark); }

.tab-bar { display: flex; gap: 4px; overflow-x: auto; padding: 12px max(24px, calc((100vw - 1260px) / 2)); border-bottom: 1px solid rgba(23,52,47,.1); background: var(--paper); position: sticky; top: 78px; z-index: 18; scrollbar-width: none; }
.tab-bar::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; border: 0; border-radius: 999px; padding: 10px 16px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.tab.active { color: var(--paper-2); background: var(--ink); }
.tab[hidden] { display: none; }

main { width: min(1260px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 90px; }
.view { display: none; animation: enter .28s ease both; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.eyebrow { margin: 0 0 10px; color: var(--coral-dark); font-size: 10px; line-height: 1; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -.025em; }
h2 { margin-bottom: 12px; font-size: clamp(32px, 4.6vw, 58px); line-height: 1.06; }
h3 { margin-bottom: 0; font-size: 20px; letter-spacing: -.02em; }
.hero-copy { max-width: 720px; margin-bottom: 0; color: var(--muted); font-size: 15px; line-height: 1.7; }

.hero-panel { min-height: 250px; display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: center; margin-bottom: 30px; padding: 46px 52px; color: #f9f5ea; border-radius: 32px; background: linear-gradient(135deg, rgba(255,255,255,.04), transparent 55%), var(--ink); position: relative; overflow: hidden; }
.hero-panel::after { content: "7"; position: absolute; right: 165px; top: -70px; color: rgba(255,255,255,.035); font: 330px/1 var(--serif); transform: rotate(8deg); }
.hero-panel .eyebrow { color: var(--sun); }
.hero-panel h2 { max-width: 680px; margin: 0 0 12px; font-size: clamp(34px, 5vw, 64px); }
.hero-panel .hero-copy { color: rgba(255,255,255,.7); }
.day-stamp { width: 134px; height: 134px; display: grid; place-items: center; align-content: center; border: 1px solid rgba(255,255,255,.24); border-radius: 50%; position: relative; z-index: 2; }
.day-stamp span { color: var(--sun); font-size: 9px; font-weight: 800; letter-spacing: .22em; }
.day-stamp strong { font: 52px/1 var(--serif); }
.day-stamp small { margin-top: 6px; color: rgba(255,255,255,.65); font-size: 10px; }

.checkin-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.form-main { display: grid; gap: 20px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,253,247,.86); box-shadow: var(--shadow); }
.task-panel, .evidence-card, .gap-panel, .chart-panel, .mock-panel, .recent-panel, .guide-card { padding: 28px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 24px; }
.panel-heading.compact { margin-bottom: 16px; }
.date-field { width: 170px; color: var(--muted); }
label { display: grid; gap: 7px; color: var(--ink-2); font-size: 11px; font-weight: 750; letter-spacing: .03em; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; background: #fffefa; color: var(--ink); padding: 12px 13px; font-size: 14px; transition: border-color .18s, box-shadow .18s; }
input:focus, select:focus, textarea:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(228,111,81,.12); outline: 0; }
textarea { resize: vertical; line-height: 1.55; }
.task-list { display: grid; gap: 10px; }
.task-item { display: grid; grid-template-columns: auto 36px 1fr auto; gap: 12px; align-items: center; min-height: 58px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: #fffefa; cursor: pointer; }
.task-item:has(input:checked) { border-color: rgba(39,116,95,.48); background: rgba(154,178,159,.12); }
.task-item input { width: 20px; height: 20px; accent-color: var(--green); }
.task-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--paper); color: var(--ink); font-size: 11px; font-weight: 850; }
.task-label { font-size: 13px; line-height: 1.45; font-weight: 650; }
.task-required { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }
.progress-line { height: 5px; margin-top: 18px; overflow: hidden; border-radius: 99px; background: #e8e2d6; }
.progress-line span { display: block; width: 0; height: 100%; background: var(--coral); transition: width .28s ease; }
.helper { margin-bottom: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.subject-chip { align-self: flex-start; border-radius: 999px; padding: 7px 10px; background: var(--ink); color: #fff; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.subject-chip.required { background: var(--coral); }
.speaking-card { border-top: 4px solid var(--coral); }
.vocab-card { border-top: 4px solid var(--sage); }
.copy-row { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.micro-status { color: var(--green); font-size: 11px; }
.parse-result { margin-top: 10px; padding: 11px 13px; border-radius: 10px; background: var(--paper); color: var(--muted); font-size: 11px; }
.parse-result.valid { color: var(--green); background: rgba(39,116,95,.09); }
.parse-result.invalid { color: var(--red); background: rgba(182,66,51,.08); }
.field-grid { display: grid; gap: 15px; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid .wide { grid-column: 1 / -1; }
.checkbox-field { display: flex; flex-direction: row; align-items: center; align-self: end; min-height: 43px; padding: 0 4px; }
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--green); }
.evidence-card.is-disabled { display: none; }

.submit-rail { position: sticky; top: 148px; }
.submit-card { padding: 26px; border-radius: var(--radius); background: var(--ink); color: #f8f4e9; box-shadow: 0 20px 50px rgba(23,52,47,.18); }
.submit-card .eyebrow { color: var(--sun); }
.submit-card h3 { margin-bottom: 20px; }
.check-list { display: grid; gap: 13px; margin: 0 0 24px; padding: 0; list-style: none; }
.check-list li { display: flex; gap: 9px; align-items: center; color: rgba(255,255,255,.58); font-size: 12px; }
.check-list li::before { content: ""; width: 15px; height: 15px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; }
.check-list li.done { color: #fff; }
.check-list li.done::before { content: "✓"; display: grid; place-items: center; border-color: var(--sage); background: var(--sage); color: var(--ink); font-size: 10px; font-weight: 900; }
.button { min-height: 44px; border: 0; border-radius: 12px; padding: 0 18px; font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.button.primary { background: var(--coral); color: white; box-shadow: 0 7px 18px rgba(228,111,81,.2); }
.button.primary:hover { background: var(--coral-dark); }
.button.secondary { border: 1px solid var(--line); background: #fffefa; color: var(--ink); }
.button.secondary:hover { border-color: var(--ink); }
.button.full { width: 100%; }
.small-button { min-height: 36px; padding: 0 13px; font-size: 10px; }
.form-message { min-height: 18px; margin: 10px 0 0; color: var(--sun); font-size: 11px; line-height: 1.5; }
.form-message.error { color: #ffb2a6; }
.form-message.success { color: #b9dfc6; }

.dashboard-head { display: flex; justify-content: space-between; gap: 30px; align-items: end; margin-bottom: 28px; }
.alert-stack { display: grid; gap: 10px; margin-bottom: 18px; }
.alert { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid; border-radius: 14px; font-size: 12px; line-height: 1.5; }
.alert::before { content: "!"; flex: 0 0 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; font-weight: 900; }
.alert.red { border-color: rgba(182,66,51,.35); background: rgba(182,66,51,.08); color: var(--red); }
.alert.red::before { background: var(--red); color: white; }
.alert.yellow { border-color: rgba(154,107,18,.35); background: rgba(234,191,98,.13); color: var(--yellow); }
.alert.yellow::before { background: var(--sun); color: var(--ink); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.metric-card { min-height: 120px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper-2); }
.metric-card span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.metric-card strong { display: block; margin-top: 12px; font: 38px/1 var(--serif); }
.metric-card small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.gap-panel { margin-bottom: 20px; }
.gap-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.gap-card { padding: 18px; border-radius: 16px; background: var(--paper); }
.gap-top { display: flex; justify-content: space-between; align-items: baseline; }
.gap-subject { font-weight: 900; }
.gap-value { font: 28px/1 var(--serif); }
.gap-bar { height: 8px; margin: 17px 0 10px; border-radius: 99px; background: #ded8cc; position: relative; overflow: hidden; }
.gap-bar span { display: block; height: 100%; border-radius: 99px; background: var(--coral); }
.gap-card small { color: var(--muted); font-size: 10px; }
.quality-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.quality-dot.绿 { background: var(--green); }.quality-dot.黄 { background: var(--sun); }.quality-dot.红 { background: var(--red); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 20px; margin-bottom: 20px; }
.chart-panel canvas { width: 100%; min-height: 260px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.chart-legend span::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-right: 5px; vertical-align: middle; background: currentColor; }
.chart-legend .l { color: #2878a8; }.chart-legend .r { color: #27745f; }.chart-legend .w { color: #d28a2d; }.chart-legend .s { color: var(--coral); }.chart-legend .admission { color: var(--red); }.chart-legend .safety { color: var(--green); }.chart-legend .target { color: #777; }
.recent-list { display: grid; gap: 10px; }
.recent-item { display: grid; grid-template-columns: 110px 1fr minmax(220px, .8fr); gap: 16px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fffefa; }
.recent-date strong, .recent-date small { display: block; }.recent-date small { margin-top: 5px; color: var(--muted); font-size: 9px; }
.quality-row { display: flex; flex-wrap: wrap; gap: 7px; }
.quality-pill { padding: 5px 7px; border-radius: 999px; background: var(--paper); font-size: 9px; }
.comment-row { display: flex; gap: 7px; }
.comment-row input { min-width: 0; padding: 9px; }
.comment-row button { min-height: 38px; padding: 0 11px; }

.gate-card { margin-bottom: 20px; padding: 24px 28px; border-radius: 20px; background: var(--ink); color: white; }
.gate-card strong { color: var(--sun); }
.plan-horizon { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; width: min(420px, 100%); margin: 0 0 22px; padding: 5px; border-radius: 14px; background: var(--paper-2); border: 1px solid var(--line); }
.horizon-option { min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; }
.horizon-option.active { background: var(--ink); color: white; }
.vocab-cycle-fields.hidden, #vocabGenericFields.hidden { display: none; }
.vocab-cycle-banner { margin-bottom: 16px; padding: 14px 16px; border-radius: 14px; background: rgba(234,191,98,.16); color: var(--ink); font-size: 13px; line-height: 1.55; }
.vocab-checks { display: grid; gap: 10px; margin-top: 14px; }
.plan-day .round-tag { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 999px; background: rgba(228,111,81,.12); color: var(--coral-dark); font-size: 10px; font-weight: 800; }
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan-day { min-height: 190px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper-2); }
.plan-day.current { border: 2px solid var(--coral); box-shadow: var(--shadow); }
.plan-day.ritual { background: rgba(234,191,98,.12); }
.plan-day-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.plan-day-head strong { font: 24px/1 var(--serif); }
.plan-day-head span { color: var(--muted); font-size: 10px; }
.plan-day h3 { min-height: 42px; font-size: 14px; line-height: 1.45; }
.plan-day ul { display: grid; gap: 7px; margin: 14px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 10px; line-height: 1.4; }
.plan-day li::before { content: "·"; margin-right: 6px; color: var(--coral); }

.guide-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.guide-card { position: relative; overflow: hidden; }
.guide-card.wide-card { grid-column: 1 / -1; }
.guide-number { position: absolute; right: 20px; top: 10px; color: rgba(23,52,47,.06); font: 74px/1 var(--serif); }
.guide-card h3 { margin-bottom: 18px; }
.guide-card p, .guide-card li { color: var(--muted); font-size: 13px; line-height: 1.7; }
.guide-card ol { padding-left: 20px; }
.guide-note { padding: 12px 14px; border-left: 3px solid var(--sun); background: rgba(234,191,98,.1); color: var(--ink-2) !important; }
pre { overflow-x: auto; padding: 16px; border-radius: 12px; background: var(--ink); color: #fff; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; }
.resource-list { display: grid; gap: 0; padding: 0; list-style: none; }
.resource-list li { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.resource-list a { color: var(--ink); font-weight: 750; }
.resource-list span { color: var(--muted); font-size: 10px; }
.band-tables { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.band-table { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.band-table h4 { margin: 0; padding: 12px 14px; background: var(--ink); color: white; font-size: 12px; }
.band-table div { display: grid; grid-template-columns: repeat(6, 1fr); }
.band-table span { padding: 9px 4px; border-right: 1px solid var(--line); border-top: 1px solid var(--line); text-align: center; font-size: 9px; }
.band-table b { display: block; margin-bottom: 3px; color: var(--coral-dark); }
.ritual-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ritual-row div { display: flex; gap: 12px; align-items: center; padding: 18px; border-radius: 14px; background: var(--paper); }
.ritual-row b { flex: 0 0 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--coral); color: white; }
.ritual-row span { font-size: 12px; line-height: 1.5; }

.pin-wall { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(23,52,47,.94); backdrop-filter: blur(12px); }
.pin-wall.hidden { display: none; }
.pin-card { width: min(480px, 100%); padding: 40px; border-radius: 28px; background: var(--paper-2); box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.pin-card .brand-mark { margin-bottom: 28px; }
.pin-card h1 { margin-bottom: 14px; font-size: clamp(34px, 8vw, 50px); line-height: 1.02; }
.pin-copy { margin-bottom: 24px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.role-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 20px; padding: 5px; border-radius: 14px; background: var(--paper); }
.role-option { min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; }
.role-option.active { background: var(--ink); color: white; }
.pin-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 110; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 12px 18px; border-radius: 99px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 12px; transition: .22s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty-state { padding: 30px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; font-size: 12px; }
.start-gate { margin-bottom: 30px; padding: 42px 40px; border-radius: 28px; background: var(--paper-2); box-shadow: var(--shadow); }
.start-gate.hidden { display: none; }
.start-gate h2 { margin: 0 0 12px; font-size: clamp(28px, 4vw, 42px); }
.start-gate .hero-copy { max-width: 520px; margin: 0 0 24px; color: var(--muted); }
.start-gate .button { min-width: 160px; }
#checkinForm.is-gated { display: none; }

@media (max-width: 980px) {
  .checkin-layout, .dashboard-grid { grid-template-columns: 1fr; }
  .submit-rail { position: static; }
  .metric-grid, .gap-grid { grid-template-columns: repeat(2, 1fr); }
  .plan-grid { grid-template-columns: repeat(2, 1fr); }
  .recent-item { grid-template-columns: 90px 1fr; }
  .comment-row { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .site-header { height: 66px; padding: 0 16px; }
  .brand small { display: none; }
  .role-badge { display: none; }
  .tab-bar { top: 66px; padding: 9px 16px; }
  main { width: min(100% - 28px, 1260px); padding-top: 20px; }
  .plan-horizon { width: 100%; }
  .horizon-option { font-size: 11px; padding: 0 6px; }
  .hero-panel { min-height: 270px; grid-template-columns: 1fr; padding: 30px 24px; border-radius: 24px; }
  .hero-panel::after { right: -20px; top: -25px; font-size: 250px; }
  .day-stamp { width: auto; height: auto; display: flex; justify-content: flex-start; gap: 8px; border: 0; border-radius: 0; }
  .day-stamp strong { font-size: 30px; }.day-stamp small { margin: 0; }
  .task-panel, .evidence-card, .gap-panel, .chart-panel, .mock-panel, .recent-panel, .guide-card { padding: 20px; }
  .panel-heading { align-items: flex-start; }
  .task-panel .panel-heading { display: grid; }
  .date-field { width: 100%; }
  .field-grid.three, .field-grid.two { grid-template-columns: 1fr 1fr; }
  .field-grid .wide { grid-column: 1 / -1; }
  .metric-grid, .gap-grid, .guide-grid, .plan-grid, .band-tables, .ritual-row { grid-template-columns: 1fr; }
  .guide-card.wide-card { grid-column: auto; }
  .dashboard-head { display: block; }
  .dashboard-head .button { margin-top: 16px; }
  .recent-item { grid-template-columns: 1fr; }
  .comment-row { grid-column: auto; }
  .pin-card { padding: 30px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
