/* ===== CSS Variables / Theme ===== */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-light: #fee2e2;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --info: #0891b2;
  --info-light: #cffafe;
  --indigo: #6366f1;
  --indigo-light: #e0e7ff;
  --orange: #ea580c;
  --orange-light: #fff7ed;
  --cyan: #06b6d4;
  --cyan-light: #cffafe;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --sidebar-bg: #1e293b;
  --sidebar-active: #334155;
  --sidebar-hover: #2d3c52;
  --sidebar-width: 250px;
  --topbar-height: 56px;
  --content-bg: #f8fafc;
  --card-bg: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --transition: 0.15s ease;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; color: var(--text-primary); background: var(--content-bg); line-height: 1.5; }
a { text-decoration: none; color: inherit; }
table { border-collapse: collapse; width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ===== Login Screen ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 50%, #1e3a5f 100%);
  padding: 1rem;
}
.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  letter-spacing: 1px;
}
.login-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.login-logo p { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.25rem; }
.form-error { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.75rem; padding: 0.5rem; background: var(--danger-light); border-radius: var(--radius-sm); }

/* ===== Forms ===== */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-group input::placeholder { color: var(--text-muted); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-inline { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-secondary { background: var(--card-bg); color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-100); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.78rem; }
.btn-xs { padding: 0.2rem 0.45rem; font-size: 0.72rem; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 0.5rem; }

/* ===== Layout ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.2s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  height: var(--topbar-height);
}
.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
  border-radius: 6px;
  letter-spacing: 1px;
  flex-shrink: 0;
}
.brand-text { font-weight: 700; font-size: 1rem; }
.sidebar-nav { flex: 1; padding: 0.75rem 0; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  color: var(--gray-400);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  margin: 1px 0;
}
.nav-item:hover { color: #fff; background: var(--sidebar-hover); }
.nav-item.active { color: #fff; background: var(--sidebar-active); border-left-color: var(--primary); }
.nav-icon { display: flex; align-items: center; flex-shrink: 0; }
.sidebar-footer { padding: 0.75rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.08); }
.version-text { font-size: 0.72rem; color: var(--gray-500); }

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 50;
}
.sidebar-toggle { display: none; background: none; border: none; color: var(--text-primary); padding: 0.25rem; }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 0.75rem; }
.admin-email { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.content { flex: 1; padding: 1.5rem; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.card-body.no-pad { padding: 0; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 0.78rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.35rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; }
table th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border-color);
  user-select: none;
  white-space: nowrap;
}
table th.sortable { cursor: pointer; }
table th.sortable:hover { color: var(--primary); }
table th .sort-arrow { margin-left: 0.25rem; font-size: 0.7rem; }
table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-primary);
  vertical-align: middle;
}
table tbody tr:hover { background: var(--gray-50); }
table tbody tr.clickable { cursor: pointer; }
table tbody tr.clickable:hover { background: var(--primary-light); }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); font-size: 0.9rem; }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 9999px;
  white-space: nowrap;
  text-transform: capitalize;
}
.badge-green { background: var(--success-light); color: var(--success); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: var(--gray-200); color: var(--gray-600); }
.badge-indigo { background: var(--indigo-light); color: var(--indigo); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-cyan { background: var(--cyan-light); color: var(--cyan); }
.badge-superadmin { background: #7c3aed; color: white; }
.badge-admin { background: #2563eb; color: white; }
.badge-viewer { background: #64748b; color: white; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.15s ease;
}
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 720px; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(-10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  line-height: 1;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--gray-100); color: var(--text-primary); }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ===== Toast ===== */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 300; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.2s ease;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--primary); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
.toast-exit { animation: toastOut 0.2s ease forwards; }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }

/* ===== Loading ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.inline-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 1rem;
}
.pagination button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
}
.pagination button:hover:not(:disabled) { background: var(--gray-100); border-color: var(--gray-300); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: default; }
.pagination-info { font-size: 0.78rem; color: var(--text-muted); margin-left: 0.75rem; }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.25rem;
  gap: 0;
}
.tab-btn {
  padding: 0.6rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 0.5rem; }

/* ===== Page header ===== */
.page-header { margin-bottom: 1.5rem; }
.page-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.page-header p { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.25rem; }
.page-header .breadcrumb { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.page-header .breadcrumb a { color: var(--primary); }
.page-header .breadcrumb a:hover { text-decoration: underline; }

/* ===== Copy box ===== */
.copy-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gray-900);
  color: #22d3ee;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.82rem;
  margin: 0.75rem 0;
  word-break: break-all;
}
.copy-box code { flex: 1; }
.copy-box button {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  flex-shrink: 0;
}
.copy-box button:hover { background: rgba(255,255,255,0.2); }

/* ===== Detail list ===== */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.detail-item {}
.detail-item .detail-label { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-item .detail-value { font-size: 0.9rem; color: var(--text-primary); margin-top: 0.15rem; }

/* ===== Status timeline ===== */
.timeline { padding: 0.5rem 0; }
.timeline-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  position: relative;
}
.timeline-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 0.35rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.timeline-item:not(:last-child) .timeline-dot::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 10px;
  width: 2px;
  height: calc(100% + 0.5rem);
  background: var(--border-color);
}
.timeline-content { flex: 1; }
.timeline-status { font-weight: 600; font-size: 0.85rem; }
.timeline-time { font-size: 0.75rem; color: var(--text-muted); }
.timeline-detail { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.1rem; }

/* ===== Filter bar ===== */
.filter-bar {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.filter-bar .form-inline { flex-wrap: wrap; }
.filter-bar .form-group { min-width: 150px; }
.filter-bar .form-group input,
.filter-bar .form-group select { padding: 0.45rem 0.6rem; font-size: 0.82rem; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .main-wrapper { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .content { padding: 1rem; }
  .form-row { flex-direction: column; gap: 0; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-left, .toolbar-right { justify-content: flex-start; }
  .filter-bar .form-inline { flex-direction: column; }
  .filter-bar .form-group { min-width: unset; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ===== Utility ===== */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.82rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-mono { font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* ===== Field Info Tooltips ===== */
.field-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  margin-left: 4px;
  position: relative;
  vertical-align: middle;
}
.field-info:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  white-space: normal;
  width: max-content;
  max-width: 260px;
  z-index: 1000;
  line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.field-info:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
  z-index: 1000;
}

/* ===== Docs Page ===== */
.docs-content { max-width: 900px; }
.docs-content h4 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.docs-content p { font-size: 14px; line-height: 1.6; color: var(--text-light); margin-bottom: 8px; }
.docs-note { background: #eff6ff; border-left: 4px solid var(--primary); padding: 12px 16px; border-radius: 4px; font-size: 13px; line-height: 1.5; color: #1e40af; }
.docs-list { padding-left: 20px; font-size: 14px; line-height: 1.8; color: var(--text-light); }
.docs-list li { margin-bottom: 6px; }
.code-block {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px 20px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  white-space: pre;
  margin-bottom: 12px;
}
.code-block code { background: none; color: inherit; padding: 0; font-size: inherit; }

/* ===== KB Tabs ===== */
.kb-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid #e2e8f0; padding-bottom: 8px; }
.kb-tab { padding: 8px 16px; border: none; background: none; cursor: pointer; font-size: 13px; font-weight: 500; color: #64748b; border-radius: 6px 6px 0 0; transition: all .15s; }
.kb-tab:hover { background: #f1f5f9; color: #1e293b; }
.kb-tab.active { background: #2563eb; color: #fff; }

/* ===== Incidents Page ===== */
.alert-card { padding: 16px; border-radius: 8px; border-left: 4px solid; }
.alert-card.alert-red { border-color: #ef4444; background: #fef2f2; }
.alert-card.alert-yellow { border-color: #f59e0b; background: #fffbeb; }
.alert-card.alert-green { border-color: #10b981; background: #ecfdf5; }
.alert-card .alert-count { font-size: 28px; font-weight: 700; }
.alert-card .alert-label { font-size: 12px; color: #64748b; margin-top: 4px; }
.alert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.incidents-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid #e2e8f0; padding-bottom: 8px; }
.incidents-tab { padding: 8px 16px; border: none; background: none; cursor: pointer; font-size: 13px; font-weight: 500; color: #64748b; border-radius: 6px 6px 0 0; }
.incidents-tab:hover { background: #f1f5f9; }
.incidents-tab.active { background: #ef4444; color: white; }
.row-red { background: #fef2f2 !important; }
.row-yellow { background: #fffbeb !important; }
.histogram-bar { display: inline-block; background: #2563eb; height: 18px; border-radius: 3px; min-width: 2px; }

/* ===== NOC Dashboard ===== */
.noc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 20px; }
.noc-card { background: white; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.1); overflow: hidden; }
.noc-card-header { padding: 12px 16px; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: white; }
.noc-card-body { padding: 16px; }
.noc-header-green { background: #059669; }
.noc-header-blue { background: #2563eb; }
.noc-header-purple { background: #7c3aed; }
.noc-header-orange { background: #d97706; }
.noc-header-red { background: #dc2626; }
.noc-header-gray { background: #475569; }
.noc-header-cyan { background: #0891b2; }

.noc-metric { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.noc-metric:last-child { border-bottom: none; }
.noc-metric-label { color: #64748b; }
.noc-metric-value { font-weight: 600; color: #1e293b; font-family: 'SF Mono', monospace; }
.noc-metric-value.good { color: #059669; }
.noc-metric-value.warn { color: #d97706; }
.noc-metric-value.bad { color: #dc2626; }

.noc-bar-container { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.noc-bar { height: 100%; border-radius: 4px; transition: width .3s; }
.noc-bar.green { background: #059669; }
.noc-bar.yellow { background: #eab308; }
.noc-bar.red { background: #dc2626; }

.noc-status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.noc-status-dot.green { background: #059669; box-shadow: 0 0 6px #059669; }
.noc-status-dot.yellow { background: #eab308; box-shadow: 0 0 6px #eab308; }
.noc-status-dot.red { background: #dc2626; box-shadow: 0 0 6px #dc2626; animation: pulse-red 1.5s infinite; }
@keyframes pulse-red { 0%,100% { box-shadow: 0 0 6px #dc2626; } 50% { box-shadow: 0 0 16px #dc2626; } }

.noc-alerts { margin-bottom: 20px; }
.noc-alert-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 8px; margin-bottom: 6px; font-size: 13px; }
.noc-alert-item.critical { background: #fef2f2; border-left: 4px solid #dc2626; color: #991b1b; }
.noc-alert-item.warning { background: #fffbeb; border-left: 4px solid #d97706; color: #92400e; }
.noc-alert-item.info { background: #eff6ff; border-left: 4px solid #2563eb; color: #1e40af; }

.noc-overall { text-align: center; padding: 20px; margin-bottom: 20px; border-radius: 12px; }
.noc-overall.healthy { background: linear-gradient(135deg, #ecfdf5, #d1fae5); border: 2px solid #059669; }
.noc-overall.degraded { background: linear-gradient(135deg, #fffbeb, #fef3c7); border: 2px solid #d97706; }
.noc-overall.critical { background: linear-gradient(135deg, #fef2f2, #fee2e2); border: 2px solid #dc2626; }
.noc-overall-status { font-size: 24px; font-weight: 700; }
.noc-overall-sub { font-size: 13px; color: #64748b; margin-top: 4px; }

.noc-refresh-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; font-size: 12px; color: #64748b; }

.noc-table { width: 100%; font-size: 12px; }
.noc-table th { text-align: left; padding: 4px 8px; color: #64748b; font-weight: 600; border-bottom: 1px solid #e2e8f0; }
.noc-table td { padding: 4px 8px; border-bottom: 1px solid #f1f5f9; }

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