/* ============================================
   RenderDesk.online — Premium Dashboard
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- Design Tokens --- */
:root {
  --bg-primary: #06060b;
  --bg-secondary: #0c0c14;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-input: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-glow: rgba(120, 90, 255, 0.35);

  --text-primary: #e4e4ef;
  --text-secondary: #8888a0;
  --text-muted: #4e4e68;
  --text-dim: #33334a;

  --accent: #785aff;
  --accent-2: #5ae4ff;
  --accent-gradient: linear-gradient(135deg, #785aff, #5ae4ff);
  --accent-glow: rgba(120, 90, 255, 0.12);
  --accent-soft: rgba(120, 90, 255, 0.08);

  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.08);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.08);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.08);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 100px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 60px rgba(120, 90, 255, 0.06);

  --transition-fast: 0.12s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-width: 260px;
}

/* --- Reset --- */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* --- Animated Background --- */
.bg-layer {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
}

.bg-layer .orb {
  position: absolute; border-radius: 50%; filter: blur(80px);
}

.bg-layer .orb-1 {
  width: 500px; height: 500px;
  background: rgba(120, 90, 255, 0.07);
  top: -5%; left: -3%;
  animation: orbit 30s ease-in-out infinite;
}

.bg-layer .orb-2 {
  width: 400px; height: 400px;
  background: rgba(90, 228, 255, 0.05);
  bottom: -10%; right: -5%;
  animation: orbit 35s ease-in-out infinite reverse;
}

.bg-layer .orb-3 {
  width: 300px; height: 300px;
  background: rgba(52, 211, 153, 0.04);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: orbit 40s ease-in-out infinite;
}

@keyframes orbit {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(80px, -50px) scale(1.1); }
  50% { transform: translate(-30px, 60px) scale(0.95); }
  75% { transform: translate(50px, 20px) scale(1.05); }
}

/* grid pattern */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.012) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at 50% 30%, black 20%, transparent 70%);
}

/* --- Layout --- */
.layout {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  grid-row: 1 / -1;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; margin-bottom: 16px;
}

.sidebar-logo .logo-mark {
  width: 36px; height: 36px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 20px rgba(120,90,255,0.25);
  position: relative;
}

.sidebar-logo .logo-mark::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.2));
  border-radius: inherit;
}

.sidebar-logo .logo-mark svg {
  width: 18px; height: 18px; fill: white; position: relative; z-index: 1;
}

.sidebar-logo span {
  font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em;
  background: var(--accent-gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* nav */
.sidebar-label {
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-dim);
  padding: 16px 12px 6px; user-select: none;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-md);
  font-size: 0.85rem; font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-base);
  cursor: pointer;
}

.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }

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

.nav-badge {
  margin-left: auto;
  font-size: 0.6rem; font-family: 'JetBrains Mono', monospace;
  padding: 2px 6px; border-radius: var(--radius-pill);
  background: var(--success-bg); color: var(--success);
}

.nav-badge.warning { background: var(--warning-bg); color: var(--warning); }

/* sidebar bottom */
.sidebar-bottom {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-clock {
  padding: 8px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
}

.sidebar-clock .dot-live {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}

/* --- Main Content --- */
.main-content {
  padding: 28px 32px;
  overflow-y: auto;
}

/* --- Top Bar --- */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}

.top-bar-left h1 {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em;
}

.top-bar-left p {
  font-size: 0.85rem; color: var(--text-muted); margin-top: 2px;
}

.top-bar-right {
  display: flex; align-items: center; gap: 12px;
}

.env-badge {
  font-size: 0.65rem; font-family: 'JetBrains Mono', monospace;
  padding: 5px 12px; border-radius: var(--radius-pill);
  background: var(--bg-glass); border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.env-badge.live { border-color: rgba(52,211,153,0.2); color: var(--success); }

/* --- Metric Cards Row --- */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 20px;
  position: relative; overflow: hidden;
  transition: all var(--transition-slow);
}

.metric-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
}

.metric-card .shimmer {
  position: absolute; top: 0; right: 0;
  width: 100px; height: 100px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  opacity: 0.5; pointer-events: none;
}

.metric-label {
  font-size: 0.7rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}

.metric-label svg { width: 14px; height: 14px; opacity: 0.6; }

.metric-value {
  font-size: 1.65rem; font-weight: 700; letter-spacing: -0.02em;
  line-height: 1;
}

.metric-sub {
  font-size: 0.7rem; color: var(--text-muted); margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
}

/* gauge bar */
.gauge-track {
  height: 4px; width: 100%;
  background: rgba(255,255,255,0.05);
  border-radius: 2px; margin-top: 12px; overflow: hidden;
}

.gauge-fill {
  height: 100%; border-radius: 2px;
  background: var(--accent-gradient);
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.gauge-fill.warn { background: linear-gradient(90deg, var(--warning), var(--danger)); }

/* --- Services Panel --- */
.panel {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 20px; overflow: hidden;
}

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.panel-title {
  font-size: 0.85rem; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}

.panel-title svg { width: 16px; height: 16px; opacity: 0.6; }

.panel-badge {
  font-size: 0.6rem; font-family: 'JetBrains Mono', monospace;
  padding: 3px 8px; border-radius: var(--radius-pill);
  background: var(--success-bg); color: var(--success);
}

.panel-badge.partial { background: var(--warning-bg); color: var(--warning); }
.panel-badge.down { background: var(--danger-bg); color: var(--danger); }

.panel-body { padding: 16px 20px; }

/* services list */
.service-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.service-row:last-child { border-bottom: none; }

.service-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}

.service-dot.active { background: var(--success); box-shadow: 0 0 8px var(--success); }
.service-dot.inactive { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

.service-name {
  font-size: 0.85rem; font-weight: 500; flex: 1;
}

.service-detail {
  font-size: 0.7rem; font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
}

.service-action {
  font-size: 0.7rem; font-weight: 500;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent);
  cursor: pointer; border: none;
  transition: all var(--transition-base);
}

.service-action:hover {
  background: rgba(120,90,255,0.15);
}

/* --- Two-Column Grid --- */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.content-grid .panel { margin-bottom: 0; }

/* --- Engine Cards --- */
.engines-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}

.engine-card {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: all var(--transition-slow);
  cursor: pointer;
}

.engine-card:hover {
  border-color: var(--border-glow);
  background: var(--bg-card-hover);
  transform: translateX(4px);
  box-shadow: var(--shadow-glow);
}

.engine-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}

.engine-icon.purple { background: rgba(120,90,255,0.12); }
.engine-icon.cyan { background: rgba(90,228,255,0.12); }
.engine-icon.green { background: rgba(52,211,153,0.12); }
.engine-icon.orange { background: rgba(251,191,36,0.12); }
.engine-icon.pink { background: rgba(248,113,113,0.12); }

.engine-info { flex: 1; min-width: 0; }
.engine-info h3 { font-size: 0.9rem; font-weight: 600; margin-bottom: 2px; }
.engine-info p { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.engine-tags { display: flex; gap: 4px; flex-shrink: 0; }

.tag {
  font-size: 0.6rem; font-family: 'JetBrains Mono', monospace;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg-glass); border: 1px solid var(--border-subtle);
  color: var(--text-dim);
}

.engine-arrow {
  color: var(--text-dim); transition: all var(--transition-base);
}
.engine-card:hover .engine-arrow { color: var(--accent); transform: translateX(3px); }

.engine-status {
  font-size: 0.6rem; font-family: 'JetBrains Mono', monospace;
  padding: 2px 8px; border-radius: var(--radius-pill);
}

.engine-status.active { background: var(--success-bg); color: var(--success); }
.engine-status.dev { background: var(--warning-bg); color: var(--warning); }

/* --- Load Chart (simple sparkline) --- */
.sparkline-container {
  display: flex; align-items: flex-end; gap: 2px;
  height: 40px; padding: 8px 0;
}

.sparkline-bar {
  flex: 1; min-width: 3px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  opacity: 0.6;
  transition: height 0.5s ease;
}

.sparkline-bar:last-child { opacity: 1; }

/* --- Activity Log --- */
.log-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.8rem;
}

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

.log-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem; color: var(--text-dim);
  white-space: nowrap; padding-top: 2px;
  min-width: 52px;
}

.log-icon { font-size: 0.75rem; padding-top: 1px; }
.log-text { color: var(--text-secondary); line-height: 1.4; }
.log-text strong { color: var(--text-primary); font-weight: 500; }

.activity-empty {
  text-align: center; padding: 16px;
  color: var(--text-dim); font-size: 0.8rem;
}

/* --- Quick Actions --- */
.quick-actions {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}

.quick-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 12px;
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.75rem; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.quick-action-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.quick-action-btn svg { width: 20px; height: 20px; opacity: 0.6; }
.quick-action-btn:hover svg { opacity: 1; }

/* --- Sections for tabs --- */
.tab-section { display: none; }
.tab-section.active { display: block; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -100%; z-index: 100;
    width: 260px; transition: left 0.3s ease;
  }
  .sidebar.open { left: 0; }
  .main-content { padding: 20px 16px; }
  .metrics-row { grid-template-columns: 1fr 1fr; }
  .quick-actions { grid-template-columns: 1fr 1fr; }

  .mobile-menu-btn {
    display: flex !important;
  }
}

.mobile-menu-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--bg-glass); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); cursor: pointer; color: var(--text-secondary);
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.anim-in { animation: fadeIn 0.4s ease forwards; opacity: 0; }
.anim-in:nth-child(1) { animation-delay: 0.02s; }
.anim-in:nth-child(2) { animation-delay: 0.06s; }
.anim-in:nth-child(3) { animation-delay: 0.1s; }
.anim-in:nth-child(4) { animation-delay: 0.14s; }
.anim-in:nth-child(5) { animation-delay: 0.18s; }
.anim-in:nth-child(6) { animation-delay: 0.22s; }

/* scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* --- Log Viewer --- */
.log-viewer {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-height: 450px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.log-select {
  font-size: 0.7rem; font-family: 'JetBrains Mono', monospace;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--bg-input); border: 1px solid var(--border-subtle);
  color: var(--text-primary); cursor: pointer;
  outline: none;
}

select option,
.log-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* --- File Manager --- */
.file-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 12px;
}

.breadcrumbs {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.75rem; color: var(--text-muted);
  flex-wrap: wrap;
}

.breadcrumbs span {
  cursor: pointer; padding: 2px 6px; border-radius: 4px;
  transition: all var(--transition-fast);
}

.breadcrumbs span:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.breadcrumbs .sep { cursor: default; opacity: 0.4; }

.file-layout {
  display: grid; grid-template-columns: 1fr; gap: 16px;
}

.file-layout.has-editor { grid-template-columns: 1fr 1fr; }

.file-list-panel {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); overflow: hidden;
}

.file-entry {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.file-entry:hover { background: var(--bg-card-hover); }
.file-entry:last-child { border-bottom: none; }

.file-entry .icon { font-size: 1rem; width: 24px; text-align: center; flex-shrink: 0; }
.file-entry .name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-entry .meta {
  font-size: 0.65rem; font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim); white-space: nowrap;
}

.file-editor-panel {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column;
}

.code-editor {
  flex: 1; width: 100%; min-height: 400px;
  background: rgba(0,0,0,0.3);
  border: none; outline: none; resize: vertical;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem; line-height: 1.6;
  color: var(--text-primary);
  padding: 16px;
  tab-size: 2;
}

/* --- Text Input --- */
.text-input {
  font-size: 0.8rem;
  padding: 6px 12px; border-radius: var(--radius-md);
  background: var(--bg-input); border: 1px solid var(--border-subtle);
  color: var(--text-primary); outline: none;
  font-family: 'JetBrains Mono', monospace;
  transition: border-color var(--transition-base);
}

.text-input:focus { border-color: var(--accent); }

/* --- Terminal --- */
#terminalContainer .xterm { padding: 8px; }

/* --- Toast Notifications --- */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 1000; display: flex; flex-direction: column;
  gap: 8px; pointer-events: none;
}

.toast {
  background: var(--bg-secondary); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 12px 18px;
  font-size: 0.8rem; color: var(--text-primary);
  box-shadow: var(--shadow-md);
  pointer-events: all;
  animation: slideInToast 0.3s ease, fadeOutToast 0.3s ease 3.7s forwards;
  display: flex; align-items: center; gap: 8px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }

@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOutToast {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* --- Backup List --- */
.backup-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.backup-item:last-child { border-bottom: none; }
.backup-item .name { flex: 1; font-size: 0.85rem; font-weight: 500; }
.backup-item .meta { font-size: 0.65rem; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }

/* --- Utility classes (replacing inline styles) --- */
.top-bar-title-row { display: flex; align-items: center; gap: 12px; }
.panel-actions { display: flex; gap: 8px; }
.service-actions-group { display: flex; gap: 4px; }
.service-action-sm { font-size: 0.7rem; }
.service-action-danger { color: var(--danger); }

/* Terminal */
.terminal-panel { height: calc(100vh - 120px); }
.terminal-body { padding: 0; height: calc(100% - 50px); }
.terminal-container { height: 100%; }

/* Bot log panel */
.bot-log-panel-hidden { margin-top: 16px; display: none; }

/* Backup form */
.backup-form { display: flex; gap: 10px; flex-wrap: wrap; }
.backup-path-input { flex: 1; min-width: 200px; }
.backup-name-input { width: 160px; }
.backups-list-panel { margin-top: 16px; }

/* Nginx log panel */
.nginx-log-panel { margin-top: 16px; }

/* Log viewer variants */
.log-viewer-short { max-height: 250px; }
.log-viewer-compact { max-height: 200px; font-size: 0.7rem; }

/* Monitoring */
.monitoring-chart-panel { margin-bottom: 16px; }
.chart-canvas { width: 100%; }
.metrics-row-3col { grid-template-columns: repeat(3, 1fr); }
.monitoring-details-grid { margin-top: 16px; }
.environment-panel { margin-top: 16px; }
.gauge-track-spaced { margin-top: 8px; }

/* --- Alert Rows (widget renderer) --- */
.alert-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.82rem;
}

.alert-row:last-child { border-bottom: none; }
.alert-icon { font-size: 0.9rem; flex-shrink: 0; }
.alert-title { font-weight: 600; color: var(--text-primary); }
.alert-message { color: var(--text-muted); margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; }
.alert-critical { border-left: 3px solid var(--danger); padding-left: 10px; }
.alert-warning { border-left: 3px solid var(--warning); padding-left: 10px; }
.alert-info { border-left: 3px solid var(--accent); padding-left: 10px; }

/* --- Widget Fallback --- */
.widget-unknown { border-left: 3px solid var(--warning); }

/* --- Service action button disabled --- */
.service-action:disabled { opacity: 0.3; cursor: not-allowed; }
/* --- API Key Management --- */
.key-masked {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.key-raw-display {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--warning);
  background: rgba(251,191,36,0.08);
  border: 1px dashed rgba(251,191,36,0.3);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  word-break: break-all;
  user-select: all;
}

.key-scopes {
  display: flex; gap: 4px; flex-wrap: wrap;
}

.scope-group {
  margin-bottom: 8px;
}

.scope-group strong {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.scope-item {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-right: 12px;
  cursor: pointer;
}

.scope-item input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Themes loaded from css/themes/ */


/* --- Analytics Modal --- */
.analytics-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 30px 20px; overflow-y: auto;
}

.analytics-modal {
  width: 100%; max-width: 960px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.analytics-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--border-subtle);
}

.analytics-header h2 { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); margin: 0; }

.analytics-body { padding: 20px 24px; }

.analytics-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px; margin-bottom: 20px;
}

.analytics-stat {
  background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 10px;
  padding: 14px; text-align: center;
}

.analytics-stat .stat-value {
  font-size: 1.4rem; font-weight: 700; color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}

.analytics-stat .stat-label {
  font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px;
}

.analytics-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 16px;
}

.analytics-table {
  width: 100%; font-size: 0.78rem; border-collapse: collapse;
}

.analytics-table td {
  padding: 6px 8px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary);
}

.analytics-table td:first-child { color: var(--text-primary); font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; }
.analytics-table td:last-child { text-align: right; font-weight: 600; color: var(--text-primary); }

.status-bar {
  display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 10px; gap: 2px;
}

.status-bar span { border-radius: 3px; }
.status-bar .s2xx { background: var(--success); }
.status-bar .s3xx { background: #60a5fa; }
.status-bar .s4xx { background: var(--warning); }
.status-bar .s5xx { background: var(--danger); }

.visitor-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--border-subtle); font-size: 0.8rem;
}

.visitor-row .v-label { color: var(--text-secondary); }
.visitor-row .v-count { color: var(--text-primary); font-weight: 600; font-family: 'JetBrains Mono', monospace; }

@media (max-width: 700px) {
  .analytics-grid { grid-template-columns: 1fr; }
  .analytics-stats { grid-template-columns: repeat(2, 1fr); }
  .analytics-modal { border-radius: 12px; }
}

