:root {
  color-scheme: light;
  --bg: #f6f8f6;
  --panel: #ffffff;
  --text: #14201f;
  --muted: #5f6f6b;
  --line: #dfe8e4;
  --teal: #0d8a78;
  --teal-dark: #075f54;
  --yellow: #f1b91c;
  --red: #c24735;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", "Microsoft YaHei", Tahoma, Arial, sans-serif;
}
a { color: inherit; text-decoration: none; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 30px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  flex-wrap: wrap;
}
.brand { font-size: 20px; font-weight: 900; color: var(--teal-dark); }
nav { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.account-nav { margin-left: auto; align-items: center; }
.credit-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid rgba(13, 138, 120, 0.24);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--teal-dark);
  background: #effaf7;
  font-weight: 800;
}

.hero-workspace {
  position: relative;
  min-height: calc(100vh - 60px);
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(246, 248, 246, 0.98) 0%, rgba(246, 248, 246, 0.86) 42%, rgba(246, 248, 246, 0.38) 100%),
    url("/static/images/memory-hero.png") center / cover no-repeat;
}
.hero-inner {
  position: relative;
  max-width: 1220px;
  margin: 0 auto;
  padding: 48px 28px 42px;
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(420px, 1.14fr);
  align-items: center;
  gap: 34px;
}
.hero-copy h1 {
  margin: 10px 0 16px;
  font-size: 48px;
  line-height: 1.12;
  max-width: 760px;
}
.hero-copy p {
  margin: 0;
  max-width: 700px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}
.eyebrow {
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
}
.hero-facts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.hero-facts span {
  border: 1px solid rgba(13, 138, 120, 0.22);
  background: rgba(255, 255, 255, 0.72);
  color: var(--teal-dark);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
}
.trial-note {
  max-width: 720px;
  margin-top: 18px;
  border-left: 4px solid var(--yellow);
  background: rgba(255, 255, 255, 0.76);
  padding: 12px 14px;
  line-height: 1.7;
  color: var(--text);
  font-weight: 700;
}

.memory-panel, .result-block, .method-grid > div {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(30, 55, 50, 0.08);
}
.memory-panel { padding: 22px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 16px;
}
.panel-head h2 { margin: 6px 0 0; font-size: 22px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 700; }
textarea, select, input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
  font: inherit;
}
textarea { resize: vertical; line-height: 1.6; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 13px;
}
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
}
.check input { width: 18px; height: 18px; }
button, .primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  min-height: 42px;
  padding: 0 17px;
  border-radius: 7px;
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
button:hover, .primary:hover { background: var(--teal-dark); }
button:disabled { cursor: wait; opacity: 0.72; }
.secondary, .ghost, .danger {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  padding: 0 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.secondary {
  border: 1px solid var(--line);
  color: var(--teal-dark);
  background: #fff;
}
.ghost {
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
}
.danger {
  border: 0;
  color: #fff;
  background: var(--red);
}
.save-note {
  margin-top: 8px !important;
  color: var(--teal-dark) !important;
  font-weight: 800;
}

.result-section, .section-head, .method-grid, .review-band {
  max-width: 1220px;
  margin: 0 auto;
  padding-left: 28px;
  padding-right: 28px;
}
.result-section { padding-top: 34px; }
.section-head { padding-top: 46px; padding-bottom: 16px; max-width: 920px; margin-left: calc((100% - 1220px) / 2); }
.section-head h2 { margin: 8px 0 10px; font-size: 32px; }
.section-head p { margin: 0; color: var(--muted); line-height: 1.75; }
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.result-block {
  padding: 20px;
  box-shadow: none;
}
.result-block.wide { grid-column: 1 / -1; }
.result-block h3 { margin: 0 0 12px; }
.result-block p { color: var(--muted); line-height: 1.75; margin: 0; white-space: pre-wrap; }
.result-block img { display: block; width: 100%; border-radius: 7px; border: 1px solid var(--line); }
.chip-list, .mini-list { display: grid; gap: 10px; }
.chip-list div, .mini-list div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: #f9fbfa;
  line-height: 1.65;
}
.chip-list strong, .mini-list strong { color: var(--teal-dark); }

.method-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 20px;
}
.method-grid > div { padding: 20px; box-shadow: none; }
.method-grid strong { display: block; margin-bottom: 8px; font-size: 17px; }
.method-grid p { margin: 0; color: var(--muted); line-height: 1.7; }
.review-band {
  margin-top: 28px;
  margin-bottom: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 30px;
  align-items: center;
  background: #0f302d;
  color: #fff;
  border-radius: 8px;
  padding-top: 28px;
  padding-bottom: 28px;
}
.review-band .eyebrow { color: #88ead7; }
.review-band h2 { margin: 8px 0 10px; }
.review-band p { color: #c9dad6; line-height: 1.75; margin: 0; }
.review-band ol {
  margin: 0;
  padding-left: 22px;
  color: #f6e7ad;
  line-height: 2;
  font-weight: 800;
}

.auth-page {
  min-height: calc(100vh - 60px);
  display: grid;
  place-items: center;
  padding: 34px 18px;
  background:
    linear-gradient(90deg, rgba(246, 248, 246, 0.98), rgba(246, 248, 246, 0.82)),
    url("/static/images/memory-hero.png") center / cover no-repeat;
}
.auth-card {
  width: min(520px, 100%);
  display: grid;
  gap: 15px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 60px rgba(30, 55, 50, 0.08);
}
.wide-card { width: min(760px, 100%); }
.auth-card h1 { margin: 0; font-size: 30px; }
.auth-card p { margin: 0; color: var(--muted); line-height: 1.75; }
.form-tip { color: var(--muted); font-size: 14px; }
.form-tip a, .panel-title a { color: var(--teal-dark); font-weight: 800; }
.alert {
  border-radius: 7px;
  padding: 11px 12px;
  line-height: 1.6;
  font-weight: 700;
}
.alert.error { color: #8b2719; background: #fff0ed; border: 1px solid #ffd2c9; }
.alert.ok { color: #075f54; background: #ecfbf7; border: 1px solid #bdeee3; }

.dashboard-page {
  max-width: 1220px;
  margin: 0 auto;
  padding: 32px 28px 46px;
}
.dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 20px;
}
.dashboard-head h1 { margin: 8px 0 10px; font-size: 34px; }
.dashboard-head p { margin: 0; color: var(--muted); line-height: 1.75; max-width: 780px; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.metric-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}
.metric-box strong { display: block; font-size: 30px; color: var(--teal-dark); }
.metric-box span { color: var(--muted); font-weight: 700; }
.metric-box.urgent {
  border-color: rgba(194, 71, 53, 0.28);
  background: #fff6f4;
}
.metric-box.urgent strong { color: var(--red); }
.panel-section {
  border-top: 1px solid var(--line);
  padding: 22px 0;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.panel-title h2 { margin: 0; font-size: 22px; }
.record-list { display: grid; gap: 10px; }
.record-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}
.record-row p { margin: 6px 0 0; color: var(--muted); line-height: 1.55; }
.record-row span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.review-task-list {
  display: grid;
  gap: 12px;
}
.review-task {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 15px;
}
.review-task.due { border-left: 4px solid var(--red); }
.review-task strong { display: block; margin-top: 7px; font-size: 17px; }
.review-task p { margin: 6px 0 0; color: var(--muted); line-height: 1.55; }
.task-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  color: #8b2719;
  background: #fff0ed;
  border: 1px solid #ffd2c9;
  font-size: 12px;
  font-weight: 900;
}
.task-badge.done {
  color: var(--teal-dark);
  background: #ecfbf7;
  border-color: #bdeee3;
}
.task-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.task-actions form { margin: 0; }
.review-timeline {
  display: grid;
  gap: 9px;
}
.review-timeline a {
  display: grid;
  grid-template-columns: 120px 160px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.review-timeline span {
  color: var(--teal-dark);
  font-weight: 900;
}
.review-timeline strong {
  color: var(--text);
}
.review-timeline em {
  color: var(--muted);
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty-box {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  color: var(--muted);
  line-height: 1.7;
}
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--teal-dark); background: #f0faf7; font-size: 13px; }
td { color: var(--text); line-height: 1.55; }
td span { color: var(--muted); font-size: 13px; }
.inline-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}
.action-cell {
  display: grid;
  gap: 8px;
  min-width: 230px;
}
.action-cell form, .compact-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.action-cell input, .compact-form input { min-width: 96px; }
.record-detail-grid { padding-left: 0; padding-right: 0; }
.study-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.study-steps div {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}
.study-steps strong {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #fff;
  background: var(--teal);
}
.study-steps span {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 25, 24, 0.42);
}
.modal-mask[hidden] {
  display: none !important;
}
.member-modal {
  width: min(520px, 100%);
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
}
.member-modal h2 { margin: 0 0 10px; }
.member-modal p { margin: 0; color: var(--muted); line-height: 1.75; }
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 900px) {
  .topbar { align-items: flex-start; padding: 12px 18px; }
  .account-nav { margin-left: 0; }
  .hero-inner { grid-template-columns: 1fr; padding: 34px 18px; }
  .hero-copy h1 { font-size: 34px; }
  .hero-bg {
    background:
      linear-gradient(180deg, rgba(246, 248, 246, 0.98) 0%, rgba(246, 248, 246, 0.86) 55%, rgba(246, 248, 246, 0.62) 100%),
      url("/static/images/memory-hero.png") center / cover no-repeat;
  }
  .memory-panel { padding: 17px; }
  .panel-head, .review-band { display: grid; }
  .form-grid, .result-grid, .method-grid, .review-band, .metric-grid, .inline-settings, .study-steps { grid-template-columns: 1fr; }
  .section-head { margin-left: auto; padding-left: 18px; padding-right: 18px; }
  .result-section, .method-grid, .review-band { padding-left: 18px; padding-right: 18px; }
  .dashboard-page { padding-left: 18px; padding-right: 18px; }
  .dashboard-head, .record-row, .review-task { display: grid; align-items: start; }
  .record-row span { white-space: normal; }
  .task-actions { justify-content: flex-start; }
  .review-timeline a { grid-template-columns: 1fr; }
  .review-timeline em { white-space: normal; }
  .action-cell form, .compact-form { display: grid; }
}
