:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e2e8f0;
  --muted: #64748b;
  --accent: #3b82f6;
  --accent-dim: #1e3a5f;
  --success: #22c55e;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  padding: 56px 16px;
}

.container {
  max-width: 960px;
  margin: 0 auto;
}

/* ── Header ──────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 48px;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

header p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ── Toggle ──────────────────────────────────────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.toggle-label-text {
  font-size: 0.82rem;
  color: var(--muted);
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: background 0.2s;
  cursor: pointer;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent-dim);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--accent);
}

/* ── Section label ───────────────────────────────────────────── */
.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

/* ── App grid ────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* ── App card ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.15s;
}

a.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card.inactive {
  opacity: 0.45;
  cursor: default;
}

.card-icon { font-size: 2rem; }

.card-favicon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.card-desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: fit-content;
  margin-top: 4px;
}

.badge-live {
  background: var(--accent-dim);
  color: var(--accent);
}

.badge-soon {
  background: rgba(100, 116, 139, 0.12);
  color: var(--muted);
}

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 360px;
  text-align: center;
}

.modal-icon { font-size: 2.2rem; margin-bottom: 12px; }
.modal-box h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.modal-box p { color: var(--muted); font-size: 0.85rem; margin-bottom: 24px; }

.modal-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 10px;
  outline: none;
  transition: border-color 0.2s;
  text-align: left;
}
.modal-input:focus { border-color: var(--accent); }

.modal-error {
  color: #f87171;
  font-size: 0.8rem;
  min-height: 1.2em;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  padding: 11px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  width: 100%;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); opacity: 1; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--success);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 200;
}
.toast.show { opacity: 1; }
