/* ==========================================================
   SocialFreedom — MEMBER WORKSPACE (V3 • SINGLE FILE • CLEAN)
   Fokus: stabil + lesbar + ohne Flickwerk
   - Desktop: Fixed Sidebar + Content daneben
   - Tablet/Mobile: Drawer Sidebar + Backdrop (ohne Blur)
   - Collapsed: kein Logo-Rahmen, Bottom-Arrow weg, Toggle rotiert
   - Kontrast/Lesbarkeit Sidebar auf Mobile/Tablet hoch
   - Cards dichter (Watermark scheint weniger durch)
   ========================================================== */


/* ---------------------------
   0) Tokens
---------------------------- */
:root{
  --max: 1180px;
  --pad: 20px;

  --r-sm: 10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", sans-serif;

  /* Workspace base */
  --bg0: #0f131a;
  --bg1: #121827;

  /* Surfaces (mehr Deckkraft => Watermark weniger sichtbar) */
  --surface:  rgba(18,24,39,.90);
  --surface2: rgba(18,24,39,.84);
  --surface3: rgba(18,24,39,.76);

  --edge:  rgba(255,255,255,.12);
  --edge2: rgba(255,255,255,.09);

  /* Text (Kontrast etwas höher) */
  --text:  rgba(255,255,255,.96);
  --muted: rgba(255,255,255,.82);
  --muted2:rgba(255,255,255,.62);

  /* Gold */
  --gold-hi: #FFF3D6;
  --gold-1:  #F7E6C3;
  --gold-2:  #F2D6A0;
  --gold-3:  #D7B06F;
  --gold-4:  #B88646;
  --gold-5:  #8A5A2C;

  --accent: rgba(242,214,160,.92);

  /* Lines */
  --line:  rgba(255,255,255,.10);
  --line2: rgba(255,255,255,.075);

  /* Shadows */
  --shadowA: 0 28px 90px rgba(0,0,0,.55);
  --shadowB: 0 16px 48px rgba(0,0,0,.38);
  --shadowC: 0 10px 26px rgba(0,0,0,.24);

  --ease: cubic-bezier(.2,.8,.2,1);

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 74px;
  --topbar-h: 76px;

  /* Drawer breakpoint: Tablets sollen Drawer bekommen */
  --drawer-bp: 768px;
}
/* When collapsed, also shift content (fix: collapse must be obvious & usable) */
body.sidebar-collapsed{
  --sidebar-w: var(--sidebar-w-collapsed);
}



/* ---------------------------
   1) Base + Reset
---------------------------- */
*{ box-sizing:border-box; }
html{
  scroll-behavior:smooth;
  background: var(--bg0);
  color-scheme: dark;
}
body{
  margin:0;
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  background:
    radial-gradient(980px 680px at 14% 8%, rgba(215,176,111,.08), transparent 62%),
    radial-gradient(860px 620px at 88% 14%, rgba(184,134,70,.05), transparent 60%),
    radial-gradient(1100px 780px at 50% 120%, rgba(18,13,10,.26), transparent 62%),
    linear-gradient(180deg, var(--bg0) 0%, var(--bg1) 55%, var(--bg0) 100%);
}
img{ max-width:100%; display:block; }
a{ color:inherit; }
p{ margin:0; }
ul{ margin:0; padding:0; }
li{ margin:0; list-style:none; }

.container{
  width:100%;
  max-width: var(--max);
  margin:0 auto;
  padding: 0 var(--pad);
}

/* Watermark (reduziert + cards sind dichter) */
body::before{
  content:"";
  position: fixed;
  inset: -35%;
  pointer-events: none;
  z-index: 0;
  background-image: url("assets/sf-logo.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 140vmin;
  opacity: 0.035; /* vorher zu stark */
  transform: rotate(-12deg);
  filter: saturate(1.05) contrast(1.06) brightness(1.12);
  mix-blend-mode: normal;
}
body{ position: relative; }
body::before{ z-index: 0; }
.app-shell,
.login-wrap{ position: relative; }

:focus-visible{
  outline: 3px solid rgba(215,176,111,.45);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto !important; }
  *, *::before, *::after{ animation:none !important; transition:none !important; }
}


/* ---------------------------
   2) Typography
---------------------------- */
h1{
  margin:0;
  font-size: clamp(1.9rem, 3.2vw, 2.55rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 980;
}
h2, h3{
  margin:0;
  letter-spacing: -0.02em;
  font-weight: 950;
}
h2{ font-size: 1.34rem; }
h3{ font-size: 1.05rem; }

.lead{
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 1.02rem;
}
.small{ font-size: .95rem; line-height: 1.55; color: var(--muted); }
.muted{ color: var(--muted); }


/* ---------------------------
   3) Buttons
---------------------------- */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding: 11px 14px;
  border-radius: 12px;
  text-decoration:none;
  font-weight: 900;
  letter-spacing: .12px;

  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);

  box-shadow: 0 12px 34px rgba(0,0,0,.28), 0 0 0 1px rgba(255,255,255,.04) inset;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), border-color .16s var(--ease), filter .16s var(--ease), opacity .16s var(--ease);
  user-select:none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0); opacity:.97; }

.btn--primary{
  color: #0e1116;
  border-color: rgba(255,255,255,.22);
  background:
    linear-gradient(180deg, rgba(255,255,255,.40), rgba(255,255,255,0) 44%),
    linear-gradient(135deg,
      var(--gold-hi) 0%,
      var(--gold-1) 18%,
      var(--gold-2) 36%,
      var(--gold-3) 60%,
      var(--gold-4) 88%,
      var(--gold-5) 118%
    );
  box-shadow:
    0 20px 72px rgba(0,0,0,.52),
    0 14px 34px rgba(215,176,111,.12),
    inset 0 1px 0 rgba(255,255,255,.68),
    inset 0 -10px 18px rgba(0,0,0,.16);
}
.btn--primary:hover{ filter: brightness(1.03) saturate(1.02); }

.btn--ghost{
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.13);
  color: rgba(255,255,255,.88);
}
.btn--ghost:hover{
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.17);
}

.iconbtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.86);
  cursor:pointer;
  user-select:none;
  transition: transform .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}
.iconbtn:hover{ background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); }
.iconbtn:active{ opacity:.98; }


/* ---------------------------
   4) Cards / Grid / Hero
---------------------------- */
.section{ padding: 18px 0 40px; }

.grid{ display:grid; gap: 14px; }
.grid--3{ grid-template-columns: repeat(3, 1fr); }
.grid--2{ grid-template-columns: repeat(2, 1fr); }

.card{
  border-radius: var(--r-lg);
  border: 1px solid var(--edge);
  background:
    radial-gradient(820px 360px at 16% 0%, rgba(215,176,111,.040), transparent 62%),
    linear-gradient(180deg, var(--surface), var(--surface2));
  padding: 16px;
  box-shadow: var(--shadowB);
  transition: transform .16s var(--ease), border-color .16s var(--ease), box-shadow .16s var(--ease), filter .16s var(--ease);
}
@media (hover:hover){
  .card:hover{
    transform: translateY(-2px);
    border-color: rgba(215,176,111,.20);
    box-shadow: 0 22px 78px rgba(0,0,0,.48);
    filter: brightness(1.01);
  }
}
.card__header{ display:flex; flex-direction:column; gap: 10px; }
.card__body{ margin-top: 10px; }
.card-cta{ display:flex; align-items:center; gap: 10px; margin-top: 12px; flex-wrap:wrap; }

.pill{
  width: fit-content;
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(215,176,111,.20);
  background: rgba(215,176,111,.07);
  color: rgba(242,214,160,.92);
  font-weight: 950;
  font-size: 12px;
  letter-spacing: .16px;
}

.hero{ padding: 30px 0 18px; }
.hero__grid{
  display:grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 16px;
  align-items:start;
}
.note{
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(215,176,111,.16);
  background:
    radial-gradient(680px 240px at 12% 0%, rgba(215,176,111,.08), transparent 62%),
    rgba(18,24,39,.78);
  color: rgba(255,255,255,.90);
  box-shadow: var(--shadowC);
}
.note b{ color: rgba(255,255,255,.96); }

.hero__card{
  border-radius: var(--r-lg);
  border: 1px solid var(--edge);
  background:
    radial-gradient(900px 420px at 18% 0%, rgba(215,176,111,.05), transparent 62%),
    linear-gradient(180deg, var(--surface), var(--surface2));
  box-shadow: var(--shadowB);
  padding: 14px;
}


/* ---------------------------
   5) Footer
---------------------------- */
.footer{
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 20px 0 32px;
  color: rgba(255,255,255,.60);
  font-size: 13px;
  background: rgba(255,255,255,.025);
}
.footer__inner{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
  flex-wrap:wrap;
}
.footer__title{ font-weight: 950; color: rgba(255,255,255,.86); }
.footer__links{ display:flex; gap: 14px; flex-wrap:wrap; }
.footer__links a{ text-decoration:none; color: rgba(255,255,255,.62); }
.footer__links a:hover{ color: rgba(255,255,255,.90); }


/* ==========================================================
   6) LOGIN (isolated)
   ========================================================== */
.login-wrap{
  min-height: 100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 28px 18px;
}
.login-shell{ width: min(560px, 100%); }

.brandline{
  display:flex;
  align-items:center;
  gap: 12px;
  margin-bottom: 14px;
}
.brandline__logo{
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  object-fit: contain;
  padding: 6px;
  border: 1px solid rgba(215,176,111,.20);
  background:
    radial-gradient(120% 90% at 25% 20%, rgba(255,255,255,.10), rgba(255,255,255,0) 58%),
    linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
  box-shadow: 0 12px 34px rgba(0,0,0,.44);
}
.brandline__name{ font-weight: 950; letter-spacing: -0.02em; line-height: 1.1; }
.brandline__sub{ margin-top: 2px; color: var(--muted2); font-size: .92rem; line-height: 1.25; }

.login-card{
  border-radius: var(--r-xl);
  overflow:hidden;
  border: 1px solid var(--edge);
  background:
    radial-gradient(820px 360px at 16% 0%, rgba(215,176,111,.045), transparent 62%),
    linear-gradient(180deg, var(--surface), var(--surface2));
  box-shadow: var(--shadowA);
}
.login-card__top{
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,0));
}
.login-title{ margin:0; font-size: 1.52rem; letter-spacing: -0.02em; line-height: 1.1; font-weight: 980; }
.login-desc{ margin: 8px 0 0; color: var(--muted); line-height: 1.45; font-size: .98rem; }
.login-card__body{ padding: 16px 18px 18px; }

.field{ display:grid; gap: 8px; margin-top: 14px; }
.label{ font-size: .92rem; color: var(--muted2); }
.input{
  width:100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  box-shadow: 0 10px 22px rgba(0,0,0,.14) inset;
}
.input::placeholder{ color: rgba(255,255,255,.44); }
.input:focus{
  outline:none;
  border-color: rgba(215,176,111,.38);
  box-shadow: 0 0 0 4px rgba(215,176,111,.12);
}
.error{
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,90,90,.28);
  background: rgba(255,90,90,.10);
  color: #ffd4d4;
  font-size: .95rem;
  line-height: 1.35;
}
.actions{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  align-items:center;
  margin-top: 16px;
}
.actions .btn{ flex: 1 1 auto; min-width: 150px; }
.sub-actions{
  display:flex;
  justify-content:space-between;
  gap: 10px;
  margin-top: 12px;
  flex-wrap:wrap;
}
.sub-actions a{
  color: var(--muted2);
  font-size: .92rem;
  text-decoration:none;
}
.sub-actions a:hover{
  color: rgba(255,255,255,.92);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.footnote{
  margin: 14px 0 0;
  color: rgba(255,255,255,.64);
  font-size: .92rem;
  line-height: 1.45;
}


/* ==========================================================
   7) APP SHELL (Desktop fixed sidebar + content beside)
   ========================================================== */
.app-shell{ min-height: 100vh; }

/* Sidebar (desktop default) */
.sidebar{
  position: fixed;
  top: 0; left: 0; bottom: 0;

  width: var(--sidebar-w);
  display:flex;
  flex-direction:column;
  padding: 14px 12px 16px;

  border-right: 0;
  background: linear-gradient(180deg, rgba(18,24,39,.92), rgba(15,19,26,.86));
  box-shadow: 18px 0 60px rgba(0,0,0,.16);

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;

  z-index: 120;

  transform: translateZ(0);
  will-change: transform;
  filter: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Divider line (inner, not fixed viewport) */
.sidebar::after{
  content:"";
  position: absolute;
  top: 0; bottom: 0;
  right: 0;
  width: 1px;
  background: linear-gradient(180deg,
    rgba(255,255,255,.10),
    rgba(255,255,255,.05),
    rgba(255,255,255,.08)
  );
  pointer-events:none;
  opacity:.55;
}

/* Content sits beside sidebar */
.app-content{
  margin-left: var(--sidebar-w);
  min-width: 0;
}
.page{
  padding-bottom: 40px;
  position: relative;
  z-index: 0;
}
.page::before{
  content:"";
  position:absolute;
  inset:0;
  background: radial-gradient(900px 500px at 30% 20%, rgba(255,255,255,.03), transparent 60%);
  pointer-events:none;
  z-index: 0;
}
.page > *{ position: relative; z-index: 1; }

/* Backdrop element exists, but only visible on drawer mode */
.sidebar-backdrop{
  display:none;
  position: fixed;
  inset: 0;
  background: rgba(10,12,16,.42);
  z-index: 999;       /* unter Sidebar */
  pointer-events: auto;
}

/* Drawer Sidebar */
@media (max-width: 768px){
  .sidebar{ z-index: 1000; } /* über Backdrop */
  body.sidebar-open .sidebar-backdrop{ display:block; }
}


/* --------------------------------
   Sidebar brand
---------------------------------- */
.sidebar__brand{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,.07);
  background:
    radial-gradient(900px 380px at 20% 0%, rgba(215,176,111,.08), transparent 55%),
    rgba(255,255,255,.02);
  box-shadow: 0 10px 26px rgba(0,0,0,.20);
}

.brand.brand--compact{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.brand__logo{
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  padding: 6px;
  object-fit: contain;

  border: 1px solid rgba(215,176,111,.18);
  background:
    radial-gradient(140% 120% at 30% 20%, rgba(255,255,255,.12), rgba(255,255,255,0) 58%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  box-shadow: 0 10px 20px rgba(0,0,0,.32);
  filter: saturate(1.02) contrast(1.10) brightness(1.12);
}

.brand__text{ min-width: 0; display:flex; flex-direction:column; }
.brand__name{
  font-weight: 950;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand__tag{
  margin-top: 2px;
  color: rgba(255,255,255,.66);
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Toggle button (top right) */
.sidebar__toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.09);
  background: rgba(255,255,255,.03);
  cursor:pointer;
  user-select:none;
  transition: transform .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease);
}
.sidebar__toggle:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.06);
  border-color: rgba(215,176,111,.18);
}
.sidebar__toggle:active{ opacity:.98; }

/* MUST rotate this element */
.toggle-icon{
  width:18px;
  height:18px;
  opacity:.90;
  transition: transform .22s var(--ease), opacity .16s var(--ease);
  transform: rotate(0deg);
}
.sidebar__toggle:hover .toggle-icon{ opacity: 1; }
body.sidebar-collapsed .sidebar__toggle .toggle-icon{ transform: rotate(180deg); }

/* Sections + nav */
.sidebar__section{
  margin-top: 14px;
  padding: 8px 10px;
  color: rgba(255,255,255,.52);
  font-weight: 900;
  letter-spacing: .16px;
  font-size: .78rem;
  text-transform: uppercase;
}

.side-nav{
  display:flex;
  flex-direction:column;
  gap: 6px;
  margin-top: 8px;
}

.side-link{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 12px;
  text-decoration:none;

  color: rgba(255,255,255,.86);
  border: 1px solid transparent;

  transition: background .16s var(--ease), border-color .16s var(--ease), transform .16s var(--ease), color .16s var(--ease);
}
.side-link:hover{
  color: rgba(255,255,255,.96);
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.08);
  transform: translateY(-1px);
}
.side-link.is-active{
  color: rgba(255,255,255,.96);
  border-color: rgba(215,176,111,.22);
  background:
    radial-gradient(680px 240px at 10% 0%, rgba(215,176,111,.12), transparent 62%),
    rgba(255,255,255,.05);
  box-shadow: 0 14px 40px rgba(0,0,0,.22);
}

.side-icon{
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  opacity: .98;
  color: rgba(255,230,180,.95);
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.34));
  transition: transform .16s var(--ease), opacity .16s var(--ease);
}
.side-link:hover .side-icon{ transform: translateY(-1px) scale(1.03); opacity: 1; }

.side-text{
  display:flex;
  flex-direction:column;
  gap: 2px;
  min-width: 0;
}
.side-title{ font-weight: 950; letter-spacing: -0.01em; line-height: 1.1; }
.side-sub{ font-size: .88rem; color: rgba(255,255,255,.74); line-height: 1.2; }

/* Sidebar footer */
.sidebar__footer{
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar__mini{
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:space-between;
  padding-top: 10px;
}
.sidebar__mini .btn{
  flex: 1 1 0;
  min-width: 0;
  justify-content:center;
  padding-left: 12px;
  padding-right: 12px;
}


/* ==========================================================
   7.1) COLLAPSED (Desktop)
   - Sidebar narrower, icon-only
   - Brand clean (no frame)
   - Footer text weg
   - Bottom arrow/buttons weg
   ========================================================== */
body.sidebar-collapsed .sidebar{
  width: var(--sidebar-w-collapsed);
  padding: 12px 10px 14px;
}
body.sidebar-collapsed .app-content{
  margin-left: var(--sidebar-w-collapsed);
}

/* Hide labels + footer text */
body.sidebar-collapsed .brand__text,
body.sidebar-collapsed .side-text,
body.sidebar-collapsed .sidebar__section,
body.sidebar-collapsed .sidebar__footer .small,
body.sidebar-collapsed .sidebar__footer p,
body.sidebar-collapsed .sidebar__footer span{
  display:none !important;
}

/* Footer area visually gone */
body.sidebar-collapsed .sidebar__footer{
  padding-top: 0;
  border-top: 0;
}

/* Center links */
body.sidebar-collapsed .side-link{
  justify-content:center;
  padding: 12px 10px;
}

/* Brand: remove frame */
body.sidebar-collapsed .sidebar__brand{
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  justify-content:center;
}
body.sidebar-collapsed .brand__logo{
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  padding: 0 !important;
}

/* Bottom collapse/arrow MUST be gone when collapsed */
body.sidebar-collapsed .sidebar__mini button,
body.sidebar-collapsed .sidebar__mini .btn--collapse,
body.sidebar-collapsed .sidebar__mini .collapse-btn{
  display:none !important;
}

/* Logout link becomes icon-only in collapsed (wenn es a.btn ist) */
body.sidebar-collapsed .sidebar__mini a.btn{
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 14px;
  font-size: 0;
  line-height: 0;
  position: relative;
  gap: 0;
}
body.sidebar-collapsed .sidebar__mini a.btn::before{
  content:"⎋";
  font-size: 18px;
  line-height: 1;
  display:inline-block;
  transform: translateY(1px);
}


/* ==========================================================
   8) TOPBAR
   ========================================================== */
.topbar{
  position: sticky;
  top: 0;
  z-index: 100;

  background: linear-gradient(180deg, rgba(18,24,39,.88), rgba(15,19,26,.66));
  border-bottom: 1px solid rgba(255,255,255,.08);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  box-shadow: 0 18px 60px rgba(0,0,0,.38);
}
.topbar::after{
  content:"";
  position:absolute;
  left:0; right:0; bottom:-1px;
  height:1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(242,214,160,.16),
    rgba(255,255,255,.06),
    rgba(242,214,160,.10),
    transparent
  );
  opacity:.85;
  pointer-events:none;
}

.topbar__inner{
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: var(--topbar-h);
  padding: 12px 0;
}

.topbar-left{ display:flex; align-items:center; gap: 12px; min-width: 0; }
.topbar-center{ display:flex; align-items:center; justify-content:center; min-width: 0; gap: 10px; color: rgba(255,255,255,.70); font-size: .92rem; }
.topbar-right{ display:flex; align-items:center; justify-content:flex-end; gap: 10px; min-width: 0; }

.topbar-actions{ display:flex; align-items:center; justify-content:flex-end; gap: 10px; flex-wrap: wrap; min-width: 0; }

.topbar-user{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background:
    radial-gradient(520px 240px at 12% 0%, rgba(215,176,111,.08), transparent 60%),
    rgba(255,255,255,.04);
  color: rgba(255,255,255,.88);
  font-size: .95rem;
  white-space: nowrap;
  box-shadow: 0 10px 26px rgba(0,0,0,.16);
}
.topbar-user strong{ color: rgba(255,255,255,.96); font-weight: 950; }

/* burger */
.topbar-burger{
  display: none;
  padding: 10px 12px;
  border-radius: 12px;
}

/* Title helper */
.topbar-title{
  display:flex;
  align-items:baseline;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: rgba(255,255,255,.80);
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
}
.topbar-title__label{
  font-size: .78rem;
  letter-spacing: .16px;
  text-transform: uppercase;
  color: rgba(255,255,255,.56);
  font-weight: 900;
}
.topbar-title__sep{ color: rgba(255,255,255,.35); font-weight: 900; }
.topbar-title__page{
  font-size: .98rem;
  font-weight: 950;
  letter-spacing: -0.01em;
  color: rgba(255,255,255,.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22ch;
}

.topbar-center__slot{
  width: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background:
    radial-gradient(520px 240px at 50% 0%, rgba(215,176,111,.07), transparent 60%),
    rgba(255,255,255,.03);
  color: rgba(255,255,255,.78);
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
  min-height: 44px;
}
.topbar-center__slot.is-empty{ opacity: .55; }


/* ==========================================================
   9) Responsive: TABLET+MOBILE -> Drawer Sidebar
   ========================================================== */
@media (max-width: 980px){
  .topbar-title{ display:none; }
}

/* Drawer Mode für Tablets & Mobile */
@media (max-width: 768px){
  :root{ --pad: 16px; }

  .hero__grid{ grid-template-columns: 1fr; }
  .grid--3{ grid-template-columns: 1fr; }
  .grid--2{ grid-template-columns: 1fr; }

  /* content full width */
  .app-content{ margin-left: 0; }

  /* Sidebar becomes drawer */
  .sidebar{
    inset: 0 auto 0 0;
    width: min(86vw, 360px);
    transform: translateX(-110%);
    transition: transform .22s var(--ease);

    /* readable + crisp */
    background: linear-gradient(180deg, rgba(20,26,40,.96), rgba(14,18,28,.92));
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;

    box-shadow: 30px 0 90px rgba(0,0,0,.55);
    /* Drawer must sit ABOVE backdrop (backdrop is 999). */
    z-index: 1000;
  }

  /* divider not needed on drawer */
  .sidebar::after{ display:none; }

  /* Backdrop on open */
  body.sidebar-open .sidebar{ transform: translateX(0%); }
  body.sidebar-open .sidebar-backdrop{ display:block; }

  /* show burger */
  .topbar-burger{ display:inline-flex; }

  /* collapsed makes no sense on drawer -> treat as expanded */
  body.sidebar-collapsed .sidebar{
    width: min(86vw, 360px);
    padding: 14px 12px 16px;
  }
  body.sidebar-collapsed .sidebar__brand{
    border: 1px solid rgba(255,255,255,.07) !important;
    background:
      radial-gradient(900px 380px at 20% 0%, rgba(215,176,111,.08), transparent 55%),
      rgba(255,255,255,.02) !important;
    box-shadow: 0 10px 26px rgba(0,0,0,.20) !important;
    padding: 10px 10px !important;
    justify-content:space-between !important;
  }
  body.sidebar-collapsed .brand__text,
  body.sidebar-collapsed .side-text,
  body.sidebar-collapsed .sidebar__section{
    display:block !important;
  }
  body.sidebar-collapsed .side-link{
    justify-content:flex-start;
    padding: 12px 12px;
  }
  body.sidebar-collapsed .sidebar__mini a.btn{
    width:auto;
    height:auto;
    font-size: inherit;
    line-height: inherit;
  }
  body.sidebar-collapsed .sidebar__mini a.btn::before{
    content:none !important;
  }

  /* Higher contrast in drawer */
  .side-title{ color: rgba(255,255,255,.96); }
  .side-sub{ color: rgba(255,255,255,.72); }
  .sidebar__section{ color: rgba(255,255,255,.62); }
  .side-icon{
    color: rgba(255,230,180,.95);
    filter: drop-shadow(0 4px 10px rgba(0,0,0,.45));
  }
  .side-link:hover{ background: rgba(255,255,255,.08); }
  .side-link.is-active{
    background:
      radial-gradient(600px 220px at 10% 0%, rgba(215,176,111,.18), transparent 62%),
      rgba(255,255,255,.07);
    border-color: rgba(215,176,111,.28);
  }
}

@media (max-width: 520px){
  .hero{ padding: 26px 0 14px; }
  .card{ padding: 14px; }
  .btn{ width:100%; }
  .sidebar__mini .btn{ width:auto; }

  .topbar__inner{
    min-height: 72px;
    padding: 10px 0;
    gap: 10px;
    grid-template-columns: auto 1fr;
  }
  .topbar-center{ display:none; }
  .topbar-user{ padding: 9px 10px; font-size: .92rem; }
}


/* Desktop safety: sidebar-open should not shift fixed sidebar */
@media (min-width: 1025px){
  body.sidebar-open .sidebar{ transform: none !important; }
  .sidebar-backdrop{ display:none !important; }
}


/* ==========================================================
   10) Premium micro (subtle)
   ========================================================== */
.side-link{ position: relative; overflow: hidden; }
@media (hover:hover){
  .side-link::before{
    content:"";
    position:absolute;
    inset:0;
    background: linear-gradient(90deg, transparent, rgba(242,214,160,.08), transparent);
    transform: translateX(-110%);
    transition: transform .55s var(--ease);
    pointer-events:none;
    opacity: .9;
  }
  .side-link:hover::before{ transform: translateX(110%); }
}
@media (prefers-reduced-motion: reduce){
  .side-link::before{ display:none !important; }
}

/* ===============================
   Drawer Layering (Tablet+Mobile)
   =============================== */

/* Backdrop default: inert */
.sidebar-backdrop{
  display:none;
  pointer-events:none;
}

/* Drawer mode */
@media (max-width: 768px){

  /* Backdrop: blocks page, clickable to close */
  body.sidebar-open .sidebar-backdrop{
    display:block;
    position: fixed;
    inset: 0;
    background: rgba(10,12,16,.42);
    z-index: 1000;
    pointer-events: auto;
  }

  /* Sidebar: MUST be above backdrop + clickable */
  .sidebar{
    z-index: 1010;
    pointer-events: auto;
    touch-action: pan-y;
  }

  /* Safety: if anything weird disables clicks */
  .sidebar *{
    pointer-events: auto;
  }
}

/* Support Modal */
.sf-modal{ position:fixed; inset:0; display:none; z-index:1000; }
.sf-modal.is-open{ display:block; }

.sf-modal__backdrop{
  position:absolute; inset:0;
  background: rgba(10,12,16,.55);
}

.sf-modal__panel{
  position:absolute;
  left:50%; top:50%;
  transform: translate(-50%,-50%);
  width: min(92vw, 760px);
  max-height: min(86vh, 720px);
  overflow:auto;

  border-radius: var(--r-lg);
  border: 1px solid var(--edge);
  background: linear-gradient(180deg, var(--surface), var(--surface2));
  box-shadow: var(--shadowA);
}

.sf-modal__head{
  position: sticky; top: 0;
  display:flex; align-items:center; justify-content:space-between;
  gap: 12px;
  padding: 14px 14px;

  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(18,24,39,.94);
}

.sf-modal__title{ font-weight: 950; letter-spacing: -0.01em; }
.sf-modal__body{ padding: 14px 14px 18px; }

/* textarea optisch wie input */
textarea.input{ resize: vertical; min-height: 140px; }

/* ==========================================================
   SOCIALFREEDOM — COACH DRAWER (FINAL)
   - Overlay Drawer rechts (Desktop + Mobile)
   - Passt visuell zum Workspace (Glass/Gold)
   - Kein Einfluss auf Footer/Flow (fixed + z-index)
   - Open-State via: body.coach-open
   ========================================================== */

/* ---------- Layering ---------- */
:root{
  --z-backdrop: 2000;
  --z-drawer:   2010;
  --coach-w: 420px;
}

/* Backdrop */
.coach-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(10,12,16,.46);
  z-index: var(--z-backdrop);
  display: none;
  opacity: 0;
  transition: opacity .18s var(--ease);
  pointer-events: none;
}

/* Drawer shell */
.coach-drawer{
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;

  width: min(92vw, var(--coach-w));
  z-index: var(--z-drawer);

  /* slide off-canvas */
  transform: translateX(110%);
  transition: transform .22s var(--ease);

  /* layout */
  display: flex;
  flex-direction: column;

  /* premium surface */
  border-left: 1px solid rgba(255,255,255,.10);
  background:
    radial-gradient(900px 420px at 20% 0%, rgba(215,176,111,.08), transparent 60%),
    linear-gradient(180deg, rgba(20,26,40,.96), rgba(14,18,28,.94));

  box-shadow: -24px 0 90px rgba(0,0,0,.58);
  will-change: transform;
}

/* OPEN STATE */
body.coach-open .coach-backdrop{
  display: block;
  opacity: 1;
  pointer-events: auto;
}

body.coach-open .coach-drawer{
  transform: translateX(0);
}

/* Optional: Body scroll lock when coach is open (wenn du willst) */
/*
body.coach-open{
  overflow: hidden;
}
*/

/* ---------- Header ---------- */
.coach-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 14px 14px;

  border-bottom: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0));
}

.coach-title{
  display:flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.coach-title strong{
  font-weight: 980;
  letter-spacing: -0.02em;
  color: rgba(255,255,255,.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.coach-title span{
  font-size: .92rem;
  color: rgba(255,255,255,.66);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coach-close{
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.86);
  cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease), transform .16s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.coach-close:hover{
  background: rgba(255,255,255,.08);
  border-color: rgba(215,176,111,.18);
  transform: translateY(-1px);
}
.coach-close:active{
  transform: translateY(0);
  opacity: .96;
}

/* ---------- Body (chat area) ---------- */
.coach-body{
  flex: 1 1 auto;
  min-height: 0;

  padding: 14px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;

  /* slight inner glow */
  background:
    radial-gradient(820px 360px at 40% 0%, rgba(255,255,255,.03), transparent 60%);
}

/* simple message bubbles (optional baseline) */
.coach-msg{
  display:flex;
  gap: 10px;
  margin-bottom: 10px;
}
.coach-bubble{
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.90);
  line-height: 1.5;
  box-shadow: 0 10px 22px rgba(0,0,0,.18);
}
.coach-bubble--me{
  margin-left: auto;
  border-color: rgba(215,176,111,.20);
  background:
    radial-gradient(520px 240px at 20% 0%, rgba(215,176,111,.10), transparent 60%),
    rgba(255,255,255,.05);
}

/* ---------- Footer (input row) ---------- */
.coach-footer{
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
  display:flex;
  gap: 10px;
  align-items:center;
}

.coach-input{
  flex: 1 1 auto;
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.94);
  outline: none;
  box-shadow: 0 10px 22px rgba(0,0,0,.14) inset;
}
.coach-input::placeholder{
  color: rgba(255,255,255,.46);
}
.coach-input:focus{
  border-color: rgba(215,176,111,.38);
  box-shadow: 0 0 0 4px rgba(215,176,111,.12);
}

/* Button in drawer: keep your existing .btn styles, just ensure sizing */
.coach-footer .btn{
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 520px){
  .coach-footer{
    flex-direction: column;
    align-items: stretch;
  }
  .coach-footer .btn{
    width: 100%;
  }
}

/* ---------- Accessibility / Motion ---------- */
@media (prefers-reduced-motion: reduce){
  .coach-drawer,
  .coach-backdrop{
    transition: none !important;
  }
}

/* ==========================================================
   11) COACH DRAWER (Global Overlay)
   - Desktop/Tablet: slide in from right
   - Mobile: slide up from bottom
   ========================================================== */

:root{
  --coach-w: 420px;
  --coach-h-mobile: 86vh;
  --coach-z: 120; /* must be above sidebar/topbar/modals */
}

/* Backdrop */
.coach-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(10,12,16,.55);
  opacity: 0;
  pointer-events: none;
  z-index: var(--coach-z);
  transition: opacity .18s var(--ease);
  /* no blur -> crisp */
}

/* Drawer base */
.coach-drawer{
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;

  width: min(var(--coach-w), 92vw);
  height: 100vh;

  display: grid;
  grid-template-rows: auto 1fr auto;

  border-left: 1px solid rgba(255,255,255,.10);
  background:
    radial-gradient(900px 420px at 20% 0%, rgba(215,176,111,.08), transparent 60%),
    linear-gradient(180deg, rgba(18,24,39,.96), rgba(15,19,26,.92));
  box-shadow: 0 30px 120px rgba(0,0,0,.72);

  transform: translateX(104%);
  opacity: 1;
  z-index: calc(var(--coach-z) + 1);

  pointer-events: auto;

  /* prevent “matsch” on mobile */
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;

  /* iOS scroll stability */
  -webkit-overflow-scrolling: touch;
}

/* Open state */
body.coach-open .coach-backdrop{
  opacity: 1;
  pointer-events: auto;
}
body.coach-open .coach-drawer{
  transform: translateX(0%);
}

/* Header */
.coach-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;

  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0));
}

.coach-title{
  display:flex;
  flex-direction:column;
  min-width: 0;
}
.coach-title strong{
  font-weight: 950;
  letter-spacing: -0.02em;
  color: rgba(255,255,255,.92);
  line-height: 1.15;
}
.coach-title span{
  margin-top: 2px;
  color: rgba(255,255,255,.58);
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coach-close{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.86);
  cursor: pointer;
  transition: transform .16s var(--ease), background .16s var(--ease), border-color .16s var(--ease), opacity .16s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.coach-close:hover{
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.14);
  transform: translateY(-1px);
}
.coach-close:active{ transform: translateY(0); opacity:.96; }

/* Body */
.coach-body{
  padding: 14px;
  overflow: auto;
}
.coach-body p{ margin:0; }

/* Footer input row */
.coach-footer{
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,.04));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.coach-input{
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  box-shadow: 0 10px 22px rgba(0,0,0,.14) inset;
  outline: none;
}
.coach-input::placeholder{ color: rgba(255,255,255,.46); }
.coach-input:focus{
  border-color: rgba(215,176,111,.38);
  box-shadow: 0 0 0 4px rgba(215,176,111,.12);
}

/* Floating button */
.coach-fab{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: calc(var(--coach-z) + 2);

  display:inline-flex;
  align-items:center;
  gap: 10px;

  padding: 12px 14px;
  border-radius: 999px;

  border: 1px solid rgba(215,176,111,.22);
  background:
    radial-gradient(220px 90px at 30% 0%, rgba(215,176,111,.14), transparent 60%),
    rgba(18,24,39,.86);

  color: rgba(255,255,255,.92);
  font-weight: 950;
  letter-spacing: .10px;

  box-shadow: 0 22px 70px rgba(0,0,0,.55);
  cursor:pointer;
  -webkit-tap-highlight-color: transparent;

  transition: transform .16s var(--ease), border-color .16s var(--ease), background .16s var(--ease), opacity .16s var(--ease);
}
.coach-fab:hover{
  transform: translateY(-1px);
  border-color: rgba(215,176,111,.30);
  background:
    radial-gradient(260px 100px at 30% 0%, rgba(215,176,111,.18), transparent 60%),
    rgba(18,24,39,.92);
}
.coach-fab:active{ transform: translateY(0); opacity:.96; }

.coach-fab__dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(242,214,160,.95);
  box-shadow: 0 0 0 3px rgba(242,214,160,.14);
}

/* Optional: hide FAB when coach is open */
body.coach-open .coach-fab{
  opacity: 0;
  pointer-events: none;
}

/* Optional: lock page scroll when coach open */
body.coach-open{
  overflow: hidden;
  touch-action: none;
}

/* ===== Mobile: slide up from bottom ===== */
@media (max-width: 860px){
  .coach-drawer{
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;

    width: 100%;
    height: var(--coach-h-mobile);

    border-left: 0;
    border-top: 1px solid rgba(255,255,255,.10);
    border-radius: 18px 18px 0 0;

    transform: translateY(104%);
  }

  body.coach-open .coach-drawer{
    transform: translateY(0%);
  }

  .coach-fab{
    right: 14px;
    bottom: 14px;
  }
}

/* ==========================================================
   COACH UI – Chat Bubbles (App-like)
   ========================================================== */

.coach-msg{
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  margin: 10px 0;
  line-height: 1.45;
  font-size: .98rem;

  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
}

.coach-msg--user{
  margin-left: auto;

  border-color: rgba(215,176,111,.22);
  background:
    radial-gradient(
      420px 160px at 30% 0%,
      rgba(215,176,111,.10),
      transparent 62%
    ),
    rgba(255,255,255,.04);
}

/* ==========================================================
   COACH DRAWER – Layout Fix (Input immer sichtbar)
   ========================================================== */

.coach-drawer{
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(420px, calc(100vw - 32px));
  height: min(680px, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;

  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(18,24,39,.92);
  box-shadow: 0 28px 90px rgba(0,0,0,.55);
  overflow: hidden;

  z-index: 200; /* über Footer/Sidebar */
}

.coach-header{
  flex: 0 0 auto;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0));
}

.coach-body{
  flex: 1 1 auto;
  min-height: 0;              /* WICHTIG: sonst drückt der Body den Footer raus */
  overflow: auto;
  padding: 14px;
}

.coach-footer{
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;

  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(10,12,16,.35);
}

.coach-input{
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.94);
}

.coach-footer .btn{
  flex: 0 0 auto;
  height: 44px;
  padding: 0 14px;
  white-space: nowrap;
}

/* Next Output module (premium focus) */
.sf-next-output .card{border:1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.04);}
.sf-next-output .card-cta{box-shadow: 0 18px 60px rgba(0,0,0,.35);}


/* SF v3: featured cards + small layout helpers */
.card--featured{border:1px solid rgba(242,214,160,.35); box-shadow: 0 10px 30px rgba(0,0,0,.12);}
.row--gap{display:flex;flex-wrap:wrap;gap:10px;align-items:center;}
.spacer{height:20px;}
.spacer-xs{height:10px;}
