/* SIGIS DevOps Dashboard — Design System v2 */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

[x-cloak] { display: none !important; }

:root {
  --bg: #000000;
  --bg-2: #0a0a0a;
  --surface: #111111;
  --surface-2: #161616;
  --surface-3: #1a1a1a;
  --border: #1f1f1f;
  --border-2: #2a2a2a;
  --border-3: #3a3a3a;
  --text: #ededed;
  --text-2: #888888;
  --text-3: #555555;
  --blue: #0070f3;
  --blue-dim: rgba(0, 112, 243, 0.08);
  --green: #00c951;
  --green-dim: rgba(0, 201, 81, 0.08);
  --red: #e5484d;
  --red-dim: rgba(229, 72, 77, 0.08);
  --amber: #f5a623;
  --amber-dim: rgba(245, 166, 35, 0.08);
  --purple: #8b5cf6;
  --purple-dim: rgba(139, 92, 246, 0.08);
  --teal: #06b6d4;
  --teal-dim: rgba(6, 182, 212, 0.08);
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Legacy aliases for backward compat with inline styles */
  --sigis-primary: #0070f3;
  --sigis-primary-light: #3b8ef5;
  --sigis-accent: #00c951;
  --sigis-danger: #e5484d;
  --sigis-warning: #f5a623;
  --sigis-bg: #000000;
  --sigis-surface: #111111;
  --sigis-surface-hover: #161616;
  --sigis-border: #1f1f1f;
  --sigis-text: #ededed;
  --sigis-text-muted: #888888;
  --sigis-card-bg: #111111;
  --sigis-success: #00c951;
  --sigis-error: #e5484d;
  --sigis-bg-tertiary: #161616;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-3); }

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 220px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--blue);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-text {
  min-width: 0;
}

.sidebar-logo-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-logo-subtitle {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 12px 18px 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 18px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  font-size: 13px;
  font-weight: 450;
  border-left: 2px solid transparent;
  margin: 1px 0;
  position: relative;
  border-radius: 0;
}

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

.nav-item.active {
  color: var(--text);
  background: var(--blue-dim);
  border-left-color: var(--blue);
}

.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-label { line-height: 1; }

/* Sidebar user card */
.sidebar-user {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-ou {
  font-size: 10px;
  color: var(--text-3);
}

.sidebar-logout {
  cursor: pointer;
  color: var(--text-3);
  transition: color 0.1s;
  flex-shrink: 0;
}

.sidebar-logout:hover { color: var(--red); }

/* ── Main Content ─────────────────────────────────────────────────────── */
.main-content {
  margin-left: 220px;
  padding: 28px 32px;
  min-height: 100vh;
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  transition: border-color 0.1s;
}

.stat-card:hover { border-color: var(--border-2); }
.stat-card.stat-card-link { cursor: pointer; }
.stat-card.stat-card-link:hover {
  border-color: var(--border-3);
  background: var(--surface-2);
}

.stat-card .label, .stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.stat-card .value, .stat-value {
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  font-family: var(--font-mono);
}

.stat-card .value.blue, .stat-value.blue { color: var(--blue); }
.stat-card .value.green, .stat-value.green { color: var(--green); }
.stat-card .value.red, .stat-value.red { color: var(--red); }
.stat-card .value.yellow, .stat-value.yellow { color: var(--amber); }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

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

.table-container th,
.data-table th {
  padding: 11px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.table-container td,
.data-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.table-container tr:last-child td,
.data-table tr:last-child td { border-bottom: none; }

.table-container tr:hover td,
.data-table tr:hover td {
  background: var(--surface-2);
}

.data-table .clickable-row:hover td {
  background: var(--blue-dim);
  cursor: pointer;
}

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
}

.badge-blue   { background: rgba(0,112,243,0.12);   color: #4da3ff; border: 1px solid rgba(0,112,243,0.25); }
.badge-green  { background: rgba(0,201,81,0.12);    color: #2ddc70; border: 1px solid rgba(0,201,81,0.25); }
.badge-red    { background: rgba(229,72,77,0.12);   color: #f06b70; border: 1px solid rgba(229,72,77,0.25); }
.badge-yellow { background: rgba(245,166,35,0.12);  color: #f7be60; border: 1px solid rgba(245,166,35,0.25); }
.badge-gray   { background: rgba(136,136,136,0.10); color: #888888; border: 1px solid rgba(136,136,136,0.20); }
.badge-info   { background: rgba(6,182,212,0.12);   color: #38d1ee; border: 1px solid rgba(6,182,212,0.25); }
.badge-warning { background: rgba(245,166,35,0.12); color: #f7be60; border: 1px solid rgba(245,166,35,0.25); }
.badge-success { background: rgba(0,201,81,0.12);   color: #2ddc70; border: 1px solid rgba(0,201,81,0.25); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  text-decoration: none;
}

.btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-3);
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.btn-primary:hover {
  background: #1a7fff;
  border-color: #1a7fff;
  color: white;
}

.btn-secondary {
  background: transparent;
  border-color: var(--border-2);
  color: var(--text-2);
}

.btn-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 11px;
}

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

/* Send report button */
.btn-send-report {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn-send-report:hover:not(:disabled) { background: #1a7fff; }
.btn-send-report:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Tab Bar ─────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  gap: 0;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-2);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.1s;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--blue);
}

.tab-btn .tab-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--border-2);
  color: var(--text-3);
}

.tab-btn.active .tab-count {
  background: var(--blue-dim);
  color: var(--blue);
}

/* ── Section Headers ─────────────────────────────────────────────────────── */
.section-header, .view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2, .view-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

/* ── Feed / Activity ─────────────────────────────────────────────────────── */
.feed-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  transition: background 0.1s;
}

.feed-item:hover { background: var(--surface-2); }
.feed-item:last-child { border-bottom: none; }

.feed-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.feed-dot.allowed { background: var(--green); }
.feed-dot.denied  { background: var(--amber); }
.feed-dot.error   { background: var(--red); }

.feed-time {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ── Auth Gate ─────────────────────────────────────────────────────────────── */
.auth-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 12px;
}

.auth-gate h2 {
  color: var(--text);
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.auth-gate p {
  color: var(--text-2);
  margin: 0;
  font-size: 13px;
}

/* ── Filters ─────────────────────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filters-bar input,
.filters-bar select {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 7px;
  padding: 7px 12px;
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.1s;
}

.filters-bar input:focus,
.filters-bar select:focus {
  border-color: var(--blue);
}

.filters-bar input::placeholder { color: var(--text-3); }

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  justify-content: center;
  font-size: 12px;
  color: var(--text-2);
  border-top: 1px solid var(--border);
}

/* ── Job Cards ─────────────────────────────────────────────────────────────── */
.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
  transition: border-color 0.1s;
}

.job-card:hover { border-color: var(--border-2); }

.job-card .job-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.job-card .job-meta {
  font-size: 11px;
  color: var(--text-2);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.job-logs {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-2);
  line-height: 1.6;
}

/* ── Profile ─────────────────────────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 56px; height: 56px;
  border-radius: 10px;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: white;
}

/* ── WS Status ─────────────────────────────────────────────────────────────── */
.ws-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-3);
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ── Status Dot / Live Dot ─────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  position: relative;
  flex-shrink: 0;
}

.status-dot::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-ring 1.8s ease-out infinite;
}

/* ── Empty State ─────────────────────────────────────────────────────────────── */
.empty-state {
  padding: 36px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

/* ── Category dot ─────────────────────────────────────────────────────────────── */
.category-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

/* ── Font Mono utility ─────────────────────────────────────────────────────────── */
.font-mono { font-family: var(--font-mono); }

/* ── Token bar mini chart ─────────────────────────────────────────────────────── */
.token-bar {
  display: flex;
  height: 20px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg);
}

.token-bar-segment {
  height: 100%;
  transition: width 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: white;
  min-width: 0;
  overflow: hidden;
}

.token-bar-haiku  { background: rgba(0, 201, 81, 0.55); }
.token-bar-sonnet { background: rgba(0, 112, 243, 0.55); }
.token-bar-opus   { background: rgba(229, 72, 77, 0.55); }

/* ── Animations ─────────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes flash-in {
  0%   { background: rgba(0,112,243,0.18); border-left: 2px solid var(--blue); }
  70%  { background: rgba(0,112,243,0.06); border-left: 2px solid var(--blue); }
  100% { background: transparent; border-left: 2px solid transparent; }
}

@keyframes value-bump {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.12); color: var(--blue); }
  100% { transform: scale(1); }
}

@keyframes loading-bar {
  0%   { margin-left: 0;    width: 30%; }
  50%  { margin-left: 30%;  width: 50%; }
  100% { margin-left: 100%; width: 10%; }
}

.feed-item.new-item { animation: flash-in 2s ease-out; }

.stat-card .value.bumped { animation: value-bump 0.4s ease-out; }

/* ── Loading ─────────────────────────────────────────────────────────────── */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  gap: 10px;
  color: var(--text-2);
  font-size: 13px;
}

.loading-spinner::before {
  content: '';
  width: 18px; height: 18px;
  border: 2px solid var(--border-2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.loading-overlay { position: relative; }

.loading-overlay.is-loading::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  border-radius: 10px;
  z-index: 10;
}

.loading-overlay.is-loading::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 22px; height: 22px;
  border: 2px solid var(--border-2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  z-index: 11;
}

/* ── Tooltips ─────────────────────────────────────────────────────────────── */
[data-tooltip] { position: relative; cursor: help; }

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 8px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
  border: 1px solid var(--border-2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  max-width: 260px;
  white-space: normal;
  text-align: center;
  line-height: 1.4;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ── Supervisor hero ─────────────────────────────────────────────────────── */
.supervisor-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
  margin-bottom: 20px;
}

.supervisor-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.supervisor-hero-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}

.supervisor-hero-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.supervisor-hero-desc {
  font-size: 12px;
  color: var(--text-2);
  margin: 0;
}

/* ── Clickable rows ─────────────────────────────────────────────────────── */
tr[style*="cursor:pointer"]:hover td {
  background: var(--blue-dim) !important;
}

.feed-item[style*="cursor:pointer"]:hover {
  background: var(--blue-dim) !important;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 56px; }
  .sidebar-logo-text,
  .nav-label,
  .nav-section-label,
  .sidebar-user-info,
  .sidebar-user-avatar span { display: none; }
  .sidebar-logo { padding: 14px 12px; justify-content: center; }
  .sidebar-logo-icon { margin: 0; }
  .nav-item { justify-content: center; padding: 10px 12px; gap: 0; }
  .sidebar-user { justify-content: center; }
  .main-content { margin-left: 56px; padding: 16px; }
}
