*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --navy:  #1f3a5f;
  --green: #2e7d5a;
  --red:   #b3382e;
  --white: #ffffff;
  --bg:    #f5f7fa;
  --border:#d0d7de;
  --text:  #1a1a2e;
  --muted: #5a6880;
  --gold:  #c9a227;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI",
               "Meiryo", "Hiragino Kaku Gothic ProN", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
}

/* ── Header ── */
.site-header {
  background: var(--navy);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.header-inner {
  padding: 12px 16px 8px;
}

.site-header h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* ── Tab Nav ── */
.tab-nav {
  display: flex;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.tab-btn {
  flex: 1;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
  border: none;
  border-bottom: 3px solid transparent;
  padding: 9px 4px 7px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-align: center;
}

.tab-btn.active {
  background: var(--white);
  color: var(--navy);
  border-bottom-color: var(--gold);
}

.tab-btn:hover:not(.active) {
  background: rgba(255,255,255,0.16);
  color: var(--white);
}

/* ── Tool sections ── */
.tool {
  display: none;
}

.tool.active {
  display: block;
}

.tool-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.tool-inner h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--navy);
}

.tool-desc {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 22px;
}

/* ── Form ── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 7px;
}

.note-inline {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="number"],
select {
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  width: 100%;
  max-width: 200px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a6880' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

input[type="number"]:focus,
select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(31,58,95,0.12);
}

.unit {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Buttons ── */
.btn-primary {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 24px auto 0;
  padding: 14px 20px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-primary:hover { opacity: 0.87; }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 9px 16px;
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--navy);
  border-radius: 7px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s;
}

.btn-secondary:hover { background: #f0f4fa; }

.link-btn {
  background: none;
  border: none;
  color: var(--navy);
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
}

/* ── Result Box ── */
.result-box {
  margin-top: 22px;
  padding: 18px 16px;
  border-radius: 10px;
  border: 2px solid;
}

.result-box.result-ok      { background: #f0faf5; border-color: var(--green); }
.result-box.result-warn    { background: #fff5f4; border-color: var(--red); }
.result-box.result-neutral { background: #f0f4fa; border-color: var(--navy); }

.result-box .result-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}
.result-box .result-main {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
}
.result-box .result-sub {
  font-size: 13px;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.result-ok   .result-label, .result-ok   .result-main { color: var(--green); }
.result-warn .result-label, .result-warn .result-main { color: var(--red); }
.result-neutral .result-label, .result-neutral .result-main { color: var(--navy); }

/* ── Guide Section (Tool A) ── */
.guide-section {
  margin-top: 28px;
  background: #f5f8ff;
  border: 1.5px solid #b8cbea;
  border-radius: 10px;
  padding: 20px 18px;
}

.guide-heading {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--navy);
}

.guide-item {
  margin-bottom: 18px;
}

.guide-item:last-child { margin-bottom: 0; }

.guide-item h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.guide-item p {
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
}

.guide-item ul {
  margin: 6px 0 0 18px;
  font-size: 13px;
  line-height: 1.8;
}

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

.guide-table td {
  padding: 7px 10px;
  border: 1px solid var(--border);
  line-height: 1.5;
  vertical-align: top;
}

.guide-table td:first-child {
  white-space: nowrap;
  font-weight: 700;
  color: var(--navy);
  background: #eef2fa;
  width: 38%;
}

/* ── Tool B: 行リスト ── */
.b-header-row,
.b-row {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 64px 32px;
  gap: 6px;
  align-items: center;
}

.b-header-row {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  text-align: center;
}

.b-header-row span:first-child { text-align: left; }

.b-row {
  margin-bottom: 8px;
}

.b-row select {
  max-width: none;
  font-size: 13px;
  padding: 8px 24px 8px 7px;
}

.b-row input[type="number"] {
  max-width: none;
  font-size: 15px;
  padding: 8px;
  text-align: center;
}

.btn-del {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  color: var(--red);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  width: 32px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.btn-del:hover {
  background: #fff0f0;
  border-color: var(--red);
}

.b-note {
  font-size: 12px;
  color: var(--muted);
  background: #f5f8ff;
  border-left: 3px solid var(--navy);
  padding: 10px 12px;
  border-radius: 0 6px 6px 0;
  margin: 16px 0;
  line-height: 1.6;
}

.b-to-a-wrap {
  margin-top: 12px;
}

/* ── Tool C: 質問 ── */
.c-question {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}

.c-question h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
  line-height: 1.5;
}

.c-question-num {
  display: inline-block;
  background: var(--navy);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
}

.c-question-hint {
  font-size: 12px;
  color: var(--muted);
  margin: -6px 0 10px;
}

.c-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.c-opt-btn {
  padding: 8px 14px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.c-opt-btn:hover { border-color: var(--navy); background: #f0f4fa; }
.c-opt-btn.selected { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* ── Tool C: 結果 ── */
.c-result-header {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  margin: 20px 0 14px;
}

.subsidy-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.subsidy-name  { font-weight: 700; font-size: 14px; color: var(--navy); margin-bottom: 5px; }
.subsidy-desc  { font-size: 13px; color: var(--text); margin-bottom: 5px; line-height: 1.6; }
.subsidy-office{ font-size: 12px; color: var(--muted); }
.subsidy-warn  { font-size: 11px; color: #9b6a10; margin-top: 6px; }

.no-subsidy {
  padding: 16px;
  background: #f0f4fa;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.btn-reset {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 20px;
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--navy);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-reset:hover { background: #f0f4fa; }

/* ── Footer ── */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.7);
  padding: 20px 16px 24px;
  margin-top: 48px;
  text-align: center;
}

.disclaimer {
  font-size: 11px;
  line-height: 1.7;
  margin-bottom: 12px;
}

.footer-links {
  font-size: 12px;
}

.footer-links a {
  color: rgba(255,255,255,0.85);
}

/* ── Utilities ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (min-width: 480px) {
  .tab-btn { font-size: 13px; padding: 10px 6px 8px; }
  .site-header h1 { font-size: 19px; }
  .b-header-row,
  .b-row { grid-template-columns: 1.6fr 1.3fr 72px 36px; }
  .b-row select { padding: 8px 26px 8px 8px; }
}

@media (min-width: 640px) {
  .tool-inner { padding: 28px 24px 56px; }
  .tool-inner h2 { font-size: 22px; }
  .btn-primary { font-size: 17px; }
  .b-header-row,
  .b-row { grid-template-columns: 1.6fr 1.4fr 80px 40px; }
}

@media (min-width: 960px) {
  .tool-inner { padding: 36px 32px 64px; }
}
