:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --ink: #14243a;
  --muted: #637187;
  --line: #d9e2ed;
  --navy: #102f52;
  --blue: #176db5;
  --blue-dark: #0d568f;
  --blue-soft: #e9f3fc;
  --green: #167447;
  --green-soft: #e8f6ef;
  --amber: #9b5b09;
  --amber-soft: #fff6e4;
  --red: #b42318;
  --shadow: 0 14px 40px rgba(16, 47, 82, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN",
    sans-serif;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(23, 109, 181, 0.24);
  outline-offset: 2px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  color: #fff;
  background: linear-gradient(118deg, #0a2746 0%, #155f9f 72%, #1b78c4 100%);
  box-shadow: 0 6px 18px rgba(8, 33, 59, 0.22);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 17px 24px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.35;
}

.brand p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #a9d6fb;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.header-links {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.header-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 9px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.header-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.app-shell {
  display: grid;
  grid-template-columns: 255px minmax(0, 1fr) 315px;
  gap: 18px;
  max-width: 1680px;
  margin: 18px auto;
  padding: 0 18px 32px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sidebar,
.summary {
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 114px);
  overflow: auto;
}

.sidebar {
  padding: 15px;
}

.summary {
  padding: 18px;
}

.content {
  min-width: 0;
}

.section-card {
  margin-bottom: 14px;
  padding: 22px;
}

.section-card h2,
.section-card h3 {
  margin: 0 0 8px;
  color: var(--navy);
}

.section-card h2 {
  font-size: 20px;
}

.section-card h3 {
  font-size: 15px;
}

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

.notice {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid #f1d69a;
  border-radius: 10px;
  color: #77500c;
  background: var(--amber-soft);
  font-size: 12px;
}

.success-note {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid #bce3cd;
  border-radius: 10px;
  color: #125b39;
  background: var(--green-soft);
  font-size: 12px;
}

.sidebar-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.step-button,
.category-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0;
  padding: 10px;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.step-button:hover,
.category-button:hover,
.step-button.active,
.category-button.active {
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.step-button.done {
  color: var(--green);
}

.category-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 13px 0;
  padding: 4px;
  border-radius: 10px;
  background: #edf2f7;
}

.mode-button {
  padding: 8px 6px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

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

.divider {
  height: 1px;
  margin: 13px 0;
  background: var(--line);
}

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

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

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

.field label {
  color: #33465e;
  font-size: 12px;
  font-weight: 800;
}

.required {
  margin-left: 5px;
  color: var(--red);
  font-size: 10px;
}

.field input,
.field select,
.field textarea,
.toolbar input,
.toolbar select,
.settings input {
  width: 100%;
  border: 1px solid #cbd7e4;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
}

.field input,
.field select,
.toolbar input,
.toolbar select,
.settings input {
  min-height: 42px;
  padding: 9px 11px;
}

.field textarea {
  min-height: 112px;
  padding: 10px 11px;
  resize: vertical;
}

.field-help {
  color: var(--muted);
  font-size: 10px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.toolbar input {
  min-width: 180px;
}

.toolbar select {
  width: auto;
  min-width: 150px;
}

.question {
  margin-bottom: 11px;
  padding: 17px;
}

.question-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.question-number {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 7px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 10px;
  font-weight: 900;
}

.question-text {
  flex: 1;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.55;
}

.badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
}

.answer-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 9px;
}

.answer-button {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #33465e;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.answer-button:hover {
  border-color: #92b8d8;
  background: #f5faff;
}

.answer-button.selected {
  border-color: var(--navy);
  color: #fff;
  background: var(--navy);
}

.question-detail {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.question-detail textarea {
  width: 100%;
  min-height: 48px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
}

.hours {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.hours.editable {
  color: var(--blue-dark);
  cursor: pointer;
  text-decoration: underline;
}

.wizard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0;
}

.wizard-nav .right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #24415e;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.button:hover {
  border-color: #9bbbd6;
  background: #f7fbff;
}

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

.button.primary:hover {
  background: var(--blue-dark);
}

.button.danger {
  color: var(--red);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.summary h3 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 15px;
}

.metric {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.metric:last-of-type {
  border-bottom: 0;
}

.metric label {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.metric strong {
  display: block;
  margin-top: 2px;
  font-size: 20px;
  line-height: 1.35;
}

.metric .range {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.progress-track {
  height: 9px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6edf5;
}

.progress-bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1681d5, #18a06c);
  transition: width 0.2s ease;
}

.summary .button {
  width: 100%;
  margin-top: 8px;
}

.summary-note {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 10px;
}

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

.project-item {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.project-item label {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.project-item strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-item.full {
  grid-column: 1 / -1;
}

.project-item.full strong {
  white-space: normal;
}

.settings {
  display: none;
}

.settings.visible {
  display: block;
}

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

.settings label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.settings input {
  margin-top: 5px;
}

.empty-state {
  padding: 30px 20px;
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none !important;
}

.home-page {
  min-height: 100vh;
  padding: 8vh 20px;
  background:
    radial-gradient(circle at top left, rgba(43, 137, 210, 0.19), transparent 34%),
    var(--bg);
}

.home-card {
  max-width: 840px;
  margin: 0 auto;
  padding: 34px;
}

.home-card h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(25px, 4vw, 36px);
}

.home-card > p {
  color: var(--muted);
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 25px;
}

.home-option {
  display: block;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
}

.home-option:hover {
  border-color: #8ab4d7;
  box-shadow: 0 10px 30px rgba(16, 47, 82, 0.09);
}

.home-option strong {
  display: block;
  color: var(--blue-dark);
  font-size: 17px;
}

.home-option span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.home-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .summary {
    position: static;
    grid-column: 1 / -1;
    max-height: none;
  }
}

@media (max-width: 780px) {
  .header-inner {
    align-items: flex-start;
    padding: 14px 16px;
  }

  .brand p {
    display: none;
  }

  .app-shell {
    display: block;
    padding: 0 12px 24px;
  }

  .sidebar,
  .summary {
    position: static;
    margin-bottom: 12px;
  }

  .sidebar {
    max-height: 340px;
  }

  .summary {
    max-height: none;
  }

  .category-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .form-grid,
  .settings-grid,
  .project-brief,
  .home-grid {
    grid-template-columns: 1fr;
  }

  .field.full,
  .project-item.full {
    grid-column: auto;
  }

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

  .question-detail {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar select {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .header-link:first-child {
    display: none;
  }

  .section-card,
  .home-card {
    padding: 18px;
  }

  .question-top {
    flex-wrap: wrap;
  }

  .question-text {
    flex-basis: calc(100% - 55px);
  }

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

@media print {
  body {
    background: #fff;
  }

  .app-header,
  .sidebar,
  .toolbar,
  .wizard-nav,
  .summary .button,
  .settings,
  .no-print {
    display: none !important;
  }

  .app-shell {
    display: block;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .panel {
    box-shadow: none;
  }

  .question {
    break-inside: avoid;
  }

  .summary {
    position: static;
    max-height: none;
    margin-top: 12px;
  }
}
