:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-2: #1a1a26;
  --border: #1e1e2e;
  --accent: #6c63ff;
  --accent-glow: rgba(108, 99, 255, 0.3);
  --text: #e0e0e0;
  --text-dim: #666;
  --danger: #ff4d6a;
  --success: #34d399;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.sr-only {
  position: absolute;
  left: -9999px;
  opacity: 0;
  width: 1px;
  height: 1px;
}

/* ── Login ── */
#login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  animation: fadeIn 0.5s ease;
}

#login-screen h1 { font-size: 1.8rem; font-weight: 600; margin-bottom: 0.5rem; }
#login-screen > p { color: var(--text-dim); margin-bottom: 2rem; font-size: 0.9rem; }

.token-input-wrap {
  display: flex;
  gap: 0.5rem;
  max-width: 420px;
  width: 100%;
}

.token-input-wrap input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

.token-input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.token-input-wrap button,
button.primary {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.token-input-wrap button:hover,
button.primary:hover { opacity: 0.85; }

.error-msg { color: var(--danger); margin-top: 1rem; font-size: 0.85rem; min-height: 1.2em; }

/* ── Dashboard ── */
#dashboard {
  display: none;
  min-height: 100vh;
  flex-direction: column;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.dash-header h1 { font-size: 1.2rem; font-weight: 600; }

.dash-header button {
  padding: 0.4rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.dash-header button:hover { border-color: var(--danger); color: var(--danger); }

.dash-body { flex: 1; padding: 2rem; }

/* ── Widget Grid ── */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.widget-grid:empty + .empty-state { display: block; }
.widget-grid:not(:empty) + .empty-state { display: none; }

.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.widget:hover { border-color: var(--accent); }

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

.widget-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.widget-content { font-size: 0.9rem; line-height: 1.6; }

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding-top: 15vh;
}

.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h2 { font-size: 1.1rem; font-weight: 500; margin-bottom: 0.5rem; color: var(--text); }
.empty-state p { font-size: 0.9rem; }

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

/* ── Responsive ── */
@media (max-width: 640px) {
  .dash-header { padding: 1rem; }
  .dash-body { padding: 1rem; }
  .widget-grid { grid-template-columns: 1fr; }
}
