* {
  box-sizing: border-box;
}

:root {
  color: #182028;
  background: #edf1f4;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(#d8e0e5 1px, transparent 1px),
    linear-gradient(90deg, #d8e0e5 1px, transparent 1px),
    #edf1f4;
  background-size: 32px 32px;
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(0, 113, 111, 0.2);
  outline-offset: 2px;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-surface {
  width: min(100%, 440px);
  padding: 28px;
  background: #ffffff;
  border: 1px solid #c8d0d6;
  border-top: 4px solid #00716f;
  border-radius: 6px;
  box-shadow: 0 14px 40px rgba(31, 43, 52, 0.12);
}

.brand-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid #e2e7ea;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: #00716f;
  border-radius: 6px;
  font-weight: 700;
  font-size: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  line-height: 1.3;
  font-weight: 680;
}

.brand-header p {
  margin-top: 3px;
  color: #64717b;
  font-size: 13px;
}

.environment-badge {
  padding: 4px 7px;
  color: #56636d;
  background: #f2f4f6;
  border: 1px solid #d7dde1;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.environment-badge.test {
  color: #8a4c00;
  background: #fff4d8;
  border-color: #e6c46e;
}

.environment-badge.production {
  color: #a12622;
  background: #fff0ef;
  border-color: #e9aaa7;
}

.login-form {
  display: grid;
  gap: 17px;
  padding-top: 24px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field label,
.mfa-status span {
  color: #3f4a53;
  font-size: 13px;
  font-weight: 600;
}

.form-field input {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  color: #182028;
  background: #ffffff;
  border: 1px solid #aeb9c1;
  border-radius: 4px;
}

.form-field input:hover {
  border-color: #71818d;
}

.form-field input:focus {
  border-color: #00716f;
}

.form-field input:disabled {
  color: #697680;
  background: #f3f5f6;
}

.mfa-status {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 11px;
  background: #f7f8f9;
  border: 1px solid #dce2e6;
  border-radius: 4px;
}

.mfa-status strong {
  color: #6b7780;
  font-size: 12px;
  font-weight: 500;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 4px;
  font-weight: 650;
  cursor: pointer;
}

.primary-button {
  color: #ffffff;
  background: #00716f;
  border: 1px solid #00716f;
}

.primary-button:hover {
  background: #005f5d;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.secondary-button {
  width: 100%;
  color: #27323a;
  background: #ffffff;
  border: 1px solid #aeb9c1;
}

.secondary-button:hover {
  background: #f3f5f6;
}

.danger-button {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 4px;
  font-weight: 650;
  font-size: 13px;
  cursor: pointer;
  color: #9b2925;
  background: #fff2f1;
  border: 1px solid #e3a9a5;
}

.danger-button:hover {
  background: #ffe3e1;
}

.danger-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.console-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  color: #9b2925;
  background: #fff2f1;
  border: 1px solid #e3a9a5;
  box-shadow: 0 6px 20px rgba(20, 30, 40, 0.16);
  z-index: 40;
}

.console-toast.ok {
  color: #14603f;
  background: #eafaf1;
  border-color: #a5d9bf;
}

.status-message {
  margin-top: 18px;
  padding: 10px 11px;
  color: #9b2925;
  background: #fff2f1;
  border: 1px solid #e7aaa7;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.5;
}

.status-message.info {
  color: #46545e;
  background: #f1f5f7;
  border-color: #ccd7dd;
}

.session-panel {
  padding-top: 24px;
}

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

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: #64717b;
  font-size: 12px;
}

h2 {
  font-size: 18px;
  line-height: 1.35;
}

.online-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #166b42;
  font-size: 12px;
}

.online-status i {
  width: 7px;
  height: 7px;
  background: #2d965f;
  border-radius: 50%;
}

.session-details {
  margin: 20px 0;
  border-top: 1px solid #e2e7ea;
}

.session-details div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #e2e7ea;
}

.session-details dt {
  color: #68757e;
  font-size: 13px;
}

.session-details dd {
  min-width: 0;
  margin: 0;
  color: #26313a;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.pending-console {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
  padding: 11px;
  background: #f1f6f5;
  border-left: 3px solid #00716f;
}

.pending-console strong {
  font-size: 13px;
}

.pending-console span {
  color: #66737c;
  font-size: 12px;
  line-height: 1.45;
}

[hidden] {
  display: none !important;
}

/* ---- WP-A1 控制台 ---- */
.console-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.console-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: #ffffff;
  border-bottom: 1px solid #d3dbe0;
}

.console-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 680;
  font-size: 15px;
}

.console-brand .brand-mark {
  width: 32px;
  height: 32px;
  font-size: 15px;
}

.console-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #3f4a53;
  font-size: 13px;
}

.secondary-button.compact {
  width: auto;
  min-height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

.primary-button.compact,
.danger-button.compact {
  width: auto;
  min-height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

/* 阶段 3 第 3 刀：节点容量水位 + 告警粘牌 */
.capacity-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 84px;
}
.capacity-text {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
}
.capacity-track {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-hover, #e2e8f0);
  overflow: hidden;
}
.capacity-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 200ms ease;
}
.capacity-fill.capacity-ok { background: var(--color-success, #16a34a); }
.capacity-fill.capacity-warning { background: var(--color-warning, #d97706); }
.capacity-fill.capacity-error { background: var(--color-error, #dc2626); }
.alert-chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}
.alert-chip.alert-warning {
  color: var(--color-warning, #92400e);
  background: var(--color-warning-subtle, #fef3c7);
}
.alert-chip.alert-error {
  color: var(--color-error, #991b1b);
  background: var(--color-error-subtle, #fee2e2);
}
.alert-chip.alert-ok {
  color: var(--color-success, #166534);
  background: var(--color-success-subtle, #dcfce7);
}
.alert-chip.alert-info {
  color: var(--color-brand, #1d4ed8);
  background: var(--color-brand-subtle, #dbeafe);
}
.data-table tr.row-at-risk td {
  background: var(--color-error-subtle, #fef2f2);
}

.console-body {
  flex: 1;
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  min-height: 0;
}

.console-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 10px;
  background: #f4f7f8;
  border-right: 1px solid #dce2e6;
}

.nav-item {
  padding: 10px 14px;
  text-align: left;
  color: #3f4a53;
  background: transparent;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
}

.nav-item:hover {
  background: #e6ecee;
}

.nav-item.active {
  color: #00514f;
  background: #d7e8e6;
  font-weight: 650;
}

.console-main {
  padding: 24px 28px;
  overflow-x: auto;
}

.console-loading,
.console-empty,
.console-error,
.console-note {
  display: block;
  color: #64717b;
  font-size: 13px;
}

.console-error {
  color: #9b2925;
}

.console-note {
  margin-top: 12px;
  color: #7a858d;
  font-size: 12px;
}

.console-empty {
  padding: 20px 0;
}

.console-title {
  margin-bottom: 18px;
  font-size: 20px;
}

.console-subtitle {
  margin: 24px 0 12px;
  font-size: 15px;
  font-weight: 650;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.stat-card {
  display: grid;
  gap: 4px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #d3dbe0;
  border-radius: 6px;
}

.stat-label {
  color: #64717b;
  font-size: 13px;
}

.stat-value {
  font-size: 26px;
  font-weight: 680;
  color: #182028;
}

.stat-hint {
  color: #7a858d;
  font-size: 12px;
}

/* 概览风险汇总：有待处理风险（>0）时高亮。 */
.stat-card-risk {
  border-color: var(--color-error, #dc2626);
  background: var(--color-error-subtle, #fef2f2);
}
.stat-card-risk .stat-value {
  color: var(--color-error, #991b1b);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.filter-label {
  color: #64717b;
  font-size: 13px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.metrics-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid #d3dbe0;
  border-radius: 6px;
  align-content: start;
}

.metrics-card-title {
  color: #182028;
  font-size: 13px;
  font-weight: 640;
}

.filter-input {
  height: 36px;
  padding: 0 10px;
  color: #182028;
  background: #ffffff;
  border: 1px solid #aeb9c1;
  border-radius: 4px;
  font-size: 13px;
}

.list-wrap {
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e2e7ea;
  white-space: nowrap;
}

.data-table th {
  color: #64717b;
  font-weight: 600;
  background: #f7f9fa;
}

.data-table td code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #26313a;
}

.data-table tr.clickable {
  cursor: pointer;
}

.data-table tr.clickable:hover td {
  background: #f2f6f7;
}

.empty-cell {
  color: #7a858d;
  text-align: center;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  background: #eef1f3;
  color: #4a565f;
}

.status-running,
.status-active,
.status-online {
  background: #dcefe4;
  color: #166b42;
}

.status-failed,
.status-revoked {
  background: #fbe3e2;
  color: #9b2925;
}

.status-completed {
  background: #dde8f5;
  color: #29508a;
}

.status-cancelled,
.status-offline,
.status-disabled,
.status-degraded,
.status-draining {
  background: #f2eddc;
  color: #8a6516;
}

.detail-list {
  margin: 0 0 8px;
  border-top: 1px solid #e2e7ea;
}

.detail-list div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #e2e7ea;
}

.detail-list dt {
  color: #68757e;
  font-size: 13px;
}

.detail-list dd {
  min-width: 0;
  margin: 0;
  color: #26313a;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  padding: 10px 0 10px 14px;
  border-left: 2px solid #cdd6db;
  margin-left: 6px;
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}

.timeline-seq {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: #7a858d;
}

.timeline-type {
  font-weight: 650;
  font-size: 13px;
  color: #26313a;
}

.timeline-time {
  color: #7a858d;
  font-size: 12px;
}

.timeline-meta {
  color: #7a858d;
  font-size: 12px;
}

.more-button {
  margin-top: 14px;
}

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

  .console-nav {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid #dce2e6;
  }

  .console-main {
    padding: 16px;
  }
}

@media (max-width: 520px) {
  .auth-layout {
    place-items: start center;
    padding: 16px;
  }

  .auth-surface {
    margin-top: 24px;
    padding: 22px 18px;
  }

  .brand-header {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .environment-badge {
    grid-column: 2;
    width: max-content;
  }
}
