:root {
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #1a1a1a;
  --bg4: #222222;
  --fg: #e0e0e0;
  --fg2: #b0b0b0;
  --fg3: #888888;
  --accent: #e8a020;
  --accent2: #c07818;
  --accent3: #f0c060;
  --link: #e8a020;
  --border: #333333;
  --red: #cc4444;
  --green: #44cc66;
  --blue: #4488cc;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--fg); line-height: 1.7; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--accent3); text-decoration: underline; }
h1, h2, h3, h4, h5 { color: var(--accent); font-weight: 600; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.7rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; margin-top: 2em; }
h3 { font-size: 1.25rem; margin-top: 1.5em; }
h4 { font-size: 1.05rem; margin-top: 1.2em; color: var(--accent2); }

/* Navigation */
nav#topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(10,10,10,0.95); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 1.5rem; height: 56px; gap: 0;
}
nav#topnav .logo-area { display: flex; align-items: center; gap: 0.7rem; padding-right: 1.5rem; border-right: 1px solid var(--border); margin-right: 1rem; }
nav#topnav .logo-text { font-weight: 700; font-size: 1.05rem; color: var(--accent); white-space: nowrap; }
nav#topnav .nav-links { display: flex; gap: 0; flex-wrap: nowrap; overflow-x: auto; }
nav#topnav .nav-links a {
  padding: 0 0.8rem; height: 56px; display: flex; align-items: center;
  font-size: 0.82rem; color: var(--fg2); white-space: nowrap;
  border-bottom: 2px solid transparent; transition: all 0.2s;
}
nav#topnav .nav-links a:hover, nav#topnav .nav-links a.current { color: var(--accent); border-bottom-color: var(--accent); text-decoration: none; }
nav#topnav .nav-links .nav-user { color: var(--accent3); font-weight: 600; }
nav#topnav .nav-links .nav-logout { color: var(--red); }

/* Sidebar */
#sidebar {
  position: fixed; top: 56px; left: 0; bottom: 0; width: 240px;
  background: var(--bg2); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 1rem 0; z-index: 100;
}
#sidebar .section-label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--fg3); padding: 0.8rem 1.2rem 0.3rem; font-weight: 600;
}
#sidebar a {
  display: block; padding: 0.35rem 1.2rem 0.35rem 1.5rem;
  font-size: 0.82rem; color: var(--fg2); border-left: 2px solid transparent; transition: all 0.15s;
}
#sidebar a:hover { color: var(--accent); background: var(--bg3); border-left-color: var(--accent); text-decoration: none; }
#sidebar a.current { color: var(--accent); border-left-color: var(--accent); background: var(--bg3); font-weight: 600; }

/* Main content */
#main { margin-left: 240px; margin-top: 56px; padding: 2rem 2.5rem 4rem; max-width: 900px; }
.section { margin-bottom: 3rem; }
.section p { margin-bottom: 1rem; color: var(--fg2); }
.section > p:first-of-type { font-size: 1.05rem; color: var(--fg); }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: 0.85rem; }
th { background: var(--bg3); color: var(--accent); font-weight: 600; text-align: left; padding: 0.6rem 0.8rem; border-bottom: 2px solid var(--border); }
td { padding: 0.5rem 0.8rem; border-bottom: 1px solid var(--border); color: var(--fg2); vertical-align: top; }
tr:hover td { background: var(--bg3); }

/* Callout boxes */
.callout { border-radius: 8px; padding: 1.2rem 1.5rem; margin: 1.5rem 0; }
.callout.gold { background: rgba(232,160,32,0.08); border-left: 4px solid var(--accent); }
.callout.red { background: rgba(204,68,68,0.08); border-left: 4px solid var(--red); }
.callout.green { background: rgba(68,204,102,0.08); border-left: 4px solid var(--green); }
.callout.blue { background: rgba(68,136,204,0.08); border-left: 4px solid var(--blue); }
.callout .callout-title { font-weight: 700; margin-bottom: 0.4rem; font-size: 0.95rem; }
.callout.gold .callout-title { color: var(--accent); }
.callout.red .callout-title { color: var(--red); }
.callout.green .callout-title { color: var(--green); }
.callout.blue .callout-title { color: var(--blue); }
.callout p { margin-bottom: 0.5rem; }

/* Details/summary */
details { margin: 0.5rem 0; }
details summary {
  cursor: pointer; padding: 0.5rem 0.8rem; border-radius: 4px;
  font-weight: 600; color: var(--accent2); font-size: 0.9rem;
  list-style: none; display: flex; align-items: center; gap: 0.5rem;
}
details summary::before { content: '\25B6'; font-size: 0.7rem; transition: transform 0.2s; display: inline-block; }
details[open] summary::before { transform: rotate(90deg); }
details summary:hover { background: var(--bg3); }
details .detail-content { padding: 0.5rem 0.8rem 0.5rem 1.5rem; }

/* Timeline */
.timeline { position: relative; padding-left: 2rem; margin: 1.5rem 0; }
.timeline::before { content: ''; position: absolute; left: 0.5rem; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline .phase { position: relative; margin-bottom: 2rem; }
.timeline .phase::before { content: ''; position: absolute; left: -1.65rem; top: 0.3rem; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.timeline .phase h4 { margin: 0; color: var(--accent); }
.timeline .phase .time { font-size: 0.8rem; color: var(--fg3); }
.timeline .phase ul { margin: 0.5rem 0 0 0; padding-left: 1.2rem; font-size: 0.88rem; color: var(--fg2); }

/* Schematic */
.schematic { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 1.2rem; font-family: 'Courier New', monospace; font-size: 0.75rem; line-height: 1.4; overflow-x: auto; white-space: pre; color: var(--fg2); margin: 1rem 0; }

/* Buttons */
.btn { display: inline-block; padding: 0.5rem 1.2rem; border-radius: 4px; font-size: 0.88rem; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: var(--bg3); color: var(--fg); transition: all 0.15s; }
.btn:hover { background: var(--bg4); text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent3); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #d55; }
.btn-success { background: var(--green); color: var(--bg); border-color: var(--green); }
.btn-success:hover { background: #5d5; }
.btn-warning { background: #c80; color: #fff; border-color: #c80; }
.btn-small { padding: 0.3rem 0.8rem; font-size: 0.8rem; }

/* Role badges */
.role-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 3px; font-size: 0.75rem; font-weight: 600; }
.role-visitor { background: var(--bg4); color: var(--fg3); }
.role-learner { background: #1a3a1a; color: #6c6; }
.role-technician { background: #1a2a3a; color: #69c; }
.role-senior_technician { background: #2a1a3a; color: #a8c; }
.role-community_lead { background: #3a3a1a; color: #cc6; }
.role-moderator { background: #3a2a1a; color: #c96; }
.role-admin { background: #3a1a1a; color: #c66; }

/* Member levels */
.member-level { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.member-level .level { flex: 1; min-width: 120px; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; text-align: center; }
.member-level .level .level-name { font-weight: 700; color: var(--accent); font-size: 0.95rem; }
.member-level .level .level-desc { font-size: 0.78rem; color: var(--fg3); margin-top: 0.3rem; }

/* Auth forms */
.auth-container { max-width: 480px; margin: 2rem auto; }
.auth-note { font-size: 0.9rem; color: var(--fg2); margin-bottom: 1.5rem; }
.auth-alt { margin-top: 1.5rem; font-size: 0.9rem; color: var(--fg3); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.9rem; color: var(--fg2); margin-bottom: 0.3rem; font-weight: 600; }
.form-group input, .form-group select { width: 100%; padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: 4px; background: var(--bg3); color: var(--fg); font-size: 0.9rem; }
.form-group input:focus, .form-group select:focus { border-color: var(--accent); outline: none; }
.form-group small { display: block; margin-top: 0.2rem; font-size: 0.78rem; color: var(--fg3); }

/* Profile */
.profile-info { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 1.2rem; margin-bottom: 2rem; }
.profile-row { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.profile-row:last-child { border-bottom: none; }
.profile-label { color: var(--fg3); font-size: 0.85rem; }
.profile-value { color: var(--fg); font-weight: 600; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.stat-card { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; text-align: center; }
.stat-card .stat-num { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-card .stat-label { font-size: 0.75rem; color: var(--fg3); text-transform: uppercase; letter-spacing: 0.08em; }

/* Flashes */
.flashes { margin: 1rem 0; }
.flash { padding: 0.8rem 1rem; border-radius: 6px; margin-bottom: 0.5rem; font-size: 0.9rem; }
.flash-success { background: rgba(68,204,102,0.1); border: 1px solid var(--green); color: var(--green); }
.flash-error { background: rgba(204,68,68,0.1); border: 1px solid var(--red); color: var(--red); }
.flash-info { background: rgba(68,136,204,0.1); border: 1px solid var(--blue); color: var(--blue); }

/* Hero */
.hero { background: linear-gradient(135deg, #1a1200 0%, #0a0a0a 60%); border: 1px solid var(--border); border-radius: 12px; padding: 2.5rem; margin-bottom: 2rem; position: relative; }
.hero h1 { margin-bottom: 0.5rem; }
.hero .tagline { font-size: 1.1rem; color: var(--fg2); }
.hero .tagline em { color: var(--accent); font-style: normal; }
.hero .metrics { display: flex; gap: 2rem; margin-top: 1.5rem; flex-wrap: wrap; }
.hero .metric { text-align: center; }
.hero .metric .num { font-size: 2rem; font-weight: 700; color: var(--accent); }
.hero .metric .label { font-size: 0.75rem; color: var(--fg3); text-transform: uppercase; letter-spacing: 0.08em; }

/* Footer */
footer { margin-top: 4rem; padding: 2rem 0; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--fg3); text-align: center; }

/* Responsive */
@media (max-width: 900px) {
  #sidebar { display: none; }
  #main { margin-left: 0; padding: 1.5rem 1rem; }
  nav#topnav .nav-links { overflow-x: auto; }
  .hero { padding: 1.5rem; }
  .hero h1 { font-size: 1.6rem; }
  .hero .metrics { flex-direction: column; gap: 0.8rem; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}