:root {
  color-scheme: light;
  --canvas: #eef1f5;
  --canvas-deep: #e6eaf0;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-muted: #f5f7fa;
  --line: rgba(60, 60, 67, 0.12);
  --line-strong: rgba(60, 60, 67, 0.2);
  --text: #1d1d1f;
  --secondary: #5d6168;
  --tertiary: #7d828b;
  --blue: #007aff;
  --blue-soft: #e8f2ff;
  --green: #248a3d;
  --green-soft: #e8f7ec;
  --orange: #c65300;
  --orange-soft: #fff1e6;
  --red: #d70015;
  --red-soft: #ffecee;
  --shadow: 0 18px 50px rgba(28, 39, 52, 0.12), 0 2px 8px rgba(28, 39, 52, 0.06);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "Microsoft YaHei UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 680px;
  min-height: 420px;
  background: transparent;
  color: var(--text);
}

body {
  width: 860px;
  height: 520px;
  overflow: hidden;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  font: inherit;
}

.monitor-shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  background:
    radial-gradient(circle at 90% -20%, rgba(0, 122, 255, 0.13), transparent 42%),
    linear-gradient(145deg, #f6f7f9 0%, var(--canvas) 55%, var(--canvas-deep) 100%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.monitor-top,
.summary-card,
.content-panel,
.status-line {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 1px 1px rgba(28, 39, 52, 0.03);
}

.monitor-top {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 12px 11px 16px;
  border-radius: 18px;
}

.title-cluster {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.window-mark {
  display: flex;
  gap: 5px;
  padding: 8px;
  border-radius: 12px;
  background: var(--surface-muted);
}

.window-mark span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff5f57;
}

.window-mark span:nth-child(2) {
  background: #febc2e;
}

.window-mark span:nth-child(3) {
  background: #28c840;
}

.eyebrow,
.card-label,
.section-kicker,
.section-meta {
  margin: 0;
  color: var(--tertiary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
}

.eyebrow span {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 3px;
  font-size: 21px;
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.12;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

h2 {
  margin-top: 2px;
  font-size: 15px;
  font-weight: 720;
  letter-spacing: -0.015em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 680;
  line-height: 1;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.26);
  outline-offset: 2px;
}

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

.button.primary {
  min-width: 128px;
  background: var(--blue);
  color: white;
  box-shadow: 0 5px 14px rgba(0, 122, 255, 0.22);
}

.button.primary:hover:not(:disabled) {
  background: #0875e1;
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface-solid);
  color: var(--text);
}

.button.quiet {
  background: transparent;
  color: var(--secondary);
}

.button.quiet:hover:not(:disabled) {
  background: var(--surface-muted);
}

.summary-band {
  display: grid;
  grid-template-columns: 1.05fr 0.72fr 0.9fr 2fr;
  gap: 10px;
}

.summary-card {
  min-width: 0;
  min-height: 82px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 13px;
  border-radius: 16px;
}

.summary-card strong {
  min-width: 0;
  margin-top: 5px;
  color: var(--text);
  font-size: 18px;
  font-weight: 720;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-card small {
  margin-top: 4px;
  color: var(--tertiary);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.risk-card[data-tone="ok"] strong {
  color: var(--green);
}

.risk-card[data-tone="warn"] strong {
  color: var(--orange);
}

.risk-card[data-tone="danger"] strong {
  color: var(--red);
}

.connection-card strong {
  font-size: 14px;
}

.runtime-badges {
  display: flex;
  gap: 5px;
  margin-top: 6px;
  min-width: 0;
}

.runtime-badge {
  min-width: 0;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 690;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runtime-badge.ready {
  background: var(--green-soft);
  color: var(--green);
}

.runtime-badge.pending {
  background: var(--surface-muted);
  color: var(--secondary);
}

.runtime-badge.danger {
  background: var(--red-soft);
  color: var(--red);
}

.monitor-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 12px;
}

.content-panel {
  min-height: 0;
  display: grid;
  padding: 12px;
  border-radius: 18px;
  overflow: hidden;
}

.party-panel {
  grid-template-rows: 38px 18px minmax(0, 1fr);
}

.evidence-panel {
  grid-template-rows: 38px auto minmax(0, 1fr);
  gap: 8px;
}

.section-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-meta {
  max-width: 48%;
  margin-top: 8px;
  text-align: right;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.party-list {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: 4px;
}

.party-columns {
  display: grid;
  grid-template-columns: 24px 62px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  color: var(--tertiary);
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
}

.party-columns span:last-child {
  text-align: center;
}

.party-row {
  min-height: 0;
  display: grid;
  grid-template-columns: 24px 62px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 6px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--surface-muted);
  font-size: 11px;
  overflow: hidden;
}

.party-row.self {
  border-color: rgba(0, 122, 255, 0.2);
  background: var(--blue-soft);
}

.job-icon,
.job-icon-placeholder {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  object-fit: contain;
}

.job-icon-placeholder {
  background: #e4e7eb;
  color: var(--tertiary);
  font-size: 10px;
  font-weight: 700;
}

.party-row .job {
  min-width: 0;
  color: var(--text);
  font-size: 10px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-row .identity {
  min-width: 0;
  color: var(--secondary);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-status {
  justify-self: stretch;
  padding: 2px 5px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.member-status.pending,
.member-status.muted {
  background: #e9ecf0;
  color: var(--secondary);
}

.member-status.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.member-status.clear {
  background: var(--green-soft);
  color: var(--green);
}

.member-status.danger {
  background: var(--red-soft);
  color: var(--red);
}

.probe-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid rgba(0, 122, 255, 0.12);
  border-radius: 13px;
  background: var(--blue-soft);
}

.probe-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-solid);
  box-shadow: 0 1px 3px rgba(0, 90, 190, 0.1);
}

.probe-icon span {
  width: 13px;
  height: 13px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  position: relative;
}

.probe-icon span::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 2px;
  right: -5px;
  bottom: -2px;
  border-radius: 2px;
  background: var(--blue);
  transform: rotate(45deg);
}

.probe-copy {
  min-width: 0;
}

.probe-title-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.probe-title-row strong {
  font-size: 12px;
  font-weight: 730;
}

.probe-title-row span {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--blue);
  font-size: 9px;
  font-weight: 720;
}

.probe-copy p {
  margin-top: 3px;
  color: #3f6288;
  font-size: 10px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.evidence-list {
  min-height: 0;
  display: grid;
  grid-auto-rows: min-content;
  align-content: start;
  gap: 6px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #c9ced6 transparent;
}

.evidence-empty {
  height: 100%;
  min-height: 112px;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--secondary);
  text-align: center;
}

.empty-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 16px;
  font-weight: 800;
}

.evidence-empty strong {
  font-size: 12px;
}

.evidence-empty small {
  margin-top: 4px;
  color: var(--tertiary);
  font-size: 10px;
}

.evidence-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) 62px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-solid);
}

.evidence-indicator {
  width: 6px;
  height: 28px;
  border-radius: 999px;
  background: var(--blue);
}

.evidence-item.medium .evidence-indicator {
  background: var(--orange);
}

.evidence-item.high .evidence-indicator {
  background: var(--red);
}

.evidence-body {
  min-width: 0;
}

.evidence-title {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
}

.evidence-title span,
.evidence-excerpt {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evidence-title strong {
  color: var(--tertiary);
  font-size: 9px;
}

.evidence-excerpt {
  margin-top: 3px;
  color: var(--secondary);
  font-size: 10px;
  line-height: 1.25;
}

.evidence-time {
  color: var(--tertiary);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.status-line {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 11px;
  border-radius: 12px;
  color: var(--secondary);
  font-size: 11px;
  line-height: 1.25;
}

.status-symbol {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
}

#statusLine {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 760px), (max-height: 460px) {
  body {
    width: 760px;
    height: 420px;
  }

  .monitor-shell {
    gap: 8px;
    padding: 10px;
    border-radius: 18px;
  }

  .monitor-top {
    min-height: 54px;
    padding: 7px 8px 7px 12px;
    border-radius: 14px;
  }

  .window-mark {
    display: none;
  }

  h1 {
    font-size: 18px;
  }

  .button {
    min-height: 34px;
    padding: 0 10px;
  }

  .summary-band {
    gap: 7px;
  }

  .summary-card {
    min-height: 62px;
    padding: 7px 10px;
    border-radius: 13px;
  }

  .summary-card strong {
    margin-top: 3px;
    font-size: 15px;
  }

  .summary-card small {
    display: none;
  }

  .monitor-grid {
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 8px;
  }

  .content-panel {
    padding: 9px;
    border-radius: 14px;
  }

  .party-panel {
    grid-template-rows: 30px minmax(0, 1fr);
  }

  .party-columns {
    display: none;
  }

  .party-panel .section-head {
    align-items: center;
  }

  .party-panel .section-kicker {
    display: none;
  }

  .party-panel h2 {
    margin-top: 0;
  }

  .party-panel .section-meta {
    margin-top: 0;
  }

  .evidence-panel {
    grid-template-rows: 36px auto minmax(0, 1fr);
    gap: 6px;
  }

  .party-list {
    gap: 2px;
  }

  .party-row {
    padding: 0 7px;
    border-radius: 8px;
  }

  .job-icon,
  .job-icon-placeholder {
    width: 15px;
    height: 15px;
    border-radius: 4px;
  }

  .member-status {
    padding-block: 1px;
    font-size: 8.5px;
  }

  .probe-card {
    padding: 5px 8px;
  }

  .probe-icon {
    width: 28px;
    height: 28px;
  }

  .evidence-empty {
    min-height: 70px;
  }

  .empty-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 5px;
  }

  .status-line {
    min-height: 28px;
    padding: 5px 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
