:root {
  --brand: #3178e2;
  --brand-dark: #0069d3;
  --navy: #405d9c;
  --text: #3b455b;
  --muted: #606e7f;
  --placeholder: #99a0ad;
  --canvas: #f6f8fa;
  --base: #ffffff;
  --subtle: #f9fafb;
  --brand-subtle: #f3f9ff;
  --border: #e2e6ed;
  --border-subtle: #edf1f6;
  --border-input: #dadee4;
  --green: #00a16c;
  --green-bg: #ecfdf5;
  --green-border: #c0efde;
  --orange: #f28100;
  --orange-bg: #fff9ee;
  --orange-border: #ffeac3;
  --red: #ef4444;
  --red-dark: #b91c1c;
  --red-bg: #fef2f2;
  --red-border: #fee2e2;
  --shadow-low: 0 1px 3px rgba(78, 91, 149, .04), 0 4px 6px -1px rgba(78, 91, 149, .02);
  --shadow-middle: 0 3px 6px -1px rgba(78, 91, 149, .08), 0 8px 15px -3px rgba(78, 91, 149, .06);
  --shadow-high: 0 5px 15px -3px rgba(78, 91, 149, .15), 0 12px 50px -12px rgba(78, 91, 149, .08);
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; color: var(--text); background: var(--canvas); font-family: 'Roboto', 'Noto Sans JP', Meiryo, sans-serif; font-size: 14px; line-height: 1.7; }
button, input, textarea, select { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--brand-dark); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; font-weight: 500; line-height: 1.3; }
h2 { font-size: 18px; font-weight: 500; line-height: 1.3; }
hr { width: 100%; margin: 0; border: 0; border-top: 1px solid var(--border); }
.isHidden { display: none !important; }
.srOnly { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.appShell { position: fixed; inset: 0; min-width: 1160px; overflow: hidden; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: 240px; flex-direction: column; background: var(--base); border-right: 1px solid var(--border); }
.sidebar__logo { display: flex; height: 56px; align-items: center; gap: 12px; padding: 0 20px; color: var(--text); font-size: 16px; font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--border); }
.sidebar__logo small { color: var(--muted); font-size: 12px; font-weight: 400; }
.sidebar__logoMark, .authCard__mark { display: inline-flex; width: 32px; height: 32px; flex: 0 0 32px; align-items: center; justify-content: center; border-radius: 8px; color: #fff; background: var(--brand); font-size: 12px; font-weight: 500; }
.sidebar__nav { display: flex; flex: 1; flex-direction: column; gap: 4px; padding: 16px 12px; }
.navItem { display: flex; width: 100%; height: 44px; align-items: center; gap: 12px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px; font-weight: 500; text-align: left; cursor: pointer; }
.navItem:hover { background: var(--subtle); }
.navItem.isActive { color: var(--brand-dark); background: var(--brand-subtle); }
.navItem:focus-visible { outline: none; box-shadow: 0 0 0 3px #d8ebff; }
.navItem__mark { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); background: var(--base); font-size: 12px; line-height: 1; }
.navItem.isActive .navItem__mark { border-color: #d8ebff; color: var(--brand-dark); background: #ecf6ff; }
.sidebar__footer { padding: 16px 20px 24px; border-top: 1px solid var(--border); }
.sidebar__footer p { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.appShell__content { height: 100%; margin-left: 240px; }
.topbar { position: fixed; inset: 0 0 auto 240px; z-index: 10; display: flex; height: 56px; min-width: 920px; align-items: center; justify-content: space-between; padding: 0 24px; background: var(--base); border-bottom: 1px solid var(--border); }
.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.breadcrumb strong { color: var(--text); font-weight: 500; }
.topbar__actions { display: flex; align-items: center; gap: 12px; }
.main { height: calc(100% - 56px); min-width: 920px; margin-top: 56px; padding: 24px; overflow: auto; }

.page { display: none; max-width: 1320px; margin: 0 auto; padding-bottom: 40px; }
.page.isActive { display: block; }
.pageHeader { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.pageHeader__title { display: flex; align-items: center; gap: 12px; }
.pageHeader__mark { display: inline-flex; width: 40px; height: 40px; flex: 0 0 40px; align-items: center; justify-content: center; border: 1px solid #d8ebff; border-radius: 8px; color: var(--brand-dark); background: var(--brand-subtle); font-size: 14px; font-weight: 500; line-height: 1; }
.pageHeader__mark--wide { width: 48px; flex-basis: 48px; font-size: 12px; }
.pageHeader--detail h1 { font-size: 22px; }
.pageDescription { max-width: 720px; margin: 0 0 24px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.sectionBlock { margin-top: 32px; }
.sectionHeader { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.button { display: inline-flex; height: 40px; align-items: center; justify-content: center; gap: 6px; padding: 0 20px; border: 1px solid transparent; border-radius: 8px; font-weight: 500; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background .2s, border-color .2s, color .2s; }
.button:focus-visible, .iconButton:focus-visible, .linkButton:focus-visible { outline: none; box-shadow: 0 0 0 3px #d8ebff; }
.button:disabled { border-color: transparent; color: #b1baca; background: var(--border); pointer-events: none; }
.button--lg { height: 48px; padding: 0 24px; font-size: 16px; }
.button--md { height: 40px; padding: 0 20px; font-size: 14px; }
.button--sm { height: 32px; padding: 0 16px; font-size: 12px; }
.button--primary { color: #fff; background: var(--brand); }
.button--primary:hover { background: var(--brand-dark); }
.button--primary:active { background: #005caf; }
.button--secondary { border-color: var(--border-input); color: var(--text); background: var(--base); }
.button--secondary:hover { background: var(--subtle); }
.button--secondary:active { background: var(--border-subtle); }
.button--danger-primary { color: #fff; background: var(--red); }
.button--danger-primary:hover { background: var(--red-dark); }
.button--danger-secondary { border-color: var(--red); color: var(--red); background: var(--base); }
.button--danger-secondary:hover { background: var(--red-bg); }
.linkButton { padding: 4px; border: 0; border-radius: 4px; color: var(--brand-dark); background: transparent; font-weight: 500; cursor: pointer; }
.iconButton { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 50%; color: var(--muted); background: transparent; font-size: 24px; cursor: pointer; }
.iconButton:hover { background: var(--subtle); }

.badge { display: inline-flex; min-height: 24px; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--subtle); font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; }
.badge--success { border-color: var(--green-border); color: var(--green); background: var(--green-bg); }
.badge--warning { border-color: var(--orange-border); color: var(--orange); background: var(--orange-bg); }
.badge--danger { border-color: var(--red-border); color: var(--red); background: var(--red-bg); }
.badge--info { border-color: #d8ebff; color: var(--brand-dark); background: var(--brand-subtle); }
.statusDot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.statusDot--success { background: var(--green); }

.card { overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--base); box-shadow: var(--shadow-low); }
.card__header { display: flex; min-height: 56px; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.card__body { padding: 24px; }
.formCard { margin-bottom: 24px; }
.statsGrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.statCard { padding: 20px 24px; }
.statCard__label { color: var(--muted); font-size: 13px; }
.statCard__value { margin-top: 8px; font-size: 28px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.3; }
.statCard__unit { margin-left: 4px; color: var(--muted); font-size: 13px; }
.guideSteps { padding: 24px; }
.guideSteps ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin: 0; padding: 0; list-style: none; }
.guideSteps li { display: flex; gap: 12px; }
.guideSteps li > span { display: inline-flex; width: 32px; height: 32px; flex: 0 0 32px; align-items: center; justify-content: center; border-radius: 50%; color: var(--brand-dark); background: var(--brand-subtle); font-weight: 500; }
.guideSteps strong { font-weight: 500; }
.guideSteps p { margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.tableCard { min-height: 200px; }
.tableWrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--muted); background: var(--subtle); font-size: 13px; font-weight: 400; text-align: left; white-space: nowrap; }
.table td { max-width: 360px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 24px; }
.table th:last-child, .table td:last-child { padding-right: 24px; }
.table tbody tr:hover { background: var(--subtle); }
.table tbody tr:last-child td { border-bottom: 0; }
.table__summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table__action { color: var(--brand-dark); font-weight: 500; text-decoration: none; }
.cardToolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.cardToolbar--filters { justify-content: flex-start; }
.searchField { width: 320px; }

.input, .select { display: block; width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-input); border-radius: 8px; color: var(--text); background: var(--base); font-size: 14px; }
.input::placeholder, .textarea::placeholder { color: var(--placeholder); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px #ecf6ff; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--red); color: var(--red); background: var(--red-border); }
.input--code, .textarea--code, .codeBlock { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.selectWrap { position: relative; width: 100%; }
.selectWrap::after { position: absolute; top: 8px; right: 12px; content: '⌄'; color: var(--placeholder); font-size: 16px; pointer-events: none; }
.select { padding-right: 32px; appearance: none; cursor: pointer; }
.selectWrap--filter { width: 200px; }
.textarea { display: block; width: 100%; min-height: 96px; padding: 12px; border: 1px solid var(--border-input); border-radius: 8px; color: var(--text); background: var(--base); font-size: 14px; line-height: 1.7; resize: vertical; }
.textarea--schema { min-height: 280px; }
.field { width: 100%; }
.field--short { max-width: 320px; }
.field label, .field legend { display: block; margin-bottom: 8px; color: var(--muted); font-size: 14px; font-weight: 500; line-height: 1.5; }
.field legend { padding: 0; }
.field__help { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.fieldError { display: flex; gap: 4px; margin-top: 8px; color: var(--red); font-size: 13px; }
.fieldError::before { content: '!'; font-weight: 500; }
.required { color: var(--red); }
.formStack { display: flex; flex-direction: column; gap: 24px; }
.formActions { position: sticky; bottom: -24px; display: flex; z-index: 5; align-items: center; justify-content: space-between; gap: 16px; margin: 24px -24px -40px; padding: 16px 24px; border-top: 1px solid var(--border); background: rgba(246, 248, 250, .96); }
.formActions > div { display: flex; gap: 12px; }
.copyRow { display: flex; gap: 12px; }

.stateMessage { padding: 40px 24px; text-align: center; }
.stateMessage__mark { display: flex; width: 80px; height: 80px; align-items: center; justify-content: center; margin: 0 auto 16px; border-radius: 50%; color: var(--muted); background: var(--border-subtle); font-size: 28px; }
.stateMessage__mark--success { color: var(--green); background: var(--green-bg); }
.stateMessage h2 { font-size: 15px; }
.stateMessage p { margin-top: 8px; color: var(--muted); font-size: 13px; }
.noticePanel { margin-bottom: 24px; padding: 16px; border: 1px solid #d8ebff; border-radius: 8px; color: var(--text); background: var(--brand-subtle); }
.noticePanel strong { font-weight: 500; }
.noticePanel p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.noticePanel--warning { margin: 0; border-color: var(--orange-border); background: var(--orange-bg); }

.detailGrid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 24px; margin-bottom: 24px; }
.definitionList { display: grid; grid-template-columns: 180px minmax(0, 1fr); margin: 0; }
.definitionList dt, .definitionList dd { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); }
.definitionList dt { color: var(--muted); background: var(--subtle); font-size: 13px; }
.definitionList dd { min-width: 0; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.definitionList--compact { margin-top: 24px; }
.notes { display: flex; flex-direction: column; gap: 12px; }
.note { padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--subtle); }
.note p { white-space: pre-wrap; }
.note time { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.codeBlock { overflow-x: auto; margin: 0; padding: 16px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--subtle); line-height: 1.7; white-space: pre-wrap; }
.resourceList { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.resourceList a { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); text-decoration: none; }
.resourceList a:hover { border-color: var(--brand); background: var(--brand-subtle); }
.resourceList strong { font-weight: 500; }
.resourceList span { color: var(--muted); font-size: 13px; }

.authGate { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(246, 248, 250, .96); }
.authCard { display: flex; width: 440px; flex-direction: column; gap: 24px; padding: 32px; border: 1px solid var(--border); border-radius: 16px; background: var(--base); box-shadow: var(--shadow-high); }
.authCard__mark { width: 48px; height: 48px; flex-basis: 48px; font-size: 14px; }
.authCard > p { color: var(--muted); }
.modal { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; }
.modal::backdrop { background: rgba(30, 47, 93, .24); backdrop-filter: blur(4px); }
.modal[open] { display: flex; align-items: center; justify-content: center; }
.modal__panel { width: min(560px, calc(100% - 48px)); max-height: calc(100% - 48px); overflow: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--base); box-shadow: var(--shadow-high); }
.modal__header { display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.modal__header h2 { font-size: 20px; }
.modal__header--danger { justify-content: flex-start; }
.modal__dangerMark { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: 50%; color: var(--red); background: var(--red-border); font-size: 20px; font-weight: 500; }
.modal__body { padding: 24px; }
.modal__footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--border); }
.dangerText { margin-top: 12px; color: var(--red); font-size: 13px; }
.checkGrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.checkGrid label { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 400; }
.checkGrid input { width: 20px; height: 20px; accent-color: var(--brand); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 120; max-width: 400px; padding: 12px 16px; border-radius: 6px; color: #fff; background: var(--green); box-shadow: var(--shadow-middle); }
.toast.isError { background: var(--red); }

.hostedFormPage { min-height: 100%; height: auto; padding: 24px; }
.hostedForm { width: min(640px, 100%); margin: 40px auto; }
.hostedForm .card__header h1 { font-size: 22px; }
.hostedForm__credit { margin-top: 16px; color: var(--muted); font-size: 12px; text-align: center; }
.hostedForm .button--primary { align-self: flex-end; }

@media (max-width: 768px) {
  .hostedFormPage { padding: 16px; }
  .hostedForm { margin: 16px auto; }
  .hostedForm .card__body { padding: 20px; }
}
