:root {
  color-scheme: light;
  --color-text: #05070d;
  --color-muted: #5c6574;
  --color-line: #dbe6f4;
  --color-bg: #f4f8ff;
  --color-brand: #075bff;
  --color-brand-dark: #003eb8;
  --color-accent: #20d4f4;
  --shadow: 0 18px 42px rgba(7, 91, 255, 0.13);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--color-bg);
  line-height: 1.55;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(100% - 32px, 1180px);
  margin: 0 auto;
  padding: 22px 0;
}

.brand,
.header-actions,
.secret-box {
  display: flex;
  align-items: center;
}

.brand {
  min-width: 260px;
  gap: 12px;
}

.brand-mark {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

.header-actions {
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--color-brand);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  font-size: 16px;
  white-space: nowrap;
}

.policy-label,
.secret-box {
  min-height: 36px;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--color-muted);
  font-size: 13px;
  box-shadow: 0 8px 18px rgba(7, 91, 255, 0.06);
}

.policy-label {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
}

.secret-box {
  gap: 9px;
  max-width: min(52vw, 480px);
  padding: 5px 5px 5px 12px;
}

.secret-label {
  flex: 0 0 auto;
  color: var(--color-brand-dark);
  font-size: 11px;
  font-weight: 700;
}

.secret-box code {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-feedback {
  width: 38px;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-brand), #0344d8);
  box-shadow: 0 10px 20px rgba(7, 91, 255, 0.22);
}

.icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #ffffff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-button:hover {
  background: var(--color-brand-dark);
}

.icon-button.is-copied {
  background: #0aa776;
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--color-brand-dark);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(7, 91, 255, 0.06);
}

.header-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.header-link:hover {
  border-color: var(--color-brand);
  background: #f8fbff;
}

.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #e8f7ff;
  color: var(--color-brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  width: min(100% - 32px, 1180px);
  margin: 0 auto;
  padding: 12px 0 32px;
}

.list-pane,
.detail-pane,
.history-pane {
  min-width: 0;
}

.list-pane {
  grid-column: 1 / -1;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

input,
select,
button {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--color-text);
  font: inherit;
}

input,
select {
  padding: 7px 9px;
}

button {
  cursor: pointer;
  border-color: var(--color-brand);
  background: linear-gradient(135deg, var(--color-brand), #0344d8);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(7, 91, 255, 0.22);
}

button:hover {
  background: var(--color-brand-dark);
}

.table-wrap {
  height: 252px;
  overflow: auto;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--color-line);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef5ff;
  color: var(--color-muted);
  font-weight: 700;
}

tr {
  cursor: pointer;
}

tr.selected td {
  background: #e8f7ff;
  color: var(--color-brand-dark);
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 5px;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 600;
}

.span-2 {
  grid-column: span 2;
}

.check-row {
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.form-actions {
  grid-column: span 2;
  display: flex;
  justify-content: flex-end;
}

.form-actions button {
  width: 120px;
}

.refresh-button {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
}

.history-pane {
  margin-top: 0;
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.history-item,
.empty {
  margin: 0;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  background: #ffffff;
  font-size: 13px;
}

.history-item {
  overflow: hidden;
  border-left: 4px solid var(--color-brand);
  box-shadow: 0 10px 24px rgba(7, 91, 255, 0.08);
}

.history-failed {
  border-left-color: #d64545;
}

.history-summary {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  min-height: 0;
  padding: 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  text-align: left;
}

.history-summary:hover {
  background: #f8fbff;
}

.history-summary:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: -2px;
}

.history-mark {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 156px;
  min-width: 156px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0 12px;
  border-radius: 8px;
  background: #e8f7ff;
  color: var(--color-brand-dark);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-body {
  display: grid;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-message {
  color: var(--color-text);
  line-height: 1.5;
}

.history-result {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f7ff;
  color: var(--color-brand-dark);
  font-size: 11px;
  font-weight: 700;
}

.history-failed .history-result {
  background: #fff1f1;
  color: #a61b1b;
}

.history-meta {
  flex-wrap: wrap;
  color: var(--color-muted);
  font-size: 12px;
}

.history-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f4f8ff;
  font-weight: 600;
}

.history-meta time {
  margin-left: auto;
  white-space: nowrap;
}

.history-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #f4f8ff;
  color: var(--color-brand-dark);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  transition: transform 160ms ease;
}

.history-summary[aria-expanded="true"] .history-toggle {
  transform: rotate(180deg);
}

.history-details {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--color-line);
  background: #fbfdff;
}

.history-details[hidden] {
  display: none;
}

.history-detail-section {
  display: grid;
  gap: 8px;
  padding-top: 12px;
}

.history-detail-section h3 {
  margin: 0;
  color: var(--color-brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.history-detail-section dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.history-change-section {
  gap: 6px;
}

.history-change-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 8px 0 10px;
  border-top: 1px solid var(--color-line);
}

.history-detail-section .history-change-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0;
}

.history-change-row dt {
  display: flex;
  align-items: flex-start;
  min-width: 0;
  padding: 0;
  color: var(--color-brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.history-change-value {
  min-width: 0;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.history-change-before {
  border-color: #ffc9c9;
  background: #fff5f5;
}

.history-change-after {
  border-color: #a9e3c0;
  background: #f2fbf5;
}

.history-change-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.history-change-before::before,
.history-change-after::before {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 700;
}

.history-change-before::before {
  content: "変更前";
  color: #b42318;
}

.history-change-after::before {
  content: "変更後";
  color: #137333;
}

.history-detail-section-prose {
  gap: 7px;
}

.history-detail-section .history-detail-prose {
  display: block;
  grid-template-columns: none;
  gap: 0;
  margin: 0;
}

.history-detail-prose div {
  min-width: 0;
}

.history-detail-prose dt {
  margin: 0 0 6px;
  color: var(--color-brand);
  font-size: 12px;
  font-weight: 700;
}

.history-detail-prose dd {
  max-width: 68ch;
  margin: 0;
  color: #233045;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.8;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.history-detail-row {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  background: #ffffff;
}

.history-detail-row dt {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 700;
}

.history-detail-row dd {
  min-width: 0;
  margin: 0;
  color: var(--color-text);
  font-weight: 600;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.empty {
  padding: 12px;
}

.api-page {
  display: grid;
  gap: 18px;
  width: min(100% - 32px, 1180px);
  margin: 0 auto;
  padding: 12px 0 40px;
}

.api-overview,
.api-section {
  min-width: 0;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.api-overview {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.api-overview p,
.api-section p {
  margin: 8px 0 0;
  color: var(--color-muted);
  font-size: 13px;
}

.api-common-grid,
.api-fields {
  display: grid;
  gap: 10px;
  margin: 0;
}

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

.api-common-grid div,
.api-fields div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  background: #fbfdff;
}

.api-common-grid dt,
.api-fields dt {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 700;
}

.api-common-grid dd,
.api-fields dd {
  min-width: 0;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 600;
}

.api-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.api-nav a {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--color-brand-dark);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.api-nav a:hover {
  border-color: var(--color-brand);
  background: #f8fbff;
}

.api-section {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.api-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.api-section-head > code {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 8px;
  background: #eef5ff;
  color: var(--color-brand-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

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

.api-spec-grid section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.api-spec-grid h3 {
  margin: 0;
  color: var(--color-brand-dark);
  font-size: 13px;
}

.sample-command-label {
  width: fit-content;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 8px;
  background: #e8f7ff;
  color: var(--color-brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.code-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #10234d;
  border-radius: 8px;
  background: #071225;
}

.code-panel pre {
  margin: 0;
  overflow: auto;
  padding: 42px 14px 14px;
}

.code-panel code {
  color: #e7f0ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre;
}

.copy-code {
  position: absolute;
  top: 8px;
  right: 8px;
  width: auto;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid #2b7cff;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: none;
}

.copy-code.is-copied {
  border-color: #0aa776;
  background: #0aa776;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar,
  .header-actions,
  .pane-header {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-actions {
    width: 100%;
  }

  .topbar,
  .workspace {
    width: min(100% - 28px, 1180px);
  }

  .secret-box {
    max-width: none;
  }

  .api-common-grid,
  .api-spec-grid {
    grid-template-columns: 1fr;
  }

  .api-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .api-section-head > code {
    white-space: normal;
  }
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2,
  .form-actions {
    grid-column: span 1;
  }

  .form-actions button {
    width: 100%;
  }

  .history-detail-section dl {
    grid-template-columns: 1fr;
  }

  .history-change-row dt {
    padding-top: 4px;
  }
}
