/* === Dashboard layout (sidebar + topbar) === */

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
}

.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
@media (max-width: 900px) { .sidebar { position: static; height: auto; } }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px 18px;
  font-weight: 800; font-size: 18px; letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); padding: 14px 10px 4px;
  font-weight: 600;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-dim);
  font-weight: 500; font-size: 14px;
  transition: all var(--duration-fast) var(--easing);
}
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-item .icon { width: 18px; height: 18px; opacity: 0.85; }

.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: var(--bg-2);
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--text-dim); }

/* Topbar */
.topbar {
  height: 64px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 9, 13, 0.5);
  backdrop-filter: blur(14px);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-size: 20px; font-weight: 700; flex: 1; }

/* Status indicator */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600;
  background: var(--bg-2); border: 1px solid var(--border);
}
.status-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-faint);
}
.status-pill.online .dot { background: var(--success); box-shadow: 0 0 8px var(--success); animation: pulse 2s infinite; }
.status-pill.offline .dot { background: var(--danger); }

/* Content */
.content {
  padding: 28px;
  display: flex; flex-direction: column; gap: 24px;
}

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-header h1 { font-size: 28px; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1024px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .stats-grid { grid-template-columns: 1fr; } }

.stat-card .label {
  font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.stat-card .value {
  font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
  display: flex; align-items: baseline; gap: 8px;
}
.stat-card .delta { font-size: 12px; color: var(--text-dim); }

/* Empty states */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-dim);
}
.empty-state .empty-icon { margin-bottom: 16px; opacity: 0.4; color: var(--text-dim); display: inline-block; }
.empty-state .empty-icon .icon { width: 36px; height: 36px; }

/* Generic responsive auto-fit grid */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.card-link:hover { color: inherit; }
.card-link h3 { color: var(--text); }

/* Auth pages */
.auth-shell {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow-card);
}
.auth-card h2 { margin-bottom: 8px; }
.auth-card p.lead { color: var(--text-dim); margin-bottom: 24px; font-size: 14px; }
.auth-footer { margin-top: 18px; text-align: center; font-size: 13px; color: var(--text-dim); }
.auth-footer a { color: var(--accent); }

/* Config editor */
.config-editor {
  font-family: var(--font-mono); font-size: 13px;
  min-height: 360px;
}

/* Toast */
.toast-area {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-2);
  font-size: 14px;
  min-width: 240px;
  box-shadow: var(--shadow-card);
}
.toast .icon { flex-shrink: 0; }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }
