:root {
  --bg: #f7f8f9;
  --bg2: #eef0f3;
  --surface: #ffffff;
  --border: rgba(0,0,0,0.08);
  --primary: #1b2d5e;
  --primary-dim: #142248;
  --text: #111218;
  --muted: #6b6f80;
  --radius: 14px;
  --font-head: 'Bahnschrift', 'DIN Alternate', 'Franklin Gothic Medium', 'Arial Narrow', sans-serif;
  --font-body: 'Bahnschrift', 'DIN Alternate', 'Franklin Gothic Medium', 'Arial Narrow', sans-serif;

  /* Hub-Farben */
  --hub-growhub:  #059669;
  --hub-teamhub:  #6366f1;
  --hub-taxhub:   #0891b2;
  --hub-innohub:  #7c3aed;
  --hub-starthub: #d97706;
  --hub-akademie: #dc2626;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  padding-top: 96px;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

.container { position: relative; z-index: 1; padding: 1.5rem 2.5rem 2.5rem; }
h1, h2, h3 { font-family: var(--font-head); margin: 0 0 .6rem 0; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.muted { color: var(--muted); font-size: .92rem; }
.small { font-size: .82rem; }
.mt-1 { margin-top: .8rem; }
.hidden { display: none !important; }

body > h1,
body > .card,
body > .grid,
body > .stat-grid,
body > section,
body > #nav {
  position: relative;
  z-index: 1;
  margin-left: 2.5rem;
  margin-right: 2.5rem;
}
body > h1 { display: none; }

/* ───────────── NAV ───────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 2.5rem;
  background: rgba(27,45,94,.96);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo-text {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.logo-text span { color: #60a5fa; }
.nav__links { display:flex; flex-wrap:wrap; gap:.35rem; list-style:none; }
.nav__links a {
  display: inline-block;
  text-decoration: none;
  color: rgba(255,255,255,.65);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding: .3rem .7rem;
  font-size: .78rem;
  background: rgba(255,255,255,.06);
  transition: .15s;
  white-space: nowrap;
}
.nav__links a:hover { color: #fff; border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.12); }
.nav__links a.active {
  background: #60a5fa;
  color: #fff;
  border-color: #60a5fa;
}
.nav__links a.nav__logout {
  background: transparent;
  border-color: rgba(220,70,90,.5);
  color: #f87171;
}
.nav__links a.nav__logout:hover { background: #c4324c; color: #fff; border-color: #c4324c; }

/* Hub nav pills with color */
.nav__links a[data-hub="growhub"].active  { background: var(--hub-growhub);  border-color: var(--hub-growhub); }
.nav__links a[data-hub="teamhub"].active  { background: var(--hub-teamhub);  border-color: var(--hub-teamhub); }
.nav__links a[data-hub="taxhub"].active   { background: var(--hub-taxhub);   border-color: var(--hub-taxhub); }
.nav__links a[data-hub="innohub"].active  { background: var(--hub-innohub);  border-color: var(--hub-innohub); }
.nav__links a[data-hub="starthub"].active { background: var(--hub-starthub); border-color: var(--hub-starthub); }
.nav__links a[data-hub="akademie"].active { background: var(--hub-akademie); border-color: var(--hub-akademie); }

/* ───────────── HERO ───────────── */
.page-hero {
  position: relative;
  z-index: 1;
  margin: .7rem 2.5rem 1rem;
  padding: 1.4rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(27,45,94,.12), rgba(27,45,94,.03));
}
.page-hero__kicker {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .7rem;
  color: var(--primary);
  margin-bottom: .45rem;
}
.page-hero__title { margin: 0; font-size: clamp(1.35rem, 2.4vw, 2rem); }
.page-hero__sub { margin-top: .35rem; color: var(--muted); font-size: .92rem; }

body[data-page="dashboard"] .page-hero { background: linear-gradient(135deg, rgba(27,45,94,.18), rgba(27,45,94,.04)); }
body[data-page="login"]     .page-hero { background: linear-gradient(135deg, rgba(27,45,94,.18), rgba(27,45,94,.06)); }
body[data-page="users"]     .page-hero { background: linear-gradient(135deg, rgba(65,120,255,.16), rgba(65,120,255,.04)); }
body[data-page="growhub"]   .page-hero { background: linear-gradient(135deg, rgba(5,150,105,.18), rgba(5,150,105,.04)); }
body[data-page="teamhub"]   .page-hero { background: linear-gradient(135deg, rgba(99,102,241,.18), rgba(99,102,241,.04)); }
body[data-page="taxhub"]    .page-hero { background: linear-gradient(135deg, rgba(8,145,178,.18), rgba(8,145,178,.04)); }
body[data-page="innohub"]   .page-hero { background: linear-gradient(135deg, rgba(124,58,237,.18), rgba(124,58,237,.04)); }
body[data-page="starthub"]  .page-hero { background: linear-gradient(135deg, rgba(217,119,6,.18), rgba(217,119,6,.04)); }
body[data-page="akademie"]  .page-hero { background: linear-gradient(135deg, rgba(220,38,38,.18), rgba(220,38,38,.04)); }
body[data-page="settings"]  .page-hero { background: linear-gradient(135deg, rgba(90,90,110,.12), rgba(90,90,110,.03)); }
body[data-page="audit"]     .page-hero { background: linear-gradient(135deg, rgba(90,90,110,.12), rgba(90,90,110,.03)); }

/* ───────────── CARDS ───────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: .9rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.04);
}
.card h3 { margin-bottom: .5rem; }
.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  margin-bottom: .8rem;
  flex-wrap: wrap;
}
.card__header h3 { margin: 0; font-size: 1.05rem; }
.card__tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.grid { display:grid; grid-template-columns: repeat(auto-fit,minmax(340px,1fr)); gap: .9rem; }
.grid--2 { grid-template-columns: repeat(auto-fit,minmax(420px,1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); }
.row { display:flex; gap:.55rem; flex-wrap:wrap; align-items: center; }
.row > * { flex:1; min-width: 140px; }

/* ───────────── STAT-CARDS ───────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .8rem;
  margin-bottom: 1rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.04);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.stat-card__label {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .68rem;
  color: var(--muted);
  font-weight: 700;
}
.stat-card__value {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--primary);
}
.stat-card__sub { font-size: .75rem; color: var(--muted); }
.stat-card--growhub  { border-left-color: var(--hub-growhub);  }
.stat-card--growhub  .stat-card__value { color: var(--hub-growhub); }
.stat-card--teamhub  { border-left-color: var(--hub-teamhub);  }
.stat-card--teamhub  .stat-card__value { color: var(--hub-teamhub); }
.stat-card--taxhub   { border-left-color: var(--hub-taxhub);   }
.stat-card--taxhub   .stat-card__value { color: var(--hub-taxhub); }
.stat-card--innohub  { border-left-color: var(--hub-innohub);  }
.stat-card--innohub  .stat-card__value { color: var(--hub-innohub); }
.stat-card--starthub { border-left-color: var(--hub-starthub); }
.stat-card--starthub .stat-card__value { color: var(--hub-starthub); }
.stat-card--akademie { border-left-color: var(--hub-akademie); }
.stat-card--akademie .stat-card__value { color: var(--hub-akademie); }

/* ───────────── HUB CARD (Dashboard Overview) ───────────── */
.hub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  transition: .18s;
  box-shadow: 0 4px 16px rgba(0,0,0,.04);
  position: relative;
  overflow: hidden;
}
.hub-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--hub-color, var(--primary));
}
.hub-card:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0,0,0,.10); }
.hub-card__icon { font-size: 1.6rem; line-height: 1; }
.hub-card__name {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -.02em;
}
.hub-card__name span { color: var(--hub-color, var(--primary)); }
.hub-card__desc { font-size: .83rem; color: var(--muted); line-height: 1.45; }
.hub-card__meta { font-size: .75rem; color: var(--muted); margin-top: auto; padding-top: .5rem; }

/* ───────────── MODULE TOGGLES (User permissions) ───────────── */
.module-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .5rem;
}
.module-toggle {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg2);
  cursor: pointer;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
  transition: .15s;
}
.module-toggle:hover { border-color: var(--hub-color); color: var(--hub-color); }
.module-toggle.active {
  background: var(--hub-color);
  border-color: var(--hub-color);
  color: #fff;
}
.module-toggle input[type="checkbox"] { display: none; }
.module-toggle .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
  transition: .15s;
}
.module-toggle.active .dot { opacity: 1; }

/* ───────────── MODULE BADGES (Table display) ───────────── */
.module-badges { display: flex; flex-wrap: wrap; gap: .25rem; }
.mbadge {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  padding: .1rem .45rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.mbadge--growhub  { background: rgba(5,150,105,.12);  color: #065f46; border-color: rgba(5,150,105,.3); }
.mbadge--teamhub  { background: rgba(99,102,241,.12); color: #3730a3; border-color: rgba(99,102,241,.3); }
.mbadge--taxhub   { background: rgba(8,145,178,.12);  color: #0e4f61; border-color: rgba(8,145,178,.3); }
.mbadge--innohub  { background: rgba(124,58,237,.12); color: #5b21b6; border-color: rgba(124,58,237,.3); }
.mbadge--starthub { background: rgba(217,119,6,.12);  color: #92400e; border-color: rgba(217,119,6,.3); }
.mbadge--akademie { background: rgba(220,38,38,.12);  color: #991b1b; border-color: rgba(220,38,38,.3); }

/* ───────────── BADGES ───────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  border: 1px solid transparent;
}
.badge--green { background: #e7f7f3; color: #007561; border-color: #00a08c33; }
.badge--red   { background: #fde8ec; color: #b3263c; border-color: #dc465a33; }
.badge--amber { background: #fdf2e3; color: #8e5b18; border-color: #b9781e33; }
.badge--blue  { background: #e4f6fa; color: #0b5e74; border-color: #0e749033; }
.badge--gray  { background: #f0f0ec; color: #6b6f80; border-color: rgba(0,0,0,.08); }

/* ───────────── INPUTS / BUTTONS ───────────── */
input, select, button, textarea {
  padding: .65rem .75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font: inherit;
}
input:disabled, select:disabled { background: #f4f4f1; color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,45,94,.12);
}
textarea { width: 100%; min-height: 95px; }
button {
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}
button:hover { background: var(--primary-dim); border-color: var(--primary-dim); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: .35rem .8rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: rgba(27,45,94,.35); }
.btn-sm {
  padding: .3rem .55rem;
  font-size: .8rem;
  border-radius: 8px;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-sm:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-danger {
  background: #dc2626;
  border-color: #dc2626;
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* ───────────── TABLES ───────────── */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: .88rem; }
th { font-weight: 700; color: var(--text); background: #fafafa; }
tbody tr:hover { background: #f6f8fc; }
tbody tr:last-child td { border-bottom: none; }
code { background: #f2f4f8; padding: 2px 6px; border-radius: 8px; font-size: .82rem; }
a { color: var(--primary); text-decoration: none; }

/* Page-specific card accents */
body[data-page="dashboard"] .card { border-left: 4px solid var(--primary); }
body[data-page="users"]     .card { border-left: 4px solid #4178ff; }
body[data-page="growhub"]   .card { border-left: 4px solid var(--hub-growhub); }
body[data-page="teamhub"]   .card { border-left: 4px solid var(--hub-teamhub); }
body[data-page="taxhub"]    .card { border-left: 4px solid var(--hub-taxhub); }
body[data-page="innohub"]   .card { border-left: 4px solid var(--hub-innohub); }
body[data-page="starthub"]  .card { border-left: 4px solid var(--hub-starthub); }
body[data-page="akademie"]  .card { border-left: 4px solid var(--hub-akademie); }
body[data-page="settings"]  .card { border-left: 4px solid #6b6f80; }
body[data-page="audit"]     .card { border-left: 4px solid #6b6f80; }

body[data-page="users"]     th { background: #eef3ff; }
body[data-page="growhub"]   th { background: #ecfdf5; }
body[data-page="teamhub"]   th { background: #eef2ff; }
body[data-page="taxhub"]    th { background: #ecfeff; }
body[data-page="innohub"]   th { background: #f5f3ff; }
body[data-page="starthub"]  th { background: #fffbeb; }
body[data-page="akademie"]  th { background: #fef2f2; }

/* ───────────── LOGIN ───────────── */
body[data-page="login"] .login-shell {
  position: relative;
  z-index: 1;
  margin: 0 2.5rem;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 1rem;
}
body[data-page="login"] .login-shell .card:first-child {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(145deg, #1b2d5e, #142248);
  color: #fff;
}
body[data-page="login"] .login-shell .card:first-child h2 { color: #fff; }
body[data-page="login"] .login-shell .card:first-child p  { color: rgba(255,255,255,.7); }
body[data-page="login"] .login-shell .card:last-child {
  border-left: 4px solid var(--primary);
}

/* ───────────── MODAL ───────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(20,22,32,.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal__box {
  width: 100%;
  max-width: 600px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow: hidden;
  animation: slideUp .22s ease;
}
@keyframes slideUp { from{transform:translateY(15px);opacity:0} to{transform:translateY(0);opacity:1} }
.modal__head {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  color: #fff;
}
.modal__head h3 { margin: 0; font-size: 1.05rem; color: #fff; }
.modal__close {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: none;
  font-size: 1.3rem;
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.modal__close:hover { background: rgba(255,255,255,.25); }
.modal__body { padding: 1.2rem; }
.modal__foot {
  padding: .9rem 1.2rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: .5rem;
  background: var(--bg);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .8rem;
}
.form-grid label {
  display: block;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: .3rem;
}
.form-grid input, .form-grid select { width: 100%; }
.form-full { grid-column: 1 / -1; }

/* Module section in modal */
.module-section {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding-top: .8rem;
  margin-top: .2rem;
}
.module-section__label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: .6rem;
}

/* ───────────── TOAST ───────────── */
#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast-item {
  padding: .7rem 1rem;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
  animation: slideInRight .25s ease;
  pointer-events: auto;
  max-width: 360px;
  border: 1px solid transparent;
}
@keyframes slideInRight { from{transform:translateX(110%);opacity:0} to{transform:translateX(0);opacity:1} }
.toast--ok  { background: #e7f7f3; color: #007561; border-color: #00a08c55; }
.toast--err { background: #fde8ec; color: #b3263c; border-color: #dc465a55; }

/* ───────────── SETTINGS ───────────── */
.settings-grid { display: grid; gap: .7rem; }
.settings-row {
  display: grid;
  grid-template-columns: 140px 1fr 1fr auto;
  gap: .55rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .6rem .8rem;
}
.settings-row__key {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}
.settings-row input { padding: .45rem .65rem; font-size: .88rem; border-radius: 8px; }
.btn-reset {
  padding: .4rem .65rem;
  font-size: .78rem;
  background: var(--bg2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-reset:hover { background: #fde8ec; color: #b3263c; border-color: #dc465a44; }
.settings-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .5rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 0 .8rem;
}
.settings-head span:nth-child(1) { width: 140px; }
.settings-head span:nth-child(2) { flex: 1; }
.settings-head span:nth-child(3) { flex: 1; }
.settings-head span:nth-child(4) { width: 60px; }
.action-bar { display: flex; gap: .6rem; align-items: center; margin-top: 1rem; }

/* ───────────── RESPONSIVE ───────────── */
@media (max-width: 800px) {
  .container { padding: 1rem; }
  .nav { padding: .8rem 1rem; align-items: flex-start; flex-direction: column; }
  body { padding-top: 170px; }
  body > h1, body > .card, body > .grid, body > .stat-grid, body > section, body > #nav,
  .page-hero { margin-left: 1rem; margin-right: 1rem; }
  body[data-page="login"] .login-shell { margin: 0 1rem; grid-template-columns: 1fr; }
  .stat-card__value { font-size: 1.6rem; }
  .settings-row { grid-template-columns: 1fr; }
}
