:root {
  --bg: #0b1020;
  --bg-alt: #121a33;
  --card: #161f3d;
  --accent: #5eead4;
  --accent-2: #818cf8;
  --text: #e6e9f5;
  --muted: #9aa3c4;
  --border: #263159;
  --danger: #fca5a5;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6;
}
h1 { font-size: 1.7rem; font-weight: 800; margin-bottom: 20px; }
h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; }
a { color: var(--accent); }
.muted { color: var(--muted); }

.site-header { position: sticky; top: 0; z-index: 100; background: rgba(11,16,32,0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.site-header nav { max-width: 1000px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; flex-wrap: wrap; gap: 10px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.logo-mark { width: 28px; height: 28px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: flex; align-items: center; justify-content: center; font-size: 0.9rem; color: #0b1020; font-weight: 800; }
.nav-links { display: flex; gap: 18px; list-style: none; flex-wrap: wrap; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 0.88rem; }
.nav-links a:hover { color: var(--text); }

.site-main { max-width: 1000px; margin: 0 auto; padding: 40px 24px 80px; }
.site-footer { text-align: center; padding: 24px; color: var(--muted); font-size: 0.8rem; border-top: 1px solid var(--border); }

.auth-card { max-width: 400px; margin: 40px auto; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 32px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.auth-card input { padding: 11px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-alt); color: var(--text); font-size: 0.95rem; outline: none; }
.auth-card input:focus { border-color: var(--accent); }
.form-error { color: var(--danger); font-size: 0.88rem; margin-top: 10px; }
.fine-print { color: var(--muted); font-size: 0.8rem; margin-top: 18px; }
.fine-print code { background: var(--bg-alt); padding: 2px 6px; border-radius: 4px; }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 22px; margin-bottom: 24px; }
.stacked-form { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
.stacked-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.stacked-form input, .stacked-form select, .stacked-form textarea {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-alt); color: var(--text); font-size: 0.92rem; outline: none; font-family: inherit;
}
.stacked-form input:focus, .stacked-form select:focus, .stacked-form textarea:focus { border-color: var(--accent); }

.btn-primary, .btn-secondary, .btn-danger {
  padding: 9px 18px; border-radius: 8px; font-weight: 600; font-size: 0.85rem;
  text-decoration: none; display: inline-block; border: 1px solid transparent; cursor: pointer;
  transition: opacity 0.2s, border-color 0.2s;
}
.btn-primary { background: var(--accent); color: #0b1020; width: fit-content; }
.btn-primary:hover { opacity: 0.88; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(252,165,165,0.4); }
.btn-danger:hover { background: rgba(252,165,165,0.1); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; text-align: center; }
.stat-num { font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.stat-label { color: var(--muted); font-size: 0.8rem; margin-top: 4px; }
.quick-links { display: flex; gap: 12px; flex-wrap: wrap; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
.admin-table th, .admin-table td { padding: 12px 16px; text-align: left; font-size: 0.88rem; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--muted); font-weight: 600; background: var(--bg-alt); }
.admin-table tr:last-child td { border-bottom: none; }

/* Readings preview */
.reading-body { line-height: 1.75; }
.reading-body h2, .reading-body h3, .reading-body h4 { margin: 24px 0 10px; }
.reading-body p { margin-bottom: 14px; }
.reading-body ul { margin: 0 0 14px 22px; }
.reading-body img { max-width: 100%; border-radius: 8px; margin: 14px 0; }
.reading-body table { border-collapse: collapse; width: 100%; margin: 14px 0; }
.reading-body table td { border: 1px solid var(--border); padding: 8px 10px; }
.badge-done { color: var(--accent); font-weight: 600; }

/* Inline simulation embeds within reading text */
.inline-sim { margin: 20px 0; }
.inline-sim iframe { display: block; }
.unit-label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; margin: 10px 0 6px; }
