@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Sora:wght@500;600;700&display=swap");

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #fafafa;
  --text: #09090b;
  --muted: #71717a;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --accent: #111827;
  --accent-soft: #f4f4f5;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --incident-new: #dc2626;
  --incident-inprogress: #f97316;
  --incident-rca-founded: #2563eb;
  --incident-resolved: #16a34a;
  --incident-unknown: #6b7280;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);

  /* Dark sidebar */
  --sidebar-bg: #0f172a;
  --sidebar-text: #f8fafc;
  --sidebar-muted: #94a3b8;
  --sidebar-accent: #3b82f6;
  --sidebar-hover: #1e293b;
  --sidebar-border: #1e293b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: radial-gradient(circle at top right, #fdfdfd 0%, #f3f4f6 48%, #eef0f3 100%);
  color: var(--text);
  font-family: "Manrope", sans-serif;
}

h1,
h2,
h3,
h4 {
  font-family: "Sora", sans-serif;
  letter-spacing: -0.02em;
}

.layout {
  height: 100vh;
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  overflow: hidden;
}

.sidebar {
  border-right: 1px solid var(--sidebar-border);
  background: var(--sidebar-bg);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  color: var(--sidebar-text);
  height: 100%;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem 1.25rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand h1 {
  margin: 0;
  font-size: 1rem;
  color: var(--sidebar-text);
}

.brand p {
  margin: 0.1rem 0 0;
  color: var(--sidebar-muted);
  font-size: 0.78rem;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1rem;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.nav-item {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 0.88rem;
  padding: 0.55rem 0.75rem;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.nav-item.active {
  border-color: transparent;
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
  box-shadow: none;
  font-weight: 600;
  border-left: 3px solid var(--sidebar-accent);
  padding-left: calc(0.75rem - 3px);
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg {
  opacity: 1;
}

.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--sidebar-border);
  padding: 1rem;
}

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.sidebar-footer .user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--sidebar-accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-footer .user-details {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.sidebar-footer .user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer .user-role {
  font-size: 0.72rem;
  color: var(--sidebar-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sidebar-footer .logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  color: var(--sidebar-muted);
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.sidebar-footer .logout-btn:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.sidebar-footer .logout-btn svg {
  width: 14px;
  height: 14px;
}

/* ── Login Page ──────────────────────────────────────────── */

.login-container {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top right, #fdfdfd 0%, #f3f4f6 48%, #eef0f3 100%);
  padding: 1rem;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 4px 20px rgba(16, 24, 40, 0.06);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand .brand-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  color: #fff;
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: 12px;
}

.login-brand h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text);
}

.login-subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.login-form .form-group {
  margin-bottom: 1rem;
}

.login-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.login-form input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface-muted);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-form input:focus {
  border-color: var(--sidebar-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.login-form input::placeholder {
  color: var(--muted);
}

.login-error {
  color: var(--incident-new);
  font-size: 0.83rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #fef2f2;
  border-radius: 6px;
  border: 1px solid #fecaca;
}

.login-btn {
  width: 100%;
  padding: 0.65rem;
  font-size: 0.92rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-footer-text {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 1.25rem 0 0;
}

.main-area {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.topbar {
  padding: 1rem 1.5rem;
  border-bottom: 2px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  background: #fff;
}

.topbar h2 {
  margin: 0;
  font-size: 1.12rem;
  font-family: "Sora", sans-serif;
  font-weight: 600;
}

.topbar p {
  margin: 0.22rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: "Manrope", sans-serif;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.topbar-actions input {
  width: 280px;
}

/* ── Notification Bell & Dropdown ─────────────────────── */

.notification-bell-wrapper {
  position: relative;
}

.notification-bell {
  position: relative;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-bell:hover {
  background: var(--accent-soft);
}

.bell-ring {
  animation: bell-shake 0.6s ease-in-out;
}

@keyframes bell-shake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-12deg); }
  45% { transform: rotate(10deg); }
  60% { transform: rotate(-8deg); }
  75% { transform: rotate(4deg); }
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--incident-new);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 200;
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(16, 24, 40, 0.12);
  overflow: hidden;
}

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 0.85rem;
}

.notif-list {
  max-height: 380px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: var(--accent-soft);
}

.notif-item.unread {
  background: #f0f7ff;
}

.notif-item.unread:hover {
  background: #e0efff;
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  margin-top: 5px;
  flex-shrink: 0;
}

.notif-item.unread .notif-dot {
  background: var(--sidebar-accent);
}

.notif-body {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
}

.notif-message {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-time {
  color: var(--muted);
  font-size: 0.7rem;
  margin-top: 0.25rem;
}

.notif-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.btn-sm {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
}

/* ── End Notification styles ──────────────────────────── */

.kpi-grid {
  padding: 1rem 1.2rem 0.45rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.8rem 0.9rem;
}

.kpi-card h4 {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-family: "Manrope", sans-serif;
  font-weight: 600;
  letter-spacing: 0;
}

.kpi-card p {
  margin: 0.42rem 0 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.content {
  padding: 1rem 1.5rem 1.5rem;
  min-width: 0;
  overflow-y: auto;
}

.content.copilot-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  padding: 1rem;
  margin-bottom: 0.85rem;
  overflow-x: auto;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.topology-entity-select {
  width: 180px;
}

.topology-depth-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.topology-depth-label select {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.22rem 0.35rem;
  background: #fff;
}

.panel-head h3 {
  margin: 0;
  font-size: 0.97rem;
}

.tag {
  border: 1px solid var(--line);
  background: var(--surface-muted);
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
}

.tag.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: #fcd34d;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.kv {
  margin: 0.4rem 0 0;
}

.kv div {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.34rem 0;
  border-bottom: 1px dashed var(--line);
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  font-weight: 600;
}

.kv textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  color: #111827;
  resize: vertical;
  min-height: 72px;
}

.feedback-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0.55rem 0 0.75rem;
}

.feedback-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafafa;
  padding: 0.55rem 0.7rem;
}

.feedback-label {
  display: inline-block;
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.feedback-value {
  font-weight: 700;
  color: #0f172a;
}

.feedback-pill {
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid transparent;
  padding: 0.18rem 0.56rem;
}

.feedback-pill.useful {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.feedback-comment-wrap textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  padding: 0.55rem 0.65rem;
  font: inherit;
  color: #0f172a;
  resize: vertical;
  min-height: 88px;
}

.feedback-comment-wrap textarea:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.feedback-actions {
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

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

.rca-recommendations {
  margin: 0.15rem 0 0;
  padding-left: 1.1rem;
}

.rca-recommendations li {
  margin: 0 0 0.45rem;
  color: #1f2937;
}

/* RCA Process Steps */
.rca-process-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 1.5rem;
}

.rca-process-steps::before {
  content: "";
  position: absolute;
  left: 1.1rem;
  top: 1.2rem;
  bottom: 1.2rem;
  width: 2px;
  background: linear-gradient(to bottom, #3b82f6, #10b981);
}

.rca-step {
  display: flex;
  gap: 0.85rem;
  padding: 0.65rem 0;
  position: relative;
}

.rca-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  z-index: 1;
  box-shadow: 0 0 0 3px #fff;
}

.rca-step:last-child .rca-step-num {
  background: #10b981;
}

.rca-step-body {
  flex: 1;
}

.rca-step-body h5 {
  margin: 0 0 0.25rem;
  font-size: 0.88rem;
  color: #0f172a;
  font-weight: 600;
}

.rca-step-body p {
  margin: 0;
  font-size: 0.84rem;
  color: #475569;
  line-height: 1.55;
}

.rca-step-body code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
  font-size: 0.78rem;
  color: #dc2626;
}

.score-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.45rem;
  padding: 0.45rem 0.65rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.score-breakdown span {
  font-size: 0.78rem;
  color: #64748b;
}

.score-breakdown strong {
  color: #0f172a;
}

/* Narrative Detail */
.narrative-detail {
  font-size: 0.88rem;
  color: #334155;
  line-height: 1.6;
}

.narrative-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
}

.narrative-badge {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.narrative-badge.root-cause {
  background: #dc2626;
  color: #fff;
}

.narrative-header strong {
  font-size: 0.95rem;
  color: #0f172a;
}

.narrative-conf {
  margin-left: auto;
  font-size: 0.82rem;
  color: #dc2626;
  font-weight: 600;
}

.narrative-detail h5 {
  margin: 0.75rem 0 0.3rem;
  font-size: 0.85rem;
  color: #0f172a;
  font-weight: 600;
}

.narrative-detail p {
  margin: 0.25rem 0;
}

.narrative-detail ul {
  margin: 0.3rem 0;
  padding-left: 1.2rem;
}

.narrative-detail li {
  margin: 0.2rem 0;
  font-size: 0.84rem;
  line-height: 1.5;
}

.narrative-detail code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
  font-size: 0.78rem;
  color: #dc2626;
}

/* Recommendation Groups */
.recommendations-grid {
  display: grid;
  gap: 0.75rem;
}

.recommendation-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: #fff;
}

.recommendation-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
}

.recommendation-header h5 {
  margin: 0;
  font-size: 0.88rem;
  color: #0f172a;
}

.priority-badge {
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.priority-badge.critical {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.priority-badge.high {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.priority-badge.medium {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.recommendation-group ul {
  margin: 0;
  padding-left: 1.2rem;
}

.recommendation-group li {
  font-size: 0.84rem;
  color: #334155;
  margin: 0.25rem 0;
  line-height: 1.55;
}

.recommendation-group code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
  font-size: 0.78rem;
  color: #dc2626;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Edge labels in graph */
.edge-label {
  pointer-events: none;
  font-style: italic;
  opacity: 0.8;
}

/* Graph node labels */
.node-label {
  pointer-events: none;
}

.kv.compact div {
  padding: 0.24rem 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.7rem;
}

.chips span {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table th,
.data-table td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.6rem 0.55rem;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table th {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding-bottom: 0.7rem;
  border-bottom: 2px solid var(--line);
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.1s ease;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table tbody tr.selected {
  background: #eff6ff;
}

.data-table.compact th,
.data-table.compact td {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.rca-ranked-table td,
.rca-ranked-table th {
  max-width: none;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.topology-graph,
.metrics-chart {
  width: 100%;
  min-height: 380px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.incident-graph-wrap .topology-graph {
  min-height: 480px;
}

.topology-graph {
  cursor: grab;
}

.topology-graph:active {
  cursor: grabbing;
}

.topology-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 0.75rem;
}

.topology-info {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  padding: 0.7rem;
  min-height: 260px;
}

.topology-info h4,
.topology-info h5 {
  margin: 0 0 0.5rem;
}

.topology-info h5 {
  margin-top: 0.65rem;
  font-size: 0.82rem;
}

.topology-node {
  cursor: grab;
}

.topology-edge {
  stroke: #9ca3af;
  stroke-width: 1.8;
  opacity: 0.9;
}

.topology-edge.related {
  stroke: #ea580c;
  stroke-width: 2.8;
  opacity: 1;
}

.topology-edge.dimmed {
  stroke: #d4d4d8;
  opacity: 0.35;
}

.topology-node circle {
  fill: #111827;
  transition: all 120ms ease;
}

.topology-node:hover circle {
  fill: #27272a;
  r: 9;
}

.topology-node.selected circle {
  fill: #f97316;
  stroke: #111827;
  stroke-width: 2;
}

.incident-graph-wrap .topology-node.incident-node circle {
  fill: #1d4ed8;
  stroke: #bfdbfe;
  stroke-width: 1.5;
}

.incident-graph-wrap .topology-node.root-cause-node circle {
  fill: #dc2626;
  stroke: #fecaca;
  stroke-width: 1.5;
}

.incident-graph-wrap .topology-node.impacted-node circle {
  fill: #f97316;
  stroke: #fed7aa;
  stroke-width: 1.5;
}

.incident-graph-wrap .topology-node.event-node circle {
  fill: #7c3aed;
  stroke: #ddd6fe;
  stroke-width: 1.5;
}

.incident-graph-wrap .topology-node.dominant-branch-node circle {
  stroke: #111827;
  stroke-width: 2.8;
  filter: drop-shadow(0 0 4px rgba(17, 24, 39, 0.25));
}

.incident-graph-wrap .topology-edge.root-cause-edge {
  stroke: #dc2626;
  stroke-width: 2.4;
}

.incident-graph-wrap .topology-edge.impact-edge {
  stroke: #f97316;
  stroke-width: 2.2;
}

.incident-graph-wrap .topology-edge.related-edge {
  stroke: #0891b2;
  stroke-width: 2;
}

.incident-graph-wrap .topology-edge.event-edge {
  stroke: #7c3aed;
  stroke-width: 2;
}

.incident-graph-wrap .topology-edge.source-edge {
  stroke: #0f766e;
  stroke-width: 2;
}

.incident-graph-wrap .topology-edge.dependency-edge {
  stroke: #6b7280;
}

.incident-graph-wrap .topology-edge.dominant-branch-edge {
  stroke-width: 2.8;
  opacity: 1;
}

.topology-node.dragging {
  cursor: grabbing;
}

/* Sigma.js container */
.sigma-container {
  width: 100%;
  height: 600px;
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  position: relative;
  overflow: hidden;
}

.sigma-container.sigma-incident {
  height: 500px;
  min-height: 400px;
}

.sigma-tooltip {
  position: absolute;
  z-index: 100;
  background: #1e293b;
  color: #f1f5f9;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  max-width: 280px;
  white-space: nowrap;
}

.sigma-tooltip strong {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: #fff;
}

.sigma-tooltip-row {
  display: flex;
  gap: 6px;
}

.sigma-tooltip-row span:first-child {
  color: #94a3b8;
}

.topology-search {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.78rem;
  background: var(--surface);
  color: var(--fg);
  width: 160px;
}

.topology-search::placeholder {
  color: #94a3b8;
}

/* === Prediction Cards === */
.prediction-section {
  margin-bottom: 1.5rem;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius);
  overflow: hidden;
}
.prediction-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(245, 158, 11, 0.08);
  color: #f59e0b;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.prediction-header-icon { font-size: 1.1rem; }
.prediction-toggle { margin-left: auto; font-size: 0.75rem; }
.prediction-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
}
.prediction-card {
  background: var(--bg);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius);
  padding: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.prediction-card:hover {
  border-color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
}
.prediction-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}
.prediction-entity-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}
.prediction-entity-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}
.prediction-metric {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
}
.prediction-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.prediction-countdown {
  font-size: 1rem;
  font-weight: 700;
  color: #f59e0b;
}
.prediction-countdown-icon { margin-right: 0.25rem; }
.prediction-details {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.prediction-confidence {
  background: rgba(245, 158, 11, 0.1);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  color: #f59e0b;
}
.prediction-values {
  font-size: 0.85rem;
  color: var(--text);
  font-family: var(--font-mono);
}

/* Prediction trendline animation */
.prediction-pulse-dot {
  animation: prediction-pulse 1.5s ease-in-out infinite;
}
@keyframes prediction-pulse {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.3; }
}

/* Prediction topology tooltip */
.prediction-tooltip {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 4px;
  color: #f59e0b;
  font-size: 0.8rem;
}

.metrics-hero {
  margin-bottom: 0.7rem;
}

.metrics-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.metrics-filter-grid label,
.metric-overlay {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  padding: 0.45rem 0.55rem;
}

.metrics-filter-grid small,
.metric-overlay small {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metrics-filter-grid select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.32rem 0.45rem;
  background: #fff;
}

.overlay-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.pill {
  appearance: none;
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 0.18rem 0.45rem;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
}

.pill.cpu {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.pill.mem {
  background: #ede9fe;
  color: #7c3aed;
  border-color: #ddd6fe;
}

.pill:not(.active) {
  opacity: 0.55;
}

.metric-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.metric-summary div {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  padding: 0.45rem 0.6rem;
}

.metric-summary small {
  color: var(--muted);
  display: block;
}

.metric-summary strong {
  font-size: 0.97rem;
}

.metric-summary-rich em {
  margin-left: 0.35rem;
  font-size: 0.72rem;
  font-style: normal;
}

.metric-summary-rich em.good {
  color: #059669;
}

.metric-summary-rich em.bad {
  color: #dc2626;
}

.metrics-chart.rich {
  min-height: 300px;
}

.metrics-legend {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  font-size: 0.76rem;
}

.metrics-legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 0.32rem;
}

.metrics-legend .dot.cpu {
  background: #3b82f6;
}

.metrics-legend .dot.mem {
  background: #8b5cf6;
}

.metrics-legend .muted {
  color: var(--muted);
}

.contributors-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.contrib-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
  padding: 0.6rem;
}

.contrib-card h4 {
  margin: 0;
  font-size: 0.84rem;
}

.contrib-card p {
  margin: 0.22rem 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.contrib-card strong {
  font-size: 0.82rem;
}

.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.2rem;
  margin-top: 0.45rem;
  height: 44px;
}

.mini-bars span {
  flex: 1;
  border-radius: 6px 6px 2px 2px;
  background: #3b82f6;
  opacity: 0.8;
}

.metrics-link {
  font-size: 0.8rem;
  color: #2563eb;
  text-decoration: none;
}

.metrics-link:hover {
  text-decoration: underline;
}

.copilot-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 0.65rem;
  min-height: 0;
  height: 100%;
}

.copilot-head-actions {
  display: flex;
  justify-content: flex-end;
}

.copilot-thread {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  padding: 1rem;
  overflow: auto;
  min-height: 0;
  max-height: none;
}

.copilot-empty {
  min-height: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  text-align: center;
  color: #64748b;
  gap: 0.55rem;
}

.copilot-empty h3 {
  margin: 0 0 0.35rem;
  color: #0f172a;
  font-size: 1.65rem;
}

.copilot-empty p {
  margin: 0 auto;
  font-size: 0.9rem;
  max-width: 56ch;
}

.copilot-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  background: #dbeafe;
  color: #1d4ed8;
}

.copilot-empty-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.6rem;
  width: 100%;
  max-width: none;
  align-items: stretch;
}

.copilot-empty-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  padding: 0.7rem;
  cursor: pointer;
}

.copilot-empty-card:hover {
  background: #f8fafc;
}

.copilot-empty-card strong {
  display: block;
  color: #0f172a;
  font-size: 0.86rem;
}

.copilot-empty-card span {
  display: block;
  margin-top: 0.25rem;
  color: #64748b;
  font-size: 0.74rem;
}

.msg {
  margin-bottom: 0.85rem;
}

.msg.user {
  display: grid;
  justify-items: end;
}

.msg.user .bubble {
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  padding: 0.55rem 0.75rem;
  max-width: min(70ch, 85%);
  font-size: 0.9rem;
}

.msg time {
  margin-top: 0.25rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.assistant-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.75rem 0.85rem;
  max-width: min(90ch, 95%);
}

.assistant-body h3 {
  margin: 0.8rem 0 0.4rem;
  color: #0f172a;
  font-size: 1rem;
  font-weight: 700;
}

.assistant-body h4 {
  margin: 0.7rem 0 0.35rem;
  color: #2563eb;
  font-size: 0.92rem;
  font-weight: 600;
}

.assistant-body h5 {
  margin: 0.6rem 0 0.3rem;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 600;
}

.assistant-body h6 {
  margin: 0.5rem 0 0.25rem;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 600;
}

.assistant-body p {
  margin: 0.3rem 0;
  font-size: 0.88rem;
  color: #334155;
  line-height: 1.55;
}

.assistant-body ul, .assistant-body ol {
  margin: 0.4rem 0;
  padding-left: 1.3rem;
}

.assistant-body li {
  font-size: 0.88rem;
  color: #334155;
  margin: 0.2rem 0;
  line-height: 1.5;
}

.assistant-body strong {
  color: #0f172a;
  font-weight: 600;
}

.assistant-body code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.82rem;
  color: #dc2626;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.assistant-body pre {
  background: #1e293b;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin: 0.5rem 0;
  overflow-x: auto;
}

.assistant-body pre code {
  background: none;
  border: none;
  color: #e2e8f0;
  padding: 0;
  font-size: 0.8rem;
}

.assistant-card small {
  display: block;
  margin-top: 0.55rem;
  color: #64748b;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Loading / thinking state */
.copilot-loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
}

.copilot-loading span {
  color: #64748b;
  font-size: 0.85rem;
}

.copilot-thinking {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.copilot-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #93c5fd;
  animation: copilotPulse 1.4s ease-in-out infinite;
}

.copilot-dot:nth-child(2) { animation-delay: 0.2s; }
.copilot-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes copilotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; background: #3b82f6; }
}

.citations {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.citations span {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem;
  color: #475569;
}

.copilot-quick {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.copilot-quick-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0.6rem 0.65rem;
  text-align: left;
  color: #334155;
  font-size: 0.82rem;
  cursor: pointer;
}

.copilot-quick-btn:hover {
  background: #f8fafc;
}

.copilot-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.65rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  position: sticky;
  bottom: 0.5rem;
  box-shadow: 0 -2px 8px rgba(16, 24, 40, 0.06);
}

.copilot-footnote {
  margin: 0;
  color: #94a3b8;
  text-align: center;
  font-size: 0.72rem;
}

.entities-header {
  margin-bottom: 0.7rem;
}

.entities-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.entities-filter-grid label {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  padding: 0.45rem 0.55rem;
}

.entities-filter-grid small {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.entities-filter-grid select,
.entities-filter-grid input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.32rem 0.45rem;
  background: #fff;
}

.entities-kpis {
  margin-top: 0.65rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.entities-kpis article {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  padding: 0.5rem 0.6rem;
}

.entities-kpis small {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.68rem;
}

.entities-kpis strong {
  display: block;
  font-size: 1.2rem;
}

.entities-kpis strong.ok {
  color: #10b981;
}

.entities-kpis strong.warn {
  color: #d97706;
}

.entities-kpis strong.bad {
  color: #dc2626;
}

.status-pill {
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line);
  display: inline-block;
}

.status-pill.healthy {
  background: #d1fae5;
  color: #047857;
  border-color: #a7f3d0;
}

.status-pill.warning {
  background: #fef3c7;
  color: #b45309;
  border-color: #fde68a;
}

.status-pill.new {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

.status-pill.inprogress {
  background: #ffedd5;
  color: #c2410c;
  border-color: #fed7aa;
}

.status-pill.rca-founded {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.status-pill.critical {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

.status-pill.resolved {
  background: #e2e8f0;
  color: #334155;
  border-color: #cbd5e1;
}

.severity-pill {
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line);
  display: inline-block;
}

.severity-pill.low {
  background: #ecfeff;
  color: #0e7490;
  border-color: #a5f3fc;
}

.severity-pill.medium {
  background: #fef9c3;
  color: #a16207;
  border-color: #fde68a;
}

.severity-pill.high {
  background: #ffedd5;
  color: #c2410c;
  border-color: #fed7aa;
}

.severity-pill.critical {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

.incident-title-cell {
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.problems-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.incident-trend-panel {
  margin-bottom: 0.7rem;
}

.incident-trend-chart {
  width: 100%;
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.incident-axis-label {
  fill: #71717a;
  font-size: 10px;
}

.incident-legend {
  gap: 0.4rem;
}

.incident-legend-item {
  border: 1px solid var(--line);
  background: #fafafa;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #27272a;
  padding: 0.2rem 0.45rem;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  cursor: pointer;
}

.incident-legend-item i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.incident-legend-item:not(.active) {
  opacity: 0.45;
}

.incident-trend-note {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.legend-chip.root {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.legend-chip.impact {
  background: #ffedd5;
  border-color: #fed7aa;
  color: #9a3412;
}

.legend-chip.upstream-impact {
  background: #fef9c3;
  border-color: #fde68a;
  color: #854d0e;
}

.legend-chip.incident {
  background: #dbeafe;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.legend-chip.event {
  background: #fce7f3;
  border-color: #f9a8d4;
  color: #9d174d;
}

.legend-group {
  margin-bottom: 0.55rem;
}

.legend-lines {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.32rem 0.45rem;
}

.legend-line {
  position: relative;
  font-size: 0.72rem;
  color: #374151;
  padding-left: 1.2rem;
  line-height: 1.2;
}

.legend-line::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0.9rem;
  height: 2px;
  background: #6b7280;
  border-radius: 999px;
}

.legend-line.root-cause-edge::before {
  background: #dc2626;
}

.legend-line.impact-edge::before {
  background: #f97316;
}

.legend-line.dependency-edge::before {
  background: #6b7280;
}

.legend-line.event-edge::before {
  background: #7c3aed;
}

.legend-line.source-edge::before {
  background: #0f766e;
}

.legend-line.related-edge::before {
  background: #0891b2;
}

.problem-kpi {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0.65rem 0.75rem;
}

.problem-kpi small {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.problem-kpi strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 2rem;
  line-height: 1;
}

.problem-kpi em {
  display: block;
  margin-top: 0.2rem;
  font-style: normal;
  font-size: 0.78rem;
  color: var(--muted);
}

.problems-filters {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0.5rem;
}

.problems-filters .filter-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.problems-filters select {
  padding: 0.4rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
  color: #334155;
  min-width: 140px;
}

.problems-table a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.problems-table a:hover {
  text-decoration: underline;
}

.conf-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.conf-wrap span {
  font-size: 0.78rem;
  color: var(--muted);
}

.conf-bar {
  width: 84px;
  height: 5px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.conf-bar i {
  display: block;
  height: 100%;
  background: #10b981;
}

.blast-dots {
  display: flex;
  gap: 0.2rem;
}

.blast-dots i {
  width: 8px;
  height: 5px;
  border-radius: 999px;
  background: #d1d5db;
}

.blast-dots i.on {
  background: #ef4444;
}

.util-row {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}

.util-row span {
  font-size: 0.72rem;
  color: var(--muted);
}

.util-bar {
  height: 6px;
  border-radius: 999px;
  background: #dbeafe;
  overflow: hidden;
}

.util-bar i {
  display: block;
  height: 100%;
  background: #3b82f6;
}

.util-bar.mem {
  background: #ede9fe;
}

.util-bar.mem i {
  background: #8b5cf6;
}

.entities-pagination {
  margin-top: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--muted);
}

.empty-state-panel {
  margin-bottom: 0.65rem;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #fbfcfe;
  padding: 1rem;
}

.empty-state h4 {
  margin: 0;
  font-size: 0.95rem;
  color: #0f172a;
}

.empty-state p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.empty-state-actions {
  margin-top: 0.7rem;
  display: flex;
  justify-content: flex-end;
}

.settings-card {
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius);
}

.settings-card-head {
  padding: 1.1rem 1.2rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.settings-card-head h3 {
  margin: 0;
  font-size: 1.02rem;
}

.settings-card-head p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.settings-form {
  padding: 0.9rem 1rem 0.8rem;
  display: grid;
  gap: 0.75rem;
}

.settings-field {
  display: grid;
  gap: 0.38rem;
}

.settings-field span {
  font-size: 0.84rem;
  font-weight: 600;
  color: #334155;
}

.settings-field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.52rem 0.62rem;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.settings-field select:focus {
  outline: 2px solid #d4d4d8;
  outline-offset: 0;
}

.settings-field select[multiple] {
  min-height: 8.7rem;
  padding: 0.38rem 0.45rem;
}

.settings-field-help {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.settings-actions {
  margin-top: 0.1rem;
  display: flex;
  justify-content: flex-end;
}

.settings-output {
  margin: 0;
  padding: 0 1rem 0.95rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.settings-output.ok {
  color: #065f46;
  font-weight: 600;
}

.settings-toggle-list {
  padding: 0.5rem 1rem 1rem;
  display: grid;
  gap: 0.6rem;
}

.settings-toggle-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
  padding: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}

.settings-toggle-item strong {
  display: block;
  font-size: 0.9rem;
  color: #0f172a;
}

.settings-toggle-item span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.settings-toggle-item input[type="checkbox"] {
  appearance: none;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #cbd5e1;
  border: 1px solid #cbd5e1;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}

.settings-toggle-item input[type="checkbox"]::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.settings-toggle-item input[type="checkbox"]:checked {
  background: #3b82f6;
  border-color: #3b82f6;
}

.settings-toggle-item input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}

.stack {
  display: grid;
  gap: 0.55rem;
}

textarea,
input,
button {
  font: inherit;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.52rem 0.62rem;
  background: #fff;
  color: var(--text);
}

textarea:focus,
input:focus {
  outline: 2px solid #d4d4d8;
  outline-offset: 0;
}

pre {
  white-space: pre-wrap;
  margin: 0.7rem 0 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  padding: 0.7rem;
  font-size: 0.82rem;
}

.btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 0.52rem 0.75rem;
  cursor: pointer;
  font-weight: 600;
}

.btn.small {
  padding: 0.28rem 0.5rem;
  min-width: 34px;
  font-size: 0.8rem;
}

.btn.subtle {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--text);
}

.btn.has-update {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  animation: pulseUpdate 2s ease-in-out infinite;
}

@keyframes pulseUpdate {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
}

.btn:hover {
  opacity: 0.92;
}

.users-panel {
  display: grid;
  gap: 16px;
}

.users-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.users-head h3 {
  margin: 0;
}

.users-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.users-table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  background: #fff;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}

.users-table th,
.users-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
}

.users-table thead th {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.users-table tbody tr + tr td {
  border-top: 1px solid var(--line);
}

.users-table tbody tr:hover {
  background: #f8fbff;
}

.users-table td:nth-child(1),
.users-table td:nth-child(2) {
  white-space: nowrap;
}

.users-table td:nth-child(5) {
  color: #334155;
  font-variant-numeric: tabular-nums;
}

.users-empty {
  text-align: center;
  color: var(--muted);
}

.user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.user-actions .btn {
  border-radius: 9px;
  padding: 0.35rem 0.62rem;
}

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn svg {
  pointer-events: none;
}

.has-tip {
  position: relative;
}

.has-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  background: #0f172a;
  color: #fff;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 20;
}

.has-tip:hover::after,
.has-tip:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.self-lock {
  font-size: 11px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  padding: 3px 8px;
}

.user-actions .users-delete {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff5f5;
}

.user-actions .users-delete:hover {
  background: #fee2e2;
}

.user-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.role-badge.admin {
  background: rgba(11, 121, 90, 0.2);
  color: #0f5a43;
}

.role-badge.operator {
  background: rgba(34, 91, 170, 0.18);
  color: #184a90;
}

.role-badge.viewer {
  background: rgba(90, 99, 122, 0.16);
  color: #3a4154;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 30, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 24px;
}

.modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #dbe4f6;
  box-shadow: 0 24px 48px rgba(14, 24, 53, 0.2);
  animation: usersModalIn 0.18s ease-out;
}

@keyframes usersModalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e8eefb;
  background: #f8fafc;
}

.modal-header h3 {
  margin: 0;
}

.modal-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.modal-body {
  display: grid;
  gap: 12px;
  padding: 16px 20px;
}

.modal-body input[readonly] {
  background: #f8fafc;
  color: #475569;
  cursor: not-allowed;
}

.modal-body select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.52rem 0.62rem;
  background: #fff;
  color: var(--text);
}

.modal-body select:focus {
  outline: 2px solid #d4d4d8;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--sidebar-border);
    height: auto;
  }

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

  .split {
    grid-template-columns: 1fr;
  }

  .topology-layout {
    grid-template-columns: 1fr;
  }

  .metrics-filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .contributors-grid {
    grid-template-columns: 1fr 1fr;
  }

  .entities-filter-grid,
  .entities-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .problems-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .copilot-quick {
    grid-template-columns: 1fr;
  }

  .copilot-empty-grid {
    grid-template-columns: 1fr;
    min-width: 0;
  }

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

  .topbar-actions input {
    width: 100%;
  }
}

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

  .metrics-filter-grid,
  .contributors-grid {
    grid-template-columns: 1fr;
  }

  .entities-filter-grid,
  .entities-kpis {
    grid-template-columns: 1fr;
  }

  .problems-kpi-grid {
    grid-template-columns: 1fr;
  }

  .content,
  .kpi-grid,
  .topbar {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }
}
