/* Pfad: /css/main.css */
/* KeyManager Pro — Globales Stylesheet */
/* Design: Behördlich-professionell, Schweizer Designsystem trifft SaaS */

/* Google Fonts werden per <link> in den HTML-Dateien geladen (non-blocking) */

/* ═══════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════ */
:root {
  --navy:       #1A2744;
  --navy-mid:   #2D4A6F;
  --navy-light: #3A5A8A;
  --blue:       #3A7BD5;
  --blue-light: #E8F0FE;
  --green:      #2D6A4F;
  --green-light:#E8F5E9;
  --orange:     #E65100;
  --orange-light:#FFF3E0;
  --red:        #C62828;
  --red-light:  #FFEBEE;
  --bg:         #F4F1EA;
  --card:       #FFFFFF;
  --border:     #EAE6DE;
  --text:       #1A2744;
  --text-muted: #8A8470;
  --text-light: #A09888;
  --gold:       #C9A84C;
  --gold-light: #FDF6EC;
  --black-light:#424242;
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   40px;
  --space-2xl:  64px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,.07);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.1);
  --shadow-xl:  0 20px 60px rgba(0,0,0,.15);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', -apple-system, sans-serif;
  --transition:   all .2s ease;
  /* Akzentfarbe — wird per Theme überschrieben */
  --accent:        #2D6A4F;
  --accent-light:  #E8F5E9;
  --accent-hover:  #245A42;
}

/* ═══════════════════════════════════════════════
   FARBTHEMEN — Akzentfarbe
   ═══════════════════════════════════════════════ */
[data-theme="green"]  { --accent:#2D6A4F; --accent-light:#E8F5E9; --accent-hover:#245A42; }
[data-theme="blue"]   { --accent:#1565C0; --accent-light:#E3F2FD; --accent-hover:#0D47A1; }
[data-theme="purple"] { --accent:#7B1FA2; --accent-light:#F3E5F5; --accent-hover:#6A1B9A; }
[data-theme="teal"]   { --accent:#00695C; --accent-light:#E0F2F1; --accent-hover:#004D40; }
[data-theme="orange"] { --accent:#D84315; --accent-light:#FBE9E7; --accent-hover:#BF360C; }
[data-theme="slate"]  { --accent:#37474F; --accent-light:#ECEFF1; --accent-hover:#263238; }

/* ═══════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════ */
[data-mode="dark"] {
  --bg:           #0F1419;
  --card:         #1A2232;
  --border:       #2A3548;
  --text:         #D8E4F0;
  --text-muted:   #7A8FA6;
  --text-light:   #506070;
  --blue-light:   #1A2D50;
  --green-light:  #1B2D22;
  --orange-light: #2D1A0A;
  --red-light:    #2D1215;
  --gold-light:   #2A2010;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.3);
  --shadow-md:    0 4px 12px rgba(0,0,0,.4);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.5);
}
[data-mode="dark"] body          { background: var(--bg); color: var(--text); }
[data-mode="dark"] h1,
[data-mode="dark"] h2,
[data-mode="dark"] h3,
[data-mode="dark"] h4            { color: var(--text); }
[data-mode="dark"] .card         { background: var(--card); border-color: var(--border); }
[data-mode="dark"] .form__input,
[data-mode="dark"] .form__select,
[data-mode="dark"] .form__textarea {
  background: #111927;
  border-color: var(--border);
  color: var(--text);
}
[data-mode="dark"] .form__label  { color: var(--text-muted); }
[data-mode="dark"] .table th     { border-color: var(--border); color: var(--text-muted); }
[data-mode="dark"] .table td     { border-color: var(--border); color: var(--text); }
[data-mode="dark"] .table tbody tr:hover td { background: #1E2D42; }
[data-mode="dark"] .btn--outline { color: var(--text); border-color: var(--border); }
[data-mode="dark"] .btn--outline:hover { background: var(--border); }
[data-mode="dark"] .modal__box   { background: var(--card); border-color: var(--border); }
[data-mode="dark"] .modal__header { border-color: var(--border); }
[data-mode="dark"] .modal__footer { border-color: var(--border); }
[data-mode="dark"] .tabs__btn    { background: var(--card); border-color: var(--border); color: var(--text-muted); }
[data-mode="dark"] .tabs__btn.active { background: var(--accent); color: #fff; }
[data-mode="dark"] .tabs__panel  { background: transparent; }
[data-mode="dark"] .info-box     { background: var(--card); border-color: var(--border); }
[data-mode="dark"] .badge--gray  { background: #2A3548; color: var(--text-muted); }
[data-mode="dark"] .page-header__sub { color: var(--text-muted); }
[data-mode="dark"] .sidebar      { background: #080E17; }
[data-mode="dark"] .sidebar__link.active { background: #1A2D42; }
[data-mode="dark"] .topbar       { background: #080E17; border-color: var(--border); }
[data-mode="dark"] .settings-nav { background: var(--card); border-color: var(--border); }
[data-mode="dark"] .settings-nav__link:hover { background: var(--border); }
[data-mode="dark"] .settings-nav__link.active { background: var(--accent); color: #fff; }
[data-mode="dark"] select option { background: #1A2232; }

/* ═══════════════════════════════════════════════
   SCHRIFTGRÖSSE
   Nur body + Textelemente skalieren.
   html-root bleibt immer bei 16 px → rem-basierte
   Abstände (Padding, Radius, Shadow) bleiben stabil.
   ═══════════════════════════════════════════════ */
[data-fontsize="small"] body { font-size: 14px; }
[data-fontsize="large"]  body { font-size: 18px; }

/* Überschriften explizit skalieren (rem → proportional) */
[data-fontsize="small"] h1 { font-size: 2.19rem; }
[data-fontsize="small"] h2 { font-size: 1.53rem; }
[data-fontsize="small"] h3 { font-size: 1.09rem; }
[data-fontsize="small"] h4 { font-size: 0.96rem; }
[data-fontsize="large"]  h1 { font-size: 2.81rem; }
[data-fontsize="large"]  h2 { font-size: 1.97rem; }
[data-fontsize="large"]  h3 { font-size: 1.41rem; }
[data-fontsize="large"]  h4 { font-size: 1.24rem; }

/* Schaltflächen, Labels, Badges, Inputs skalieren mit body-Größe mit */
[data-fontsize="small"] .btn,
[data-fontsize="small"] .form__input,
[data-fontsize="small"] .form__select,
[data-fontsize="small"] .form__textarea,
[data-fontsize="small"] .form__label,
[data-fontsize="small"] .badge,
[data-fontsize="small"] .sidebar__link,
[data-fontsize="small"] .modal__title,
[data-fontsize="small"] td, [data-fontsize="small"] th { font-size: 0.8125rem; } /* 13px */

[data-fontsize="large"]  .btn,
[data-fontsize="large"]  .form__input,
[data-fontsize="large"]  .form__select,
[data-fontsize="large"]  .form__textarea,
[data-fontsize="large"]  .form__label,
[data-fontsize="large"]  .badge,
[data-fontsize="large"]  .sidebar__link,
[data-fontsize="large"]  .modal__title,
[data-fontsize="large"]  td, [data-fontsize="large"]  th { font-size: 1rem; } /* 16px */

/* ═══════════════════════════════════════════════
   KOMPAKT-MODUS
   ═══════════════════════════════════════════════ */
[data-compact="true"] .card          { padding: var(--space-md); }
[data-compact="true"] .table th,
[data-compact="true"] .table td      { padding: 7px 10px; }
[data-compact="true"] .sidebar__link { padding: 7px 12px; }
/* Modals: Kompakt-Modus greift hier NICHT — Dialoge behalten immer vollen Rand */
[data-compact="true"] .form__group   { margin-bottom: var(--space-sm); }
[data-compact="true"] .page-header   { padding: var(--space-md) 0; }

/* Akzentfarbe-Overrides (ersetzen --green überall) */
.btn--green          { background: var(--accent) !important; }
.btn--green:hover    { background: var(--accent-hover) !important; }
.btn--green-light    { background: var(--accent-light) !important; color: var(--accent) !important; }
.sidebar__link.active { background: var(--accent) !important; }
.table th.sort-asc,
.table th.sort-desc  { color: var(--accent) !important; }
.table th.sort-asc::after,
.table th.sort-desc::after { color: var(--accent) !important; }
.table th.sortable:hover   { color: var(--accent) !important; }
.filter-chip.active  { background: var(--accent) !important; border-color: var(--accent) !important; }
.badge--green        { background: var(--accent-light); color: var(--accent); }
.progress__bar       { background: var(--accent) !important; }

/* ═══════════════════════════════════════════════
   DARSTELLUNGS-EINSTELLUNGEN UI
   ═══════════════════════════════════════════════ */
.theme-section-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}
.mode-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.mode-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 12px 12px;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  background: var(--bg);
}
.mode-card:hover  { border-color: var(--accent); }
.mode-card.active { border-color: var(--accent); background: var(--accent-light); }
.mode-card__preview {
  width: 100%;
  height: 52px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
  display: flex;
  gap: 4px;
}
.mode-card__preview-sidebar {
  width: 28%;
  height: 100%;
  border-radius: 4px 0 0 4px;
}
.mode-card__preview-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px;
}
.mode-card__preview-line {
  height: 6px;
  border-radius: 3px;
}
.mode-card__label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
}
.mode-card__sub {
  font-size: .68rem;
  color: var(--text-muted);
}
/* Light preview */
.mode-card--light .mode-card__preview { background: #F4F1EA; }
.mode-card--light .mode-card__preview-sidebar { background: #1A2744; }
.mode-card--light .mode-card__preview-line:nth-child(1) { background: #e0dbd4; width: 90%; }
.mode-card--light .mode-card__preview-line:nth-child(2) { background: #e8e3dc; width: 70%; }
.mode-card--light .mode-card__preview-line:nth-child(3) { background: var(--accent); width: 50%; }
/* Dark preview */
.mode-card--dark .mode-card__preview  { background: #0F1419; }
.mode-card--dark .mode-card__preview-sidebar { background: #080E17; }
.mode-card--dark .mode-card__preview-line:nth-child(1) { background: #2A3548; width: 90%; }
.mode-card--dark .mode-card__preview-line:nth-child(2) { background: #1A2232; width: 70%; }
.mode-card--dark .mode-card__preview-line:nth-child(3) { background: var(--accent); width: 50%; }
/* System preview */
.mode-card--system .mode-card__preview {
  background: linear-gradient(to right, #F4F1EA 50%, #0F1419 50%);
}
.mode-card--system .mode-card__preview-sidebar {
  background: linear-gradient(to bottom, #1A2744 50%, #080E17 50%);
}
.mode-card--system .mode-card__preview-line:nth-child(1) { background: #9E9E9E; width: 90%; }
.mode-card--system .mode-card__preview-line:nth-child(2) { background: #BDBDBD; width: 70%; }
.mode-card--system .mode-card__preview-line:nth-child(3) { background: var(--accent); width: 50%; }

.color-swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}
.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: var(--transition);
  position: relative;
}
.color-swatch:hover    { transform: scale(1.15); }
.color-swatch.active   { border-color: var(--text); }
.color-swatch.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .75rem;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

.fontsize-btns {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.fontsize-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
}
.fontsize-btn:hover  { border-color: var(--accent); }
.fontsize-btn.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  margin-bottom: var(--space-sm);
}
.toggle-row__info strong { font-size: .875rem; color: var(--text); display: block; }
.toggle-row__info span   { font-size: .75rem; color: var(--text-muted); }
.toggle-switch {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  position: relative;
  background: var(--border);
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-switch.on { background: var(--accent); }
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: left .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.toggle-switch.on::after { left: 23px; }

/* ═══════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════ */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea {
  font-family: var(--font-body);
  font-size: inherit;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--navy);
}
h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

/* ═══════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}
.container--narrow {
  max-width: 480px;
}
.container--mid {
  max-width: 640px;
}

/* ═══════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════ */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.card--hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card--navy {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.card--featured {
  border: 2px solid var(--gold);
  box-shadow: var(--shadow-md);
  transform: scale(1.03);
  position: relative;
}

/* ═══════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn--disabled {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}
.btn--green   { background: var(--green); color: #fff; }
.btn--navy    { background: var(--navy); color: #fff; }
.btn--blue    { background: var(--blue); color: #fff; }
.btn--red     { background: var(--red); color: #fff; }
.btn--orange  { background: var(--orange); color: #fff; }
.btn--gold    { background: var(--gold); color: #fff; }
.btn--ghost   { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.btn--ghost:hover { background: rgba(255,255,255,.1); }
.btn--outline { background: transparent; color: var(--navy); border: 1px solid var(--border); }
.btn--outline:hover { background: var(--bg); }
.btn--sm      { padding: 6px 14px; font-size: .8rem; }
.btn--lg      { padding: 14px 32px; font-size: 1rem; }
.btn--full    { width: 100%; }
.btn--icon    { padding: 8px; min-width: 36px; }
.btn--green-light { background: var(--green-light); color: var(--green); }
.btn--red-light   { background: var(--red-light); color: var(--red); }
.btn--blue-light  { background: var(--blue-light); color: var(--blue); }

/* Loading state */
.btn--loading {
  pointer-events: none;
  position: relative;
  color: transparent !important; /* Ausnahme: Loading-State muss Text verbergen */
}
.btn--loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════ */
.form__group {
  margin-bottom: var(--space-md);
}
.form__label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: var(--space-xs);
}
.form__input,
.form__select,
.form__textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: .9rem;
  background: #FAFAF6;
  color: var(--text);
  transition: var(--transition);
}
.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(58,123,213,.12);
}
.form__input--error {
  border-color: var(--red);
}
.form__error {
  font-size: .78rem;
  color: var(--red);
  margin-top: var(--space-xs);
  display: none;
}
.form__error.visible {
  display: block;
}
.form__hint {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}
.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}
.form__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A8470' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form__textarea {
  resize: vertical;
  min-height: 80px;
}
.form__checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  font-size: .875rem;
  cursor: pointer;
}
.form__checkbox input[type="checkbox"] {
  width: 18px; height: 18px;
  margin-top: 2px;
  accent-color: var(--green);
  cursor: pointer;
}

/* Password strength bar */
.pw-strength {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-top: var(--space-sm);
  overflow: hidden;
}
.pw-strength__bar {
  height: 100%;
  border-radius: 2px;
  width: 0;
  transition: width .3s, background .3s;
}
.pw-strength__label {
  font-size: .75rem;
  margin-top: var(--space-xs);
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge--green  { background: var(--green-light); color: var(--green); }
.badge--orange { background: var(--orange-light); color: var(--orange); }
.badge--red    { background: var(--red-light); color: var(--red); }
.badge--blue   { background: var(--blue-light); color: var(--blue); }
.badge--navy   { background: var(--navy); color: #fff; }
.badge--gold   { background: var(--gold-light); color: var(--gold); }
.badge--gray   { background: #F0ECE4; color: var(--text-muted); }
.badge--black  { background: #EEEEEE; color: var(--black-light); }

/* ═══════════════════════════════════════════════
   INFO TAGS
   ═══════════════════════════════════════════════ */
.tag {
  display: inline-block;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  margin: 2px;
}
.tag__label {
  font-size: .65rem;
  color: var(--text-light);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.tag__value {
  font-size: .8rem;
  color: var(--navy);
  font-weight: 700;
}
.tag--mono .tag__value {
  font-family: 'Courier New', monospace;
}

/* ═══════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
/* Sortierbare Spalten */
.table th.sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 22px;
  position: relative;
  transition: color .15s;
}
.table th.sortable:hover {
  color: var(--green);
}
.table th.sortable::after {
  content: '⇅';
  position: absolute;
  right: 6px;
  font-size: .75rem;
  opacity: .35;
  transition: opacity .15s;
}
.table th.sortable:hover::after { opacity: .7; }
.table th.sort-asc::after  { content: '▲'; opacity: 1; color: var(--green); }
.table th.sort-desc::after { content: '▼'; opacity: 1; color: var(--green); }
.table th.sort-asc,
.table th.sort-desc { color: var(--green); }
.table td {
  padding: 11px 14px;
  font-size: .875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover td {
  background: #FAF9F6;
}

/* ═══════════════════════════════════════════════
   MODAL
   Padding und max-width in em → skalieren proportional
   mit der gewählten Schriftgröße (Klein/Normal/Groß).
   ═══════════════════════════════════════════════ */
.modal__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1em;
}
.modal__overlay.open {
  display: flex;
}
.modal__box {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1.5em;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}
/* em-basierte max-width: Modal wächst/schrumpft mit Schriftgröße */
.modal__box--sm { max-width: min(27.5em, 95vw); }   /* ~440px bei Normal */
.modal__box--md { max-width: min(35em,   95vw); }   /* ~560px bei Normal */
.modal__box--lg { max-width: min(43.75em,95vw); }   /* ~700px bei Normal */
.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5em;
}
.modal__title {
  font-size: 1.15rem;
  font-weight: 800;
}
.modal__close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}
.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5em;
  margin-top: 1.5em;
  padding-top: 1em;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: var(--space-lg);
}
.tabs__btn {
  flex: 1;
  padding: 9px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  transition: var(--transition);
}
.tabs__btn.active {
  background: var(--card);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}
.tabs__panel {
  display: none;
}
.tabs__panel.active {
  display: block;
}

/* ═══════════════════════════════════════════════
   STEPPER (Progress Steps)
   ═══════════════════════════════════════════════ */
.stepper {
  display: flex;
  gap: 4px;
  margin-bottom: var(--space-lg);
}
.stepper__step,
.step {
  flex: 1;
  text-align: center;
}
.stepper__bar,
.step-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-bottom: var(--space-xs);
  transition: background .3s;
}
.stepper__bar.done,
.step-bar.done {
  background: var(--green);
}
.stepper__label,
.step-label {
  font-size: .7rem;
  color: var(--text-light);
  font-weight: 500;
}
.stepper__label.active,
.step-label.active {
  color: var(--green);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-sm);
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease;
  max-width: 380px;
}
.toast--success { background: var(--green); color: #fff; }
.toast--error   { background: var(--red); color: #fff; }
.toast--warning { background: var(--orange); color: #fff; }
.toast--info    { background: var(--blue); color: #fff; }
.toast--out { animation: toastOut .3s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0); } to { opacity:0; transform:translateY(10px); } }

/* ═══════════════════════════════════════════════
   CODE INPUT (6-digit verification)
   ═══════════════════════════════════════════════ */
.code-input {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}
.code-input__field {
  width: 48px; height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FAFAF6;
  transition: var(--transition);
}
.code-input__field:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(58,123,213,.15);
}

/* ═══════════════════════════════════════════════
   APP SHELL — SIDEBAR
   ═══════════════════════════════════════════════ */
.app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--navy);
  color: #C8D6E5;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s;
}
.sidebar__brand {
  padding: var(--space-lg) var(--space-md);
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-align: center;
}
.sidebar__logo {
  width: 64px; height: 64px;
  border-radius: var(--radius-md);
  object-fit: contain;
  margin: 0 auto var(--space-sm);
  background: rgba(255,255,255,.08);
  padding: 8px;
}
.sidebar__org-name {
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 600;
  color: #fff;
}
.sidebar__nav {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #8EA4C0;
  font-weight: 600;
  font-size: .875rem;
  text-decoration: none;
  margin-bottom: 2px;
  transition: var(--transition);
}
.sidebar__link:hover {
  background: rgba(255,255,255,.06);
  color: #C8D6E5;
  text-decoration: none;
}
.sidebar__link.active {
  background: var(--navy-mid);
  color: #fff;
}
.sidebar__link-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}
.sidebar__settings {
  padding: var(--space-sm);
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar__footer {
  padding: var(--space-md);
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.sidebar__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--navy-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar__user-name {
  font-size: .78rem;
  font-weight: 600;
  color: #C8D6E5;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar__logout {
  font-size: .7rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
}
.sidebar__logout:hover { color: var(--red); }

/* App main area */
.app__main {
  flex: 1;
  margin-left: 240px;
  padding: var(--space-lg);
  background: var(--bg);
  min-height: 100vh;
  overflow-y: auto;
}

/* Page header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-md);
}
.page-header__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
}
.page-header__sub {
  color: var(--text-muted);
  font-size: .875rem;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   BUILDING CARDS GRID
   ═══════════════════════════════════════════════ */
.bld-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}
.bld-card {
  position: relative;
  cursor: pointer;
}
.bld-card__badge {
  position: absolute;
  top: 12px; right: 14px;
  font-size: .7rem;
  background: var(--bg);
  padding: 3px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 600;
}
.bld-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--space-md);
}
.bld-card__icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.bld-card__name {
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 700;
  color: var(--navy);
}
.bld-card__addr {
  font-size: .78rem;
  color: var(--text-muted);
}

/* Progress bar (keys issued) */
.progress {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-top: var(--space-sm);
}
.progress__bar {
  height: 100%;
  border-radius: 2px;
  transition: width .3s;
}

/* KPI stat cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.kpi-card {
  display: flex;
  flex-direction: column;
}
.kpi-card__label {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
}
.kpi-card__value {
  font-size: 1.75rem;
  font-weight: 800;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   EMOJI PICKER
   ═══════════════════════════════════════════════ */
.emoji-picker {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}
.emoji-picker__btn {
  width: 40px; height: 40px;
  font-size: 1.25rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: var(--transition);
}
.emoji-picker__btn:hover {
  border-color: var(--border);
}
.emoji-picker__btn.active {
  border-color: var(--gold);
  background: var(--gold-light);
}

/* ═══════════════════════════════════════════════
   CHIPS (Schlüssel-Vorschläge)
   ═══════════════════════════════════════════════ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip.active { background: var(--blue-light); border-color: var(--blue); color: var(--blue); }

/* ═══════════════════════════════════════════════
   ACTION MENU (3-dot)
   ═══════════════════════════════════════════════ */
.action-menu {
  position: relative;
}
.action-menu__trigger {
  background: none;
  border: none;
  padding: 4px 8px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 4px;
}
.action-menu__trigger:hover { background: var(--bg); }
.action-menu__dropdown {
  display: none;
  position: absolute;
  right: 0; top: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 50;
  overflow: hidden;
}
.action-menu__dropdown.open {
  display: block;
}
.action-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 14px;
  font-size: .84rem;
  color: var(--text);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background .1s;
}
.action-menu__item:hover { background: var(--bg); }
.action-menu__item--danger { color: var(--red); }

/* ═══════════════════════════════════════════════
   HERO SECTION (Landing)
   ═══════════════════════════════════════════════ */
.hero {
  background: var(--navy);
  color: #fff;
  padding: var(--space-2xl) 0;
  position: relative;
  overflow: hidden;
}
.hero__bg-pattern {
  position: absolute;
  inset: 0;
  opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0L60 30L30 60L0 30z' fill='%23fff' fill-opacity='.1'/%3E%3C/svg%3E");
  background-size: 40px 40px;
}
.hero__content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: center;
  position: relative;
  z-index: 1;
}
.hero__headline {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: var(--space-md);
}
.hero__sub {
  font-size: 1.1rem;
  color: rgba(255,255,255,.7);
  margin-bottom: var(--space-lg);
  line-height: 1.6;
}
.hero__buttons {
  display: flex;
  gap: var(--space-md);
}

/* ═══════════════════════════════════════════════
   PRICING SECTION
   ═══════════════════════════════════════════════ */
.pricing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}
.pricing-toggle__label {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.pricing-toggle__label.active { color: var(--navy); }
.pricing-toggle__switch {
  width: 48px; height: 26px;
  border-radius: 13px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  border: none;
  transition: background .2s;
}
.pricing-toggle__switch.active { background: var(--green); }
.pricing-toggle__switch::after {
  content: '';
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px; left: 3px;
  transition: transform .2s;
}
.pricing-toggle__switch.active::after { transform: translateX(22px); }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-md);
  align-items: flex-start;
}

/* ═══════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════ */
.login-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
.login-page__brand {
  background: var(--navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}
.login-page__brand-logo {
  width: 120px; height: 120px;
  border-radius: var(--radius-lg);
  object-fit: contain;
  background: rgba(255,255,255,.08);
  padding: 16px;
  margin-bottom: var(--space-lg);
}
.login-page__brand-name {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: #fff;
  font-weight: 700;
  text-align: center;
}
.login-page__brand-sub {
  color: rgba(255,255,255,.5);
  font-size: .9rem;
  margin-top: var(--space-sm);
}
.login-page__form-area {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}
.login-page__form {
  width: 100%;
  max-width: 380px;
}

/* ═══════════════════════════════════════════════
   TRUST BADGES
   ═══════════════════════════════════════════════ */
.trust-badges {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  padding: var(--space-xl) 0;
}
.trust-badge {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.trust-badge__icon {
  font-size: 1.2rem;
}

/* ═══════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════ */
.footer {
  background: var(--navy);
  color: rgba(255,255,255,.6);
  padding: var(--space-xl) 0;
}
.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-xl);
}
.footer__brand {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: var(--space-sm);
}
.footer__heading {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.4);
  margin-bottom: var(--space-md);
}
.footer__link {
  display: block;
  color: rgba(255,255,255,.6);
  font-size: .85rem;
  margin-bottom: var(--space-sm);
  text-decoration: none;
}
.footer__link:hover { color: #fff; }

/* ═══════════════════════════════════════════════
   INLINE FORM (Lagerplatz schnell anlegen)
   ═══════════════════════════════════════════════ */
.inline-form {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
  padding: var(--space-md);
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-top: var(--space-sm);
}
.inline-form .form__group { margin-bottom: 0; flex: 1; }

/* ═══════════════════════════════════════════════
   FILTER CHIPS
   ═══════════════════════════════════════════════ */
.filter-chips {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}
.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.filter-chip:hover { border-color: var(--blue); }
.filter-chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ═══════════════════════════════════════════════
   INFO BOX
   ═══════════════════════════════════════════════ */
.info-box {
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  line-height: 1.5;
}
.info-box--blue  { background: var(--blue-light); color: var(--navy); }
.info-box--green { background: var(--green-light); color: var(--green); }
.info-box--red   { background: var(--red-light); color: var(--red); }
.info-box--gold  { background: var(--gold-light); color: var(--navy); }

/* ═══════════════════════════════════════════════
   SETTINGS SIDEBAR
   ═══════════════════════════════════════════════ */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-lg);
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  transition: var(--transition);
}
.settings-nav__link:hover { background: var(--card); }
.settings-nav__link.active { background: var(--card); color: var(--navy); box-shadow: var(--shadow-sm); }

/* ═══════════════════════════════════════════════
   PERMISSIONS TABLE
   ═══════════════════════════════════════════════ */
.perm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.perm-table th { padding: 8px 12px; font-size: .7rem; }
.perm-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.perm-table td:first-child { text-align: left; font-weight: 600; }
.perm-table input[type="radio"] {
  accent-color: var(--blue);
  width: 16px; height: 16px;
}

/* ═══════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .pricing-grid { grid-template-columns: repeat(3, 1fr); }
  .bld-grid { grid-template-columns: repeat(2, 1fr); }
  .hero__content { grid-template-columns: 1fr; text-align: center; }
  .hero__buttons { justify-content: center; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  .sidebar.open { transform: translateX(0); }
  .app__main { margin-left: 0; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
  .bld-grid { grid-template-columns: 1fr; }
  .form__row { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-page__brand { display: none; }
  .footer__grid { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .hero__headline { font-size: 2rem; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.4rem; }
}

@media (max-width: 480px) {
  .code-input__field { width: 40px; height: 48px; font-size: 1.2rem; }
  .container { padding: 0 var(--space-md); }
}

/* Mobile topbar (hidden by default, shown on mobile) */
.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--navy);
  color: #fff;
  align-items: center;
  padding: 0 var(--space-md);
  z-index: 99;
  gap: var(--space-md);
}
.topbar__hamburger {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}
.topbar__title {
  font-weight: 700;
  font-size: .95rem;
}

@media (max-width: 768px) {
  .topbar { display: flex; }
  .app__main { padding-top: 72px; }
}

/* Backdrop for mobile sidebar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.3);
  z-index: 99;
}
.sidebar-backdrop.open { display: block; }

/* ═══════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.hidden { display: none; }
.fw-700 { font-weight: 700; }
.mono { font-family: 'Courier New', monospace; }
