:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --card-bg: #ffffff;
  --text: #1a1d21;
  --muted: #5b6270;
  --border: #e2e4e8;
  --accent: #2f6fed;
  --error-bg: #fdeeee;
  --error-text: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --card-bg: #1d2025;
    --text: #eef0f3;
    --muted: #9aa1ac;
    --border: #2c3036;
    --error-bg: #3a1f1f;
    --error-text: #ff8a80;
  }
}

* { box-sizing: border-box; }

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

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-card h1 { margin: 0 0 4px; font-size: 1.3rem; }
.auth-card label { font-size: 0.85rem; margin-top: 8px; }
.auth-card input {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}
.auth-card button {
  margin-top: 16px;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  cursor: pointer;
}

.muted { color: var(--muted); }
.error {
  background: var(--error-bg);
  color: var(--error-text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.app-shell { min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 600; margin-right: auto; }
.topbar select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.link-button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
}

.content { padding: 24px; max-width: 960px; margin: 0 auto; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 16px 0 32px;
}
.module-card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  position: relative;
}
.module-card h3 { margin: 0 0 8px; font-size: 1rem; }
.module-card p { margin: 0; font-size: 0.85rem; color: var(--muted); }
.phase-tag {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

.stub-box {
  background: var(--card-bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 20px;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.audit-table th, .audit-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.audit-table th { color: var(--muted); font-weight: 600; }
