:root {
  --bg: #070b18;
  --bg-panel: #0d1428;
  --bg-panel2: #111a33;
  --border: #1e2a4d;
  --text: #dbe4ff;
  --muted: #8391b5;
  --accent: #4f7cff;
  --accent2: #9d5cff;
  --cyan: #38d6f5;
  --green: #3ddc85;
  --orange: #ffab49;
  --red: #ff5c72;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 80% -10%, rgba(79,124,255,.12), transparent),
                    radial-gradient(900px 500px at -10% 110%, rgba(157,92,255,.10), transparent);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}
a { color: var(--cyan); text-decoration: none; }
h1 { font-size: 1.5rem; margin-bottom: 16px; }
h2 { font-size: 1.05rem; margin-bottom: 10px; color: var(--text); }
.muted { color: var(--muted); font-size: .85rem; }
.inline { display: inline; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px; background: rgba(13,20,40,.92);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50; backdrop-filter: blur(8px);
}
.logo { font-size: 1.25rem; font-weight: 700; color: var(--text); letter-spacing: .5px; }
.logo span { color: var(--accent); }
.resources { display: flex; gap: 16px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.resources::-webkit-scrollbar { display: none; }
.res { display: flex; align-items: center; gap: 7px; white-space: nowrap; font-size: .9rem; }
.res b { font-weight: 600; line-height: 1.1; }
.res-txt { display: flex; flex-direction: column; }
.res-txt small { color: var(--muted); font-size: .6rem; text-transform: uppercase; letter-spacing: .5px; line-height: 1.2; }
.ri { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ri-credits { background: var(--orange); }
.ri-compute { background: var(--accent); }
.ri-data { background: var(--cyan); }
.ri-research { background: var(--accent2); }
.ri-reputation { background: var(--green); }
.ri-chips { background: #ffd84f; }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  background: none; border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: .95rem;
}
.icon-btn:hover { border-color: var(--accent); }

/* Shell / Sidebar */
.shell { display: flex; min-height: calc(100vh - 53px); }
.sidebar {
  width: 210px; flex-shrink: 0; padding: 16px 10px;
  border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px;
}
.sidebar a {
  color: var(--muted); padding: 9px 14px; border-radius: 8px; font-size: .95rem;
}
.sidebar a:hover { color: var(--text); background: var(--bg-panel); }
.sidebar a.active { color: var(--text); background: linear-gradient(90deg, rgba(79,124,255,.25), rgba(157,92,255,.12)); border-left: 3px solid var(--accent); }
.sidebar .admin-link { color: var(--orange); margin-top: 8px; }
.sidebar-footer { margin-top: auto; padding: 14px; border-top: 1px solid var(--border); font-size: .85rem; }
.company-name { font-weight: 600; margin-bottom: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); }

.content { flex: 1; padding: 22px; max-width: 1500px; }
.content-plain { padding: 22px; }

/* Cards / Grid */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  background: linear-gradient(160deg, var(--bg-panel), var(--bg-panel2));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.card h2 { border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 12px; }
.card-banner {
  width: calc(100% + 32px); margin: -16px -16px 12px; display: block;
  border-radius: var(--radius) var(--radius) 0 0; object-fit: cover; height: 120px;
}
.page-banner {
  width: 100%; height: 140px; object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 16px; display: block;
}
.card .sub { font-size: .85rem; color: var(--muted); }

/* Buttons */
.btn {
  display: inline-block; border: none; cursor: pointer; border-radius: 8px;
  padding: 9px 16px; font-size: .92rem; font-weight: 600; color: #fff;
  background: var(--bg-panel2); border: 1px solid var(--border); min-height: 40px;
}
.btn:hover { filter: brightness(1.15); }
.btn-primary { background: linear-gradient(90deg, var(--accent), var(--accent2)); border: none; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-sm { padding: 5px 12px; min-height: 32px; font-size: .85rem; }
.btn-block { display: block; width: 100%; }

/* Forms */
label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 10px 12px; font-size: .95rem; min-height: 42px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type=range] { min-height: auto; padding: 0; }
.form-row { display: flex; gap: 12px; }
.form-row > div { flex: 1; }

/* Tables -> mobile cards */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 9px 10px; border-bottom: 1px solid rgba(30,42,77,.5); }
tr.highlight td { background: rgba(79,124,255,.12); }
.num { text-align: right; }

/* Progress */
.progress { background: var(--bg); border-radius: 6px; height: 10px; overflow: hidden; border: 1px solid var(--border); }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--cyan)); transition: width 1s linear; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .75rem; border: 1px solid var(--border); color: var(--muted); }
.badge-Einfach { color: var(--muted); }
.badge-Fortgeschritten { color: var(--cyan); border-color: var(--cyan); }
.badge-Selten { color: var(--accent); border-color: var(--accent); }
.badge-Episch { color: var(--accent2); border-color: var(--accent2); }
.badge-Legend\E4r, .badge-Legendaer { color: var(--orange); border-color: var(--orange); }
.badge-ok { color: var(--green); border-color: var(--green); }
.badge-warn { color: var(--orange); border-color: var(--orange); }
.badge-err { color: var(--red); border-color: var(--red); }

/* Blueprint-Stufen: grün / blau / lila */
.badge-tier-standard { color: #4ade80; border-color: #4ade80; background: rgba(74, 222, 128, .08); }
.badge-tier-selten { color: #60a5fa; border-color: #60a5fa; background: rgba(96, 165, 250, .08); }
.badge-tier-episch { color: #c084fc; border-color: #c084fc; background: rgba(192, 132, 252, .12); box-shadow: 0 0 8px rgba(192, 132, 252, .35); }
.card-tier-standard { border-color: rgba(74, 222, 128, .55); }
.card-tier-selten { border-color: rgba(96, 165, 250, .55); }
.card-tier-episch { border-color: rgba(192, 132, 252, .65); box-shadow: 0 0 12px rgba(192, 132, 252, .18); }

/* Tabs */
.tabs {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px;
  scrollbar-width: thin;
}
.tab-btn {
  background: rgba(20,27,61,.6); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 7px 14px; cursor: pointer; white-space: nowrap; font-size: .88rem;
}
.tab-btn:hover { border-color: var(--accent); color: var(--text); }
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab-count {
  background: rgba(255,255,255,.18); border-radius: 999px; padding: 1px 7px;
  font-size: .75rem; margin-left: 4px;
}
.tab-btn:not(.active) .tab-count { background: rgba(79,124,255,.2); color: var(--accent); }

/* Flash */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: .92rem; }
.flash-success { background: rgba(61,220,133,.12); border: 1px solid var(--green); color: var(--green); }
.flash-error { background: rgba(255,92,114,.12); border: 1px solid var(--red); color: var(--red); }
.flash-warning { background: rgba(255,184,77,.12); border: 1px solid var(--orange); color: var(--orange); }

/* Timer */
.timer { font-variant-numeric: tabular-nums; color: var(--cyan); font-weight: 600; }

/* Stat rows */
.stat-list { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.stat-list .row { display: flex; justify-content: space-between; gap: 10px; }
.stat-list .row span:first-child { color: var(--muted); }

/* Auth */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-logo { font-size: 2.2rem; font-weight: 700; }
.auth-logo span { color: var(--accent); }
.auth-pitch { color: var(--muted); font-size: .92rem; margin-top: 8px; }
.auth-card { background: linear-gradient(160deg, var(--bg-panel), var(--bg-panel2)); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: .88rem; }
.auth-legal { text-align: center; color: var(--muted); font-size: .75rem; margin-top: 18px; }
.social-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; margin: 16px 0 4px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Bottom nav (mobile) */
.bottom-nav { display: none; }
.mobile-menu { display: none; }
.pwa-bar {
  position: fixed; bottom: 70px; left: 12px; right: 12px; z-index: 90;
  background: var(--bg-panel2); border: 1px solid var(--accent); border-radius: 12px;
  padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-size: .85rem;
}
.pwa-bar[hidden] { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { padding: 14px; padding-bottom: 84px; }
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .resources {
    order: 3; width: 100%;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px;
    overflow: visible;
  }
  .res { font-size: .82rem; }
  .res-txt small { font-size: .58rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: rgba(13,20,40,.97); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button {
    flex: 1; text-align: center; color: var(--muted); font-size: .8rem; padding: 10px 2px;
    background: none; border: none; cursor: pointer; border-radius: 8px;
  }
  .bottom-nav a.active { color: var(--accent); }
  .mobile-menu {
    position: fixed; bottom: 58px; left: 12px; right: 12px; z-index: 99;
    background: var(--bg-panel2); border: 1px solid var(--border); border-radius: 12px;
    padding: 10px; flex-direction: column; gap: 4px;
  }
  .mobile-menu.open { display: flex; }
  .mobile-menu a, .mobile-menu button {
    color: var(--text); padding: 12px; border-radius: 8px; background: none; border: none;
    text-align: left; font-size: .95rem; cursor: pointer; width: 100%;
  }
  .mobile-menu a:active, .mobile-menu button:active { background: var(--bg-panel); }
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; padding: 8px; }
  table.responsive td { display: flex; justify-content: space-between; border: none; padding: 6px 8px; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); margin-right: 12px; }
}
