:root {
  --sos-bg: #0b0f19;
  --sos-panel: #131a2a;
  --sos-panel-2: #0f1524;
  --sos-border: #223049;
  --sos-text: #e6ebf5;
  --sos-muted: #8a97b1;
  --sos-primary: #3b82f6;
  --sos-success: #22c55e;
  --sos-warning: #f59e0b;
}

html, body { height: 100%; }

body {
  background-color: var(--sos-bg);
  color: var(--sos-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.app-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sos-panel-2);
  border-right: 1px solid var(--sos-border);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 56px;
  padding: 0 1rem;
  border-bottom: 1px solid var(--sos-border);
  font-weight: 600;
}

.brand-mark { color: var(--sos-primary); }

.app-nav { padding: 0.5rem; gap: 2px; }

.app-nav .nav-link {
  color: var(--sos-muted);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-nav .nav-link:hover { background: #1a2439; color: var(--sos-text); }
.app-nav .nav-link.active { background: #1e293b; color: #fff; }

.disabled-link { pointer-events: none; opacity: 0.55; }

.soon {
  font-size: 0.6rem;
  text-transform: uppercase;
  background: #22304a;
  color: var(--sos-muted);
  padding: 1px 6px;
  border-radius: 6px;
}

/* Main */
.app-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.app-topbar {
  height: 56px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--sos-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background: var(--sos-panel-2);
}

.topbar-subtitle { color: var(--sos-muted); font-size: 0.85rem; }

.app-content { flex: 1; overflow-y: auto; padding: 1.5rem; }

.app-statusbar {
  height: 30px;
  flex-shrink: 0;
  border-top: 1px solid var(--sos-border);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0 1.25rem;
  background: var(--sos-panel-2);
  font-size: 0.75rem;
  color: var(--sos-muted);
}

/* Cards / panels */
.card { background: var(--sos-panel); border: 1px solid var(--sos-border); }
.card .card-title { font-weight: 600; }

.page-header { margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 600; margin: 0; }
.page-header p { color: var(--sos-muted); margin: 0.25rem 0 0; font-size: 0.9rem; }

.stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-label { color: var(--sos-muted); font-size: 0.8rem; }

.text-muted-2 { color: var(--sos-muted) !important; }

.form-control, .form-select {
  background: var(--sos-panel-2);
  border-color: var(--sos-border);
  color: var(--sos-text);
}
.form-control:focus, .form-select:focus {
  background: var(--sos-panel-2);
  color: var(--sos-text);
  border-color: var(--sos-primary);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.15);
}

.module-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}
.module-row:hover { background: #1a2439; }
.module-index { width: 1.5rem; color: var(--sos-muted); font-size: 0.8rem; }
.module-status { font-size: 0.75rem; color: var(--sos-muted); text-transform: capitalize; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-idle { background: #3a4a66; }
.dot-done { background: var(--sos-success); }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--sos-muted); }

/* Rendered module markdown */
.module-content { line-height: 1.7; }
.module-content h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 1rem; }
.module-content h2 { font-size: 1.2rem; font-weight: 600; margin: 1.75rem 0 0.5rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--sos-border); }
.module-content h3 { font-size: 1.02rem; font-weight: 600; margin: 1.25rem 0 0.4rem; }
.module-content p { margin: 0 0 0.85rem; }
.module-content ul, .module-content ol { margin: 0 0 0.85rem 1.25rem; }
.module-content li { margin-bottom: 0.3rem; }
.module-content table { width: 100%; border-collapse: collapse; margin: 0 0 1rem; }
.module-content th, .module-content td { border: 1px solid var(--sos-border); padding: 0.4rem 0.6rem; text-align: left; }
.module-content code { background: var(--sos-panel-2); padding: 0.1rem 0.35rem; border-radius: 4px; }
.module-content blockquote { border-left: 3px solid var(--sos-border); margin: 0 0 1rem; padding-left: 1rem; color: var(--sos-muted); }
