:root {
  --page-bg: #ffffff;
  --card-bg: #ffffff;
  --line: #cfcfcf;
  --line-soft: #e9e9e9;
  --text: #111111;
  --muted: #555555;
  --blue: #2f73e0;
  --blue-soft: #edf4ff;
  --red: #d7000f;
  --green: #0f8c4d;
  --green-soft: #edf8f2;
  --orange: #b26a00;
  --orange-soft: #fff7ea;
  --deep-red: #ab2431;
  --deep-red-soft: #fff0f2;
  --song-font: "SimSun", "NSimSun", "Songti SC", "STSong", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--song-font);
}

button,
input,
textarea,
select {
  font-family: var(--song-font);
}

a {
  color: inherit;
  text-decoration: none;
}

.page-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.page-layout-compact {
  grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  padding: 30px 20px;
  background: #ffffff;
  border-right: 1px solid var(--line-soft);
}

.sidebar-brand {
  margin-bottom: 24px;
}

.sidebar-brand strong {
  display: block;
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.35;
}

.sidebar-brand span {
  font-size: 16px;
  color: var(--muted);
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.nav-link {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.45;
}

.nav-link:hover {
  background: #f7f7f7;
  color: var(--text);
}

.nav-link.is-current {
  background: #f7f7f7;
  border-color: #bcc5d3;
}

.content-area {
  padding: 26px 28px 40px;
  background: #ffffff;
}

.content-area-compact {
  display: flex;
  justify-content: center;
  padding: 42px 44px 64px;
}

.page-shell {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
}

.page-shell-compact {
  width: 100%;
  max-width: 860px;
  min-height: 0;
}

.main-card,
.appendix-panel {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.main-card {
  margin-bottom: 24px;
  width: 100%;
}

.page-shell-compact .main-card {
  margin-bottom: 0;
  min-height: 0;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.06);
}

.card-banner {
  padding: 18px 24px 16px;
  background: var(--red);
  color: #ffffff;
}

.card-banner h1 {
  margin: 0 0 8px;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.25;
}

.card-banner p {
  margin: 0;
  font-size: 18px;
  line-height: 1.6;
}

.card-body,
.results-panel,
.appendix-panel {
  padding: 24px;
}

.page-shell-compact .card-body,
.page-shell-compact .results-panel {
  padding: 30px 28px 32px;
}

.section-title h2 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.25;
}

.section-title p {
  margin: 0 0 22px;
  font-size: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.assessment-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 42px;
}

.full-span {
  grid-column: 1 / -1;
}

.field,
.field-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 10px;
}

.field span,
.field-label {
  font-size: 22px;
  font-weight: 700;
}

.segmented-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f4f6fa;
  gap: 6px;
}

.segment-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.segment-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.segment-option span {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 58px;
  border-radius: 9px;
  font-size: 24px;
  font-weight: 700;
  color: #3d4a60;
  background: transparent;
}

.segment-option input:checked + span {
  background: var(--blue);
  color: #ffffff;
}

input[type="text"],
input[type="date"],
select.date-select,
input[type="number"] {
  width: 100%;
  min-height: 58px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-size: 22px;
  outline: none;
}

input[type="text"]:focus,
input[type="date"]:focus,
select.date-select:focus,
input[type="number"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 115, 224, 0.08);
}

.date-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 122px;
  gap: 16px;
  align-items: center;
}

.date-input-row-native {
  grid-template-columns: minmax(0, 1fr);
}

.date-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
}

.date-select-row .date-select {
  min-width: 0;
  width: 100%;
  padding: 12px 12px 12px 14px;
  font-size: 22px;
  line-height: 1.35;
  color: #111111;
  background-image: none;
  -webkit-appearance: menulist;
  -moz-appearance: menulist;
  appearance: auto;
}

.date-picker-btn {
  width: 122px;
  min-height: 58px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fc;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}

.date-picker-btn:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.native-date-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 122px;
  min-height: 58px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fc;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
}

.native-date-button:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.native-date-button span {
  pointer-events: none;
}

.native-date-input {
  position: absolute;
  inset: 0;
  opacity: 0.01;
  cursor: pointer;
}

.native-date-proxy {
  position: fixed;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0.01;
  z-index: -1;
}

.field-tip,
.helper-text {
  display: block;
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.choice-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 200px;
  min-height: 54px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}

.choice-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.choice-chip span {
  font-size: 22px;
  font-weight: 700;
}

.choice-chip input:checked + span {
  color: var(--blue);
}

.choice-chip input:checked {
  outline: none;
}

.choice-chip input:checked + span {
  border-color: var(--blue);
}

.choice-chip input:checked + span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100%;
  min-height: 100%;
  border-radius: 6px;
  background: var(--blue-soft);
}

.preview-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #fcfcfc;
}

.preview-item span {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
  color: var(--muted);
}

.preview-item strong {
  font-size: 28px;
  line-height: 1.3;
}

.button-row {
  display: flex;
  gap: 12px;
}

.primary-btn,
.secondary-btn {
  min-height: 54px;
  padding: 0 24px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn {
  background: var(--blue);
  color: #ffffff;
}

.secondary-btn {
  background: #f4f4f4;
  border-color: var(--line);
  color: var(--text);
}

.message-box {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 10px;
  font-size: 20px;
  font-weight: 700;
}

.error-box {
  background: var(--deep-red-soft);
  color: var(--deep-red);
  border: 1px solid #f1c9ce;
}

.results-panel {
  border-top: 1px solid var(--line-soft);
}

.result-title {
  margin-bottom: 18px;
}

.basic-result {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.basic-result-item {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.basic-result-item span {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
  color: var(--muted);
}

.basic-result-item strong {
  font-size: 26px;
  line-height: 1.35;
}

.result-table-card + .result-table-card {
  margin-top: 22px;
}

.result-table-card {
  display: block;
  width: 100%;
  overflow-x: auto;
}

.dietary-table-card {
  margin-top: 22px;
}

.dietary-result-table {
  table-layout: fixed;
}

.dietary-result-table th,
.dietary-result-table td {
  font-size: 20px;
}

.dietary-result-table tbody th {
  width: 42%;
  text-align: left;
}

.dietary-result-note {
  margin-top: 12px;
}

.dietary-mode-block {
  width: 100%;
}

.dietary-inner-grid {
  gap: 20px 42px;
}

.school-age-result-table th:first-child,
.school-age-result-table td:first-child {
  width: 55%;
}

.result-table-card h3,
.appendix-card h3 {
  margin: 0 0 12px;
  font-size: 28px;
  line-height: 1.3;
}

.simple-result-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.simple-result-table th,
.simple-result-table td {
  padding: 18px 12px;
  border: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
  font-size: 22px;
  line-height: 1.45;
}

.simple-result-table thead th {
  background: #f8f8f8;
  font-size: 21px;
  font-weight: 700;
}

.simple-result-table tbody th {
  width: 110px;
  background: #fafafa;
  font-weight: 700;
}

.result-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 94px;
  min-height: 42px;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 22px;
  font-weight: 700;
}

.pill-normal {
  background: var(--green-soft);
  color: var(--green);
}

.pill-neutral {
  background: #f2f4f7;
  color: #22324d;
}

.pill-warn {
  background: var(--orange-soft);
  color: var(--orange);
}

.pill-danger,
.pill-strong {
  background: var(--deep-red-soft);
  color: var(--deep-red);
}

.appendix-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.appendix-grid-spaced {
  margin-bottom: 26px;
}

.appendix-group-title {
  margin: 0 0 16px;
  font-size: 30px;
  line-height: 1.3;
}

.appendix-page-panel {
  padding: 0;
}

.appendix-page-banner {
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: #ffffff;
}

.appendix-page-banner h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.3;
}

.appendix-page-banner p {
  margin: 0;
  font-size: 20px;
  line-height: 1.75;
  color: #333333;
}

.appendix-panel-body {
  padding: 24px;
}

.appendix-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.appendix-card-tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-bottom: 12px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #22324d;
  font-size: 17px;
  font-weight: 700;
}

.appendix-card p {
  margin: 0 0 14px;
  font-size: 19px;
  line-height: 1.7;
  color: #333333;
}

.appendix-link {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafafa;
  font-size: 20px;
  font-weight: 700;
}

.appendix-link + .appendix-link {
  margin-top: 10px;
}

.appendix-link:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.calendar-popover {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.calendar-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
}

.calendar-dialog {
  position: relative;
  width: min(500px, calc(100% - 28px));
  margin: 72px auto 0;
  padding: 18px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.14);
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 48px 48px 1fr 48px 48px;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.calendar-toolbar strong {
  text-align: center;
  font-size: 24px;
  line-height: 1.3;
}

.calendar-nav-btn,
.calendar-action-btn {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}

.calendar-nav-btn {
  font-size: 24px;
  font-weight: 700;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 10px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-day {
  min-height: 46px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #ffffff;
  font-size: 18px;
  cursor: pointer;
}

.calendar-day.is-muted {
  color: #a5a5a5;
  background: #fafafa;
}

.calendar-day.is-today {
  border-color: var(--blue);
}

.calendar-day.is-selected {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.calendar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.calendar-action-btn {
  min-width: 92px;
  padding: 0 14px;
  font-size: 18px;
  font-weight: 700;
}

.calendar-action-btn.secondary {
  background: #f4f4f4;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line-soft);
  }
}

@media (max-width: 900px) {
  .content-area {
    padding: 18px 14px 28px;
  }

  .content-area-compact {
    display: block;
    padding: 18px 14px 28px;
  }

  .page-layout-compact {
    grid-template-columns: 1fr;
  }

  .page-shell-compact {
    width: 100%;
    min-height: 0;
  }

  .assessment-form,
  .basic-result,
  .appendix-grid {
    grid-template-columns: 1fr;
  }

  .segmented-row,
  .preview-strip,
  .date-input-row {
    grid-template-columns: 1fr;
  }

  .choice-chip {
    min-width: 0;
    width: 100%;
  }

  .button-row {
    flex-direction: column;
  }

  .simple-result-table {
    display: block;
    overflow-x: auto;
  }
}
