:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --border: #2d3a4f;
  --text: #e7edf7;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 10px;
  --font: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

#app { min-height: 100vh; }

/* ── Auth ───────────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.auth-card h1 {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
  font-weight: 600;
}

/* ── Form fields ────────────────────────────────────────────────────────── */
.field { margin-bottom: 1rem; }

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

.field input,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.field textarea {
  min-height: 80px;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-primary  { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--border); color: var(--text); margin-top: 0.5rem; }
.btn-secondary:hover { background: #3a4d66; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost  { background: transparent; color: var(--muted); border: 1px solid var(--border); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Utility text ───────────────────────────────────────────────────────── */
.hint    { font-size: 0.8rem;  color: var(--muted); margin-top: 0.75rem; }
.error   { color: var(--danger); font-size: 0.85rem; margin-top: 0.5rem; }
.success { color: var(--ok);    font-size: 0.85rem; margin-top: 0.5rem; }
.mono    { font-family: ui-monospace, monospace; font-size: 0.75rem; word-break: break-all; max-height: 200px; overflow: auto; }

/* ── App layout ─────────────────────────────────────────────────────────── */
.layout { display: flex; flex-direction: column; min-height: 100vh; }

.nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.nav .brand { font-weight: 700; margin-right: auto; letter-spacing: -0.02em; }

.nav button {
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}

.nav button:hover,
.nav button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

main.page {
  flex: 1;
  padding: 1.5rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.page h2 { margin: 0 0 1rem; font-size: 1.35rem; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* ── File list ──────────────────────────────────────────────────────────── */
.file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: color 0.15s;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { color: var(--accent); }

/* ── Activity log ───────────────────────────────────────────────────────── */
.activity-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-item span { color: var(--muted); font-size: 0.8rem; }

/* ── Step marker ────────────────────────────────────────────────────────── */
.step {
  margin: 1rem 0 0.5rem;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
  font-size: 0.95rem;
}

/* ── Preview iframe ─────────────────────────────────────────────────────── */
.preview-frame {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
  margin-top: 1rem;
}

/* ── QR / signup ────────────────────────────────────────────────────────── */
.signup-qr-card  { max-width: 420px; text-align: center; }
.signup-qr-steps { text-align: left; line-height: 1.55; }
.signup-qr-wrap  { display: flex; justify-content: center; margin: 1.25rem 0; }
.signup-qr-img   { display: block; background: #fff; padding: 12px; border-radius: 12px; box-sizing: content-box; }

/* ── Reset-done badge ───────────────────────────────────────────────────── */
.reset-done-badge {
  width: 88px;
  height: 88px;
  margin: 0.5rem auto 1rem;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.2);
  border: 2px solid var(--ok);
  color: var(--ok);
  font-size: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ── Upload mode toggle cards ───────────────────────────────────────────── */
.mode-toggle { display: flex; gap: 1rem; margin: 0.75rem 0 1.25rem; flex-wrap: wrap; }

.mode-btn {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.mode-btn span  { font-weight: 600; font-size: 0.95rem; }
.mode-btn small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.2s ease;
  margin-top: 0;
  display: block;
}
.mode-btn:hover small,
.mode-active small {
  max-height: 120px;
  opacity: 1;
  margin-top: 0.4rem;
}
.mode-btn:hover { border-color: var(--accent); }
.mode-active    { border-color: var(--accent); background: rgba(59, 130, 246, 0.08); }

/* ── File mode badges ───────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  vertical-align: middle;
}
.badge-plain { background: rgba(234, 179, 8, 0.15); color: #eab308; border: 1px solid rgba(234, 179, 8, 0.3); }
.badge-enc   { background: rgba(59, 130, 246, 0.15); color: var(--accent); border: 1px solid rgba(59, 130, 246, 0.3); }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
