:root{
  /* Colors */
  --bg:#f7f8fb;
  --text:#0f172a;             /* slate-900 */
  --muted:#6b7280;            /* gray-500 */
  --border:#e5e7eb;           /* gray-200 */
  --line:#e5e7eb;
  --panel:#ffffff;
  --panel-alt:#fafafa;

  --primary:#2563eb;          /* blue-600 */
  --primary-600:#2563eb;
  --primary-700:#1d4ed8;

  /* Radius / shadow */
  --radius:12px;
  --shadow-lg:0 20px 50px rgba(0,0,0,.1);
  --shadow-md:0 10px 30px rgba(0,0,0,.08);
  --shadow-sm:0 6px 16px rgba(0,0,0,.06);

  /* Layout scale */
  --gap: clamp(12px, 1.6vw, 20px);
  --container: 1200px;
  --dialog-w: 640px;
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;

  /* Header sizing baseline (drives logo + button heights) */
  --header-button-h: 40px;     /* ≥1024px default */
  --site-logo-scale: 1.5;      /* Logo ist 1.5× Buttonhöhe */
}

/* ---------- Responsive Design Scale ---------- */
/*  ≥1440px: etwas großzügiger */
@media (min-width: 1440px){
  :root{
    --header-button-h: 44px;
    --gap: 20px;
    --container: 1280px;
  }
}
/*  1024–1439px: Standard (aus :root) */

/*  768–1023px: leicht kompakter */
@media (max-width: 1023.98px){
  :root{
    --header-button-h: 38px;
    --gap: 18px;
    --container: 1100px;
  }
}
/*  640–767px: mobile landscape / small tablets */
@media (max-width: 767.98px){
  :root{
    --header-button-h: 36px;
    --gap: 16px;
    --container: 100%;
  }
}
/*  ≤639px: phone – kompakteste Stufe */
@media (max-width: 639.98px){
  :root{
    --header-button-h: 34px;
    --gap: 14px;
  }
}

*{ box-sizing:border-box }
html,body{ height:100% }
html{ -webkit-text-size-adjust:100% }
body{
  margin:0; background:var(--bg); color:var(--text); font-family:var(--font);
  font-size:16px; line-height:1.45;
}

/* Utilities */
.hidden{ display:none !important }
.hf-hidden{ display:none !important }

/* Container */
.container{ width:min(100% - 2rem, var(--container)); margin:auto; padding: 0 1rem; }

/* ---------- Header ---------- */
.header{
  display:flex; justify-content:space-between; align-items:flex-start; /* Oberkante bündig */
  padding: clamp(10px, 1.5vw, 16px) 0;
  min-height: calc(var(--header-button-h) * var(--site-logo-scale)); /* vermeidet Umbrüche */
}
.brand {display: flex;align-items: flex-start;gap: .7rem;}
.app-title{ font-weight:700; margin:0; font-size: clamp(18px, 2vw, 22px); }

/* Header actions: rechts und oberkantig */
.header-actions{
  margin-left:auto;
  display:flex; align-items:flex-start; gap:12px;
}

/* Logo RECHTS: 1.5 × Buttonhöhe, oberkantig bündig */
#siteLogo {
  height: calc(var(--header-button-h) * var(--site-logo-scale));
  width: auto;
  align-self: flex-start;
  display: block;
}

/* ---------- User Button / Trigger ---------- */
.hf-user{ position:relative; }

.hf-menu-trigger{
  display:inline-flex; align-items:center; gap:10px;
  padding:8px 12px;
  border:1px solid var(--border); background:#fff; color:#111;
  border-radius:999px; box-shadow: var(--shadow-sm);
  cursor:pointer; user-select:none;
  transition: box-shadow .15s ease, transform .04s ease, border-color .15s ease;
  min-height: var(--header-button-h);
}
.hf-menu-trigger:hover{ box-shadow: var(--shadow-md); border-color:#d1d5db; }
.hf-menu-trigger:active{ transform: translateY(1px); }
.hf-menu-trigger:focus-visible{ outline:3px solid rgba(37,99,235,.25); outline-offset:3px; }

.hf-hamb{ color:#374151 }               /* Hamburger-Icon */
.hf-first{ font-weight:600; color:#111; max-width: 14ch; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Avatar im Trigger */
.hf-avatar{
  inline-size: calc(var(--header-button-h) - 6px);
  block-size: calc(var(--header-button-h) - 6px);
  display:grid; place-items:center;
  border-radius:999px; color:#fff; font-weight:700; font-size:12px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}
.hf-avatar-imgSmall{
  inline-size: calc(var(--header-button-h) - 6px);
  block-size: calc(var(--header-button-h) - 6px);
  border-radius:999px; object-fit:cover;
  border:1px solid var(--border);
}

/* ---------- Dropdown Menu ---------- */
.hf-menu{
  position:absolute; top: calc(100% + 10px); right:0;
  width: min(92vw, 320px);
  background:#fff; border:1px solid var(--border);
  border-radius:16px; box-shadow: var(--shadow-lg);
  transform-origin:top right; transform:scale(.98) translateY(-4px);
  opacity:0; pointer-events:none;
  transition: transform .16s ease, opacity .16s ease;
  z-index: 50;
}
.hf-menu.open{ transform:scale(1) translateY(0); opacity:1; pointer-events:auto; }

.hf-section{ padding:8px; }
.hf-divider{ height:1px; background:var(--line); margin:6px 0; }

.hf-item{
  display:flex; align-items:center; gap:12px;
  width:100%; text-align:left;
  padding:10px 12px; border-radius:10px;
  background:transparent; border:0; color:#111; cursor:pointer;
  transition: background .15s ease;
  min-height: 40px; /* bessere touch targets */
}
.hf-item:hover{ background:#f3f4f6; }
.hf-item.hf-danger{ color:#b91c1c; }
.hf-item.hf-danger:hover{ background:#fee2e2; }

.hf-icon{
  inline-size:36px; block-size:36px; display:grid; place-items:center;
  border-radius:999px; background:#f3f4f6; color:#374151;
}

.hf-user-header{ display:flex; gap:12px; align-items:center; padding:12px; }
.hf-user-meta{ min-width:0 }
.hf-user-name{ font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hf-user-mail{ color:#6b7280; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hf-avatar-img{
  inline-size:60px; block-size:60px; border-radius:999px; object-fit:cover; border:1px solid var(--border);
}
.hf-avatar{ width:40px; height:40px; }

/* ---------- Forms / Inputs / Buttons ---------- */
.input{
  width:100%; padding:12px 14px; border-radius:10px;
  border:1px solid var(--border); background:#fff; color:var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus{ outline:none; border-color:#c7d2fe; box-shadow:0 0 0 3px rgba(37,99,235,.15); }
.input-sm{ padding:8px 10px; border-radius:8px; min-height: var(--header-button-h); }


.btn{
  appearance:none; border:0; border-radius:10px;
  background: var(--primary); color:#fff; font-weight:700;
  --btn-py: 12px;           /* default spacing */
  --btn-px: 14px;
  --btn-fs: 1rem;
  padding: var(--btn-py) var(--btn-px);
  font-size: var(--btn-fs);
  cursor:pointer; transition: filter .15s ease, transform .04s ease;
  min-height: 0;            /* avoid being forced tall */
}

.btn--mi{
  --btn-py: 9px;            /* mid button */
  --btn-px: 12px;
  --btn-fs: 0.9rem;
  border-radius: 8px;
  line-height: 1.2;
}


.btn--sm{
  --btn-py: 6px;            /* smaller button */
  --btn-px: 10px;
  --btn-fs: 0.85rem;
  border-radius: 8px;
  line-height: 1.2;
}

/* keep your variants working */
.btn-ghost{
  background:#eef2ff; color:#1e3a8a; border:1px solid #c7d2fe;
}
.btn:hover{ filter: brightness(1.05); }
.btn:active{ transform: translateY(1px); }
.btn-ghost:hover{ filter: brightness(1.03); }

/*

.btn{
  appearance:none; border:0; border-radius:10px;
  background: var(--primary); color:#fff; font-weight:700;
  padding:12px 14px; cursor:pointer; transition: filter .15s ease, transform .04s ease;
  min-height: var(--header-button-h);
}
.btn:hover{ filter: brightness(1.05); }
.btn:active{ transform: translateY(1px); }
.btn-ghost{
  background:#eef2ff; color:#1e3a8a; border:1px solid #c7d2fe;
}
.btn-ghost:hover{ filter: brightness(1.03); }
*/

/* ---------- Cards / Layout ---------- */
.card{
  background:#fff; border:1px solid var(--border);
  border-radius:var(--radius);
  padding: clamp(16px, 2vw, 24px);
  box-shadow: var(--shadow-sm);
}
.card-title{ margin:0 0 .5rem 0; font-size: clamp(20px, 2vw, 26px); font-weight:700; }

.main-grid{ display:grid; grid-template-columns: 1fr; gap: var(--gap); }

/* ---------- Footer / Toast ---------- */
.footer{ opacity:.8; margin:24px 0; }
.toast{
  position:fixed; left:50%; bottom:24px; transform:translateX(-50%);
  background:#111827; color:#fff; padding:10px 14px; border-radius:10px;
  box-shadow:var(--shadow-md); z-index:1300; opacity:0; pointer-events:none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show{ opacity:1; transform:translateX(-50%) translateY(0) }

/* ---------- Small layout tweaks ---------- */
@media (max-width: 767.98px){
  .app-title{ display:none; }                 /* Platz sparen */
  .hf-first{ display:none; }                  /* Vorname neben Avatar ausblenden */
}

@media (hover:none){
  /* Größere touch targets bei Touch-Geräten */
  .hf-item{ min-height: 44px; }
}

/* ===============================================
   === ADDITIONS FROM FILE 2 (non-conflicting) ===
   =============================================== */

/* Extra input wrappers & labels */
.input-wrap{ position:relative }
.input-icon{
  position:absolute; right:8px; top:50%; transform:translateY(-50%);
  border:0; background:transparent; color:#6b7280; cursor:pointer;
}
.label{ color:#374151; font-weight:600; font-size:.95rem; }
.field{ display:grid; gap:6px }
.field-inline{ display:inline-flex; align-items:center; gap:8px }

/* Status helpers */
.err{ color:#b91c1c; min-height:1.2em; }
.msg{ color:#16a34a; min-height:1.2em; }
.hint{ color:#6b7280; font-size:.85rem }

/* Button variants */
.btn-outline{
  background: #fff;
  color: #111827;
  border: 1px solid var(--border);
}
.btn-outline:hover{ filter: none; background: #f9fafb; }

.btn-danger{
  background: #dc2626;               /* red-600 */
  color: #fff;
}
.btn-danger:hover{ filter: brightness(1.05); }

.btn-outline-danger{
  background: #fff;
  color: #b91c1c;                     /* red-700 text */
  border: 1px solid #fecaca;          /* red-200 border */
}
.btn-outline-danger:hover{
  background: #fff5f5;
  border-color: #fda4a4;              /* red-300 */
}

/* Modals */
.hf-modal{ position:fixed; inset:0; display:grid; place-items:center; z-index:1200; }
.hf-modal-backdrop{
  position:absolute; inset:0; background: rgba(15,23,42,.5); /* opaque overlay */
}
.hf-dialog{
  position:relative; z-index:1; width: min(var(--dialog-w), 92vw);
  max-height: 90vh; overflow:auto;
  background:#fff; color:#0f172a;             /* solid dialog */
  border:1px solid var(--border); border-radius:16px;
  box-shadow: var(--shadow-lg);
  padding: clamp(18px, 2vw, 28px);
}
.hf-x{
  position:absolute; top:10px; right:10px;
  inline-size:36px; block-size:36px; border-radius:10px;
  border:1px solid var(--border); background:#fff; color:#111; cursor:pointer;
}
@media (max-width: 480px){
  .hf-dialog{ width: min(520px, 94vw); border-radius:14px; }
}

/* Settings / modal tweaks */
#modalSettings .avatar { width: 48px; height: 48px; }
@media (min-width: 768px){
  #modalSettings .avatar { width: 160px; height: 160px; }
}
#modalSettings select.input{ background:#fff; }

/* Section cards inside dialogs (Preferences, Danger zone) */
.form-section{
  margin-top: 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.form-section h3{
  margin: 0 0 6px 0;
  font-weight: 700;
  font-size: 1rem;
  color: #111827;
}
.form-section .help{
  margin: 0 0 12px 0;
  color: var(--muted);
  font-size: .92rem;
}

/* Clean grid for fields */
.form-grid{
  display: grid;
  gap: 12px;
}
@media (min-width: 640px){
  .form-grid{ grid-template-columns: 1fr 1fr; }
}
.form-grid .field{ min-width: 0; }

/* Optional: align language select with header button height without overriding File 1 layout */
#lang.input-sm{
  padding-top:8px;
  padding-bottom:8px;
  min-height: var(--header-button-h);
}
#lang{ margin-inline-end: 8px; }

/* Keep header-actions from File 1; only ensure center alignment when used with selects */
.header-actions.align-center{ align-items:center; }

.modal{ position:fixed; inset:0; display:none; z-index:1000; }
.modal.open{ display:grid; place-items:center; }

.modal__backdrop{ position:absolute; inset:0; background:rgba(15,23,42,.55); z-index:0; }
.modal__dialog{ position:relative; z-index:1; /* über Backdrop */ }

.modal__header{ display:flex; align-items:center; justify-content:space-between; }
.modal__close{
  position:relative; z-index:2;  /* sicher über Content */
  border:0; background:transparent; font-size:20px; cursor:pointer; line-height:1;
}
