:root {
  --ink: #071018;
  --ink-2: #101a24;
  --paper: #f7f0e6;
  --white: #fffaf2;
  --line: #d8cdbd;
  --muted: #5f6f82;
  --red: #ef4e32;
  --teal: #0d655d;
  --blue: #3157ff;
  --amber: #c98620;
  --good: #0f766e;
  --warn: #b45309;
  --bad: #b91c1c;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans JP", "BIZ UDPGothic", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
  line-height: 1.8;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 56px);
  background: rgba(247, 240, 230, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  line-height: 1.1;
  text-decoration: none;
}

.mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
}

.brand small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.nav a {
  text-decoration: none;
}

.utilitybar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px clamp(16px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: #fff7eb;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #b8a894;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.action-btn.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.action-btn.warn {
  border-color: var(--red);
  color: var(--red);
}

.action-btn:hover,
.action-btn:focus {
  outline: 2px solid rgba(49, 87, 255, .22);
  outline-offset: 2px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(320px, .52fr);
  gap: clamp(22px, 5vw, 64px);
  align-items: end;
  padding: clamp(42px, 7vw, 96px) clamp(18px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
}

.hero.compact {
  grid-template-columns: minmax(0, 1fr);
  padding-bottom: clamp(34px, 5vw, 62px);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.kicker::before {
  content: "";
  width: 32px;
  height: 3px;
  border-radius: 999px;
  background: var(--red);
}

h1, h2, h3, p {
  margin: 0;
}

h1, h2 {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  font-weight: 900;
  letter-spacing: 0;
}

h1 {
  max-width: 980px;
  font-size: clamp(42px, 7vw, 88px);
  line-height: 1.08;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.18;
}

h3 {
  margin-bottom: 10px;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.35;
  font-weight: 900;
}

.lead {
  max-width: 880px;
  margin-top: 22px;
  color: #1f2937;
  font-size: clamp(16px, 1.8vw, 21px);
  font-weight: 800;
}

.note {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.summary {
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.summary b {
  color: var(--teal);
}

.section {
  padding: clamp(42px, 6vw, 78px) clamp(18px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
}

.section.dark {
  background: var(--ink);
  color: var(--paper);
}

.section.dark .note,
.section.dark .lead {
  color: #cbd5e1;
}

.section.dark .timeline-row,
.section.dark .workflow-step {
  border-color: #263444;
  background: var(--ink-2);
  color: var(--paper);
}

.section.dark .timeline-row span,
.section.dark .workflow-step p,
.section.dark .card p,
.section.dark .panel p {
  color: #dbe4ee;
}

.workflow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.workflow-step {
  min-height: 154px;
  padding: 18px;
  background: var(--white);
}

.workflow-step b {
  display: block;
  margin-bottom: 10px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}

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

.metric {
  display: grid;
  gap: 4px;
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.metric b {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

.route-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin: 4px 6px 4px 0;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff7eb;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

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

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

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.panel,
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 22px;
}

.card.flat {
  border-radius: 0;
}

.dark .card,
.dark .panel {
  border-color: #263444;
  background: var(--ink-2);
}

.num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  font-weight: 900;
}

.dark .num {
  background: var(--red);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #efe4d3;
  color: #344054;
  font-size: 11px;
  font-weight: 900;
}

.dark .tag {
  background: #1f2b38;
  color: #dbe4ee;
}

.checklist {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.checklist li::before {
  content: "";
  width: 18px;
  height: 18px;
  margin-top: 6px;
  border: 2px solid var(--teal);
  border-radius: 4px;
  background: transparent;
}

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

.do {
  border-top: 6px solid var(--good);
}

.dont {
  border-top: 6px solid var(--bad);
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow-wrap: anywhere;
  background: var(--white);
}

th, td {
  padding: 12px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #efe4d3;
  font-weight: 900;
}

.dark table,
.dark th,
.dark td {
  border-color: #314153;
}

.dark table {
  background: var(--ink-2);
}

.dark th {
  background: #172332;
}

.script {
  white-space: pre-wrap;
  padding: 18px;
  border-left: 5px solid var(--red);
  border-radius: 8px;
  background: #fff5e8;
  color: #111827;
  font-weight: 750;
}

.dark .script {
  background: #121f2b;
  color: #eef2f7;
}

.snippet {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.snippet-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.snippet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.snippet-body,
.data-block {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 16px;
  border: 1px solid #eadfce;
  border-radius: 8px;
  background: #fff7eb;
  font-weight: 750;
}

.dark .snippet,
.dark .snippet-body,
.dark .data-block {
  border-color: #314153;
  background: #101a24;
  color: #eef2f7;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.blank-line {
  min-height: 42px;
  border-bottom: 1px solid #a99883;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e7f3ef;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.status-pill.admin {
  background: #e7edff;
  color: var(--blue);
}

.status-pill.public {
  background: #e7f3ef;
  color: var(--teal);
}

.status-pill.private {
  background: #fff1df;
  color: var(--warn);
}

.status-pill.danger {
  background: #fee2e2;
  color: var(--bad);
}

.pdf-sheet {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: #111827;
}

.letterhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ink);
}

.letterhead b {
  display: block;
  font-size: 20px;
}

.letterhead small,
.letter-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.letter-title {
  margin: 34px 0 24px;
  text-align: center;
  font-size: clamp(26px, 4vw, 40px);
}

.letter-body {
  display: grid;
  gap: 18px;
  font-size: 15px;
}

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

.signature-box {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fffaf2;
}

.data-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.data-list li {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.data-list b {
  color: var(--muted);
  font-size: 12px;
}

.timeline {
  display: grid;
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.timeline-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  background: var(--white);
  color: var(--ink);
}

.timeline-row b {
  color: var(--red);
}

.footer {
  padding: 28px clamp(18px, 5vw, 72px);
  background: #071018;
  color: var(--paper);
}

.footer p {
  color: #b9c5d2;
  font-size: 13px;
  font-weight: 700;
}

.print-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 16px 44px rgba(7, 16, 24, .25);
}

.print-root {
  display: none;
}

@media (max-width: 920px) {
  .hero,
  .grid-2,
  .grid-3,
  .metric-grid,
  .do-dont {
    grid-template-columns: 1fr;
  }

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

  .workflow {
    grid-template-columns: 1fr;
  }

  .nav {
    display: none;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
  }

  .brand small {
    display: none;
  }

  .hero,
  .section {
    padding-left: 16px;
    padding-right: 16px;
  }

  h1 {
    font-size: clamp(36px, 12vw, 52px);
  }

  .grid-4,
  .timeline-row,
  .form-grid,
  .signature-grid,
  .data-list li {
    grid-template-columns: 1fr;
  }

  .utilitybar,
  .snippet-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
  }

  th, td {
    font-size: 13px;
  }
}

@media print {
  .no-print,
  .topbar,
  .utilitybar,
  .snippet-actions,
  .toast {
    display: none !important;
  }

  body.print-one > *:not(.print-root) {
    display: none !important;
  }

  body.print-one .print-root {
    display: block;
    padding: 18mm 14mm;
  }

  .topbar {
    position: static;
  }

  body {
    background: white;
    color: black;
  }

  .hero,
  .section,
  .footer {
    padding: 22mm 14mm;
  }

  .pdf-sheet {
    max-width: none;
    padding: 0;
    border: 0;
    background: white;
  }

  .section {
    break-inside: avoid;
  }

  .card,
  .panel,
  .summary {
    box-shadow: none;
    break-inside: avoid;
  }

  a {
    text-decoration: none;
  }
}
