/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --color-bg:         #0f1117;
  --color-surface:    #1a1d27;
  --color-border:     #2a2d3a;
  --color-text:       #e8eaf0;
  --color-muted:      #8b90a0;
  --color-accent:     #6c8fff;
  --color-accent-dim: #3a4f99;
  --color-danger:     #ff6b6b;
  --color-success:    #4caf82;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-sans: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100svh;
}

/* ── Typography ────────────────────────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1rem;    font-weight: 600; }
p  { color: var(--color-muted); }

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

.container {
  width: 100%;
  max-width: 860px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* ── Components ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}
.btn-primary:hover { opacity: 0.88; }

.btn-ghost {
  background: transparent;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover { color: var(--color-text); border-color: var(--color-muted); }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { opacity: 0.88; }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s;
  outline: none;
}
.input:focus { border-color: var(--color-accent); }
.input::placeholder { color: var(--color-muted); }

.label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--color-muted);
}

.field { display: flex; flex-direction: column; gap: 0.25rem; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--color-accent-dim);
  color: var(--color-accent);
}

/* ── Toast notifications ───────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 999;
}

.toast {
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slide-in 0.2s ease;
  max-width: 320px;
}
.toast.success { background: var(--color-success); color: #fff; }
.toast.error   { background: var(--color-danger);  color: #fff; }
.toast.info    { background: var(--color-surface);  color: var(--color-text); border: 1px solid var(--color-border); }

@keyframes slide-in {
  from { opacity: 0; transform: translateX(1rem); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Nav ───────────────────────────────────────────────────────────────────── */
nav {
  border-bottom: 1px solid var(--color-border);
  padding: 0.85rem 0;
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
}

/* ── Install banner ────────────────────────────────────────────────────────── */
#install-banner {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.65rem 0;
  text-align: center;
  font-size: 0.88rem;
  display: none;
}
#install-banner.visible { display: block; }
#install-banner p { color: var(--color-muted); display: inline; margin-right: 0.75rem; }

/* ── Page transitions ──────────────────────────────────────────────────────── */
#page {
  flex: 1;
  padding-block: 2rem;
}
.page-enter { animation: fade-in 0.18s ease; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.stack   { display: flex; flex-direction: column; }
.stack-sm  { gap: 0.5rem; }
.stack-md  { gap: 1rem; }
.stack-lg  { gap: 1.5rem; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.text-center { text-align: center; }
.text-muted  { color: var(--color-muted); font-size: 0.9rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 2rem; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  h1 { font-size: 1.4rem; }
  .card { padding: 1.1rem; }
  #toast-container { bottom: 1rem; right: 1rem; left: 1rem; }
  .toast { max-width: 100%; }
}

/* ── Reduced motion ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
