:root{
  --primary:#1da1f2;
  --primary-600:#0c88d3;
  --accent:#2f80ed;
  --muted:#6b7280;
  --ink:#111827;
  --bg:#f5f6f8;
  --card:#ffffff;
  --border:#e5e7eb;
  --shadow:0 10px 30px rgba(17,24,39,.08);

  /* Header / Adminbar */
  --header-h: 64px;    /* Fallback – wird per JS gemessen */
  --adminbar: 0px;     /* 32/46px nur am Seitenanfang, via Body-Klasse */
}

/* Base */
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji";
  line-height:1.6;
  color:var(--ink);
  background:var(--bg);
}
img{max-width:100%;height:auto;display:block}
a{color:var(--primary);text-decoration:none}
a:hover{text-decoration:underline}

/* Container */
.container{width:min(1200px,94%);margin-inline:auto}

/* ===== Header: fixed, Adminbar-aware, kompakt beim Scrollen ===== */
.site-header{
  position:fixed;
  top:var(--adminbar);
  left:0; right:0; width:100%;
  z-index:10000;
  background:#fff;
  border-bottom:1px solid var(--border);
  transition: top .2s ease, box-shadow .15s ease, backdrop-filter .15s ease, transform .2s ease;
}
.header-inner{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.65rem 0}
.brand{display:flex;align-items:center;gap:.75rem;color:inherit}
.brand .custom-logo{max-height:38px;width:auto}
.brand-text{display:flex;flex-direction:column}
.site-title{font-weight:700;margin:0;letter-spacing:.2px}
.site-tagline{font-size:.85rem;color:var(--muted)}

/* Schatten, wenn gescrolled (Body bekommt .header-compact via JS) */
body.header-compact .site-header{ box-shadow:0 4px 16px rgba(17,24,39,.06); }

/* Adminbar-Höhen NUR am Seitenanfang (nicht kompakt) */
@media (min-width:783px){ body.admin-bar:not(.header-compact){ --adminbar:32px; } }
@media (max-width:782px){ body.admin-bar:not(.header-compact){ --adminbar:46px; } }

/* iPhone-Notch oben nur wenn KEINE Adminbar & NICHT kompakt */
@supports (padding-top: env(safe-area-inset-top)){
  body:not(.admin-bar):not(.header-compact) .site-header{
    padding-top:env(safe-area-inset-top);
  }
}

/* Inhalt unter fixen Header schieben */
.site-main{ padding-top: calc(var(--header-h) + var(--adminbar) + 12px); padding-bottom:1.25rem; }

/* ===== Navigation ===== */
.main-navigation ul{list-style:none;display:flex;gap:.5rem;padding:0;margin:0}
.main-navigation a{display:inline-block;padding:.5rem .75rem;border-radius:.5rem}
.main-navigation a:hover,.main-navigation .current-menu-item>a{background:#f3f4f6;text-decoration:none}
.menu-toggle{display:none;background:transparent;border:0;padding:.5rem}
.menu-toggle__bar{display:block;width:24px;height:2px;background:#111827;margin:5px 0}

/* ===== Mobile-Menü als Overlay – bündig unter Header ===== */
@media (max-width:900px){
  .main-navigation{
    z-index: 9000;
  }
  .menu-toggle{display:inline-block}

  .main-navigation{
    position:fixed; top:0; left:0; right:0;
    background:#fff; width:100%;
    border-bottom:1px solid var(--border);
    box-shadow:0 12px 30px rgba(17,24,39,.12);
    display:none; z-index:9999;
    max-height:100vh; overflow:auto;
  }
  /* Spacer schiebt Menüinhalt exakt unter Headerkante */
  .main-navigation::before{
    content:""; display:block;
    height: calc(var(--adminbar) + var(--header-h));
  }
  .main-navigation.open{ display:block; }
  .main-navigation ul{ flex-direction:column; padding:.75rem; }
}

/* ===== Buttons ===== */
.button{
  display:inline-block;
  background:var(--primary);
  color:#fff;
  border-radius:8px;
  padding:.65rem 1.1rem;
  font-weight:600;
  font-size:1rem;
  border:1px solid transparent;
  box-shadow:var(--shadow);
  cursor:pointer;
  transition:background .2s, transform .1s, filter .2s;
}
.button:hover{ filter:brightness(.96); text-decoration:none; }
.button:active{ transform:scale(.97); }
.button.ghost{ background:transparent; border-color:var(--primary); color:var(--primary); box-shadow:none; }

/* Roter Abbrechen-Button */
.button-cancel{
  background:#dc3545;
  border-color:#dc3545;
  display:inline-block;
  color:#fff;
  border-radius:8px;
  padding: .65rem 1.1rem;
  font-weight:600;
  font-size:1rem;
  border:1px solid transparent;
  box-shadow:var(--shadow);
  cursor:pointer;
  transition:background .2s, transform .1s, filter .2s;
}
.button-cancel:hover{ background:#b52a37; }

/* ===== Content-Kachel ===== */
.site-main > .container{
  background:#fff; border-radius:12px;
  box-shadow:0 4px 20px rgba(17,24,39,.06);
  padding:2rem; margin-bottom:2rem;
}

/* ===== Formulare schön ===== */
form { max-width:100%; width:100%; }
form label{ display:block; font-size:.95rem; font-weight:600; margin:0 0 .35rem; color:var(--ink); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], select, textarea{
  width:100%; padding:.75rem .9rem; font-size:1rem;
  border:1px solid var(--border); border-radius:8px; background:#fff; color:var(--ink);
  transition:border-color .2s, box-shadow .2s; appearance:none; box-sizing:border-box;
}
textarea{ min-height:120px; resize:vertical; }
input:focus, select:focus, textarea:focus{
  border-color:var(--primary); outline:none; box-shadow:0 0 0 3px rgba(29,161,242,.2);
}
form .form-row, form p, form div{ margin-bottom:1rem; }
input[type="checkbox"], input[type="radio"]{ transform:scale(1.2); margin-right:.4rem; }

/* Datei-Upload hübsch (global) */
input[type="file"]{
  width:100%; border:1px solid var(--border); border-radius:10px;
  padding:.5rem; background:#fff; box-sizing:border-box;
  color:var(--muted); font-size:.95rem; /* Dateiname */
}
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button{
  font-size:.95rem; background:var(--primary); color:#fff; border:0;
  border-radius:8px; padding:.65rem 1rem; font-weight:600; margin-right:.75rem;
  cursor:pointer; transition:filter .2s;
}
input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover{ filter:brightness(.95); }

/* Optional: Liste ausgewählter Dateien */
.file-name-list{ margin-top:.5rem; font-size:.9rem; color:var(--muted); display:flex; gap:.5rem; flex-wrap:wrap; }
.file-name-list span{ background:#eef5ff; border:1px solid #d6e6ff; border-radius:6px; padding:.25rem .5rem; }

/* ===== Footer ===== */
.site-footer{ border-top:1px solid var(--border); background:#fff; padding:2rem 0; margin-top:2rem; }
.footer-widgets{ display:grid; grid-template-columns:repeat(12,1fr); gap:1rem; }
.site-info{ display:flex; align-items:center; justify-content:space-between; gap:1rem; flex-wrap:wrap; }

/* ===== Mobile polish ===== */
@media (max-width:768px){
  .header-inner{ padding:.5rem 0; }
  .brand .custom-logo{ max-height:30px; }
  .site-title{ font-size:1rem; }
  .site-tagline{ display:none; }

  .site-main > .container{ padding:1rem; border-radius:10px; }
  .button{ padding:.5rem .75rem; font-size:.95rem; }

  table{ display:block; width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; border-collapse:collapse; }
  td, th{ padding:.6rem .6rem; white-space:nowrap; }
}
@media (max-width:420px){
  .site-title{ font-size:.95rem; }
  .button{ font-size:.9rem; padding:.45rem .65rem; }
  td, th{ padding:.5rem .5rem; }
}

/* iOS safe area Seiten/Boden */
.site-header{ padding-left:max(env(safe-area-inset-left),0); padding-right:max(env(safe-area-inset-right),0); }
.site-footer{ padding-left:max(env(safe-area-inset-left),0); padding-right:max(env(safe-area-inset-right),0); }
body{ padding-bottom: env(safe-area-inset-bottom); }

/* Brand-Logo immer links ausrichten */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Behält Menü rechts */
}

.brand{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:.5rem;
  margin-right:auto;
}

/* Logo-Größe */
.brand .custom-logo{ max-height:38px; width:auto; height:auto; display:block; }
.custom-logo-link{ display:inline-flex; align-items:center; line-height:0; }

/* Firmenname-Text */
.brand .brand-text .site-title{
  font-size:1.8rem;
  font-weight:700;
  color:var(--ink);
  white-space:nowrap; /* Verhindert Umbrechen */
}

.custom-logo-link{ display:inline-flex; align-items:center; line-height:0; }
.brand .custom-logo{ max-height:38px; width:auto; height:auto; display:block; }

/* Standard: Desktop-Logo sichtbar, Mobile-Logo unsichtbar */
.custom-logo-desktop{ max-height:38px; }
.custom-logo-mobile,
.custom-logo-link-mobile{ display:none; }

/* Handy-/Tablet: Mobiles Logo sichtbar, Desktop-Logo ausblenden */
@media (max-width: 768px){
  .custom-logo-desktop{ display:none; }
  .custom-logo-mobile,
  .custom-logo-link-mobile{ display:inline-flex; }
  .custom-logo-mobile{ max-height:36px; } /* hier die mobile Größe einstellen */
  .brand .brand-text .site-title{ font-size:1.5rem; }
}

/* Optional: noch kleiner auf sehr kleinen Phones */
@media (max-width: 380px){
  .custom-logo-mobile{ max-height:22px; }
}

@media (max-width:768px){
  .brand .custom-logo{ max-height:36px; }
  .brand .brand-text .site-title{ font-size:1.5rem; }
}

