/* ── Reset & base ───────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f172a;
  --surface: rgba(30, 41, 59, 0.8);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --danger: #ef4444;
  --border: rgba(71, 85, 105, 0.5);
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* ── Views ──────────────────────────────────────────────────────────── */
.view {
  min-height: 100vh;
}

/* ── Login ──────────────────────────────────────────────────────────── */
.login-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 80px 20px 40px;
}

.logo {
  text-align: center;
  margin-bottom: 40px;
}

.logo h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.tagline {
  color: var(--text-muted);
  margin-top: 4px;
  font-size: 0.95rem;
}

.auth-form {
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.auth-form h2 {
  font-size: 1.25rem;
  margin-bottom: 20px;
}

.auth-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-top: 12px;
}

.auth-form label:first-of-type {
  margin-top: 0;
}

.auth-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
  background: rgba(15, 23, 42, 0.6);
  color: var(--text);
}

.auth-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.auth-form input::placeholder {
  color: #64748b;
}

.auth-form button[type="submit"] {
  width: 100%;
  padding: 12px;
  margin-top: 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.auth-form button[type="submit"]:hover {
  background: var(--primary-hover);
}

.auth-form button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.switch-link {
  text-align: center;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.switch-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.error-msg {
  background: rgba(127, 29, 29, 0.25);
  color: #f87171;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.success-msg {
  background: rgba(21, 94, 117, 0.25);
  color: #4ade80;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.form-description {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* ── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
}

#user-name {
  color: var(--text-muted);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

.btn-link:hover {
  text-decoration: underline;
}

/* ── Avatar Menu ───────────────────────────────────────────────────── */
.avatar-menu {
  position: relative;
}

.avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  line-height: 1;
}

.avatar-btn:hover {
  opacity: 0.85;
}

.avatar-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px 0;
  z-index: 100;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.1s;
}

.dropdown-item:hover {
  background: rgba(99, 102, 241, 0.1);
}

/* ── App Launcher ───────────────────────────────────────────────────── */
.launcher {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px;
}

.launcher h2 {
  font-size: 1.5rem;
  margin-bottom: 24px;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.app-card {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.app-card .app-name {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
}

.app-card .app-name-bold {
  font-weight: 700;
}

.app-card .app-name-light {
  font-weight: 300;
}

.app-card .app-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.app-card .app-role {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 500;
  letter-spacing: 0.03em;
}

.app-card.disabled {
  opacity: 0.4;
  pointer-events: none;
}


.no-apps {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
