.m40-operation-console {
  --m40-ink: #183149;
  --m40-muted: #60788d;
  --m40-line: #d6e2eb;
  --m40-blue: #0f6f9c;
  --m40-blue-soft: #eaf6fb;
  --m40-green: #19745a;
  --m40-green-soft: #e9f7f1;
  --m40-amber: #9a6500;
  --m40-amber-soft: #fff7df;
  --m40-red: #a23c3c;
  --m40-red-soft: #fff0ef;
  color: var(--m40-ink);
  overflow: hidden;
}

.m40-console-hero {
  align-items: flex-start;
  background:
    radial-gradient(circle at 92% 10%, rgba(49, 164, 192, 0.22), transparent 32%),
    linear-gradient(135deg, #eef9fc 0%, #f7fbfd 48%, #f4f7fa 100%);
  border: 1px solid #c8e3ec;
  border-radius: 18px;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 24px;
}

.m40-console-hero h2,
.m40-action-surface h3 {
  color: #133650;
  margin: 4px 0 8px;
}

.m40-console-hero p,
.m40-action-card p,
.m40-action-grid p,
.m40-role-note small {
  color: var(--m40-muted);
  line-height: 1.65;
  margin: 0;
  overflow-wrap: anywhere;
}

.m40-eyebrow {
  color: var(--m40-blue);
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.m40-state-stack {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 240px;
}

.m40-state-stack strong {
  color: var(--m40-green);
  font-size: 14px;
  overflow-wrap: anywhere;
  text-align: right;
}

.m40-state-stack span {
  color: var(--m40-muted);
  font-size: 13px;
}

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

.m40-guard-grid span {
  background: var(--m40-green-soft);
  border: 1px solid #bce0d0;
  border-radius: 12px;
  color: var(--m40-green);
  font-size: 13px;
  font-weight: 750;
  min-height: 44px;
  padding: 12px 14px;
}

.m40-context-strip {
  background: #fff;
  border: 1px solid var(--m40-line);
  border-radius: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
  padding: 14px;
}

.m40-context-strip div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.m40-context-strip small {
  color: var(--m40-muted);
}

.m40-context-strip strong,
.m40-context-strip span {
  overflow-wrap: anywhere;
}

.m40-console-blocker,
.m40-console-error,
.m40-console-notice,
.m40-console-empty {
  border-radius: 12px;
  margin: 14px 0;
  padding: 14px 16px;
}

.m40-console-blocker {
  background: var(--m40-amber-soft);
  border: 1px solid #ead18d;
  color: #76500a;
}

.m40-console-blocker ul {
  margin: 8px 0 0 18px;
  padding: 0;
}

.m40-console-error {
  background: var(--m40-red-soft);
  border: 1px solid #efc3bf;
  color: var(--m40-red);
}

.m40-console-notice {
  background: var(--m40-green-soft);
  border: 1px solid #bce0d0;
  color: var(--m40-green);
}

.m40-console-notice p,
.m40-console-error p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.m40-console-empty {
  background: var(--m40-blue-soft);
  border: 1px solid #c5e2ed;
  color: var(--m40-blue);
}

.m40-step-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  list-style: none;
  margin: 14px 0;
  padding: 0;
}

.m40-step-grid li {
  min-width: 0;
}

.m40-step-grid button {
  background: #fff;
  border: 1px solid var(--m40-line);
  border-radius: 14px;
  color: var(--m40-ink);
  cursor: pointer;
  display: grid;
  gap: 6px;
  height: 100%;
  min-height: 150px;
  padding: 14px;
  text-align: left;
  width: 100%;
}

.m40-step-grid button > span {
  align-items: center;
  background: #eef3f7;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.m40-step-grid button > small,
.m40-step-grid button > p {
  color: var(--m40-muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
  overflow-wrap: anywhere;
}

.m40-step-grid .pass button {
  background: var(--m40-green-soft);
  border-color: #bce0d0;
}

.m40-step-grid .blocked button {
  background: var(--m40-red-soft);
  border-color: #efc3bf;
}

.m40-step-grid .current button,
.m40-step-grid .selected button {
  border-color: var(--m40-blue);
  box-shadow: 0 0 0 3px rgba(15, 111, 156, 0.12);
}

.m40-step-grid button:focus-visible,
.m40-operation-console .btn:focus-visible,
.m40-operation-console input:focus-visible,
.m40-operation-console select:focus-visible {
  outline: 3px solid rgba(15, 111, 156, 0.3);
  outline-offset: 2px;
}

.m40-action-surface {
  background: #f8fafc;
  border: 1px solid var(--m40-line);
  border-radius: 16px;
  padding: 18px;
}

.m40-action-surface > header {
  align-items: flex-start;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.m40-role-note {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  text-align: right;
}

.m40-role-note span {
  color: var(--m40-blue);
  font-weight: 750;
}

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

.m40-action-card,
.m40-action-grid article {
  background: #fff;
  border: 1px solid var(--m40-line);
  border-radius: 14px;
  padding: 16px;
}

.m40-action-card h4,
.m40-action-grid h4 {
  margin: 0 0 8px;
}

.m40-action-card ul {
  color: var(--m40-muted);
  line-height: 1.55;
}

.m40-operation-console label {
  color: #2c4b63;
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
  margin: 12px 0;
}

.m40-operation-console input,
.m40-operation-console select {
  background: #fff;
  border: 1px solid #bfcfdb;
  border-radius: 10px;
  color: var(--m40-ink);
  min-height: 44px;
  padding: 9px 11px;
  width: 100%;
}

.m40-operation-console .btn {
  min-height: 44px;
}

.m40-button-row,
.m40-route-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.m40-route-chips span {
  background: var(--m40-blue-soft);
  border: 1px solid #c5e2ed;
  border-radius: 999px;
  color: var(--m40-blue);
  font-size: 12px;
  padding: 7px 10px;
}

.m40-advanced-evidence {
  background: #fff;
  border: 1px solid var(--m40-line);
  border-radius: 12px;
  margin: 14px 0;
  overflow: hidden;
}

.m40-advanced-evidence > summary {
  color: var(--m40-blue);
  cursor: pointer;
  font-weight: 750;
  min-height: 44px;
  padding: 12px 14px;
}

.m40-advanced-evidence > :not(summary) {
  margin-left: 14px;
  margin-right: 14px;
}

.m40-advanced-evidence > :last-child {
  margin-bottom: 14px;
}

@media (max-width: 1500px) {
  .m40-step-grid {
    grid-template-columns: repeat(4, minmax(210px, 1fr));
    overflow-x: auto;
  }
}

@media (max-width: 1180px) {
  .m40-guard-grid,
  .m40-context-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .m40-step-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .m40-console-hero,
  .m40-action-surface > header {
    align-items: stretch;
    flex-direction: column;
  }

  .m40-state-stack,
  .m40-role-note {
    align-items: flex-start;
    min-width: 0;
    text-align: left;
  }

  .m40-guard-grid,
  .m40-context-strip,
  .m40-step-grid,
  .m40-action-grid {
    grid-template-columns: 1fr;
  }

  .m40-step-grid button {
    min-height: 132px;
  }
}
