:root {
  --bg-top: #0a1116;
  --bg-bottom: #111a20;
  --panel-bg: rgba(14, 20, 27, 0.86);
  --panel-border: rgba(138, 162, 178, 0.18);
  --muted: #8da1b1;
  --text: #eef4fb;
  --accent: #a3ff9f;
  --accent-strong: #78e86f;
  --danger: #ff8f70;
  --shadow: 0 30px 60px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

body.console-body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  background:
    radial-gradient(circle at top left, rgba(163, 255, 159, 0.14), transparent 28%),
    radial-gradient(circle at right 10%, rgba(77, 196, 255, 0.1), transparent 24%),
    linear-gradient(165deg, var(--bg-top), var(--bg-bottom));
}

.console-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
  padding: 1rem;
}

.topbar,
.statusbar,
.panel {
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.topbar,
.statusbar {
  border-radius: 18px;
  padding: 0.9rem 1rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-brand,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-system,
.statusbar-inner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.brand-dot,
.status-lamp {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  box-shadow: 0 0 18px rgba(163, 255, 159, 0.55);
}

.status-lamp.status-healthy {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

.status-lamp.status-degraded {
  background: linear-gradient(180deg, #ffd666, #ffb347);
  box-shadow: 0 0 18px rgba(255, 214, 102, 0.45);
}

.status-lamp.status-unknown {
  background: linear-gradient(180deg, #91a0ad, #6b7884);
  box-shadow: 0 0 18px rgba(145, 160, 173, 0.35);
}

.brand-title {
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.brand-subtitle,
.panel-header p,
.identity-role,
.task-group h3,
.message-label,
.detail-grid dt,
.status-pill {
  color: var(--muted);
}

.identity-card {
  text-align: right;
}

.identity-name {
  font-size: 0.92rem;
}

.topbar-button,
.panel-action,
.chat-input-row button {
  border: 1px solid rgba(163, 255, 159, 0.24);
  border-radius: 12px;
  background: rgba(163, 255, 159, 0.08);
  color: var(--text);
  padding: 0.65rem 0.9rem;
  cursor: pointer;
}

.topbar-button.danger {
  border-color: rgba(255, 143, 112, 0.25);
  background: rgba(255, 143, 112, 0.08);
  color: #ffd5c7;
}

.topbar-button.status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(16rem, 21rem) minmax(0, 1fr) minmax(18rem, 22rem);
  gap: 1rem;
  min-height: 0;
}

.panel {
  border-radius: 22px;
  padding: 1rem;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
}

.task-columns,
.chat-stream,
.panel-details {
  min-height: 0;
}

.task-columns {
  display: grid;
  gap: 0.8rem;
  overflow: auto;
}

.task-group {
  display: grid;
  gap: 0.5rem;
}

.task-group h3 {
  margin: 0;
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
}

.group-count {
  margin-left: 0.35rem;
  color: var(--text);
}

.task-card,
.detail-card,
.message-bubble {
  border: 1px solid rgba(141, 161, 177, 0.16);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  padding: 0.85rem;
}

.task-card-button {
  width: 100%;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.task-card-button.selected,
.task-card-button:hover {
  border-color: rgba(163, 255, 159, 0.32);
  background: rgba(163, 255, 159, 0.06);
}

.task-card.skeleton-card {
  min-height: 4rem;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.02), rgba(255,255,255,0.06), rgba(255,255,255,0.02));
}

.task-card.skeleton-card.muted {
  opacity: 0.6;
}

.task-card h4,
.detail-card h3 {
  margin: 0;
}

.pr-card h4 {
  margin: 0.35rem 0 0;
}

.task-card p,
.detail-description {
  margin: 0.45rem 0 0;
  line-height: 1.5;
}

.pr-topline,
.pr-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.pr-topline {
  align-items: start;
}

.pr-actions {
  justify-content: start;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.pr-safety {
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.9rem;
  border: 1px solid rgba(255, 214, 102, 0.2);
  background: rgba(255, 214, 102, 0.08);
}

.pr-safety-danger {
  border-color: rgba(255, 143, 112, 0.24);
  background: rgba(255, 143, 112, 0.08);
  color: #ffd5c7;
}

.pr-diff {
  max-height: 26rem;
  overflow: auto;
  margin-top: 0.8rem;
}

.task-card-topline,
.detail-title-row,
.detail-badges,
.execution-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.detail-title-row {
  align-items: start;
}

.task-priority,
.task-tier,
.detail-status,
.execution-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(141, 161, 177, 0.2);
}

.task-priority {
  background: rgba(125, 211, 252, 0.08);
}

.task-tier.tier-1 {
  background: rgba(163, 255, 159, 0.1);
}

.task-tier.tier-2 {
  background: rgba(255, 214, 102, 0.1);
}

.task-tier.tier-3 {
  background: rgba(255, 143, 112, 0.12);
}

.task-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.8rem 0 0;
}

.task-meta dt {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.task-meta dd {
  margin: 0.18rem 0 0;
}

.task-card-empty {
  color: var(--muted);
}

.chat-stream {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 0.8rem;
  overflow: auto;
}

.message-bubble.user {
  border-color: rgba(163, 255, 159, 0.24);
}

.message-bubble.assistant {
  border-color: rgba(125, 211, 252, 0.22);
}

.message-bubble p {
  margin: 0.35rem 0 0;
  line-height: 1.5;
}

.chat-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
}

.chat-input-row textarea {
  resize: none;
  min-height: 5rem;
  border-radius: 16px;
  border: 1px solid rgba(141, 161, 177, 0.16);
  background: rgba(8, 12, 16, 0.72);
  color: var(--text);
  padding: 0.9rem 1rem;
  font: inherit;
}

.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 0.8rem;
  margin: 0;
}

.detail-grid dd {
  margin: 0;
}

.detail-pre {
  overflow: auto;
  margin: 0.75rem 0 0;
  padding: 0.85rem;
  border-radius: 14px;
  background: rgba(8, 12, 16, 0.72);
}

.execution-list {
  display: grid;
  gap: 0.75rem;
}

.execution-card {
  border: 1px solid rgba(141, 161, 177, 0.16);
  border-radius: 14px;
  padding: 0.8rem;
}

.execution-status-succeeded {
  background: rgba(163, 255, 159, 0.1);
}

.execution-status-failed,
.execution-status-cancelled {
  background: rgba(255, 143, 112, 0.12);
}

.execution-status-running {
  background: rgba(125, 211, 252, 0.1);
}

.execution-error {
  margin: 0.75rem 0 0;
  color: #ffd5c7;
}

.detail-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

.panel-action.ghost {
  background: transparent;
}

.statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.detail-list {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
}

.detail-list li + li {
  margin-top: 0.35rem;
}

.status-pill {
  border: 1px solid rgba(141, 161, 177, 0.16);
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  background: rgba(255, 255, 255, 0.02);
}

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

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

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }
}
