/* =====================================================================
   UG-SAN Stab – Design im Stil von www.rv.de (Landkreis Ravensburg)
   Orange #ff6f00, Grau #6f6f6e, Hintergrund #e9ecef, weisse eckige Karten,
   Schrift Open Sans (lokal in assets/fonts, OFL-Lizenz).
   Darstellungen: hell (Standard), dunkel, hoher Kontrast (data-theme am <html>).
   ===================================================================== */

@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/open-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/open-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/open-sans-latin-700-normal.woff2) format("woff2"); }

:root {
  --orange: #ff6f00;        /* Akzent: Knoepfe, Titelbalken, aktiver Menuepunkt */
  --orange-dark: #d95e00;   /* Hover */
  --orange-soft: #fff1e6;
  --grau: #6f6f6e;          /* Logo-Grau, Fusszeile */
  --grau-dark: #505050;     /* dunkler Knopf "Termin vereinbaren" */
  --bg: #e9ecef;            /* Seitenhintergrund */
  --util: #f2eeec;          /* Servicezeile oben */
  --surface: #ffffff;
  --text: #454545;
  --muted: #6f6f6e;
  --head: #6f6f6e;          /* Ueberschriften (grau wie rv.de) */
  --line: #dcdfe3;
  --ok: #2e7d32; --ok-bg: #e8f5e9;
  --err: #c62828; --err-bg: #fdecea;
  --info: #1f5f8b; --info-bg: #e7f1f8;
  --warn: #8a5300; --warn-bg: #fff4e0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06);
  --side-w: 270px;
  --side-w-mini: 68px;
  --wrap: 1280px;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #1c1e21; --util: #26292d; --surface: #2a2d31; --text: #e4e4e4; --muted: #a9a9a9; --head: #cfcfcf;
  --line: #3b3f44; --orange-soft: #3a2a1c; --grau: #3a3c40; --grau-dark: #44474c;
  --ok-bg: #1d3320; --err-bg: #3b1f1f; --info-bg: #1c2d3b; --warn-bg: #3a2d16;
  --ok: #8fd694; --err: #ff9a9a; --info: #8fc3ea; --warn: #ffc56b;
  color-scheme: dark;
}
/* Hoher Kontrast (wie "Kontrast umschalten" auf rv.de): schwarz/weiss/gelb */
html[data-theme="contrast"] {
  --orange: #ffd400; --orange-dark: #ffe866; --orange-soft: #222; --grau: #000; --grau-dark: #000;
  --bg: #000; --util: #000; --surface: #000; --text: #fff; --muted: #fff; --head: #ffd400; --line: #fff;
  --ok: #7CFC00; --ok-bg: #000; --err: #ff6b6b; --err-bg: #000; --info: #7fdfff; --info-bg: #000; --warn: #ffd400; --warn-bg: #000;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 "Open Sans", "Helvetica Neue", Arial, sans-serif; }
[hidden] { display: none !important; }
a { color: var(--orange-dark); }
/* :where() = geringe Gewichtung, damit Menue- und Kachel-Links ihre eigene Farbe behalten */
:where(html[data-theme="dark"]) a { color: #ff9a4d; }
:where(html[data-theme="contrast"]) a { color: var(--orange); }
img { max-width: 100%; }
.ic { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--orange); color: #fff; padding: 8px 14px; font-weight: 700; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ===== Servicezeile ===== */
.util { background: var(--util); font-size: 13px; color: var(--grau-dark); }
html[data-theme="dark"] .util, html[data-theme="contrast"] .util { color: var(--text); }
.util-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 34px; }
.util-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.util-links { display: flex; align-items: center; }
.util-links > * { padding: 0 10px; border-left: 1px solid #c9c3bf; line-height: 1.2; }
.util-links > *:first-child { border-left: 0; }
.util-btn { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.util-btn:hover { color: var(--orange-dark); }
.util-user { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }

/* ===== Kopfbereich mit Bild (Anmeldeseite) und Banner (Dashboard) ===== */
.hero { position: relative; overflow: hidden; background: #3b4048; min-height: 150px; }
.hero-big { min-height: 250px; }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-in { position: relative; display: flex; align-items: center; gap: 24px; padding-top: 26px; padding-bottom: 26px; }
.hero-name { margin: 0; color: #fff; font-size: 26px; font-weight: 600; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.logo { display: inline-flex; text-decoration: none; flex: none; }
.logo .logo-lk { height: 90px; width: auto; display: block; }
.logo-ug { width: 116px; height: 116px; background: var(--orange); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 0 12px;
  font-weight: 600; font-size: 25px; line-height: 1.02; letter-spacing: .02em; }
.logo-ug span:nth-child(2) { padding-left: 14px; }
.logo-ug span:nth-child(3) { font-size: 20px; font-weight: 400; letter-spacing: .08em; }
html[data-theme="contrast"] .logo-ug { color: #000; }
.btn-white { background: #fff; color: var(--orange) !important; font-weight: 700; text-decoration: none; padding: 7px 22px; min-width: 150px; text-align: center; }
.btn-white:hover { background: var(--orange); color: #fff !important; }
html[data-theme="contrast"] .btn-white { background: #000; color: var(--orange) !important; border: 2px solid var(--orange); }

/* ===== Grundlayout wie drk-kbl-wg: links Menue (volle Hoehe), rechts Hauptbereich (volle Breite) ===== */
body.shell { display: block; }
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .25s ease; }
.layout.collapsed { grid-template-columns: var(--side-w-mini) minmax(0, 1fr); }
/* Menuespalte bis ganz unten weiss, auch wenn die Seite laenger ist */
.layout { background: linear-gradient(to right, var(--surface) var(--side-w), transparent 0); }
.layout.collapsed { background: linear-gradient(to right, var(--surface) var(--side-w-mini), transparent 0); }

/* ===== Seitenmenue ===== */
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); border-top: 5px solid var(--orange); padding-top: env(safe-area-inset-top, 0px); }
html[data-theme="contrast"] .sidebar { border-right-color: #fff; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.brand { padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.brand-logo { display: block; text-decoration: none; }
.brand-logo .logo-lk { display: block; width: 100%; max-width: 160px; height: auto; }
.brand-logo .logo-ug { width: 84px; height: 84px; font-size: 18px; padding: 0 9px; }
.brand-logo .logo-ug span:nth-child(3) { font-size: 14px; }
.brand-mini { display: none; }
.brand-mini img { width: 40px; height: 40px; display: block; }
.brand-name { display: block; margin-top: 10px; font-weight: 700; color: var(--text); font-size: 15px; line-height: 1.25; }
.brand-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }
.nav-side { flex: 1; padding: 6px 0; }
.nav-top { padding: 4px 0 6px; border-bottom: 1px solid var(--line); }
.lvl1 { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 16px; border: 0; border-left: 4px solid transparent; background: none;
  font: inherit; font-size: 14.5px; font-weight: 600; color: var(--text); text-decoration: none; text-align: left; cursor: pointer; white-space: nowrap; }
.lvl1 .icon { color: var(--muted); display: flex; }
.lvl1:hover { background: var(--orange-soft); color: var(--text); }
.lvl1:hover .icon, .lvl1.active .icon, .lvl1.in .icon { color: var(--orange); }
.lvl1.active { border-left-color: var(--orange); background: var(--orange-soft); }
.lvl1 .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.lvl1 .chev { display: flex; transition: transform .2s; color: var(--muted); }
.lvl1 .chev .ic { width: 16px; height: 16px; }
.lvl1[aria-expanded="true"] .chev { transform: rotate(90deg); }
.lvl1[aria-expanded="false"] + .sub { display: none; }
.sub ul { padding: 2px 0 8px; }
.lvl2 { display: block; padding: 6px 16px 6px 53px; font-size: 14px; color: var(--text); text-decoration: none; border-left: 4px solid transparent; }
.lvl2:hover { color: var(--orange-dark); background: var(--orange-soft); }
.lvl2.active { color: var(--orange-dark); font-weight: 700; border-left-color: var(--orange); }
html[data-theme="dark"] .lvl2.active, html[data-theme="dark"] .lvl2:hover { color: #ff9a4d; }
html[data-theme="contrast"] .lvl2.active, html[data-theme="contrast"] .lvl2:hover { color: var(--orange); }
.nav-sec { border-bottom: 1px solid var(--line); }
.nav-sec:last-child { border-bottom: 0; }
.sec { display: flex; justify-content: space-between; align-items: center; width: 100%; background: none; border: 0; cursor: pointer;
  padding: 12px 16px 6px; font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.sec:hover { color: var(--orange-dark); }
.sec-chev { width: 14px; height: 14px; transform: rotate(90deg); transition: transform .2s; }
.sec[aria-expanded="false"] .sec-chev { transform: none; }
.sec[aria-expanded="false"] + .sec-items { display: none; }
.sec-items { padding-bottom: 6px !important; }
.nav-foot { border-top: 1px solid var(--line); padding: 6px 0 !important; }
.me { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--util); }
.me-txt { min-width: 0; }
.me-txt b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-txt small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 36px; height: 36px; flex: none; background: var(--orange); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; }
html[data-theme="contrast"] .avatar { color: #000; }
.backdrop { display: none; }

/* Menue verkleinert (nur Symbole) */
.layout.collapsed .brand { padding: 12px 0; display: flex; justify-content: center; }
.layout.collapsed .brand-logo, .layout.collapsed .brand-name { display: none; }
.layout.collapsed .brand-mini { display: block; }
.layout.collapsed .lvl1 { justify-content: center; padding: 10px 0; gap: 0; }
.layout.collapsed .lvl1 .label, .layout.collapsed .lvl1 .chev, .layout.collapsed .sub, .layout.collapsed .me-txt { display: none; }
.layout.collapsed .sec { justify-content: center; padding: 8px 0; }
.layout.collapsed .sec span { display: none; }
.layout.collapsed .sec + .sec-items { display: block !important; }
.layout.collapsed .sec-chev { display: none; }
.layout.collapsed .nav-sec .sec { height: 1px; padding: 0; margin: 6px 14px; background: var(--line); }
.layout.collapsed .me { justify-content: center; padding: 12px 0; }

/* ===== Hauptbereich ===== */
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 8px 24px 8px 12px; min-height: 58px; }
html[data-theme="contrast"] .topbar { border-bottom-color: #fff; }
.tb-btn { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; background: none; border: 0; cursor: pointer; color: var(--text); }
.tb-btn:hover { background: var(--orange-soft); color: var(--orange-dark); }
.tb-btn .ic { width: 22px; height: 22px; }
.topbar .crumbs { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { display: flex; width: min(340px, 40%); }
.search input { flex: 1; min-width: 0; border: 1px solid var(--line); border-right: 0; padding: 7px 12px; font: inherit; font-size: 14px; background: var(--bg); color: var(--text); }
.search input:focus { outline: 2px solid var(--orange); outline-offset: -1px; background: var(--surface); }
.search button { width: 40px; border: 0; background: var(--grau); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.search button:hover { background: var(--orange); }
.content { flex: 1 0 auto; padding: 24px 32px 40px; }
.banner { position: relative; overflow: hidden; background: #3b4048; margin: -24px -32px 28px; min-height: 200px; }
.banner-in { position: relative; padding: 28px 32px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.45); }
.banner-date { margin: 0; font-size: 13px; font-weight: 600; opacity: .9; }
.banner-gruss { margin: 2px 0 4px; font-size: 30px; font-weight: 600; line-height: 1.2; }
.banner-txt { margin: 0 0 18px; max-width: 720px; }
.banner-quick { display: flex; flex-wrap: wrap; gap: 12px; text-shadow: none; }
.dash-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 0 28px; align-items: start; }
.dash-row .stats { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

/* ===== Inhalt ===== */
.crumbs { font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs strong { color: var(--text); font-weight: 600; }
.page-title, .dash-sec > h2 { font-size: 24px; font-weight: 600; color: var(--head); margin: 0 0 14px; line-height: 1.3; }
.dash .page-title { position: absolute; left: -9999px; }   /* Dashboard: Banner und Abschnitte genuegen */
.card { background: var(--surface); box-shadow: var(--shadow); }
html[data-theme="contrast"] .card, html[data-theme="contrast"] .side-card { border: 1px solid #fff; }
.card-body { padding: 22px 24px; }
.card-body > :first-child { margin-top: 0; }
.card-body > :last-child { margin-bottom: 0; }
.card-bar { margin: 0; background: var(--orange); color: #fff; font-size: 19px; font-weight: 600; padding: 10px 24px; }
html[data-theme="contrast"] .card-bar { color: #000; }
h2.h-sub { font-size: 18px; font-weight: 600; color: var(--head); margin: 26px 0 8px; }
.text { white-space: normal; }
.link { font-weight: 700; color: var(--text); text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }
.link:hover { color: var(--orange-dark); }
.link .ic { width: 16px; height: 16px; color: var(--orange); }

/* Meldungen */
.msg { padding: 10px 14px; border-left: 4px solid; margin: 0 0 16px; }
.msg.ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.msg.err { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.msg.info { background: var(--info-bg); border-color: var(--info); color: var(--info); }

/* Knoepfe */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--orange); color: #fff !important; border: 2px solid var(--orange); padding: 8px 20px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.btn .ic { width: 18px; height: 18px; }
html[data-theme="contrast"] .btn { color: #000 !important; }
.btn-ghost { background: transparent; color: var(--text) !important; border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); border-color: var(--muted); }
.btn-danger { background: transparent; color: var(--err) !important; border-color: var(--err); }
.btn-danger:hover { background: var(--err); color: #fff !important; border-color: var(--err); }
.btn-small { background: none; border: 1px solid var(--line); padding: 3px 10px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.btn-small:hover { border-color: var(--err); color: var(--err); }

/* Formulare */
.form { max-width: 720px; }
.form.narrow { max-width: 420px; }
.form.form-wide { max-width: 900px; }
/* Rahmen "Angaben fuer das Adressbuch" */
.ab-box { border: 2px solid var(--orange); background: var(--orange-soft); padding: 18px 22px 6px; margin: 6px 0 24px; }
.ab-titel { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--text); }
.ab-titel .ic { color: var(--orange); width: 24px; height: 24px; }
.ab-hinweis { margin: 0 0 12px; font-size: 14px; }
.ab-box fieldset { border-top-color: var(--line); }
.ab-box input:not([type="checkbox"]), .ab-box select { background: var(--surface); }
.row-plz { display: grid; grid-template-columns: 140px 1fr; gap: 0 16px; }
.form label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 4px; }
.form input:not([type="checkbox"]):not([type="radio"]), .form select, .form textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #b9bec4; background: var(--surface); color: var(--text); font: inherit; border-radius: 0; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--orange); outline: 2px solid var(--orange); outline-offset: 0; }
.form fieldset { border: 0; border-top: 3px solid var(--orange); padding: 4px 0 10px; margin: 0 0 18px; }
.form legend { font-weight: 700; color: var(--head); padding-right: 10px; font-size: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.form .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 10px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--orange); flex: none; }
.check b { display: block; font-weight: 600; }
.check small { display: block; color: var(--muted); font-size: 13px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 18px; }
.form-danger { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }
.inline-form { margin-top: 10px; }

/* Tabellen */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.list th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--orange); }
table.list td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:hover td { background: var(--orange-soft); }
table.list tr.off td { opacity: .6; }
table.list a { color: var(--text); text-decoration: none; }
table.list a:hover { color: var(--orange-dark); text-decoration: underline; }
.badge { display: inline-block; padding: 1px 9px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-off { background: var(--bg); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 14px; border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; background: var(--surface); }
.chip:hover { border-color: var(--orange); }
.chip.on { background: var(--orange); border-color: var(--orange); color: #fff; }
html[data-theme="contrast"] .chip.on { color: #000; }
/* Listen (Anwesenheits-/Adressliste) */
.li-arten { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 6px; }
.li-art { cursor: pointer; display: block; }
.li-art input { position: absolute; opacity: 0; }
.li-art-box { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 2px solid var(--line); background: var(--surface); height: 100%; }
.li-art-box b { display: block; font-size: 16px; }
.li-art-box small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.li-art-ic { width: 30px; height: 30px; color: var(--muted); flex: none; }
.li-art:hover .li-art-box { border-color: var(--orange); }
.li-art input:checked + .li-art-box { border-color: var(--orange); background: var(--orange-soft); }
.li-art input:checked + .li-art-box .li-art-ic { color: var(--orange); }
.li-art input:focus-visible + .li-art-box { outline: 3px solid var(--orange); outline-offset: 2px; }
.li-form:has(input[value="adressliste"]:checked) .li-sitzung { display: none; }
.li-personen { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 12px; }
.li-personen summary { cursor: pointer; padding: 6px 0; }
.li-personen ul { columns: 2 260px; margin: 8px 0; padding-left: 18px; }
.li-personen li { margin: 3px 0; break-inside: avoid; }

/* Linksammlung */
.ls-kopf { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.ls-such { flex: 1; position: relative; max-width: 620px; }
.ls-such input { width: 100%; padding: 11px 14px 11px 42px; border: 1px solid #b9bec4; background: var(--surface); color: var(--text); font: inherit; font-size: 16px; }
.ls-such input:focus { outline: 2px solid var(--orange); outline-offset: -1px; }
.ls-such-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 20px; height: 20px; }
.ls-kopf .ls-ansicht { margin-left: auto; }
.ls-kopf .btn { white-space: nowrap; }
.ls-chips { margin-bottom: 22px; }
.chip-n { display: inline-block; min-width: 20px; padding: 0 5px; margin-left: 4px; font-size: 12px; text-align: center; background: var(--bg); color: var(--muted); }
.chip.on .chip-n { background: rgba(255,255,255,.25); color: inherit; }
.ls-sec { margin-bottom: 26px; }
.ls-kat { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; color: var(--head); margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--orange); }
.ls-kat .ic { color: var(--orange); }
.ls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); gap: 12px; }
.ls-tile { min-width: 0; }
.ls-tile { position: relative; background: var(--surface); box-shadow: var(--shadow); border-left: 4px solid transparent; transition: border-color .15s, box-shadow .15s; }
.ls-tile:hover, .ls-tile:focus-within { border-left-color: var(--orange); box-shadow: 0 4px 14px rgba(0,0,0,.12); }
html[data-theme="contrast"] .ls-tile { border: 1px solid #fff; border-left-width: 4px; }
.ls-main { display: flex; gap: 14px; align-items: flex-start; padding: 14px 44px 14px 14px; color: var(--text); text-decoration: none; height: 100%; }
.ls-badge { flex: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 20px; }
.ls-f1 { background: #ff6f00; } .ls-f2 { background: #6f6f6e; } .ls-f3 { background: #c25400; }
.ls-f4 { background: #4d5157; } .ls-f5 { background: #8a6a55; } .ls-f6 { background: #9a9894; }
html[data-theme="contrast"] .ls-badge { background: #000; border: 2px solid var(--orange); color: var(--orange); }
.ls-body { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ls-titel { font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; hyphens: auto; }
.ls-ext { width: 13px; height: 13px; margin-right: 4px; color: var(--muted); vertical-align: -1px; flex: none; }
.ls-main:hover .ls-titel { color: var(--orange-dark); }
html[data-theme="dark"] .ls-main:hover .ls-titel { color: #ff9a4d; }
.ls-domain { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Umschalter Kacheln / Liste */
.ls-ansicht { display: flex; flex: none; border: 1px solid #b9bec4; background: var(--surface); }
.ls-ans { display: flex; align-items: center; gap: 6px; padding: 9px 12px; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; }
.ls-ans + .ls-ans { border-left: 1px solid #b9bec4; }
.ls-ans .ic { width: 18px; height: 18px; }
.ls-ans:hover { background: var(--orange-soft); }
.ls-ans.on { background: var(--orange); color: #fff; }
html[data-theme="contrast"] .ls-ans.on { color: #000; }
/* Detailliste */
.ls-zeile { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--text) !important; }
.ls-zeile .ls-badge { width: 34px; height: 34px; font-size: 16px; }
.ls-zeile span { min-width: 0; }
.ls-zeile b { display: block; overflow-wrap: break-word; }
.ls-zeile small { display: block; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.ls-zeile:hover b { color: var(--orange-dark); text-decoration: underline; }
table.ls-liste td { vertical-align: middle; }
table.ls-liste th:first-child { width: 38%; min-width: 260px; }
.ls-zeile small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ls-desc-l { color: var(--muted); font-size: 14px; max-width: 420px; }
.ls-akt { width: 44px; }
.ls-akt .ls-edit { position: static; }
.ls-desc { font-size: 13.5px; margin-top: 4px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ls-edit { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.ls-edit .ic { width: 17px; height: 17px; }
.ls-edit:hover { background: var(--orange-soft); color: var(--orange-dark); }
.ls-leer { text-align: center; padding: 40px 20px !important; }
.ls-leer-ic { width: 48px; height: 48px; color: var(--orange); }

/* Kurzlinks */
.kl-such { display: flex; gap: 8px; flex: 1; max-width: 560px; }
.kl-such input { flex: 1; min-width: 0; padding: 8px 11px; border: 1px solid #b9bec4; background: var(--surface); color: var(--text); font: inherit; }
.kl-such input:focus { outline: 2px solid var(--orange); outline-offset: -1px; }
.kl-kurz { font-weight: 700; color: var(--orange-dark) !important; word-break: break-all; }
html[data-theme="dark"] .kl-kurz { color: #ff9a4d !important; }
.kl-ziel a { word-break: break-all; }
table.list td.num { white-space: nowrap; }
.kl-akt { white-space: nowrap; text-align: right; }
.kl-akt .btn-small { display: inline-flex; align-items: center; gap: 4px; margin: 2px 0 2px 4px; text-decoration: none; color: var(--text); background: var(--surface); }
.kl-akt .btn-small .ic { width: 15px; height: 15px; }
.kl-akt .btn-small:hover { border-color: var(--orange); color: var(--orange-dark); }
.kl-akt .btn-small.ok { border-color: var(--ok); color: var(--ok); }
.qr-row td { background: var(--bg) !important; }
.qr-box { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 6px 0; }
.qr-box img { background: #fff; padding: 0; border: 1px solid var(--line); width: 200px; height: 200px; image-rendering: pixelated; }
.qr-box p { word-break: break-all; margin: 0 0 10px; }
.kl-tag { display: flex; align-items: stretch; }
.kl-basis { display: flex; align-items: center; padding: 0 10px; background: var(--bg); border: 1px solid #b9bec4; border-right: 0; color: var(--muted); font-size: 14px; white-space: nowrap; }
.form .kl-tag input { flex: 1; min-width: 0; }
code { font-size: 13px; background: var(--bg); padding: 1px 5px; }

/* ===== Dashboard ===== */
.dash-sec { margin-bottom: 34px; }
.hw { list-style: none; margin: 0; padding: 0; }
.hw li a { display: grid; grid-template-columns: 90px 1fr auto; gap: 2px 12px; padding: 9px 4px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.hw li a:hover { background: var(--orange-soft); }
.hw-datum { color: var(--muted); font-size: 13px; grid-row: span 2; padding-top: 2px; }
.hw-titel { font-weight: 700; }
.hw-text { grid-column: 2; font-size: 13.5px; color: var(--muted); }
.hw-mod { grid-column: 3; grid-row: 1; font-size: 12px; color: var(--orange-dark); font-weight: 700; white-space: nowrap; }
html[data-theme="dark"] .hw-mod { color: #ff9a4d; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.stat { background: var(--surface); box-shadow: var(--shadow); padding: 16px 18px 14px; text-decoration: none; color: var(--text); display: grid; grid-template-columns: 1fr auto; border-top: 4px solid var(--orange); }
html[data-theme="contrast"] .stat { border: 1px solid #fff; border-top: 4px solid var(--orange); }
.stat:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.stat-ic { grid-column: 2; grid-row: 1 / span 2; color: var(--orange); }
.stat-ic .ic { width: 30px; height: 30px; }
.stat-wert { font-size: 32px; font-weight: 700; line-height: 1.1; color: var(--text); }
.stat-text { font-weight: 600; }
.stat-mod { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: 4px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tile { background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; }
html[data-theme="contrast"] .tile { border: 1px solid #fff; }
.tile-top { position: relative; display: block; height: 140px; background: var(--grau) url(img/kopf.svg) center bottom / cover; color: #fff; text-decoration: none; }
.tile-ic { position: absolute; right: 16px; top: 14px; color: rgba(255,255,255,.92); }
.tile-ic .ic { width: 54px; height: 54px; stroke-width: 1.3; }
.tile-title { position: absolute; left: 0; bottom: 14px; max-width: 88%; background: var(--orange); color: #fff; padding: 6px 14px; font-weight: 600; font-size: 16px; line-height: 1.3; }
html[data-theme="contrast"] .tile-title { color: #000; }
.tile-top:hover .tile-title { background: var(--orange-dark); }
.tile-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; font-size: 14px; }
.tile-body p { margin: 0; color: var(--muted); }
.tile-links { list-style: none; margin: 0; padding: 0; }
.tile-links a { color: var(--text); text-decoration: none; display: block; padding: 3px 0 3px 14px; position: relative; }
.tile-links a::before { content: ""; position: absolute; left: 0; top: 11px; width: 6px; height: 6px; background: var(--orange); }
.tile-links a:hover { color: var(--orange-dark); }
.tile-body .link { margin-top: auto; }
.hits { list-style: none; margin: 0 0 12px; padding: 0; }
.hits a { display: flex; gap: 12px; align-items: center; padding: 9px 6px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.hits a:hover { background: var(--orange-soft); }
.hits .ic { color: var(--orange); width: 22px; height: 22px; }
.hits b { display: block; }
.hits small { display: block; color: var(--muted); }

/* ===== Schlichte Seiten (Anmeldung) ===== */
.plain { padding-top: 0; padding-bottom: 60px; }
.plain-card { max-width: 520px; margin: -70px auto 0; position: relative; }
.plain-card .form { max-width: none; }

/* ===== Fusszeile ===== */
body.plain-body { min-height: 100vh; display: flex; flex-direction: column; }
.plain { flex: 1 0 auto; width: 100%; }
.foot { background: var(--grau); color: #fff; font-size: 14px; padding: 28px 0 34px; }
html[data-theme="contrast"] .foot { border-top: 2px solid #fff; }
.foot-in { max-width: var(--wrap); margin: 0 auto; padding: 0 32px; display: flex; flex-wrap: wrap; gap: 24px 48px; align-items: flex-start; }
.foot-col b { font-size: 15px; }
.foot-links { list-style: none; margin: 0; padding: 0; }
.foot-links a { color: #fff; font-weight: 700; text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }
.foot-slogan { margin: 0 0 0 auto; align-self: center; color: var(--orange); font-size: 22px; font-weight: 600; font-style: italic; }
html[data-theme="dark"] .foot-slogan { color: #ff9a4d; }

/* ===== Tablet / Handy ===== */
@media (max-width: 1100px) {
  .dash-row { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .layout, .layout.collapsed { grid-template-columns: 1fr; background: none; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; width: min(300px, 86vw); height: auto; transform: translateX(-105%); transition: transform .25s ease; }
  .layout.open .sidebar { transform: none; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
  .layout.open .backdrop { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.45); }
  /* auf dem Handy immer das volle Menue (nicht die Symbolleiste) */
  .layout.collapsed .brand { display: block; padding: 16px 16px 14px; }
  .layout.collapsed .brand-logo, .layout.collapsed .brand-name { display: block; }
  .layout.collapsed .brand-mini { display: none; }
  .layout.collapsed .lvl1 { justify-content: flex-start; padding: 9px 16px; gap: 12px; }
  .layout.collapsed .lvl1 .label, .layout.collapsed .lvl1 .chev, .layout.collapsed .me-txt { display: flex; }
  .layout.collapsed .lvl1 .label, .layout.collapsed .me-txt { display: block; }
  .layout.collapsed .lvl1[aria-expanded="true"] + .sub { display: block; }
  .layout.collapsed .nav-sec .sec { height: auto; margin: 0; padding: 12px 16px 6px; background: none; justify-content: space-between; }
  .layout.collapsed .sec span, .layout.collapsed .sec-chev { display: inline; }
  .layout.collapsed .me { justify-content: flex-start; padding: 12px 16px; }
  body.menu-open { overflow: hidden; }
  .content { padding: 18px 16px 32px; }
  .banner { margin: -18px -16px 22px; }
  .banner-in { padding: 22px 16px; }
  .topbar { padding: 6px 10px; gap: 8px; }
  .topbar .crumbs { display: none; }
  .search { flex: 1; width: auto; }
  .hero-big { min-height: 0; }
  .plain-card { margin-top: 18px; }
  .hero-in { gap: 14px; padding-top: 16px; padding-bottom: 16px; }
  .logo .logo-lk { height: 70px; }
  .logo-ug { width: 84px; height: 84px; font-size: 18px; padding: 0 9px; }
  .logo-ug span:nth-child(3) { font-size: 14px; }
  .util-txt { display: none; }
  .util-in { justify-content: flex-end; }
  .foot-in { padding: 0 16px; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .btn-white { flex: 1; min-width: 0; padding: 7px 10px; }
  .row2 { grid-template-columns: 1fr; }
  .row-plz { grid-template-columns: 100px 1fr; gap: 0 10px; }
  .ab-box { padding: 14px 12px 4px; margin-left: -4px; margin-right: -4px; }
  .card-body { padding: 16px; }
  .page-title, .dash-sec > h2 { font-size: 21px; }
  .banner-gruss { font-size: 24px; }
  .hw li a { grid-template-columns: 1fr; }
  .hw-datum, .hw-text, .hw-mod { grid-column: 1; grid-row: auto; }
  .foot-slogan { margin-left: 0; }
  .hero-name { font-size: 20px; }
  .foot-slogan { font-size: 18px; }
  /* Tabellen auf dem Handy als Karten: jede Zeile ein Block, Spaltenname vor dem Wert (data-label setzt ug.js) */
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list thead { position: absolute; left: -9999px; }
  table.list tr { border: 1px solid var(--line); border-left: 4px solid var(--orange); margin-bottom: 10px; padding: 6px 12px; background: var(--surface); }
  table.list tr:hover td { background: none; }
  table.list td { border: 0; padding: 4px 0; }
  table.list td[data-label]:not(:first-child)::before { content: attr(data-label) ": "; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
  table.list td:empty { display: none; }
  table.list td.nowrap { white-space: normal; }
  .table-wrap { overflow: visible; }
  .toolbar { align-items: stretch; }
  .toolbar .btn { justify-content: center; }
  .actions .btn { flex: 1; justify-content: center; }
  .li-knoepfe .btn { flex-basis: 100%; }
  .kl-such { max-width: none; width: 100%; }
  .ls-kopf { flex-wrap: wrap; }
  .ls-such { flex-basis: 100%; max-width: none; }
  .ls-kopf .btn { margin-left: 0; flex: 1; justify-content: center; }
  .ls-ans span { position: absolute; left: -9999px; }
  .ls-ans { padding: 10px 14px; }
  table.ls-liste td.ls-akt { position: absolute; top: 6px; right: 6px; width: auto; padding: 0; }
  table.ls-liste tr { position: relative; }
  table.ls-liste td:first-child { padding-right: 40px; }
  .ls-grid { grid-template-columns: minmax(0, 1fr); }
  .ls-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .ls-chips .chip { flex: none; }
  .kl-btxt { position: absolute; left: -9999px; }
  .kl-akt { text-align: left; white-space: normal; }
  .kl-akt .btn-small { margin: 4px 6px 0 0; padding: 7px 12px; }
  .kl-basis { font-size: 12px; max-width: 55%; }
  table.list tr.qr-row { border-left-color: var(--grau); }
}
/* Fingerbedienung: groessere Tippflaechen */
@media (pointer: coarse) {
  .lvl1 { padding-top: 12px; padding-bottom: 12px; }
  .lvl2 { padding-top: 10px; padding-bottom: 10px; }
  .chip { padding: 7px 14px; }
  .tile-links a { padding: 6px 0 6px 14px; }
  .form input:not([type="checkbox"]):not([type="radio"]), .form select, .form textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .util, .hero, .banner, .sidebar, .topbar, .foot, .toolbar .btn, .actions { display: none !important; }
  .layout { display: block; padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* ---------------------------------------------------------------------
   Tagesordnungen (modules/tagesordnung, oeffentliche Seiten /top/)
   --------------------------------------------------------------------- */
.plain-card.to-oeffentlich { max-width: 980px; }
.to-kopf { border-left: 5px solid var(--orange); background: var(--surface); box-shadow: var(--shadow); padding: 14px 20px; margin: 0 0 18px; }
.plain-card .to-kopf { box-shadow: none; background: var(--orange-soft); }
.to-name { margin: 0 0 4px; font-size: 22px; color: var(--head); overflow-wrap: anywhere; }
.to-termin { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-weight: 600; color: var(--text); }
.to-termin .ic { width: 18px; height: 18px; color: var(--orange); flex: none; }
.to-kopf .small { margin: 0; }
.to-info { margin: 8px 0 0; }
.to-zwei { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 24px; align-items: start; }
.to-zwei .form { max-width: none; }
.to-hilfe .card-bar { font-size: 16px; padding: 8px 18px; }
.to-hilfe .card-body { padding: 14px 18px; font-size: 14px; }
.to-hilfe ol, .to-hilfe ul { margin: 0; padding-left: 20px; }
.to-hilfe li + li { margin-top: 6px; }
.plain-card .to-hilfe { box-shadow: none; border: 1px solid var(--line); }
.to-termin-felder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; }
.to-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.to-link { color: inherit; text-decoration: none; }
.to-link:hover b { color: var(--orange); text-decoration: underline; }
td.to-tab-akt { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.to-tab-akt .inline-form, .to-akt .inline-form { margin: 0; }
.btn-small { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; line-height: 1.4; min-height: 30px; border-radius: 2px; }
.btn-small .ic { width: 15px; height: 15px; flex: none; }
.btn-small:not(.danger):hover { border-color: var(--orange); color: var(--orange); }
.btn-small.danger { color: var(--err); }
.btn-small.danger:hover { background: var(--err-bg); }
.btn-small.ok { border-color: var(--ok); color: var(--ok); }
.btn-small[disabled] { opacity: .4; cursor: default; pointer-events: none; }
/* Verwaltung */
.to-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 24px; align-items: start; }
.to-seite { display: flex; flex-direction: column; gap: 18px; }
.to-seite .card-bar { font-size: 16px; padding: 8px 18px; }
.to-seite .card-body { padding: 14px 18px; }
.to-seite .form-danger { margin-top: 0; border-top: 0; padding-top: 0; }
.to-punkte-kopf { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 10px; }
.to-punkte-kopf h2 { margin: 0; }
.to-punkt { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 0; background: var(--surface); box-shadow: var(--shadow); margin: 0 0 10px; scroll-margin-top: 80px; }
.to-punkt:target { outline: 2px solid var(--orange); }
.to-nr { background: var(--orange); color: #fff; font-weight: 700; font-size: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; padding: 10px 4px; }
.to-nr small { font-size: 11px; font-weight: 600; letter-spacing: .08em; opacity: .9; }
html[data-theme="contrast"] .to-nr { background: #000; }
.to-body { padding: 12px 16px; min-width: 0; }
.to-body h3 { margin: 0 0 4px; font-size: 17px; color: var(--text); overflow-wrap: anywhere; }
.to-body p { margin: 0 0 6px; overflow-wrap: anywhere; }
.to-body p:last-child { margin: 0; }
.to-akt { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; justify-content: flex-end; padding: 12px 14px 12px 0; max-width: 300px; }
.to-pfeil { min-width: 34px; justify-content: center; }
.to-pos select { height: 30px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; padding: 0 4px; }
.plain-card .to-punkt { box-shadow: none; border: 1px solid var(--line); }
.to-dls { display: grid; gap: 8px; }
.to-dl { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.to-dl:hover { border-color: var(--orange); background: var(--orange-soft); }
.to-dl b { display: block; font-size: 15px; }
.to-dl small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.to-dl-ic { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 26px; padding: 0 5px; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: #fff; border-radius: 2px; }
.to-dl-docx { background: #2b579a; }
.to-dl-pdf { background: #b3261e; }
.to-dl-xlsx { background: #217346; }
.to-dl-pptx { background: #c43e1c; }
.to-ppt { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.to-ppt label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.to-ppt-zeile { display: flex; gap: 8px; }
.to-ppt-zeile input { flex: 1; min-width: 0; border: 1px solid #b9bec5; padding: 8px 10px; font: inherit; background: var(--surface); color: var(--text); }
.to-ppt-zeile .btn { flex: none; gap: 8px; padding-left: 10px; }
.to-ppt-zeile .btn .to-dl-ic { min-width: 0; height: 20px; font-size: 10px; }
.to-lnk + .to-lnk { margin-top: 12px; }
.to-lnk b { display: block; font-size: 14px; }
.to-lnk small { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.to-lnk-zeile { display: flex; gap: 6px; }
.to-lnk-zeile input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 12.5px; padding: 4px 8px; }
.to-einst summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.to-einst summary::-webkit-details-marker { display: none; }
.to-einst summary::after { content: "+"; font-size: 22px; line-height: 1; }
.to-einst[open] summary::after { content: "\2212"; }
.to-einst .form label:first-of-type { margin-top: 0; }
.to-druck-knopf { display: flex; gap: 8px; flex-wrap: wrap; }
/* Bildablage */
.to-bild-neu { max-width: none; background: var(--surface); box-shadow: var(--shadow); padding: 16px 20px; margin-bottom: 20px; }
.to-bild-felder { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.to-bilder { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.to-bild { background: var(--surface); box-shadow: var(--shadow); padding: 12px; min-width: 0; }
.to-bild img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--bg); display: block; }
.to-bild .form label { font-size: 13px; margin-top: 8px; }
.to-bild .actions { margin-top: 10px; }
.to-pikto { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.to-pikto figure { margin: 0; background: var(--surface); box-shadow: var(--shadow); padding: 6px; text-align: center; font-size: 12px; }
.to-pikto img { width: 100%; display: block; }
@media (max-width: 1100px) {
  .to-grid { grid-template-columns: minmax(0, 1fr); }
  .to-seite { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; align-items: start; }
}
@media (max-width: 860px) {
  .to-zwei { grid-template-columns: minmax(0, 1fr); }
  .to-bild-felder { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .to-seite { display: flex; }
  .to-punkt { grid-template-columns: 48px minmax(0, 1fr); }
  .to-nr { font-size: 19px; }
  .to-akt { grid-column: 1 / -1; max-width: none; justify-content: flex-start; padding: 0 12px 12px; border-top: 1px solid var(--line); padding-top: 10px; }
  .to-akt .btn-small span { display: none; }
  .to-name { font-size: 19px; }
  .to-kopf { padding: 12px 14px; }
  .to-termin-felder { grid-template-columns: minmax(0, 1fr); }
  td.to-tab-akt { display: flex !important; }
  .to-ppt-zeile { flex-direction: column; }
}
@media print {
  .to-druck-knopf, .to-akt, .to-hilfe { display: none !important; }
  .to-punkt { break-inside: avoid; box-shadow: none; border: 1px solid #999; }
  .to-nr { background: #fff !important; color: #000 !important; border-right: 1px solid #999; }
}
.to-h-0 { margin-top: 0; }
.to-pikto-box { margin-top: 24px; }
.to-pikto-box summary { cursor: pointer; }
/* Eingabefelder in Flex-Zeilen duerfen schmaler werden als ihre Standardbreite (schmale Handys, 320 px) */
.search { min-width: 0; }
.search input, .to-lnk-zeile input, .to-ppt-zeile input { width: 0; flex: 1 1 0; }
@media (max-width: 400px) {
  .to-lnk-zeile .btn-small span { display: none; }
}

/* ---------------------------------------------------------------------
   Chat (modules/chat, Fenster chat/)
   --------------------------------------------------------------------- */
.lvl1 .icon { position: relative; }
.nav-zahl { position: absolute; top: -7px; right: -9px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
html[data-theme="contrast"] .nav-zahl { background: #fff; color: #000; }
.chat-kopf { flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }
.chat-kopf .to-name { margin: 0; }
.chat-e2e { display: flex; align-items: center; gap: 6px; margin: 0; }
.chat-e2e .ic { width: 16px; height: 16px; color: var(--ok); flex: none; }
.chat-liste { display: grid; gap: 12px; margin: 14px 0; }
.chat-karte { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--surface); box-shadow: var(--shadow); padding: 14px 18px; border-left: 4px solid var(--line); }
.chat-karte.neu { border-left-color: var(--orange); }
.chat-ic { position: relative; width: 48px; height: 48px; border-radius: 50%; background: var(--orange-soft); color: var(--orange); display: flex; align-items: center; justify-content: center; }
.chat-ic .ic { width: 26px; height: 26px; }
.chat-n { position: absolute; top: -4px; right: -6px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--orange); color: #fff; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; padding: 0 6px; box-shadow: 0 0 0 2px var(--surface); }
.chat-body h3 { margin: 0 0 2px; font-size: 17px; overflow-wrap: anywhere; }
.chat-karte.neu .chat-body h3 { color: var(--orange-dark); }
.chat-body p { margin: 2px 0; }
.chat-akt { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chat-akt .btn { white-space: nowrap; }
.chat-zugang { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin: 8px 0 6px; }
.chat-art { position: relative; cursor: pointer; display: block; margin: 0 !important; }
.chat-art input { position: absolute; opacity: 0; }
.chat-art-box { display: block; border: 2px solid var(--line); padding: 12px 14px; background: var(--surface); height: 100%; }
.chat-art-box b { display: block; font-size: 15px; }
.chat-art-box small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.chat-art input:checked + .chat-art-box { border-color: var(--orange); background: var(--orange-soft); }
.chat-art input:focus-visible + .chat-art-box { outline: 2px solid var(--orange); outline-offset: 2px; }
.chat-link-opt { border-left: 3px solid var(--orange); padding: 2px 0 2px 14px; margin-top: 8px; }
.chat-such { width: 100%; max-width: 360px; margin: 6px 0; }
.chat-leute { max-height: 420px; overflow: auto; border: 1px solid var(--line); }
.chat-person { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 2px 12px; border-bottom: 1px solid var(--line); }
.chat-person:last-child { border-bottom: 0; }
.chat-person.an { background: var(--orange-soft); }
.chat-person .check { margin: 6px 0 !important; flex: 1; min-width: 0; }
.chat-verw { display: flex !important; align-items: center; gap: 6px; font-size: 13px !important; font-weight: 400 !important; margin: 0 !important; color: var(--muted); white-space: nowrap; cursor: pointer; }
.chat-verw input { accent-color: var(--orange); }
.chat-linkbox { margin: 0 0 20px; }
.chat-linkbox .card-bar { display: flex; align-items: center; gap: 8px; font-size: 16px; padding: 8px 18px; }
.chat-linkbox .card-bar .ic { width: 18px; height: 18px; }
.chat-linkbox .card-body { padding: 14px 18px; }
.chat-linkbox .to-lnk-zeile input { font-size: 13px; padding: 6px 8px; }

/* Chat-Fenster */
body.chat-app { margin: 0; height: 100vh; height: 100dvh; overflow: hidden; background: var(--bg); }
.cw { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 900px; margin: 0 auto; background: var(--surface); box-shadow: 0 0 0 1px var(--line); position: relative; }
.cw-kopf { display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--orange); color: #fff; flex: none; }
html[data-theme="contrast"] .cw-kopf { background: #000; border-bottom: 1px solid #fff; }
.cw-ic { width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: flex; align-items: center; justify-content: center; flex: none; }
.cw-ic .ic { width: 22px; height: 22px; }
.cw-titel { flex: 1; min-width: 0; }
.cw-titel b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-titel small { display: block; font-size: 12px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-schloss .ic { width: 18px; height: 18px; opacity: .9; }
.cw-btn { width: 40px; height: 40px; border: 0; background: none; color: inherit; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 50%; flex: none; }
.cw-btn:hover, .cw-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .2); }
.cw-btn .ic { width: 22px; height: 22px; }
.cw-panel { position: absolute; top: 58px; right: 8px; left: auto; width: min(340px, calc(100% - 16px)); max-height: calc(100% - 140px); overflow: auto; background: var(--surface); box-shadow: 0 6px 24px rgba(0, 0, 0, .25); padding: 14px 18px; z-index: 5; }
.cw-panel h2 { font-size: 15px; margin: 0 0 6px; color: var(--head); }
.cw-panel ul { margin: 0 0 10px; padding-left: 18px; }
.cw-klein { font-size: 12.5px; color: var(--muted); }
.cw-liste { flex: 1; overflow-y: auto; padding: 12px 12px 6px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); overscroll-behavior: contain; }
.cw-hinweis { margin: auto; max-width: 420px; text-align: center; color: var(--muted); padding: 18px; }
.cw-hinweis.err { color: var(--err); }
.cw-hinweis h2 { color: var(--head); font-size: 18px; }
.cw-name { text-align: left; background: var(--surface); padding: 18px 20px; box-shadow: var(--shadow); color: var(--text); }
.cw-name label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 14px; }
.cw-name input { width: 100%; border: 1px solid #b9bec5; padding: 10px 12px; font: inherit; margin-bottom: 12px; background: var(--surface); color: var(--text); }
.cw-name .btn { width: 100%; justify-content: center; }
.cw-tag { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface); padding: 3px 12px; border-radius: 12px; margin: 8px 0 4px; box-shadow: var(--shadow); }
.cw-msg { max-width: min(78%, 560px); align-self: flex-start; background: var(--surface); padding: 6px 10px 4px; border-radius: 4px 12px 12px 12px; box-shadow: var(--shadow); position: relative; overflow-wrap: anywhere; }
.cw-msg.ich { align-self: flex-end; background: #ffe7d3; border-radius: 12px 4px 12px 12px; }
html[data-theme="dark"] .cw-msg.ich { background: #4a3322; }
html[data-theme="contrast"] .cw-msg, html[data-theme="contrast"] .cw-msg.ich { border: 1px solid #fff; background: #000; }
.cw-msg.ich .cw-von { display: none; }
.cw-von { font-size: 12.5px; font-weight: 700; color: var(--orange-dark); margin-bottom: 1px; }
html[data-theme="dark"] .cw-von { color: #ff9a4d; }
.cw-msg.gast .cw-von { color: var(--info); }
.cw-gast { font-size: 10.5px; font-weight: 600; background: var(--info-bg); color: var(--info); padding: 0 5px; border-radius: 3px; vertical-align: 1px; }
.cw-txt { font-size: 15px; line-height: 1.45; white-space: normal; }
.cw-txt a { color: var(--info); }
.cw-kaputt { font-style: italic; color: var(--muted); }
.cw-fuss { display: flex; justify-content: flex-end; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 1px; }
.cw-weg { border: 0; background: none; padding: 2px; color: var(--muted); cursor: pointer; opacity: 0; display: flex; }
.cw-weg .ic { width: 14px; height: 14px; }
.cw-msg:hover .cw-weg, .cw-weg:focus-visible { opacity: 1; }
@media (hover: none) { .cw-weg { opacity: .6; } }
.cw-weg:hover { color: var(--err); }
.cw-datei { display: grid; gap: 6px; }
.cw-bild img { display: block; max-width: 100%; max-height: 320px; border-radius: 6px; cursor: zoom-in; }
.cw-laedt { font-size: 13px; color: var(--muted); padding: 30px 10px; text-align: center; background: var(--bg); border-radius: 6px; }
.cw-dl { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--bg); padding: 8px 10px; cursor: pointer; text-align: left; font: inherit; color: var(--text); border-radius: 6px; max-width: 100%; }
.cw-dl .ic { width: 26px; height: 26px; color: var(--orange); flex: none; }
.cw-dl span { min-width: 0; }
.cw-dl b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.cw-dl small { display: block; font-size: 12px; color: var(--muted); }
.cw-aelter { align-self: center; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 5px 14px; border-radius: 14px; font: inherit; font-size: 13px; cursor: pointer; }
.cw-form { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); flex: none; }
.cw-form[hidden] { display: none; }
.cw-anhang { color: var(--muted); }
.cw-anhang:hover { background: var(--orange-soft); color: var(--orange); }
.cw-form textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--line); border-radius: 20px; padding: 9px 14px; font: inherit; font-size: 15px; line-height: 1.35; max-height: 160px; background: var(--bg); color: var(--text); }
.cw-form textarea:focus { outline: 2px solid var(--orange); outline-offset: -1px; background: var(--surface); }
.cw-senden { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--orange); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.cw-senden:hover { background: var(--orange-dark); }
.cw-senden .ic { width: 20px; height: 20px; }
@media (max-width: 560px) {
  .chat-karte { grid-template-columns: 40px minmax(0, 1fr); padding: 12px 14px; }
  .chat-ic { width: 38px; height: 38px; }
  .chat-akt { grid-column: 1 / -1; justify-content: stretch; }
  .chat-akt .btn { flex: 1; justify-content: center; }
  .chat-person { flex-wrap: wrap; gap: 0 10px; padding-bottom: 6px; }
  .cw-msg { max-width: 88%; }
}
@media print { .cw-form, .cw-kopf .cw-btn { display: none !important; } }
