:root {
  --paper: #f4f2ed;
  --surface: #fffdf9;
  --ink: #17231c;
  --muted: #6e756e;
  --line: #d9ddd5;
  --green: #284d3b;
  --green-soft: #e3ece6;
  --gold: #b18447;
  --shadow: 0 24px 70px rgba(28, 42, 34, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Aptos", "Microsoft YaHei", "PingFang SC", sans-serif;
  line-height: 1.65;
}

button, select, textarea, input { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1380px;
  margin: 0 auto;
  padding: 22px 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 25px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-family: sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.topbar-actions, .toolbar-actions, .home-footer-note {
  display: flex;
  align-items: center;
  gap: 18px;
}

.source-note, .draft-badge {
  color: var(--muted);
  font-size: 13px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

.text-button:hover { color: var(--green); }

main { max-width: 1380px; margin: 0 auto; padding: 28px 32px 70px; }

.home-view { max-width: 1080px; margin: 0 auto; padding-top: 8vh; }
.home-intro { max-width: 740px; margin-bottom: 50px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 18px;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(38px, 5vw, 72px);
  font-weight: 400;
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 30px;
  font-weight: 400;
  line-height: 1.2;
}

h3 { margin-bottom: 8px; font-size: 17px; }
.intro-copy { max-width: 560px; color: var(--muted); font-size: 17px; }

.selector-panel {
  padding: 30px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.8);
  box-shadow: var(--shadow);
}

.panel-heading, .content-toolbar, .unit-header, .modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.status-dot {
  width: 9px;
  height: 9px;
  margin-top: 7px;
  border-radius: 50%;
  background: #6b9d7e;
}

.selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  gap: 15px;
  margin-top: 30px;
}

.field, .lesson-select { display: grid; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
select, textarea, input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

select { min-height: 48px; padding: 0 14px; }
select:focus, textarea:focus, input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(40, 77, 59, 0.1); }
select:disabled { color: #a8aea7; background: #f4f4f0; cursor: not-allowed; }

.selection-hint { min-height: 26px; margin: 14px 0 18px; color: var(--muted); font-size: 13px; }
.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 19px;
  border: 1px solid var(--green);
  border-radius: 0;
  font-size: 13px;
  font-weight: 700;
}

.primary-button { background: var(--green); color: #fff; }
.primary-button:hover { background: #1c3c2c; }
.primary-button:disabled { border-color: #bec8c0; background: #bec8c0; cursor: not-allowed; }
.secondary-button { background: transparent; color: var(--green); }
.secondary-button:hover { background: var(--green-soft); }
.primary-button.small, .secondary-button { min-height: 40px; }
.full { width: 100%; }

.home-footer-note { justify-content: space-between; margin-top: 22px; color: var(--muted); font-size: 12px; }
.is-hidden { display: none !important; }

.unit-header { align-items: center; padding: 18px 0 34px; border-bottom: 1px solid var(--line); }
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.back-button:hover { color: var(--green); }
.unit-heading { flex: 1; text-align: center; }
.unit-heading h1 { margin-bottom: 7px; font-size: clamp(32px, 4vw, 54px); }
.unit-heading p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.draft-badge { padding: 7px 10px; border: 1px solid var(--line); background: var(--surface); }

.section-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 700px;
  margin: 34px auto 44px;
  border-bottom: 1px solid var(--line);
}

.section-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 15px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}
.section-tab span { color: var(--gold); font-size: 11px; }
.section-tab.is-active { border-bottom-color: var(--green); color: var(--green); }

.content-toolbar { align-items: flex-end; margin-bottom: 26px; }
.design-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 30px; }
.outline-panel { border-right: 1px solid var(--line); padding-right: 22px; }
.outline-item {
  display: block;
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid rgba(217, 221, 213, 0.7);
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 13px;
}
.outline-item.is-active { color: var(--green); font-weight: 700; }
.document-panel {
  min-height: 530px;
  padding: 34px 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 14px 45px rgba(28, 42, 34, 0.04);
}

.document-panel h3 { margin: 0 0 18px; font-family: Georgia, "Songti SC", serif; font-size: 25px; font-weight: 400; }
.document-panel h4 { margin: 28px 0 10px; color: var(--green); font-size: 14px; }
.document-panel p { margin-bottom: 12px; color: #4c564e; }
.reference-document h3 { margin-bottom: 24px; }
.reference-paragraph {
  white-space: pre-wrap;
  color: #2e352f;
  line-height: 1.75;
}
.reference-empty { min-height: 10px; }
.reference-table {
  width: 100%;
  margin: 18px 0 24px;
  border-collapse: collapse;
  color: #2e352f;
  font-size: 13px;
}
.reference-table td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  vertical-align: top;
  white-space: pre-wrap;
}
.lesson-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 6px 0 24px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.lesson-meta strong { color: #4c564e; }
.document-panel ul, .document-panel ol { margin: 10px 0 18px; padding-left: 22px; color: #4c564e; }
.document-panel li { margin-bottom: 7px; }
.content-block { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.content-block + .content-block { padding-top: 26px; }
.muted-box { padding: 16px; background: #f0f3ee; color: var(--muted); font-size: 13px; }
.locked-note {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 24px;
  padding: 12px 14px;
  border-left: 3px solid var(--gold);
  background: #f8f5ea;
  color: var(--muted);
  font-size: 13px;
}
.locked-note strong { color: var(--green); }
.editable {
  min-height: 120px;
  padding: 14px;
  line-height: 1.7;
  resize: vertical;
}
.step-list { display: grid; gap: 16px; }
.step-item { padding: 16px; background: #f5f7f3; border-left: 2px solid var(--green); }
.step-item strong { display: block; margin-bottom: 8px; color: var(--green); }
.step-item p { margin-bottom: 8px; }
.english-line {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 2px solid var(--gold);
  background: #fbfaf5;
  color: #37433b;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.6;
}
.english-line span {
  display: block;
  margin-bottom: 3px;
  color: var(--gold);
  font-family: Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.step-evaluation { color: var(--muted); font-size: 12px; }

.lesson-select { width: 300px; }
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 30px; align-items: start; }
.lesson-actions { display: grid; gap: 18px; }
.action-card, .schedule-card { padding: 22px; border: 1px solid var(--line); background: var(--surface); }
.action-card h3 { margin-bottom: 2px; font-family: Georgia, serif; font-size: 24px; font-weight: 400; }
.action-card p { color: var(--muted); font-size: 13px; }
.action-stack { display: grid; gap: 9px; margin-top: 24px; }
.schedule-card ol { margin: 12px 0 0; padding-left: 20px; color: var(--muted); font-size: 12px; }
.schedule-card li { margin-bottom: 8px; padding-left: 3px; }
.schedule-card li.is-active { color: var(--green); font-weight: 700; }

.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(23, 35, 28, 0.45); }
.modal-card { position: relative; width: min(900px, 100%); max-height: min(820px, 90vh); overflow: auto; background: var(--surface); box-shadow: var(--shadow); }
.modal-header { align-items: center; padding: 22px 26px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 25px; }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 27px; line-height: 1; }
.modal-body { padding: 28px; }

@media (max-width: 800px) {
  .topbar, main { padding-left: 18px; padding-right: 18px; }
  .topbar-actions .text-button { display: none; }
  .home-view { padding-top: 5vh; }
  .selector-panel { padding: 22px; }
  .selector-grid, .design-layout, .lesson-layout { grid-template-columns: 1fr; }
  .outline-panel { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 12px; }
  .outline-item { display: inline-block; width: auto; margin-right: 18px; border-bottom: 0; }
  .document-panel { padding: 24px 20px; }
  .lesson-meta { grid-template-columns: 1fr 1fr; }
  .unit-header { align-items: flex-start; flex-wrap: wrap; }
  .unit-heading { order: -1; flex-basis: 100%; text-align: left; }
  .lesson-select { width: 100%; }
  .content-toolbar { display: grid; }
  .toolbar-actions { justify-content: flex-start; }
  .home-footer-note { display: grid; gap: 4px; }
}
