* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #111827;
  color: #f3f4f6;
  min-height: 100vh;
}

/* ---- Login ---- */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.login-box {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.75rem;
  padding: 2.5rem 2rem;
  width: 24rem;
  max-width: 90vw;
}

.login-box h2 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-box h2 span {
  color: #3b82f6;
}

.login-box input {
  width: 100%;
  padding: 0.625rem 1rem;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 0.375rem;
  color: #f3f4f6;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  outline: none;
}

.login-box input:focus {
  border-color: #3b82f6;
}

.login-box button {
  width: 100%;
  padding: 0.625rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.login-box button:hover {
  background: #1d4ed8;
}

.login-error {
  color: #f87171;
  font-size: 0.8125rem;
  text-align: center;
  margin-bottom: 0.75rem;
  display: none;
}

/* ---- Header ---- */
.header {
  background: #1f2937;
  border-bottom: 1px solid #374151;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 700;
}

.header h1 span {
  color: #3b82f6;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-logout {
  background: #7f1d1d;
  color: #fca5a5;
  padding: 0.375rem 0.75rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-logout:hover {
  background: #991b1b;
}

/* ---- Dashboard ---- */
.dashboard {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #d1d5db;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
}

/* ---- System Info ---- */
.system-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.system-card {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.5rem;
  padding: 1.25rem;
}

.system-card .label {
  font-size: 0.75rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.system-card .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f3f4f6;
}

.system-card .sub {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #374151;
  border-radius: 3px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ---- Apps Grid ---- */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.app-card {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition: border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.app-card:hover {
  border-color: #4b5563;
}

.app-card .accent-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.app-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  margin-top: 0.25rem;
}

.app-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #f3f4f6;
}

.app-card-domain {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.125rem;
}

/* Status badge */
.status-badge {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
}

.status-online {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.status-offline {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-online .status-dot {
  background: #34d399;
  animation: pulse 2s ease-in-out infinite;
}

.status-offline .status-dot {
  background: #f87171;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* App card info */
.app-card-info {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  color: #9ca3af;
}

.app-card-info span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* App card links */
.app-card-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.app-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 0.375rem;
  color: #60a5fa;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}

.app-link:hover {
  background: #1e3a5f;
  border-color: #60a5fa;
  color: #93bbfc;
}

/* ---- Database section in cards ---- */
.db-section {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 0.375rem;
}

.db-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.db-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.db-size {
  font-size: 0.6875rem;
  color: #6b7280;
}

.db-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: #d1d5db;
  margin-bottom: 0.5rem;
}

.db-collections {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.db-collection {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0.5rem;
  background: #1f2937;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
}

.db-col-name {
  color: #9ca3af;
}

.db-col-count {
  color: #60a5fa;
  font-weight: 600;
}

/* ---- Footer ---- */
.hub-footer {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
  font-size: 0.75rem;
  border-top: 1px solid #1f2937;
}

/* ---- Last check ---- */
.last-check {
  font-size: 0.6875rem;
  color: #6b7280;
  text-align: right;
}

/* ---- Spinner ---- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #374151;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .dashboard { padding: 1rem; }
  .apps-grid { grid-template-columns: 1fr; }
  .system-bar { grid-template-columns: repeat(2, 1fr); }
  .header { padding: 0.75rem 1rem; }
  .header h1 { font-size: 1rem; }
}

@media (max-width: 480px) {
  .system-bar { grid-template-columns: 1fr; }
}
