:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --border: #d9e0e4;
  --text: #17212b;
  --muted: #64727f;
  --green: #0f8f69;
  --green-soft: #e8f6f0;
  --amber: #a86405;
  --amber-soft: #fff4df;
  --red: #b42318;
  --red-soft: #fff0ef;
  --blue: #2359c4;
  --blue-soft: #edf4ff;
  --ink: #0f172a;
  --violet: #5145cd;
  --violet-soft: #f0efff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Meiryo", "Yu Gothic", system-ui, sans-serif;
}

.shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.25;
}

h2 {
  font-size: 16px;
  line-height: 1.4;
}

.env-pill,
.status-badge {
  min-width: 88px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.status-badge.ok {
  border-color: #b9dfd0;
  background: var(--green-soft);
  color: var(--green);
}

.status-badge.warn,
.env-pill.warn {
  border-color: #f1d09b;
  background: var(--amber-soft);
  color: var(--amber);
}

.status-badge.error {
  border-color: #f2c3bf;
  background: var(--red-soft);
  color: var(--red);
}

.mini-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.mini-chip.ok {
  border-color: #b9dfd0;
  background: var(--green-soft);
  color: var(--green);
}

.mini-chip.warn {
  border-color: #f1d09b;
  background: var(--amber-soft);
  color: var(--amber);
}

.mini-chip.error {
  border-color: #f2c3bf;
  background: var(--red-soft);
  color: var(--red);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.status-panel,
.work-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfd;
}

.status-list {
  margin: 0;
  padding: 0;
}

.status-list div {
  display: grid;
  grid-template-columns: minmax(160px, 0.45fr) minmax(0, 1fr);
  min-height: 56px;
  border-bottom: 1px solid #eef1f3;
}

.status-list div:last-child {
  border-bottom: 0;
}

dt,
dd {
  margin: 0;
  padding: 16px;
  font-size: 14px;
  line-height: 1.5;
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  font-weight: 700;
}

.step-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-list li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 60px;
  padding: 14px 16px;
  border-bottom: 1px solid #eef1f3;
}

.step-list li:last-child {
  border-bottom: 0;
}

.step-list span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
}

.step-list p {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
}

.link-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.link-button {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--blue);
}

.primary-button {
  border: 1px solid #0d7e5d;
  background: var(--green);
  color: #ffffff;
  cursor: pointer;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.setup-body {
  display: grid;
  gap: 16px;
  padding: 18px 16px;
}

.setup-body p {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.7;
}

.result-box {
  min-height: 180px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid #d9e0e4;
  border-radius: 8px;
  background: #0f172a;
  color: #e5eefb;
  font-size: 13px;
  line-height: 1.6;
}

.result-box.compact {
  min-height: 96px;
}

.cases-panel {
  margin-top: 16px;
}

.implementation-panel {
  margin-bottom: 16px;
}

.implementation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px;
}

.implementation-card {
  min-height: 94px;
  padding: 12px;
  border: 1px solid #eef1f3;
  border-radius: 8px;
  background: #fbfcfd;
}

.implementation-card.done {
  border-color: #b9dfd0;
  background: var(--green-soft);
}

.implementation-card.preview {
  border-color: #c8d7f2;
  background: var(--blue-soft);
}

.implementation-card.locked {
  border-color: #e3e8ed;
  background: #f6f8fa;
}

.implementation-card.goal {
  border-color: #f1d09b;
  background: var(--amber-soft);
}

.implementation-title {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.implementation-card p:last-child {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.detail-panel {
  margin-top: 16px;
}

.auth-panel {
  margin-top: 16px;
}

.auth-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.auth-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.auth-title {
  font-size: 15px;
  font-weight: 800;
}

.auth-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.sign-in-mount:empty {
  display: none;
}

.case-list {
  display: grid;
  gap: 0;
}

.case-empty,
.case-card {
  padding: 16px;
  border-bottom: 1px solid #eef1f3;
}

.case-empty {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.case-card:last-child {
  border-bottom: 0;
}

.case-card.is-selected {
  background: #f8fbff;
}

.case-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.case-title {
  font-size: 15px;
  font-weight: 800;
}

.case-meta,
.case-detail {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.case-detail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.case-open-button {
  margin-top: 12px;
}

.case-detail-view {
  display: grid;
  gap: 0;
}

.detail-section {
  padding: 16px;
  border-bottom: 1px solid #eef1f3;
}

.detail-section:last-child {
  border-bottom: 0;
}

.detail-section h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

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

.detail-item {
  min-height: 54px;
  padding: 9px 10px;
  border: 1px solid #eef1f3;
  border-radius: 8px;
  background: #fbfcfd;
}

.detail-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-value {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
}

.property-grid {
  display: grid;
  gap: 12px;
}

.property-card {
  padding: 14px;
  border: 1px solid #dfe6eb;
  border-radius: 8px;
  background: #ffffff;
}

.property-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.property-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.property-title {
  font-size: 15px;
  font-weight: 800;
}

.property-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.property-body-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.8fr);
  gap: 12px;
}

.property-block {
  min-width: 0;
}

.property-block:nth-child(3),
.property-block:nth-child(4) {
  grid-column: 1 / -1;
}

.block-title {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.flow-stack {
  display: grid;
  gap: 8px;
}

.flow-label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workflow-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 6px;
}

.flow-step {
  min-height: 28px;
  padding: 6px 8px;
  border: 1px solid #dfe6eb;
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.flow-step.is-active {
  border-color: #9fcbba;
  background: var(--green-soft);
  color: var(--green);
}

.flow-step.is-disabled {
  color: #a2abb4;
  background: #f6f8fa;
}

.action-block {
  display: grid;
  gap: 8px;
}

.action-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.action-button.primary {
  border: 1px solid #0d7e5d;
  background: var(--green);
  color: #ffffff;
}

.action-button.secondary {
  border: 1px solid #c7d4dc;
  background: #ffffff;
  color: var(--blue);
}

.action-button.muted {
  border: 1px solid #dfe6eb;
  background: #f6f8fa;
  color: #7b8793;
}

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

.property-note {
  padding: 10px;
  border-left: 3px solid #b9dfd0;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.action-feedback {
  padding: 10px 12px;
  border: 1px solid #c8d7f2;
  border-radius: 8px;
  background: var(--blue-soft);
}

.action-feedback-title {
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.action-feedback-body {
  margin-top: 4px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-backdrop[hidden] {
  display: none;
}

.action-modal {
  width: min(560px, 100%);
  max-height: min(680px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.24);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfd;
}

.icon-close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

.modal-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.modal-body p {
  color: #334155;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.7;
}

.modal-summary {
  display: grid;
  gap: 8px;
  margin: 0;
}

.modal-summary div {
  display: grid;
  grid-template-columns: minmax(124px, 0.4fr) minmax(0, 1fr);
  border: 1px solid #eef1f3;
  border-radius: 8px;
  background: #fbfcfd;
}

.modal-summary dt,
.modal-summary dd {
  padding: 12px;
}

.modal-note {
  min-height: 44px;
  padding: 10px 12px;
  border-left: 3px solid #b9dfd0;
  background: #fbfcfd;
}

.modal-note.error {
  border-left-color: #f2c3bf;
  background: var(--red-soft);
  color: var(--red);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border);
}

.timeline-list,
.requirement-list {
  display: grid;
  gap: 8px;
}

.timeline-item,
.requirement-item {
  padding: 10px;
  border: 1px solid #eef1f3;
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding-top: 16px;
  }

  .topbar,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-list div {
    grid-template-columns: 1fr;
  }

  dt {
    padding-bottom: 4px;
  }

  dd {
    padding-top: 0;
  }

  .case-card-head,
  .auth-summary,
  .property-card-head,
  .case-detail {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

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

  .implementation-grid {
    grid-template-columns: 1fr;
  }

  .compact-grid,
  .rule-grid,
  .property-body-grid {
    grid-template-columns: 1fr;
  }

  .property-block:nth-child(3),
  .property-block:nth-child(4) {
    grid-column: auto;
  }

  .workflow-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-summary div {
    grid-template-columns: 1fr;
  }

  .modal-summary dt {
    padding-bottom: 0;
  }

  .modal-summary dd {
    padding-top: 4px;
  }
}
