:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #0d1b2d;
  --panel-soft: #13243b;
  --border: #223957;
  --text: #eff6ff;
  --muted: #8ea5c4;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.14);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --neutral: #94a3b8;
  --shadow: 0 20px 45px rgba(2, 8, 23, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(96, 165, 250, 0.18), transparent 30%),
    linear-gradient(180deg, #07111f 0%, #091521 100%);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  background: rgba(7, 17, 31, 0.82);
  backdrop-filter: blur(16px);
  border-right: 1px solid rgba(142, 165, 196, 0.12);
}

.brand h1,
.section-header h2,
.section-header.inner h2,
.detail-title {
  margin: 0;
}

.brand p {
  color: var(--muted);
  line-height: 1.55;
}

.brand-kicker,
.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 8px;
}

.sidebar-nav {
  margin: 28px 0;
  display: grid;
  gap: 8px;
}

.sidebar-nav a {
  padding: 12px 14px;
  border-radius: 14px;
  color: #d8e7ff;
  background: transparent;
  border: 1px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(19, 36, 59, 0.9);
  border-color: rgba(96, 165, 250, 0.22);
}

.main-content {
  padding: 28px;
  display: grid;
  gap: 24px;
}

.section {
  display: grid;
  gap: 16px;
}

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

.section-header.inner {
  margin-bottom: 4px;
}

.card {
  background: linear-gradient(180deg, rgba(13, 27, 45, 0.96), rgba(10, 21, 36, 0.98));
  border: 1px solid rgba(142, 165, 196, 0.14);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.card.compact,
.section-card,
.table-card {
  padding: 18px;
}

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

.kpi-card {
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(19, 36, 59, 0.92), rgba(10, 21, 36, 0.98));
  border: 1px solid rgba(142, 165, 196, 0.12);
}

.kpi-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.kpi-value {
  margin-top: 12px;
  font-size: clamp(1.55rem, 2vw, 2rem);
  font-weight: 700;
}

.kpi-footnote {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.role-grid,
.split-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.role-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(19, 36, 59, 0.76);
  border: 1px solid rgba(142, 165, 196, 0.14);
}

.role-card-header,
.label-row,
.task-card-header,
.inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.role-meta,
.muted {
  color: var(--muted);
}

.status-badge,
.severity-badge,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-active,
.severity-info { background: rgba(52, 211, 153, 0.14); color: #9bf2cd; }
.status-warning,
.severity-warning { background: rgba(251, 191, 36, 0.14); color: #fddc7b; }
.status-critical,
.severity-critical { background: rgba(248, 113, 113, 0.16); color: #ffb0b0; }
.status-neutral { background: rgba(148, 163, 184, 0.14); color: #d8e7ff; }

.stack-list {
  display: grid;
  gap: 12px;
}

.list-item,
.task-card,
.detail-block {
  padding: 16px;
  border-radius: 18px;
  background: rgba(19, 36, 59, 0.7);
  border: 1px solid rgba(142, 165, 196, 0.12);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.toolbar-field {
  display: grid;
  gap: 8px;
}

.toolbar-field span {
  font-size: 0.82rem;
  color: var(--muted);
}

input,
select {
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(142, 165, 196, 0.2);
  background: rgba(7, 17, 31, 0.75);
  color: var(--text);
  padding: 0 14px;
}

.ghost-button,
.primary-button {
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  padding: 0 14px;
  cursor: pointer;
}

.ghost-button {
  background: rgba(19, 36, 59, 0.9);
  color: #d8e7ff;
}

.primary-button {
  background: var(--accent-soft);
  color: #ddecff;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 14px;
  border-bottom: 1px solid rgba(142, 165, 196, 0.12);
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

td strong,
.task-id {
  word-break: break-word;
}

.task-cards {
  display: grid;
  gap: 12px;
}

.mobile-only { display: none; }
.desktop-only { display: block; }

.activity-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.detail-panel {
  position: sticky;
  top: 28px;
  align-self: start;
}

.detail-content {
  display: grid;
  gap: 12px;
}

.empty-state {
  color: var(--muted);
  line-height: 1.6;
}

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

.key-value {
  padding: 12px;
  border-radius: 16px;
  background: rgba(7, 17, 31, 0.55);
  border: 1px solid rgba(142, 165, 196, 0.1);
}

.key-value span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 6px;
}

.detail-list {
  display: grid;
  gap: 10px;
}

.detail-list-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(7, 17, 31, 0.55);
  border: 1px solid rgba(142, 165, 196, 0.1);
}

.source-link {
  color: #b7d5ff;
  word-break: break-all;
}

.warning-list {
  margin: 0;
  padding-left: 18px;
  color: #f8d48b;
}

@media (max-width: 1279px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

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

  .sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(142, 165, 196, 0.12);
  }

  .main-content {
    padding: 20px 16px calc(96px + env(safe-area-inset-bottom));
  }

  .role-grid,
  .split-section,
  .activity-layout,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

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

@media (max-width: 767px) {
  .main-content { gap: 18px; }
  .section-card,
  .table-card,
  .card.compact { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .mobile-only { display: grid; }
  .desktop-only { display: none; }
  .key-value-grid { grid-template-columns: 1fr; }
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }
  .label-row,
  .task-card-header,
  .inline-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .ghost-button,
  .primary-button { width: 100%; }
}
