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

:root {
  --bg: #0B0D14;
  --surface: #13161F;
  --surface-2: #1A1D2A;
  --border: #232638;
  --primary: #4F7DF3;
  --primary-h: #3A6AE0;
  --text: #E8EAED;
  --muted: #6E7491;
  --success: #22C55E;
  --warning: #F59E0B;
  --error: #EF4444;
  --r: 12px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }

/* ── Auth screen ── */
#auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 60% 0%, #1a2a5e22 0%, transparent 60%);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 40px;
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo img { height: 36px; }
.auth-logo h1 { font-size: 22px; font-weight: 700; margin-top: 10px; }
.auth-logo span { color: var(--primary); }
.auth-logo p { color: var(--muted); font-size: 13px; margin-top: 4px; }

.tabs { display: flex; gap: 0; margin-bottom: 28px; border-bottom: 1px solid var(--border); }
.tab-btn {
  flex: 1; padding: 10px; background: none; border: none; color: var(--muted);
  font-size: 14px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .15s; margin-bottom: -1px;
}
.tab-btn.active { color: var(--text); border-bottom-color: var(--primary); }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.form-group input {
  width: 100%; padding: 10px 14px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  font-size: 14px; font-family: inherit; outline: none; transition: border-color .15s;
}
.form-group input:focus { border-color: var(--primary); }
.form-group input::placeholder { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; font-family: inherit; transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; width: 100%; margin-top: 8px; padding: 12px; }
.btn-primary:hover { background: var(--primary-h); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 13px; }

.form-error { color: var(--error); font-size: 13px; margin-top: 12px; text-align: center; min-height: 20px; }
.forgot { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }

/* ── App layout ── */
#app-screen { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 24px 16px;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; padding: 0 8px; }
.sidebar-logo-icon {
  width: 32px; height: 32px; background: var(--primary); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.sidebar-logo-text { font-size: 15px; font-weight: 700; }
.sidebar-logo-sub { font-size: 11px; color: var(--muted); }

.nav { flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; color: var(--muted); cursor: pointer; font-weight: 500;
  transition: all .15s; user-select: none; margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: #4F7DF318; color: var(--primary); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer { margin-top: auto; }
.user-info {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--surface-2); border-radius: 8px; margin-bottom: 8px;
}
.user-avatar {
  width: 32px; height: 32px; background: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  font-size: 13px; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-email { font-size: 11px; color: var(--muted); }
.logout-btn {
  width: 100%; padding: 8px; border-radius: 8px; background: none;
  border: 1px solid var(--border); color: var(--muted); cursor: pointer;
  font-size: 13px; font-family: inherit; transition: all .15s;
}
.logout-btn:hover { border-color: var(--error); color: var(--error); }

.main { flex: 1; padding: 40px; overflow-y: auto; max-width: 900px; }
.page { display: none; }
.page.active { display: block; }

.page-header { margin-bottom: 28px; }
.page-title { font-size: 22px; font-weight: 700; }
.page-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ── Systems ── */
.systems-grid { display: grid; gap: 16px; }
.system-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 20px; transition: border-color .15s;
}
.system-card:hover { border-color: #3a3d52; }
.system-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.system-name { font-size: 16px; font-weight: 600; }
.system-type { font-size: 12px; color: var(--muted); margin-top: 2px; }
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.status-active { background: #22c55e18; color: var(--success); }
.status-paused { background: #f59e0b18; color: var(--warning); }
.status-inactive { background: #ef444418; color: var(--error); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.system-desc { color: var(--muted); font-size: 13px; line-height: 1.5; }
.system-meta { display: flex; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.system-meta-item { font-size: 12px; color: var(--muted); }
.system-meta-item span { color: var(--text); font-weight: 500; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 8px; }

/* ── Profile ── */
.profile-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 28px; max-width: 480px;
}
.profile-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 20px; }
.profile-actions { margin-top: 20px; display: flex; gap: 10px; }
.save-msg { font-size: 13px; color: var(--success); margin-top: 10px; min-height: 20px; }

/* ── Activity log ── */
.activity-list { list-style: none; }
.activity-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 6px; }
.activity-action { font-size: 14px; }
.activity-time { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Loading ── */
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; justify-content: center; padding: 40px; }

@media (max-width: 640px) {
  .sidebar { display: none; }
  .main { padding: 20px; }
}
