/* ============================================
   助成金ヒアリングフォーム — 共通スタイル
   コーポレート青系 / 端正・信頼感
   ============================================ */

:root {
  /* Color tokens */
  --bg: #f5f7fb;
  --bg-elev: #ffffff;
  --bg-section: #f8fafc;
  --border: #e3e8f0;
  --border-strong: #c8d2e0;
  --border-focus: #1d4fd8;
  --text: #0f1b2d;
  --text-2: #46556b;
  --text-3: #6b7891;
  --muted: #8a96ab;
  --primary: #1d4fd8;
  --primary-hover: #1742b8;
  --primary-soft: #e7eefd;
  --primary-strong: #143092;
  --success: #0f8a5f;
  --success-soft: #e6f5ee;
  --warning: #b76b00;
  --warning-soft: #fff4e0;
  --danger: #c53030;
  --danger-soft: #fdecec;
  --header-bg: #0b1d3d;
  --header-text: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.04), 0 1px 1px rgba(15, 27, 45, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 27, 45, 0.06), 0 1px 2px rgba(15, 27, 45, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 27, 45, 0.08);

  /* Type */
  --font-sans: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Radius */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-xl: 14px;

  /* Layout */
  --maxw: 880px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; }
.ast-container{
	padding: 0;
}
/* ---------- Header ---------- */
.f-header {
  background: linear-gradient(135deg, #0b1d3d 0%, #143064 60%, #1d4fd8 130%);
  color: var(--header-text);
  padding: 28px 24px 32px;
  position: relative;
  overflow: hidden;
}
.f-header::after {
  content: "";
  position: absolute;
  inset: auto -20% -50% auto;
  width: 60%;
  height: 200%;
  background: radial-gradient(closest-side, rgba(255,255,255,0.06), transparent 70%);
  pointer-events: none;
}
.f-header__brand {
  font-size: 12px;
  letter-spacing: 0.18em;
  font-weight: 600;
  opacity: 0.78;
  display: flex;
  align-items: center;
  gap: 10px;
}
.f-header__brand::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: linear-gradient(135deg, #5b8bff, #ffffff);
  display: inline-block;
}
.f-header__title {
  margin: 14px 0 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
color: #fff;
}
.f-header__sub {
  font-size: 13px;
  opacity: 0.78;
  font-weight: 400;
}
.f-header__chip {
  display: inline-block;
  margin-top: 14px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.08em;
}

/* ---------- Container ---------- */
.f-shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 15px 80px;
}

/* ---------- Section card ---------- */
.f-section {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}
.f-section__head {
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-section);
}
.f-section__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.f-section__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--primary);
  color: white;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}
.f-section__hint {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--text-3);
}
.f-section__body {
  padding: 18px 15px 22px;
}

/* Sub-group within a section */
.f-subgroup {
  border-top: 1px dashed var(--border);
  padding-top: 16px;
  margin-top: 16px;
}
.f-subgroup:first-child {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}
.f-subgroup__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.f-subgroup__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.f-subgroup__badge {
  font-size: 11px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.f-subgroup__remove {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-3);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.f-subgroup__remove:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ---------- Field row ---------- */
.f-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px 18px;
  align-items: start;
  padding: 8px 0;
}
.f-row + .f-row {
  border-top: 1px solid #f1f4f8;
}
.f-row__label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  padding-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.f-req {
  color: var(--danger);
  font-size: 11px;
  background: var(--danger-soft);
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.f-opt {
  color: var(--text-3);
  font-size: 11px;
  background: #f0f3f8;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
}
.f-row__field { min-width: 0; }
.f-row__hint {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 6px;
}

/* ---------- Inputs ---------- */
.f-input,
.f-select,
.f-textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s, background .15s;
  line-height: 1.5;
}
.f-input::placeholder, .f-textarea::placeholder { color: #b3bccd; }
.f-input:hover, .f-select:hover, .f-textarea:hover { border-color: #9aa9c2; }
.f-input:focus,
.f-select:focus,
.f-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(29, 79, 216, 0.12);
}
.f-textarea { min-height: 140px; resize: vertical; }
.f-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%2346556b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.f-input.is-error,
.f-select.is-error,
.f-textarea.is-error {
  border-color: var(--danger);
  background: #fff8f8;
}
.f-error-msg {
  display: none;
  font-size: 12px;
  color: var(--danger);
  margin-top: 5px;
  font-weight: 500;
}
.f-row.is-error .f-error-msg { display: block; }

.f-counter {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Composed inputs */
.f-compose {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.f-compose .f-input { width: 83px; flex: 0 0 auto; text-align: center; }
.f-compose .f-input--mid { width: 110px; }
.f-compose .f-input--wide { width: 140px; }
.f-compose .f-sep { color: var(--muted); }
.f-compose .f-suffix { font-size: 13px; color: var(--text-3); }

/* Radio / Checkbox pills */
.f-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.f-options input[type="radio"],
.f-options input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.f-options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: white;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-2);
  transition: all .15s;
  user-select: none;
}
.f-options label::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: white;
  flex: 0 0 auto;
  transition: all .15s;
}
.f-options input[type="checkbox"] + label::before { border-radius: 4px; }
.f-options label:hover { border-color: #9aa9c2; }
.f-options input:checked + label {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-strong);
  font-weight: 600;
}
.f-options input:checked + label::before {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 3px white;
}
.f-options input[type="checkbox"]:checked + label::before {
  background: var(--primary) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 5l2 2 4-4' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/8px no-repeat;
  box-shadow: none;
}

/* ---------- Buttons ---------- */
.f-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  line-height: 1;
}
.f-btn--primary {
  background: var(--primary);
  color: white;
}
.f-btn--primary:hover { background: var(--primary-hover); }
.f-btn--ghost {
  background: white;
  color: var(--text-2);
  border-color: var(--border-strong);
}
.f-btn--ghost:hover { border-color: #9aa9c2; background: #fafbfd; }
.f-btn--link {
  background: transparent;
  color: var(--primary);
  padding: 8px 12px;
}
.f-btn--link:hover { background: var(--primary-soft); }
.f-btn--save {
  background: var(--primary);
  color: white;
  padding: 10px 26px;
  font-weight: 600;
}
.f-btn--save:hover { background: var(--primary-hover); }
.f-btn--submit {
  background: var(--success);
  color: white;
  padding: 14px 36px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.f-btn--submit:hover { background: #0c6f4d; }
.f-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.f-btn--block { display: flex; width: 100%; }

.f-btn-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
}
.f-btn-row--end { justify-content: flex-end; }
.f-btn-row--between { justify-content: space-between; }

/* ---------- Misc helpers ---------- */
.f-callout {
  border: 1px dashed var(--danger);
  background: var(--danger-soft);
  color: #8b1d1d;
  padding: 14px 16px;
  border-radius: var(--r-md);
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 4px;
  cursor: pointer;
  transition: all .15s;
}
.f-callout:hover { background: #fbdfdf; }
.f-callout::before {
  content: "+";
  display: inline-block;
  width: 20px;
  height: 20px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  margin-right: 8px;
  font-weight: 700;
  line-height: 20px;
}

.f-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: white;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 1000;
}
.f-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.f-saved-indicator {
  font-size: 12px;
  color: var(--success);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.f-saved-indicator::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

/* ---------- Progress bar (B案) ---------- */
.f-progress {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 18px 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.f-progress__inner { max-width: var(--maxw); margin: 0 auto; }
.f-progress__steps {
  display: flex;
  gap: 0;
  align-items: center;
  margin-bottom: 10px;
}
.f-progress__step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  font-size: 11.5px;
  color: var(--text-3);
  cursor: pointer;
  transition: color .15s;
}
.f-progress__step:hover { color: var(--text); }
.f-progress__dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--border-strong);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all .2s;
}
.f-progress__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 13px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border-strong);
  z-index: 1;
}
.f-progress__step.is-done .f-progress__dot {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
.f-progress__step.is-done:not(:last-child)::after { background: var(--success); }
.f-progress__step.is-current .f-progress__dot {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.f-progress__step.is-current { color: var(--primary); font-weight: 600; }

.f-progress__bar {
  height: 4px;
  background: #eef1f6;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}
.f-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #4d7af0);
  border-radius: 99px;
  transition: width .35s ease;
}
.f-progress__pct {
  font-size: 11px;
  color: var(--text-3);
  text-align: right;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* B案: hide non-current sections */
.layout-multistep .f-section { display: none; }
.layout-multistep .f-section.is-active {
  display: block;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Side nav (C案) ---------- */
.layout-sidenav .f-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  max-width: 1100px;
}
.f-sidenav {
  position: sticky;
  top: 16px;
  align-self: start;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 10px;
  box-shadow: var(--shadow-sm);
}
.f-sidenav__title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.12em;
  padding: 4px 10px 10px;
}
.f-sidenav__list { list-style: none; padding: 0; margin: 0; }
.f-sidenav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  transition: all .15s;
}
.f-sidenav__item:hover { background: var(--bg-section); }
.f-sidenav__item.is-active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 600;
}
.f-sidenav__num {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: #eef1f6;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.f-sidenav__item.is-active .f-sidenav__num {
  background: var(--primary);
  color: white;
}
.f-sidenav__item.is-done .f-sidenav__num {
  background: var(--success);
  color: white;
}
.f-sidenav__progress {
  margin: 12px 10px 4px;
  height: 4px;
  background: #eef1f6;
  border-radius: 99px;
  overflow: hidden;
}
.f-sidenav__progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width .35s;
}
.f-sidenav__pct {
  margin: 6px 10px 0;
  font-size: 11px;
  color: var(--text-3);
  text-align: right;
}

/* ---------- Done screen ---------- */
.f-done {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 56px 32px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.f-done__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--success-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
}
.f-done__title { font-size: 22px; font-weight: 700; margin: 0 0 8px; }
.f-done__sub { font-size: 14px; color: var(--text-3); margin: 0 0 28px; }
.f-done__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* JSON / Email preview drawer */
.f-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 92vw);
  background: white;
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 32px rgba(15,27,45,0.1);
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 200;
  display: flex;
  flex-direction: column;
}
.f-drawer.is-open { transform: translateX(0); }
.f-drawer__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.f-drawer__title { font-size: 15px; font-weight: 700; flex: 1; }
.f-drawer__close {
  background: transparent;
  border: 0;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-3);
  width: 32px;
  height: 32px;
  border-radius: 6px;
}
.f-drawer__close:hover { background: var(--bg-section); }
.f-drawer__tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
}
.f-drawer__tab {
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  background: none;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  font-weight: 600;
}
.f-drawer__tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.f-drawer__body {
  flex: 1;
  overflow: auto;
  padding: 18px 20px;
}
.f-drawer__pre {
  margin: 0;
  padding: 14px;
  background: #0f1b2d;
  color: #d8e2ee;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}
.f-drawer__email {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--text);
}
.f-drawer__email-meta {
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12.5px;
  margin-bottom: 14px;
}
.f-drawer__email-meta div { display: flex; gap: 8px; }
.f-drawer__email-meta strong { width: 56px; color: var(--text-3); font-weight: 600; }
.f-drawer__email-body {
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
}
.f-drawer__backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 27, 45, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  z-index: 199;
}
.f-drawer__backdrop.is-open { opacity: 1; pointer-events: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .f-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .f-row__label { padding-top: 0; }
  .layout-sidenav .f-shell {
    grid-template-columns: 1fr;
  }
  .f-sidenav { position: relative; top: 0; }
}
