/* ========================================
   AIKOCLAW — DASHBOARD STYLES
   ======================================== */

/* ── Dashboard Layout ── */
.dash-body {
  background: var(--dark-1);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Dashboard Navbar ── */
.dash-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,13,26,0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0 24px;
}
.dash-nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.dash-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.dash-brand img { width: 30px; height: 30px; border-radius: 7px; object-fit: contain; }
.dash-brand strong { font-weight: 900; }

.dash-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(40,200,64,0.12);
  border: 1px solid rgba(40,200,64,0.25);
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
  color: #28C840;
  font-family: var(--mono);
}
.status-dot {
  width: 7px; height: 7px;
  background: #28C840;
  border-radius: 50%;
  box-shadow: 0 0 6px #28C840;
  animation: pulse-orb 2s ease-in-out infinite;
}
.dash-home-btn {
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.6);
  padding: 6px 14px; border-radius: 8px;
  transition: var(--transition);
}
.dash-home-btn:hover { background: rgba(255,255,255,0.08); color: var(--white); }

/* ── Dashboard Body Layout ── */
.dash-layout {
  display: flex;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 0 24px;
  gap: 0;
}

/* ── Sidebar ── */
.dash-sidebar {
  width: 220px;
  flex-shrink: 0;
  padding: 24px 0;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar-section { margin-bottom: 28px; }
.sidebar-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: rgba(255,255,255,0.3);
  padding: 0 12px; margin-bottom: 6px; font-family: var(--mono);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500; color: rgba(255,255,255,0.55);
  cursor: pointer; transition: var(--transition);
  text-decoration: none;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); }
.sidebar-link.active { background: rgba(232,76,61,0.14); color: var(--white); font-weight: 700; }
.sidebar-link.active .sl-icon { color: var(--coral); }
.sl-icon { font-size: 16px; width: 20px; text-align: center; }
.sl-badge {
  margin-left: auto; font-size: 10px; font-weight: 800;
  background: var(--red); color: var(--white);
  padding: 1px 6px; border-radius: 50px;
  font-family: var(--mono);
}

/* ── Main Content ── */
.dash-main {
  flex: 1;
  padding: 28px 28px;
  overflow-y: auto;
  min-width: 0;
}

.dash-page { display: none; }
.dash-page.active { display: block; }

/* ── Page Header ── */
.dash-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.dash-page-title {
  font-size: 22px; font-weight: 800; color: var(--white);
  letter-spacing: -0.03em;
}
.dash-page-sub { font-size: 13px; color: rgba(255,255,255,0.4); margin-top: 3px; font-family: var(--mono); }
.dash-actions { display: flex; gap: 10px; }
.dash-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: var(--transition); border: 1.5px solid transparent;
  font-family: var(--font);
}
.dash-btn-primary {
  background: linear-gradient(135deg, var(--red) 0%, var(--coral) 100%);
  color: var(--white); box-shadow: 0 3px 16px rgba(232,76,61,0.35);
}
.dash-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(232,76,61,0.5); }
.dash-btn-secondary {
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.75);
  border-color: rgba(255,255,255,0.1);
}
.dash-btn-secondary:hover { background: rgba(255,255,255,0.1); color: var(--white); }

/* ── KPI Cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; padding: 20px;
  transition: var(--transition);
}
.kpi-card:hover { border-color: rgba(232,76,61,0.25); background: rgba(255,255,255,0.06); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi-icon { font-size: 22px; }
.kpi-trend {
  font-size: 11px; font-weight: 700; font-family: var(--mono);
  padding: 2px 8px; border-radius: 50px;
}
.kpi-trend.up { color: #28C840; background: rgba(40,200,64,0.12); }
.kpi-trend.down { color: #FF5F57; background: rgba(255,95,87,0.12); }
.kpi-trend.neutral { color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.06); }
.kpi-value { font-size: 28px; font-weight: 900; color: var(--white); letter-spacing: -0.03em; font-family: var(--mono); line-height: 1; margin-bottom: 4px; }
.kpi-label { font-size: 12px; color: rgba(255,255,255,0.4); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Cards ── */
.dash-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; padding: 22px;
  margin-bottom: 20px;
}
.dash-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.dash-card-title {
  font-size: 14px; font-weight: 700; color: var(--white); letter-spacing: -0.01em;
}
.dash-card-sub { font-size: 12px; color: rgba(255,255,255,0.35); font-family: var(--mono); }

/* ── Agent Table ── */
.agent-table { width: 100%; border-collapse: collapse; }
.agent-table th {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: rgba(255,255,255,0.3);
  padding: 8px 12px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.06);
  font-family: var(--mono);
}
.agent-table td {
  padding: 13px 12px; border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px; color: rgba(255,255,255,0.8); vertical-align: middle;
}
.agent-table tr:last-child td { border-bottom: none; }
.agent-table tr:hover td { background: rgba(255,255,255,0.03); }

.agent-name { font-weight: 700; color: var(--white); font-family: var(--mono); font-size: 13px; }
.agent-div  { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 2px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 50px;
  font-size: 11px; font-weight: 700; font-family: var(--mono);
}
.status-active   { background: rgba(40,200,64,0.12);  color: #28C840;  border: 1px solid rgba(40,200,64,0.2); }
.status-idle     { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.5); border: 1px solid rgba(255,255,255,0.1); }
.status-spawning { background: rgba(254,188,46,0.12);  color: #FEBC2E; border: 1px solid rgba(254,188,46,0.2); }
.status-destroying { background: rgba(255,95,87,0.12); color: #FF5F57; border: 1px solid rgba(255,95,87,0.2); }

.lane-badge {
  font-size: 11px; font-weight: 800; font-family: var(--mono);
  padding: 2px 8px; border-radius: 6px;
}
.lane-p0 { background: rgba(255,95,87,0.18); color: #FF5F57; }
.lane-p1 { background: rgba(254,188,46,0.15); color: #FEBC2E; }
.lane-p2 { background: rgba(40,200,64,0.13);  color: #28C840; }
.lane-p3 { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.5); }

.table-action-btn {
  padding: 4px 12px; border-radius: 7px; font-size: 11px; font-weight: 700;
  cursor: pointer; transition: var(--transition); border: 1px solid transparent;
  font-family: var(--mono);
}
.btn-kill  { color: #FF5F57; background: rgba(255,95,87,0.1); border-color: rgba(255,95,87,0.2); }
.btn-kill:hover { background: rgba(255,95,87,0.25); }
.btn-log   { color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); }
.btn-log:hover { background: rgba(255,255,255,0.12); }

/* ── Lane Chart Bars ── */
.lane-bars { display: flex; flex-direction: column; gap: 12px; }
.lane-row { display: flex; align-items: center; gap: 12px; }
.lane-name { font-size: 12px; font-weight: 700; font-family: var(--mono); width: 55px; flex-shrink: 0; }
.lane-bar-track { flex: 1; height: 8px; background: rgba(255,255,255,0.07); border-radius: 50px; overflow: hidden; }
.lane-bar-fill  { height: 100%; border-radius: 50px; transition: width 1s ease; }
.fill-p0 { background: linear-gradient(90deg, #FF5F57, #FF8F8A); }
.fill-p1 { background: linear-gradient(90deg, #FEBC2E, #FFD97A); }
.fill-p2 { background: linear-gradient(90deg, #28C840, #6EE687); }
.fill-p3 { background: linear-gradient(90deg, #6B6B8A, #9898B8); }
.lane-count { font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.5); font-family: var(--mono); width: 30px; text-align: right; }

/* ── Memory Tier Cards ── */
.memory-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; }
.mem-card {
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px; padding: 16px;
}
.mem-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.mem-icon { font-size: 20px; }
.mem-name { font-size: 13px; font-weight: 700; color: var(--white); }
.mem-type { font-size: 11px; color: rgba(255,255,255,0.35); font-family: var(--mono); }
.mem-stat { display: flex; justify-content: space-between; margin-bottom: 8px; }
.mem-stat-label { font-size: 11px; color: rgba(255,255,255,0.4); }
.mem-stat-val   { font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.8); font-family: var(--mono); }
.mem-bar-track  { height: 5px; background: rgba(255,255,255,0.07); border-radius: 50px; overflow: hidden; margin-top: 8px; }
.mem-bar-fill   { height: 100%; border-radius: 50px; }
.fill-redis  { background: linear-gradient(90deg, #FF5F57, #FF9A3C); }
.fill-pg     { background: linear-gradient(90deg, #4F9CF9, #818CF8); }
.fill-qdrant { background: linear-gradient(90deg, #818CF8, #C084FC); }
.fill-snap   { background: linear-gradient(90deg, #28C840, #6EE687); }

/* ── Live Log Terminal ── */
.live-log {
  background: var(--dark-1); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px; overflow: hidden; font-family: var(--mono);
}
.log-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.log-title { font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.5); }
.log-clear-btn {
  font-size: 11px; color: rgba(255,255,255,0.35); background: none; border: none;
  cursor: pointer; transition: color 0.2s; font-family: var(--mono);
}
.log-clear-btn:hover { color: var(--coral); }
.log-body { padding: 14px 16px; max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.log-line { font-size: 12px; line-height: 1.5; display: flex; gap: 10px; }
.log-time  { color: rgba(255,255,255,0.25); flex-shrink: 0; }
.log-level { font-weight: 700; flex-shrink: 0; width: 45px; }
.log-msg   { color: rgba(255,255,255,0.75); }
.level-info  { color: #4F9CF9; }
.level-ok    { color: #28C840; }
.level-warn  { color: #FEBC2E; }
.level-error { color: #FF5F57; }

/* ── Circuit Breaker Status ── */
.cb-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.cb-card {
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.cb-name  { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.8); }
.cb-sub   { font-size: 11px; color: rgba(255,255,255,0.3); font-family: var(--mono); margin-top: 2px; }
.cb-state { font-size: 12px; font-weight: 800; font-family: var(--mono); padding: 3px 10px; border-radius: 50px; }
.cb-closed   { background: rgba(40,200,64,0.12); color: #28C840; border: 1px solid rgba(40,200,64,0.2); }
.cb-open     { background: rgba(255,95,87,0.14); color: #FF5F57; border: 1px solid rgba(255,95,87,0.2); }
.cb-halfopen { background: rgba(254,188,46,0.12); color: #FEBC2E; border: 1px solid rgba(254,188,46,0.2); }

/* ── Spawn Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--dark-2); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px; padding: 32px; width: 480px; max-width: 95vw;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  transform: scale(0.96); transition: transform 0.25s ease;
}
.modal-overlay.open .modal-box { transform: scale(1); }
.modal-title { font-size: 20px; font-weight: 800; color: var(--white); margin-bottom: 6px; }
.modal-sub   { font-size: 13px; color: rgba(255,255,255,0.45); margin-bottom: 24px; font-family: var(--mono); }
.modal-form  { display: flex; flex-direction: column; gap: 16px; }
.form-group  { display: flex; flex-direction: column; gap: 6px; }
.form-label  { font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 0.04em; font-family: var(--mono); }
.form-input, .form-select {
  background: rgba(255,255,255,0.06); border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 10px; padding: 11px 14px; font-size: 14px;
  color: var(--white); font-family: var(--font); outline: none;
  transition: border-color 0.2s ease;
}
.form-input::placeholder { color: rgba(255,255,255,0.25); }
.form-input:focus, .form-select:focus { border-color: var(--red); }
.form-select option { background: var(--dark-2); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.modal-cancel {
  padding: 10px 20px; border-radius: 10px; font-size: 14px; font-weight: 600;
  color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.06);
  border: none; cursor: pointer; transition: var(--transition);
}
.modal-cancel:hover { background: rgba(255,255,255,0.12); }

/* ── Grid helpers ── */
.dash-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dash-3col { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

/* ── Responsive dashboard ── */
@media (max-width: 900px) {
  .dash-sidebar { display: none; }
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .dash-2col, .dash-3col { grid-template-columns: 1fr; }
  .memory-grid { grid-template-columns: 1fr; }
  .cb-grid { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
