/* Community Claudia Ruhnau – Grundgestaltung */
:root {
  --gold: #DA9D39;
  --gold-dark: #B9822B;
  --plum: #611B65;
  --plum-soft: #7A3E7E;
  --brown: #66491B;
  --teal: #4F716E;
  --cream: #FDFAF7;
  --sand: #F4ECE2;
  --ink: #2A2118;
  --muted: #6F6154;
  --line: #E8DED2;
  --white: #FFFFFF;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(42, 33, 24, .06), 0 1px 3px rgba(42, 33, 24, .04);
  --shadow: 0 10px 30px -12px rgba(42, 33, 24, .18), 0 2px 6px rgba(42, 33, 24, .05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
h2 { font-size: 1.28rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
a { color: var(--plum); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
small { font-size: .82rem; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.eyebrow {
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold-dark);
  font-weight: 600;
  margin: 0 0 .5rem;
}
.eyebrow a { color: inherit; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--white); padding: .6rem 1rem; border-radius: 8px; z-index: 99; }

/* ------------------------------------------------------------------ Kopfzeile */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .7rem clamp(1rem, 3vw, 2rem);
  background: rgba(253, 250, 247, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--plum), #8C4A8F);
  color: #fff;
  font-family: var(--serif);
  font-size: .95rem;
  letter-spacing: .02em;
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--serif); font-size: 1.02rem; font-weight: 600; }
.brand-text small { color: var(--muted); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.navtoggle { display: none; background: none; border: 0; padding: .4rem; cursor: pointer; }
.navtoggle span { display: block; width: 20px; height: 2px; background: var(--ink); margin: 4px 0; border-radius: 2px; }

/* ---------------------------------------------------------------------- Layout */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: clamp(1rem, 2.5vw, 2.5rem); max-width: 1240px; margin: 0 auto; padding: clamp(1rem, 2.5vw, 2rem); }

.sidebar { position: sticky; top: 74px; align-self: start; display: flex; flex-direction: column; gap: 1.5rem; }
.nav { display: flex; flex-direction: column; gap: .1rem; }
.nav-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 1rem 0 .35rem .75rem; }
.nav-title:first-child { margin-top: 0; }
.nav-link {
  display: flex; align-items: center; gap: .55rem;
  padding: .55rem .75rem;
  border-radius: 10px;
  color: var(--ink);
  font-size: .94rem;
  border: 1px solid transparent;
}
.nav-link:hover { background: var(--sand); text-decoration: none; }
.nav-link.active { background: var(--white); border-color: var(--line); box-shadow: var(--shadow-sm); font-weight: 600; }
.nav-empty { color: var(--muted); font-size: .85rem; padding: .4rem .75rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--gold)); flex: none; }
.sidebar-foot { display: flex; align-items: center; gap: .6rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.sidebar-foot strong { display: block; font-size: .86rem; }
.sidebar-foot small { color: var(--muted); font-size: .74rem; word-break: break-all; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--sand); color: var(--brown); font-size: .8rem; font-weight: 600; flex: none; }

.main { min-width: 0; }

.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.6rem; }
.page-head h1 { margin-bottom: .3rem; }
.page-head .muted { max-width: 62ch; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ------------------------------------------------------------------- Bausteine */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(1.1rem, 2vw, 1.7rem); box-shadow: var(--shadow-sm); margin-bottom: 1.4rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.4rem; }
.prose { line-height: 1.75; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .68rem 1.15rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .94rem;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--plum); color: #fff; box-shadow: 0 6px 16px -8px rgba(97, 27, 101, .8); }
.btn-primary:hover { background: #521754; }
.btn-ghost { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--sand); }
.btn-quiet { background: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--ink); background: var(--sand); }
.btn-danger { background: #A8322B; color: #fff; }
.btn-sm { padding: .45rem .85rem; font-size: .86rem; }
.btn-block { width: 100%; }
.inline { display: inline; }

.field { display: block; margin-bottom: 1rem; }
.field > span { display: block; font-size: .84rem; font-weight: 600; color: var(--brown); margin-bottom: .35rem; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=url], select, textarea {
  width: 100%;
  padding: .68rem .85rem;
  font: inherit;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(218, 157, 57, .18);
}
textarea { min-height: 110px; resize: vertical; }
input:disabled { background: var(--sand); color: var(--muted); }
.check { display: flex; align-items: flex-start; gap: .5rem; font-size: .9rem; margin-bottom: 1rem; color: var(--ink); }
.check input { margin-top: .25rem; }
.hint { color: var(--muted); font-size: .8rem; margin-top: -.4rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }

.notice { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .92rem; border: 1px solid; }
.notice-success { background: #EFF6EF; border-color: #CFE3CF; color: #2F5A34; }
.notice-error { background: #FBEFEE; border-color: #F0D3D1; color: #8C2B24; }
.notice-info { background: #F2F4F7; border-color: #DDE3EA; color: #34495E; }

.empty-state { background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius-lg); padding: clamp(1.6rem, 4vw, 3rem); text-align: center; }
.empty-state h1, .empty-state h2 { margin-bottom: .5rem; }
.error-state { max-width: 34rem; margin: 6vh auto; }

/* ------------------------------------------------------------- Anmeldeseite */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-brand {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: clamp(2rem, 5vw, 4rem);
  color: #FDF7EE;
  background:
    radial-gradient(120% 90% at 15% 10%, rgba(218, 157, 57, .32), transparent 60%),
    radial-gradient(90% 80% at 90% 90%, rgba(79, 113, 110, .35), transparent 65%),
    linear-gradient(160deg, #4A144D 0%, #611B65 45%, #3E103F 100%);
  overflow: hidden;
}
.auth-brand::after {
  content: "";
  position: absolute; inset: auto -10% -25% -10%; height: 55%;
  background: radial-gradient(closest-side, rgba(218, 157, 57, .18), transparent 70%);
}
.auth-brand-inner { position: relative; max-width: 30rem; }
.auth-brand .eyebrow { color: #E8C48A; }
.auth-brand h1 { font-size: clamp(2rem, 3.6vw, 2.9rem); color: #fff; margin-bottom: 1rem; }
.auth-brand .lead { font-size: 1.06rem; color: rgba(253, 247, 238, .86); max-width: 26rem; }
.auth-points { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .7rem; font-size: .95rem; color: rgba(253, 247, 238, .9); }
.auth-points li { display: flex; gap: .6rem; }
.auth-points li::before { content: "✓"; color: var(--gold); font-weight: 700; }
.auth-brand-foot { position: relative; font-size: .78rem; letter-spacing: .08em; color: rgba(253, 247, 238, .55); text-transform: uppercase; }

.auth-form { display: grid; place-items: center; padding: clamp(1.6rem, 5vw, 4rem); background: var(--cream); }
.auth-form-inner { width: min(26rem, 100%); }
.auth-form h2 { font-size: 1.7rem; margin-bottom: .2rem; }
.auth-help { margin-top: 1rem; font-size: .9rem; }
.auth-note { margin-top: 2rem; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 1rem; }

.center-card { min-height: 80vh; display: grid; place-items: center; padding: 2rem 1rem; }
.center-card-inner { width: min(27rem, 100%); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(1.4rem, 3vw, 2.2rem); box-shadow: var(--shadow); }

.guest { padding: 0; }
.guest .notice { max-width: 36rem; margin: 1rem auto 0; }

/* -------------------------------------------------------------- Gruppekarten */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 1.1rem; margin-bottom: 1.8rem; }
.group-card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 1.4rem 1.3rem 1.2rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease;
}
.group-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow); }
.group-card-bar { position: absolute; inset: 0 0 auto; height: 4px; background: var(--accent, var(--gold)); }
.group-card h2 { font-size: 1.16rem; margin: .5rem 0 .4rem; }
.group-meta { display: flex; gap: .9rem; font-size: .82rem; color: var(--muted); margin: auto 0 .6rem; }
.group-link { font-size: .86rem; font-weight: 600; color: var(--accent, var(--gold-dark)); }

.tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1.2rem; }
.tab { padding: .42rem .85rem; border-radius: 999px; font-size: .87rem; color: var(--muted); border: 1px solid var(--line); background: var(--white); }
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ------------------------------------------------------------ Materialliste */
.material-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.material-list li { margin: 0; }
.material-row {
  display: flex; align-items: center; gap: .9rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.material-row:hover { text-decoration: none; border-color: var(--gold); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.material-main { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1; }
.material-main strong { font-size: .98rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.material-desc { color: var(--muted); font-size: .87rem; }
.material-main small { color: var(--muted); font-size: .78rem; }
.material-open { font-size: .84rem; font-weight: 600; color: var(--gold-dark); white-space: nowrap; }
.material-list-large .material-row { padding: 1.05rem 1.15rem; }

.kind-icon {
  display: grid; place-items: center;
  width: 42px; height: 42px; flex: none;
  border-radius: 12px;
  font-size: .68rem; font-weight: 700; letter-spacing: .02em;
  background: var(--sand); color: var(--brown);
}
.kind-video { background: #F2E7DA; color: #8a5a1e; font-size: .9rem; }
.kind-pdf { background: #F8E6E4; color: #A8322B; }
.kind-script { background: #E8EFEC; color: #34574F; }
.kind-audio { background: #EEE7F2; color: var(--plum); font-size: 1rem; }
.kind-link { background: #E9EEF5; color: #37567F; font-size: .95rem; }

.badge-new {
  display: inline-block;
  padding: .1rem .45rem;
  border-radius: 999px;
  background: var(--gold);
  color: #fff;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* -------------------------------------------------------------- Medienseiten */
.player-wrap { margin-bottom: 1.6rem; }
.player {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  max-height: 74vh;
  border-radius: var(--radius-lg);
  background: #14100C;
  box-shadow: var(--shadow);
  display: block;
}
.player.is-portrait {
  width: auto;
  height: min(74vh, 640px);
  max-width: 100%;
  aspect-ratio: auto;
  margin-left: auto;
  margin-right: auto;
}
.player-hint { font-size: .78rem; color: var(--muted); margin: .5rem 0 0; }
.audio-panel { display: grid; place-items: center; }
.audio { width: 100%; }
.pdf-wrap { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1rem; box-shadow: var(--shadow-sm); }
.pdf-wrap iframe { width: 100%; height: min(78vh, 900px); border: 0; display: block; }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; }
.pager-item { display: flex; flex-direction: column; gap: .1rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); max-width: 46%; color: var(--ink); }
.pager-item:hover { text-decoration: none; border-color: var(--gold); }
.pager-item small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.pager-item.right { text-align: right; margin-left: auto; }

/* ------------------------------------------------------------------- Tabellen */
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; background: #FCF8F3; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #FDFAF6; }
table.data td.actions { text-align: right; white-space: nowrap; }
.tag { display: inline-block; padding: .12rem .5rem; border-radius: 999px; background: var(--sand); color: var(--brown); font-size: .74rem; margin: 0 .2rem .2rem 0; }
.tag-muted { background: #EFEBE6; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-on { color: #2F7A45; }
.status-off { color: #9A8C7E; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; margin-bottom: 1.6rem; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); }
.stat strong { display: block; font-family: var(--serif); font-size: 1.7rem; line-height: 1.1; }
.stat span { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }

.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1.1rem; }
.toolbar form { display: flex; gap: .5rem; align-items: center; }
.toolbar input[type=text], .toolbar select { width: auto; min-width: 12rem; }

.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .35rem 1rem; max-height: 22rem; overflow-y: auto; padding: .6rem; border: 1px solid var(--line); border-radius: var(--radius); background: #FDFBF8; }
.member-grid .check { margin: 0; font-size: .88rem; }

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.2rem;
  text-align: center;
  background: #FDFBF8;
  transition: border-color .15s ease, background .15s ease;
  cursor: pointer;
}
.dropzone.dragover { border-color: var(--gold); background: #FBF3E6; }
.dropzone strong { display: block; margin-bottom: .2rem; }
.dropzone small { color: var(--muted); }
.progress { height: 8px; border-radius: 999px; background: var(--sand); overflow: hidden; margin-top: .9rem; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-dark)); transition: width .2s ease; }
.file-chip { display: flex; align-items: center; gap: .7rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); margin-top: .8rem; }
.file-chip .btn { margin-left: auto; }

.toast { position: fixed; right: 1.2rem; bottom: 1.2rem; background: var(--ink); color: #fff; padding: .8rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow); font-size: .9rem; z-index: 80; opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

/* --------------------------------------------------------------- Responsive */
@media (max-width: 980px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { min-height: 34vh; }
  .auth-brand .auth-points { display: none; }
  .shell { grid-template-columns: 1fr; }
  .navtoggle { display: block; }
  .sidebar {
    position: static;
    display: none;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow);
  }
  .sidebar.open { display: flex; }
  .shell { padding-top: .8rem; }
  .topbar-right .btn-ghost { display: none; }
}

@media (max-width: 620px) {
  body { font-size: 15.5px; }
  .topbar { padding: .6rem 1rem; }
  .brand-text small { display: none; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .material-open { display: none; }
  .pdf-wrap iframe { height: 70vh; }
  .toolbar input[type=text], .toolbar select { min-width: 0; width: 100%; }
  .toolbar form { width: 100%; flex-wrap: wrap; }
}

.stat-sub { display: block; font-size: .72rem; color: var(--muted); margin-top: .25rem; letter-spacing: 0; }

/* Schreibgeschützte Felder */
input[readonly], input:disabled {
  background: #F4EEE7;
  color: #6E6154;
  cursor: default;
}
input[readonly]:focus, input:disabled:focus { outline: none; border-color: var(--line); box-shadow: none; }

/* Passwortfeld mit Auge */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { padding-right: 2.9rem; }
.pw-toggle {
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.pw-toggle:hover { color: var(--ink); background: rgba(42, 33, 24, .06); }
.pw-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.pw-toggle svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pw-toggle.is-visible { color: var(--plum); }

@media print {
  .topbar, .sidebar, .page-actions { display: none; }
  body { background: #fff; }
}
