:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --panel: #ffffff;
  --ink: #182230;
  --muted: #667085;
  --line: #d0d5dd;
  --blue: #174a7c;
  --green: #0f766e;
  --red: #b42318;
  --amber: #a66f1f;
  --gold: #b8872b;
  --navy: #101828;
  --soft-blue: #e9f0f7;
  --shadow: 0 14px 34px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
}

body.template-page {
  background: #eef1f5;
}

.is-hidden {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 14px;
  background:
    linear-gradient(135deg, rgba(16, 24, 40, 0.94), rgba(23, 74, 124, 0.72)),
    var(--navy);
}

.auth-card {
  width: min(100%, 440px);
  display: grid;
  gap: 16px;
  padding: 26px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.auth-brand {
  color: var(--ink);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.auth-brand p {
  color: var(--muted);
}

.auth-card .section-title {
  margin-bottom: 0;
}

.auth-card .section-title h2 {
  margin: 2px 0 6px;
  font-size: 26px;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
}

.auth-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.support-note {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.support-note a,
.sidebar-contact a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.support-note a:hover,
.sidebar-contact a:hover {
  text-decoration: underline;
}

.captcha-box {
  display: grid;
  gap: 9px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.captcha-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}

.captcha-head span {
  color: var(--muted);
  font-weight: 700;
}

.captcha-box.verified .captcha-head span {
  color: var(--green);
}

.captcha-track {
  position: relative;
  height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: linear-gradient(90deg, #edf2f7, #fff);
  overflow: hidden;
  touch-action: none;
}

.captcha-target {
  position: absolute;
  top: 7px;
  width: 28px;
  height: 28px;
  border: 2px dashed var(--blue);
  border-radius: 8px;
  background: rgba(23, 74, 124, 0.08);
}

.captcha-handle {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(23, 74, 124, 0.24);
}

.captcha-box small {
  color: var(--muted);
  font-weight: 650;
}

.user-chip {
  max-width: 220px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar {
  background: var(--navy);
  color: #f8fafc;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #16202d;
  border-radius: 8px;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
}

.brand p,
.profile-card span,
.eyebrow,
.section-title p,
.payment-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.sidebar .brand p,
.sidebar .profile-card span {
  color: #aeb8c7;
}

.primary-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 11px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  color: #d8dee9;
  background: transparent;
  text-align: left;
}

.nav-item[data-view="history"] {
  display: none;
}

.nav-item.active,
.nav-item:hover {
  background: #1d2939;
  color: #ffffff;
}

.icon {
  width: 22px;
  text-align: center;
}

.profile-card {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: #182230;
  border-radius: 8px;
}

.sidebar-contact {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #dbeafe;
  font-size: 13px;
}

.sidebar-contact span {
  font-weight: 700;
  color: #dbeafe;
}

.sidebar-contact a {
  word-break: break-all;
  color: #fff;
}

.profile-card div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.profile-card strong,
.profile-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  flex: 0 0 auto;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h2 {
  margin: 2px 0 0;
  font-size: 25px;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.step {
  min-height: 52px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
}

.step span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e8edf5;
  color: #334155;
  font-weight: 700;
  font-size: 12px;
}

.step.active {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: inset 0 -3px 0 var(--gold);
}

.step.active span {
  background: var(--blue);
  color: #fff;
}

.form-panel,
.report-card,
.history-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-panel {
  display: none;
  padding: 22px;
  border-top: 3px solid var(--gold);
}

.form-panel.active {
  display: block;
}

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

.section-title h3 {
  margin: 0 0 5px;
  font-size: 18px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: #374151;
  font-weight: 650;
  font-size: 14px;
  position: relative;
}

label.required > span::after,
.required-group legend::after {
  content: "必須";
  display: inline-grid;
  place-items: center;
  min-height: 18px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff4e5;
  color: #9a5b13;
  font-size: 11px;
  font-weight: 800;
  vertical-align: 1px;
}

.field-error {
  border-color: var(--red) !important;
  background: #fffafa !important;
}

.checkbox-group.field-error {
  box-shadow: inset 0 0 0 1px var(--red);
}

label.wide {
  grid-column: 1 / -1;
}

.checkbox-group {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 0;
}

.checkbox-group legend {
  padding: 0 6px;
  color: #374151;
  font-weight: 700;
  font-size: 14px;
}

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

.checkbox-options label {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 650;
}

.checkbox-options input {
  width: 18px;
  min-height: 18px;
  padding: 0;
  flex: 0 0 auto;
}

.empty-options {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.conditional-field.hidden {
  display: none;
}

.help-icon {
  position: absolute;
  top: -2px;
  right: 0;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--blue);
  font-weight: 800;
  line-height: 1;
}

.help-icon:hover {
  background: #e8f0ff;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
}

.date-field {
  padding: 12px;
  border: 1px solid #e1e6ee;
  border-radius: 8px;
  background: #fbfcfe;
}

.date-selects {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) repeat(2, minmax(96px, 0.7fr));
  gap: 10px;
  align-items: end;
}

.date-unit {
  display: grid;
  gap: 6px;
}

.date-unit span,
.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.date-unit select {
  min-width: 0;
  background-color: #fff;
}

.station-picker {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(220px, 1.4fr);
  gap: 10px;
}

.field-hint {
  margin-top: -2px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(23, 74, 124, 0.16);
  border-color: var(--blue);
}

.actions-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.actions-row.split {
  justify-content: space-between;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 700;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.primary-button:hover {
  background: #123b63;
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.secondary-button {
  background: #eef2f7;
  color: #1f2937;
  border-color: var(--line);
}

.ghost-button {
  width: 42px;
  padding: 0;
  background: #fff;
  color: #334155;
  border-color: var(--line);
}

.compact {
  min-width: 72px;
}

.report-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

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

.report-option {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  text-align: left;
}

.report-option strong {
  color: var(--gold);
}

.report-option.active {
  border-color: var(--blue);
  box-shadow: inset 4px 0 0 var(--gold);
}

.report-card {
  padding: 22px;
}

.report-history-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.compact-history-toolbar {
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}

.report-history-panel .history-list {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  max-height: none;
  overflow: auto;
}

.free-quota-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.free-quota-note.warning {
  color: #92400e;
  font-weight: 700;
}

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

.summary-grid div {
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.summary-grid span {
  color: var(--muted);
  font-size: 13px;
}

.summary-grid strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-panel {
  display: none;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px dashed #c8d2e1;
  border-radius: 8px;
  margin-bottom: 14px;
}

.payment-panel.visible {
  display: flex;
}

.wide-button {
  width: 100%;
}

.history-toolbar {
  margin-bottom: 12px;
  display: flex;
  justify-content: flex-end;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  background: #e8edf5;
  border-radius: 8px;
  gap: 4px;
}

.segmented button {
  border: 0;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 7px;
  background: transparent;
  color: #475569;
  font-weight: 650;
}

.segmented button.active {
  background: #fff;
  color: var(--blue);
}

.history-list {
  display: grid;
  overflow: hidden;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.history-button {
  width: 100%;
  border: 0;
  background: #fff;
  text-align: left;
}

.history-button:hover {
  background: #f8fafc;
}

.history-item:last-child {
  border-bottom: 0;
}

.history-item h4 {
  margin: 0 0 4px;
}

.history-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 750;
}

.badge.free {
  color: var(--green);
  background: #dcfce7;
}

.badge.detail {
  color: var(--blue);
  background: #dbeafe;
}

.badge.full {
  color: var(--amber);
  background: #fef3c7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  pointer-events: none;
  background: #111827;
  color: #fff;
  border-radius: 8px;
  padding: 12px 16px;
  transition: 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
}

.modal.visible {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.46);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 32px));
  margin: 12vh auto 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-panel h3 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  padding: 18px;
  display: grid;
  gap: 10px;
}

.modal-body p {
  margin: 0;
  line-height: 1.7;
  color: #374151;
}

.template-shell {
  width: min(1080px, calc(100vw - 32px));
  margin: 28px auto 60px;
  display: grid;
  gap: 22px;
}

.template-header,
.template-section {
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.template-header {
  padding: 34px 40px;
  border-top: 8px solid #1f2937;
}

.template-header h1 {
  margin: 6px 0 12px;
  font-size: 28px;
  letter-spacing: 0;
}

.template-header p:last-child {
  max-width: 860px;
  line-height: 1.8;
  color: #4b5563;
}

.template-section {
  padding: 0;
  overflow: hidden;
}

.template-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px;
  border-bottom: 1px solid #d8dee8;
  background: #f8fafc;
}

.template-title h2 {
  margin: 0;
  font-size: 21px;
}

.template-card {
  padding: 24px 28px;
  border-bottom: 1px solid #e4e8ef;
}

.template-card:last-child {
  border-bottom: 0;
}

.template-card h3 {
  margin: 0 0 12px;
  font-size: 17px;
  padding-left: 12px;
  border-left: 4px solid #1d4ed8;
}

.template-card h4 {
  margin: 0 0 8px;
}

.template-card p,
.template-card li,
.template-card span {
  line-height: 1.75;
  color: #374151;
}

.sample-box {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid #cfd8e5;
  background: #f8fafc;
  border-radius: 8px;
}

.school-mini-grid,
.strategy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.strategy-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.school-mini-grid div,
.strategy-grid div {
  border: 1px solid #d8dee8;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.template-list {
  margin: 0;
  padding-left: 22px;
}

.analysis-table {
  border: 1px solid #d8dee8;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 14px;
}

.analysis-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.6fr 1.4fr;
  border-bottom: 1px solid #e4e8ef;
}

.analysis-row:last-child {
  border-bottom: 0;
}

.analysis-row span {
  padding: 11px 12px;
  border-right: 1px solid #e4e8ef;
}

.analysis-row span:last-child {
  border-right: 0;
}

.analysis-row.head {
  background: #f1f5f9;
  font-weight: 800;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #fbfcfe;
}

.report-paper {
  background: #fff;
  border: 1px solid #d8dee8;
  box-shadow: var(--shadow);
}

.paper-cover {
  padding: 42px 46px 34px;
  border-bottom: 1px solid #d8dee8;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.paper-cover h2 {
  margin: 10px 0 16px;
  font-size: 27px;
}

.paper-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.paper-meta div {
  border-top: 2px solid #1f2937;
  padding-top: 8px;
  display: grid;
  gap: 4px;
}

.paper-meta span {
  color: #6b7280;
  font-size: 12px;
}

.paper-section {
  padding: 26px 46px;
  border-bottom: 1px solid #e4e8ef;
}

.paper-section:last-child {
  border-bottom: 0;
}

.paper-section h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

.paper-section p {
  color: #374151;
  line-height: 1.85;
}

.metric-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 14px;
}

.metric-table th,
.metric-table td {
  border: 1px solid #d8dee8;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.metric-table th {
  background: #f1f5f9;
}

.visual-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.visual-grid div {
  border: 1px solid #d8dee8;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
  display: grid;
  gap: 6px;
}

.visual-grid span {
  color: #4b5563;
  line-height: 1.6;
}

.score-bars {
  display: grid;
  gap: 10px;
  margin: 12px 0 16px;
}

.score-bars div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.score-bars strong {
  display: block;
  min-width: 54px;
  max-width: 100%;
  background: #1d4ed8;
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  text-align: right;
}

.radar-placeholder {
  margin: 14px 0 18px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.radar-placeholder div {
  min-height: 88px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  background: #f8fafc;
  color: #4b5563;
}

.radar-placeholder strong {
  font-size: 22px;
  color: #1d4ed8;
}

.risk-heatmap {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.risk {
  border-radius: 8px;
  padding: 16px 10px;
  text-align: center;
  font-weight: 800;
  line-height: 1.6;
}

.risk.low {
  background: #dcfce7;
  color: #166534;
}

.risk.mid {
  background: #fef3c7;
  color: #92400e;
}

.risk.high {
  background: #fee2e2;
  color: #991b1b;
}

@media (max-width: 760px) {
  .template-header,
  .template-card,
  .paper-cover,
  .paper-section {
    padding-left: 18px;
    padding-right: 18px;
  }

  .school-mini-grid,
  .strategy-grid,
  .paper-meta,
  .visual-grid,
  .radar-placeholder,
  .risk-heatmap,
  .analysis-row,
  .support-layout,
  .timeline div {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .date-selects,
  .station-picker {
    grid-template-columns: 1fr;
  }

  .date-field {
    padding: 10px;
  }
}

.detail-report {
  max-width: 980px;
}

.report-content {
  display: grid;
  gap: 14px;
}

.report-support {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.support-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.faq-list {
  display: grid;
  gap: 10px;
}

.faq-list details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.faq-list summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
  color: var(--navy);
}

.faq-list p {
  margin: 0;
  padding: 0 14px 14px;
  color: #475467;
  line-height: 1.75;
  font-size: 14px;
}

.question-form {
  display: grid;
  gap: 13px;
}

.detail-report-head {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail-report-head div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  display: grid;
  gap: 4px;
  border-top: 3px solid var(--gold);
}

.detail-report-head span,
.detail-school-grid span {
  color: var(--muted);
  font-size: 12px;
}

.detail-pages {
  display: grid;
  gap: 16px;
}

.detail-page {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 10px 26px rgba(16, 24, 40, 0.06);
}

.detail-page-label {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 12px;
}

.detail-page h4 {
  margin: 0 0 12px;
  font-size: 19px;
  border-left: 4px solid var(--gold);
  padding-left: 10px;
  color: var(--navy);
}

.detail-page p {
  margin: 0 0 12px;
  color: #374151;
  line-height: 1.75;
}

.report-frame {
  width: 100%;
  min-height: 72vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-link-row {
  margin: 0;
}

.detail-link-row a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

.detail-link-row.support-note a {
  min-height: 36px;
  padding: 0;
  background: transparent;
  color: var(--blue);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 12px;
}

.detail-table th,
.detail-table td {
  border: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
}

.detail-table th {
  background: #f4f7fb;
  white-space: nowrap;
  color: var(--navy);
}

.detail-school-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.detail-school-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, #fff, #fbfcfe);
  display: grid;
  gap: 7px;
  border-top: 3px solid var(--gold);
}

.detail-school-grid strong {
  font-size: 18px;
}

.detail-school-grid p {
  margin: 0;
  font-size: 13px;
}

.match-reasons {
  margin: 0;
  padding-left: 18px;
  color: #344054;
  font-size: 12px;
  line-height: 1.55;
}

.detail-school-grid small {
  color: var(--muted);
  line-height: 1.45;
}

.detail-school-grid b {
  color: var(--blue);
  font-size: 13px;
}

.detail-score-bars {
  display: grid;
  gap: 9px;
  margin: 12px 0;
}

.detail-score-bars div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.detail-score-bars strong {
  max-width: 100%;
  min-width: 44px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), #2f6f9f);
  color: #fff;
  padding: 5px 9px;
  text-align: right;
  font-size: 12px;
}

.detail-note {
  border: 1px solid #cfd8e5;
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  border-left: 4px solid var(--gold);
}

.detail-note p {
  margin: 6px 0 0;
}

.detail-risk-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.detail-risk-grid div {
  border-radius: 8px;
  padding: 13px 8px;
  text-align: center;
  line-height: 1.6;
}

.detail-risk-grid .low {
  background: #dcfce7;
  color: #166534;
}

.detail-risk-grid .mid {
  background: #fef3c7;
  color: #92400e;
}

.detail-risk-grid .high {
  background: #fee2e2;
  color: #991b1b;
}

.detail-list {
  margin: 0;
  padding-left: 18px;
  color: #374151;
  line-height: 1.8;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding-bottom: 70px;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    min-height: auto;
    padding: 8px 10px;
    border-top: 1px solid #334155;
  }

  .brand {
    display: none;
  }

  .primary-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-item {
    justify-content: center;
    min-height: 52px;
    padding: 6px 4px;
    display: grid;
    gap: 2px;
    text-align: center;
  }

  .nav-item span:last-child {
    display: block;
    font-size: 11px;
  }

  .icon {
    width: auto;
    font-size: 16px;
  }

  .profile-card {
    display: none;
  }

  .main {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    display: grid;
  }

  .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto auto auto;
  }

  .user-chip {
    max-width: none;
  }

  .topbar h2 {
    font-size: 21px;
  }

  .grid.two,
  .stepper,
  .report-layout,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .step {
    min-height: 46px;
    font-size: 13px;
  }

  .form-panel,
  .report-card {
    padding: 16px;
    box-shadow: none;
  }

  input,
  select,
  .primary-button,
  .secondary-button,
  .ghost-button {
    min-height: 46px;
  }

  .actions-row,
  .actions-row.split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .actions-row.split .secondary-button {
    order: 2;
  }

  .report-options {
    grid-template-columns: 1fr;
  }

  .report-option {
    min-height: 64px;
  }

  .payment-panel.visible {
    display: grid;
  }

  .history-toolbar {
    justify-content: stretch;
  }

  .segmented {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .segmented button {
    padding: 0 6px;
    font-size: 12px;
  }

  .history-item {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .badge {
    justify-self: start;
  }

  .detail-report-head,
  .detail-school-grid,
  .detail-risk-grid {
    grid-template-columns: 1fr;
  }

  .detail-page {
    padding: 15px;
  }

  .detail-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .date-selects,
  .station-picker {
    grid-template-columns: 1fr;
  }

  .checkbox-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-card {
    padding: 20px;
  }

  .auth-actions {
    display: grid;
  }

  .modal-panel {
    width: calc(100vw - 24px);
    margin-top: 10vh;
  }
}

body.public-report-mode {
  background: #f6f7f9;
}

body.public-report-mode .sidebar,
body.public-report-mode .topbar,
body.public-report-mode #detailView .section-title,
body.public-report-mode #detailView .summary-grid,
body.public-report-mode #detailView .actions-row,
body.public-report-mode .detail-report-head,
body.public-report-mode .detail-link-row {
  display: none;
}

body.public-report-mode .app-shell {
  display: block;
  min-height: 100vh;
}

body.public-report-mode .main {
  padding: 0;
  max-width: none;
}

body.public-report-mode .view {
  padding: 0;
}

body.public-report-mode .detail-report {
  max-width: 760px;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 12px;
}

body.public-report-mode .online-report-body {
  border-radius: 10px;
  padding: 18px;
}

@media (max-width: 520px) {
  .paper-cover h2,
  .template-header h1 {
    font-size: 22px;
  }

  .metric-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .paper-meta {
    grid-template-columns: 1fr;
  }

  .paper-section p,
  .template-card p,
  .template-card li {
    font-size: 14px;
  }
}
