:root {
  --ink: #1f2a2a;
  --muted: #667371;
  --paper: #f4f1e9;
  --card: #fffdf8;
  --line: #d8d3c8;
  --brand: #0d6b5a;
  --brand-dark: #074b40;
  --brand-soft: #dcefe9;
  --accent: #c96a42;
  --input: #edf6ff;
  --input-line: #9cc3df;
  --shadow: 0 12px 34px rgba(31, 42, 42, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums;
}

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

.hero {
  color: white;
  background:
    radial-gradient(circle at 82% 20%, rgba(255,255,255,.12), transparent 24%),
    linear-gradient(125deg, #063c34, #0d6b5a 58%, #388c78);
  border-bottom: 5px solid #d6a05f;
}
.hero__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 48px 28px 40px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}
.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: #dcefe9;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}
.back-link:hover { color: white; text-decoration: underline; }
.eyebrow {
  margin-bottom: 8px;
  color: #cce9e2;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.eyebrow--dark { color: var(--brand); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(34px, 5vw, 58px); line-height: 1.05; letter-spacing: -.035em; }
h2 { margin-bottom: 18px; font-size: 23px; letter-spacing: -.02em; }
.hero__copy { max-width: 660px; margin-bottom: 0; color: #e4f0ed; font-size: 17px; line-height: 1.7; }
.hero__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; max-width: 520px; }
.button {
  min-height: 42px;
  padding: 10px 15px;
  color: #17413a;
  background: #fff;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 10px;
  font-weight: 750;
  box-shadow: 0 3px 9px rgba(0,0,0,.12);
}
.button:hover { transform: translateY(-1px); }
.button--primary { color: white; background: #d37850; border-color: #e7a384; }
.button--quiet { color: white; background: transparent; }

main { max-width: 1440px; margin: 0 auto; padding: 26px 28px 64px; }
.notice {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 22px;
  padding: 15px 18px;
  color: #664228;
  background: #fff3df;
  border: 1px solid #edd0a7;
  border-radius: 12px;
  line-height: 1.6;
}
.notice strong { white-space: nowrap; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.metric {
  min-height: 152px;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.metric--accent { color: white; background: var(--brand); border-color: var(--brand); }
.metric__label { font-size: 13px; color: var(--muted); }
.metric--accent .metric__label, .metric--accent small { color: #dcefe9; }
.metric strong { margin: 7px 0 4px; font-size: clamp(29px, 4vw, 42px); line-height: 1; }
.metric small { color: var(--muted); }

.panel {
  margin-bottom: 20px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin-bottom: 16px; }
.save-state, .summary-badge {
  padding: 7px 11px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.settings__grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 14px;
}
.settings label { color: var(--muted); font-size: 12px; font-weight: 750; }
.settings input, .rooms-table input[type="number"] {
  width: 100%;
  margin-top: 7px;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--input);
  border: 1px solid var(--input-line);
  border-radius: 8px;
  outline: none;
}
.settings input:focus, .rooms-table input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13,107,90,.12); }
.helper { margin: 14px 0 0; color: var(--muted); font-size: 13px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { color: #475452; background: #f1eee6; font-size: 12px; letter-spacing: .02em; }
td { font-size: 14px; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
tbody tr:last-child td, tfoot tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfaf5; }
.summary-table td:nth-child(1) { color: var(--brand-dark); font-weight: 850; }
.summary-table td:nth-child(6) { color: var(--accent); font-size: 17px; font-weight: 900; }

.corridor-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; }
.corridor-grid .panel { margin-bottom: 20px; }
.corridor-visual {
  height: 68px;
  margin: 8px 0 20px;
  display: grid;
  grid-template-columns: .15fr 1.2fr .15fr;
  border: 2px solid var(--brand-dark);
  border-radius: 8px;
  overflow: hidden;
}
.corridor-visual .center { background: repeating-linear-gradient(90deg, #dcefe9 0, #dcefe9 80px, #a5d1c6 81px, #a5d1c6 82px); }
.corridor-visual .edge { background: #f5c69d; }
.corridor-card dl { margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.corridor-card dl div { padding: 12px; background: #f7f4ec; border-radius: 10px; }
.corridor-card dt { margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.corridor-card dd { margin: 0; font-weight: 850; }
.method-card ul { margin: 0; padding-left: 20px; color: #495654; line-height: 1.85; }

.legend { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.legend span { width: 14px; height: 14px; background: var(--input); border: 1px solid var(--input-line); border-radius: 3px; }
.table-wrap--rooms { max-height: 72vh; }
.rooms-table { min-width: 1260px; }
.rooms-table thead { position: sticky; top: 0; z-index: 3; }
.rooms-table th { text-align: center !important; }
.rooms-table td { padding: 7px 8px; text-align: right !important; }
.rooms-table td:first-child { text-align: center !important; color: var(--brand-dark); font-weight: 900; }
.rooms-table input[type="number"] { width: 78px; margin: 0; padding: 7px 6px; text-align: right; }
.rooms-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); }
.rooms-table .checkbox-cell { text-align: center !important; }
.rooms-table .derived { background: #fbfaf5; }
.rooms-table tfoot td { padding-top: 12px; padding-bottom: 12px; color: var(--brand-dark); background: #e7f2ee; font-weight: 900; }
.rooms-table input:disabled { color: #9aa3a1; background: #f0f0ed; border-color: #ddd; }

.footnotes { max-width: 980px; margin: 34px auto 0; color: #566260; line-height: 1.75; text-align: center; }
.footnotes h2 { color: var(--ink); }
.timestamp { font-size: 12px; color: #87908e; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  max-width: calc(100vw - 40px);
  padding: 11px 16px;
  color: white;
  background: #183d36;
  border-radius: 9px;
  box-shadow: 0 8px 28px rgba(0,0,0,.22);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1050px) {
  .hero__inner { align-items: flex-start; flex-direction: column; }
  .hero__actions { justify-content: flex-start; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .settings__grid { grid-template-columns: repeat(3, 1fr); }
  .corridor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .hero__inner, main { padding-left: 16px; padding-right: 16px; }
  .hero__inner { padding-top: 34px; }
  .hero__actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .button { padding-left: 9px; padding-right: 9px; font-size: 13px; }
  .notice { flex-direction: column; gap: 5px; }
  .metrics { grid-template-columns: 1fr; }
  .metric { min-height: 128px; }
  .settings__grid { grid-template-columns: repeat(2, 1fr); }
  .section-heading { flex-direction: column; gap: 0; }
  .corridor-card dl { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 18px; }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: white; color: black; font-size: 9pt; }
  .no-print, .toast { display: none !important; }
  .hero { color: black; background: white; border-bottom: 2px solid #333; }
  .hero__inner { max-width: none; padding: 0 0 10mm; }
  .hero__copy, .eyebrow { color: #333; }
  main { max-width: none; padding: 6mm 0 0; }
  .notice, .panel, .metric { box-shadow: none; break-inside: avoid; }
  .metrics { grid-template-columns: repeat(4, 1fr); }
  .metric { min-height: auto; padding: 10px; }
  .metric strong { font-size: 21px; }
  .metric--accent { color: black; background: white; }
  .metric--accent .metric__label, .metric--accent small { color: #555; }
  .corridor-grid { grid-template-columns: 1fr 1fr; }
  .table-wrap, .table-wrap--rooms { max-height: none; overflow: visible; }
  .rooms-panel { page-break-before: always; }
  .rooms-table { min-width: 0; font-size: 7pt; }
  .rooms-table input { display: none; }
  .rooms-table td.input-cell::after { content: attr(data-print); }
  th, td { padding: 5px 6px; }
  .footnotes { margin-top: 8mm; }
}
