/* inofirm – Oberfläche
   Ruhige, warme Neutraltöne · Enoxa-Rot als einzige Akzentfarbe · IBM Plex Sans (lokal, SIL OFL) */

@font-face { font-family: "Plex"; src: url("fonts/plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/plex-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/plex-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/plex-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f5f4f0; --surface: #ffffff; --sunken: #efede7;
  --border: #e3e0d8; --border-strong: #cfcabe;
  --text: #1d1c19; --text-2: #3d3a34; --muted: #77726a;
  --primary: #d63d34; --primary-600: #b52f27; --primary-50: #fdecea; --brand: #e0483f;
  --red: #9b1c1c; --red-50: #fbeceb; --yellow: #9a5a06; --yellow-50: #fbf1de;
  --green: #2e6b3d; --green-50: #e9f2ea; --blue: #2d5b88; --blue-50: #e9eff5; --grey-50: #f1efea;
  --radius: 6px; --sidebar: 236px; font-size: 14.5px;
  --font: "Plex", ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0; letter-spacing: -.015em; }
h2 { font-size: 1.02rem; font-weight: 600; margin: 0 0 .8rem; letter-spacing: -.005em; }
h3 { font-size: .95rem; font-weight: 600; margin: 0 0 .6rem; }
p { margin: .4rem 0 .8rem; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .86em; background: var(--grey-50); padding: .05rem .3rem; border-radius: 3px; }
.icon { width: 17px; height: 17px; flex: none; }
.muted { color: var(--muted); } .small { font-size: .8rem; } .right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; } .inline { display: inline; } .text-red { color: var(--red); font-weight: 600; } .text-green { color: var(--green); font-weight: 500; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; } .hidden { display: none !important; }
::selection { background: #fbd5d1; }

/* ---------- Grundgerüst ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--sunken); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 30; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .65rem; padding: 1.05rem 1.1rem 1rem; color: var(--text); font-weight: 600; font-size: .98rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 28px; height: 28px; flex: none; }
.brand-logo.lg { width: 52px; height: 52px; }
.brand-name { font-size: 1.12rem; font-weight: 600; letter-spacing: -.02em; }
.sidebar nav { display: flex; flex-direction: column; padding: .2rem .6rem; gap: 1px; }
.sidebar nav a { display: flex; align-items: center; gap: .65rem; padding: .45rem .65rem; border-radius: 5px; color: var(--text-2); font-size: .9rem; }
.sidebar nav a .icon { color: var(--muted); }
.sidebar nav a:hover { background: rgba(29,28,25,.05); text-decoration: none; }
.sidebar nav a.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 2px 0 0 var(--primary), 0 0 0 1px var(--border); }
.sidebar nav a.active .icon { color: var(--primary); }
.nav-section { margin: 1.1rem .65rem .3rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 4px; font-size: .7rem; padding: 0 .38rem; font-weight: 600; line-height: 1.55; font-feature-settings: "tnum" 1; }
.sidebar-foot { margin-top: auto; padding: 1rem 1.15rem; font-size: .72rem; color: var(--muted); }
.has-nav .main { margin-left: var(--sidebar); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .8rem; padding: .6rem 1.75rem; background: rgba(245,244,240,.92); backdrop-filter: saturate(1.2) blur(8px); border-bottom: 1px solid var(--border); }
.company-switch { display: flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .1rem .55rem; }
.company-switch select { border: 0; background: transparent; font-weight: 600; padding: .35rem .2rem; max-width: 300px; box-shadow: none !important; }
.company-dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.search { flex: 1; display: flex; align-items: center; gap: .4rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 .65rem; color: var(--muted); max-width: 480px; }
.search:focus-within { border-color: var(--primary); }
.search input { border: 0; background: transparent; padding: .48rem .2rem; width: 100%; box-shadow: none !important; }
.user-menu { margin-left: auto; display: flex; align-items: center; gap: .2rem; }
.user-chip { display: flex; align-items: center; gap: .55rem; color: var(--text); padding: .2rem .5rem; border-radius: var(--radius); }
.user-chip:hover { background: rgba(29,28,25,.05); text-decoration: none; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--text); color: var(--bg); font-weight: 600; font-size: .82rem; }
.user-name { display: flex; flex-direction: column; font-size: .85rem; font-weight: 600; line-height: 1.15; }
.user-name small { color: var(--muted); font-weight: 400; font-size: .73rem; }
.btn-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; background: transparent; border-radius: var(--radius); color: var(--muted); cursor: pointer; }
.btn-icon:hover { background: rgba(29,28,25,.06); color: var(--text); }
.nav-toggle { display: none; }
.content { padding: 1.6rem 1.75rem 3rem; max-width: 1480px; }

/* ---------- Seitenkopf ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.page-head .subtitle { margin: .3rem 0 0; color: var(--muted); font-size: .92rem; }
.actions { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: .8rem; color: var(--muted); margin-bottom: .45rem; }
.breadcrumb a { color: var(--muted); } .breadcrumb a:hover { color: var(--text); }

/* ---------- Karten & Raster ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem 1.25rem; margin-bottom: 1.1rem; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; } .card.flush .card-head { padding: .95rem 1.25rem .2rem; }
.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

/* Kennzahlen: eine zusammenhängende Leiste statt einzelner Kacheln */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; margin-bottom: 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stat { display: block; padding: .95rem 1.15rem; color: var(--text); border-right: 1px solid var(--border); }
.stat:last-child { border-right: 0; }
a.stat:hover { text-decoration: none; background: #fbfaf8; }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: .4rem; }
.stat-label::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--border-strong); flex: none; }
.stat-value { font-size: 1.6rem; font-weight: 600; margin-top: .2rem; letter-spacing: -.02em; font-feature-settings: "tnum" 1; }
.stat-hint { font-size: .78rem; color: var(--muted); margin-top: .05rem; }
.stat.red .stat-label::before { background: var(--red); } .stat.red .stat-value { color: var(--red); }
.stat.yellow .stat-label::before { background: #d08a1c; }
.stat.green .stat-label::before { background: var(--green); }
.stat.blue .stat-label::before { background: var(--primary); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: .76rem; padding: .55rem .75rem; border-bottom: 1px solid var(--border); white-space: nowrap; background: #fbfaf8; }
.table td { padding: .58rem .75rem; border-bottom: 1px solid #eeebe4; vertical-align: top; }
.table tbody tr:hover { background: #fbfaf7; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td { border-top: 1px solid var(--border); background: #fbfaf8; }
.table .num { text-align: right; white-space: nowrap; font-feature-settings: "tnum" 1; }
.table th a { color: inherit; }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 1.25rem; }
.card.flush .table th:last-child, .card.flush .table td:last-child { padding-right: 1.25rem; }
.card:not(.flush) .table th { background: transparent; }
.row-link { color: var(--text); font-weight: 600; }
.row-link:hover { color: var(--primary); }
dl.kv { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: .5rem 1rem; margin: 0; font-size: .9rem; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; word-break: break-word; }

/* ---------- Badges & Ampel ---------- */
.badge { display: inline-block; padding: .08rem .45rem; border-radius: 4px; font-size: .74rem; font-weight: 500; background: var(--grey-50); color: var(--text-2); white-space: nowrap; }
.status-aktiv { background: var(--green-50); color: var(--green); }
.status-gekuendigt { background: var(--blue-50); color: var(--blue); }
.status-beendet { background: var(--grey-50); color: var(--muted); }
.status-entwurf { background: var(--yellow-50); color: var(--yellow); }
.ampel { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 500; white-space: nowrap; }
.ampel::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ampel-rot { color: var(--red); } .ampel-gelb { color: var(--yellow); } .ampel-gruen { color: var(--green); } .ampel-blau { color: var(--blue); } .ampel-grau { color: #a29d93; }
.cat-pill { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; white-space: nowrap; color: var(--text-2); }
.cat-pill i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tag { display: inline-block; background: var(--grey-50); color: var(--text-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 .4rem; font-size: .74rem; margin: 0 .2rem .2rem 0; }
.days { font-weight: 600; font-feature-settings: "tnum" 1; font-size: .86rem; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .85rem; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 500; font-size: .86rem; cursor: pointer; line-height: 1.25; white-space: nowrap; font-family: inherit; transition: background .12s, border-color .12s; }
.btn:hover { background: #f8f7f4; border-color: #bdb7aa; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; } .btn-danger:hover { background: #8f1d17; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-50); border-color: transparent; }
.btn-danger-ghost { border-color: transparent; background: transparent; color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-50); border-color: transparent; }
.btn-sm { padding: .26rem .55rem; font-size: .78rem; }
.btn-block { width: 100%; justify-content: center; padding: .65rem; }
.btn-link-danger { border: 0; background: none; color: var(--red); cursor: pointer; font-size: 1rem; padding: 0 .2rem; }
.btn .icon { width: 15px; height: 15px; }
.btn:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Formulare ---------- */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .8rem; font-weight: 500; color: var(--text-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=tel], input[type=search], input[type=color], select, textarea {
  font: inherit; font-weight: 400; font-size: .9rem; color: var(--text); padding: .48rem .62rem; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface); width: 100%; }
input[type=color] { padding: .15rem; height: 36px; }
input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; }
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,95,91,.14); }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; font-size: .88rem; color: var(--text); }
label.check input { width: auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .85rem 1rem; }
.form-grid .span-2 { grid-column: span 2; } .form-grid .span-all { grid-column: 1 / -1; }
.form-row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end; }
.form-row > label { flex: 1 1 180px; }
.form-row > label.label-btn { flex: 0 0 auto; }
.form-section { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1.2rem; }
.form-section > h3 { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.form-actions { display: flex; gap: .55rem; margin-top: 1.3rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.hint { font-weight: 400; color: var(--muted); font-size: .76rem; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters label { font-size: .74rem; }
.filters select, .filters input { padding: .38rem .55rem; font-size: .85rem; min-width: 150px; }

/* ---------- Meldungen ---------- */
.alert { padding: .7rem .95rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; border-left-width: 3px; font-size: .9rem; background: var(--surface); }
.alert-success { border-color: #c9ddcc; border-left-color: var(--green); color: #1f4a2a; }
.alert-error { border-color: #ecc8c5; border-left-color: var(--red); color: #7a1a14; }
.alert-info { border-color: #d3dde8; border-left-color: var(--blue); color: #213f5e; }
.alert-warning { border-color: #ead7b4; border-left-color: #d08a1c; color: #6a3f05; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 1.3rem; border-bottom: 1px solid var(--border); margin-bottom: 1.2rem; overflow-x: auto; }
.tabs a { padding: .55rem 0; color: var(--muted); font-weight: 500; font-size: .88rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }
.tabs .count { background: var(--grey-50); color: var(--muted); border-radius: 4px; padding: 0 .38rem; font-size: .72rem; margin-left: .35rem; font-feature-settings: "tnum" 1; }

/* ---------- Dateien & Notizen ---------- */
.file-link { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; color: var(--text); }
.file-link:hover { color: var(--primary); }
.file-ext { font-size: .62rem; font-weight: 700; letter-spacing: .03em; background: var(--grey-50); border: 1px solid var(--border); color: var(--text-2); border-radius: 3px; padding: .05rem .3rem; }
.upload-form { margin-top: 1rem; }
.dropzone { position: relative; border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 1.1rem; text-align: center; color: var(--muted); margin-bottom: .8rem; background: #fbfaf8; font-size: .88rem; }
.dropzone.drag { border-color: var(--primary); background: var(--primary-50); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone.has-files span { color: var(--text); font-weight: 500; }
.note-form { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; margin-bottom: 1rem; }
.note { border-left: 2px solid var(--border-strong); padding: .2rem 0 .2rem .8rem; margin-bottom: .85rem; }
.note-meta { font-size: .78rem; color: var(--muted); }
.note-body { font-size: .9rem; margin-top: .15rem; }

/* ---------- Fristenlisten ---------- */
.deadline-list { list-style: none; margin: 0; padding: 0; }
.deadline-list li { display: flex; gap: .9rem; align-items: center; padding: .62rem 0; border-bottom: 1px solid #eeebe4; }
.deadline-list li:last-child { border-bottom: 0; }
.date-box { flex: none; width: 50px; text-align: center; border-radius: 5px; background: var(--grey-50); padding: .28rem 0; line-height: 1.1; border: 1px solid var(--border); }
.date-box b { display: block; font-size: 1.05rem; font-weight: 600; font-feature-settings: "tnum" 1; }
.date-box small { font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.date-box.rot { background: var(--red-50); border-color: #efcfcc; color: var(--red); }
.date-box.gelb { background: var(--yellow-50); border-color: #eedcb8; color: var(--yellow); }
.date-box.gruen { background: var(--green-50); border-color: #cfe1d2; color: var(--green); }
.date-box.blau { background: var(--blue-50); border-color: #d1dceb; color: var(--blue); }
.dl-main { flex: 1; min-width: 0; } .dl-main .title { font-weight: 500; } .dl-main .meta { font-size: .8rem; color: var(--muted); }

/* ---------- Diagramme ---------- */
.bars { display: flex; flex-direction: column; gap: .6rem; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 36%) 1fr auto; gap: .7rem; align-items: center; font-size: .84rem; }
.bar-row .bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--grey-50); border-radius: 2px; height: 8px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 2px; background: var(--primary); min-width: 2px; }
.bar-value { font-feature-settings: "tnum" 1; font-weight: 500; white-space: nowrap; }
.timeline { display: grid; grid-template-columns: repeat(12, 1fr); gap: .4rem; align-items: end; height: 150px; padding-top: .5rem; }
.tl-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .25rem; }
.tl-bar { width: 100%; max-width: 28px; background: var(--primary); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; opacity: .85; }
.tl-col:hover .tl-bar { opacity: 1; }
.tl-bar.has-red { background: linear-gradient(to top, var(--red) var(--r, 0%), var(--primary) var(--r, 0%)); }
.tl-num { font-size: .74rem; font-weight: 600; font-feature-settings: "tnum" 1; }
.tl-label { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-top: 1px solid var(--border); width: 100%; text-align: center; padding-top: .25rem; }

/* ---------- Kalender ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal-h { padding: .4rem .45rem; font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: #fbfaf8; }
.cal-d { min-height: 104px; padding: .3rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: .76rem; background: var(--surface); }
.cal-d.other { background: #faf9f6; color: #b0aaa0; }
.cal-d.today { background: var(--primary-50); }
.cal-d .dnum { font-weight: 600; margin-bottom: .2rem; font-feature-settings: "tnum" 1; }
.cal-ev { display: block; padding: .08rem .35rem; border-radius: 3px; margin-bottom: 2px; color: var(--text); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--blue-50); border-left: 2px solid var(--blue); }
.cal-ev:hover { text-decoration: none; filter: brightness(.97); }
.cal-ev.rot { background: var(--red-50); border-left-color: var(--red); }
.cal-ev.gelb { background: var(--yellow-50); border-left-color: #d08a1c; }
.cal-ev.gruen { background: var(--green-50); border-left-color: var(--green); }
.cal-ev.grau { background: var(--grey-50); border-left-color: #a29d93; }
.cal-ev.blau { background: var(--blue-50); border-left-color: var(--blue); }

/* ---------- Beteiligungsbaum ---------- */
.org-tree, .org-tree ul { list-style: none; margin: 0; padding-left: 1.6rem; position: relative; }
.org-tree { padding-left: 0; }
.org-tree ul::before { content: ""; position: absolute; left: .6rem; top: 0; bottom: .9rem; border-left: 1px solid var(--border-strong); }
.org-tree li { position: relative; margin: .45rem 0; }
.org-tree ul > li::before { content: ""; position: absolute; left: -1rem; top: 1.15rem; width: .9rem; border-top: 1px solid var(--border-strong); }
.org-node { display: inline-flex; align-items: center; gap: .6rem; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 5px; padding: .42rem .75rem; }
.org-node .pct { background: var(--primary-50); color: var(--primary); font-weight: 600; font-size: .76rem; border-radius: 4px; padding: .02rem .45rem; font-feature-settings: "tnum" 1; }
.org-node.extern { border-left-color: #a29d93; background: #fbfaf8; }

/* ---------- Leerzustand ---------- */
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }

/* ---------- Anmeldung: dunkle Fläche links, Formular rechts ---------- */
.no-nav .content { max-width: none; padding: 0; }
.no-nav .content > .alert { position: fixed; top: 1rem; right: 1rem; z-index: 5; max-width: 380px; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 480px); }
.login-wrap::before { content: ""; background-color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56'%3E%3Cpath d='M0 55.5h56M55.5 0v56' stroke='%23ffffff' stroke-opacity='.06'/%3E%3C/svg%3E"),
    linear-gradient(160deg, rgba(31,95,91,.55), rgba(29,28,25,0) 60%); }
.login-card { align-self: center; width: 100%; max-width: 360px; margin: 0 auto; padding: 2rem 1.5rem; }
.login-brand { margin-bottom: 1.6rem; }
.login-brand h1 { margin-top: 1rem; font-size: 1.35rem; }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-wrap::before { display: none; } }

/* ---------- Brief (Kündigungsschreiben) ---------- */
.letter { background: #fff; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 27mm 20mm 20mm 25mm; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06); font-family: Arial, Helvetica, sans-serif; font-size: 11pt; line-height: 1.5; color: #000; }
.letter .sender-line { font-size: 7.5pt; text-decoration: underline; color: #333; margin-bottom: 2mm; }
.letter .address { height: 40mm; white-space: pre-line; }
.letter .date-line { text-align: right; margin: 6mm 0 8mm; }
.letter .subject { font-weight: bold; margin-bottom: 6mm; white-space: pre-line; }
.letter .body { white-space: pre-line; }
.letter .sign { margin-top: 18mm; white-space: pre-line; }
.letter .sender-block { position: absolute; }
.error-trace { white-space: pre-wrap; font-size: .75rem; background: #1d1c19; color: #eee; padding: 1rem; border-radius: 6px; overflow: auto; }
.pw-mask { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .05em; }

@media (max-width: 1100px) { .grid-main, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 24px rgba(0,0,0,.08); }
  body.nav-open .sidebar { transform: none; }
  .has-nav .main { margin-left: 0; }
  .nav-toggle { display: inline-grid; }
  .grid-2 { grid-template-columns: 1fr; }
  .user-name, .search { display: none; }
  .content { padding: 1rem; }
  .form-grid .span-2 { grid-column: auto; }
  .stat { border-right: 0; border-bottom: 1px solid var(--border); }
}
@media print {
  .sidebar, .topbar, .no-print, .alert { display: none !important; }
  .has-nav .main { margin: 0; } .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
  .letter { box-shadow: none; margin: 0; width: auto; min-height: 0; padding: 0; }
  @page { size: A4; margin: 20mm 20mm 20mm 25mm; }
}

/* ---------- Kartenabrechnung: Import & Zuordnung ---------- */
.badge[style*="background"] { color: #fff; }
.text-success { color: var(--green); } .text-danger { color: var(--red); } .text-muted { color: var(--muted); } .text-end { text-align: right; }
.text-bg-secondary, .text-bg-light { background: var(--grey-50); color: var(--text-2); } .text-bg-warning { background: var(--yellow-50); color: var(--yellow); }
.text-bg-success { background: var(--green-50); color: var(--green); } .text-bg-dark { background: var(--text); color: #fff; }
.border-warning { border-color: #d08a1c !important; box-shadow: 0 0 0 2px rgba(208,138,28,.15); }
.group-row td { background: var(--sunken) !important; font-size: .8rem; font-weight: 600; }
.assign-table td { vertical-align: top; }
.assign-table select, .assign-table input[type=text], .assign-table textarea { font-size: .8rem; padding: .28rem .4rem; width: auto; }
.tx-row.status-open { box-shadow: inset 3px 0 0 #d08a1c; }
.tx-row.status-assigned { box-shadow: inset 3px 0 0 var(--green); }
.tx-row.status-ignored { opacity: .55; }
.tx-row.is-dirty { background: #fffbe6; }
.tx-row.copied { background: #eef7ee; } .tx-row.copied td { background: transparent; }
.tx-row.has-pc:not(.status-ignored) { box-shadow: inset 5px 0 0 var(--pc); }
.tx-row.has-pc:not(.status-ignored):not(.is-dirty):not(.copied) > td { background: color-mix(in srgb, var(--pc) 6%, transparent); }
.bulkbar { position: sticky; top: 57px; z-index: 6; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.bulkbar select { width: auto; font-size: .8rem; padding: .3rem .45rem; }
.alloc { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .25rem; }
.rule-line { display: flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--muted); }
.rule-line input[type=text] { max-width: 200px; }
.tx-note { font-size: .78rem; resize: vertical; min-height: 0; width: 100% !important; background: transparent; border-style: dashed; margin-top: .25rem; }
.tx-note:focus, .tx-note.has-note { background: #fffbea; border-style: solid; border-color: #e8d28a; }
.find-same { opacity: .35; text-decoration: none; } .tx-row:hover .find-same { opacity: 1; }
.lvl-a { min-width: 170px; font-size: .8rem; }

/* ---------- Rechtsfälle ---------- */
.lg-timeline { position: relative; margin-left: .4rem; border-left: 2px solid var(--border); padding-left: 1.1rem; }
.lg-timeline .tl-item { position: relative; display: grid; grid-template-columns: 92px 1fr; gap: .8rem; padding: .6rem 0; border-bottom: 1px solid var(--grey-50); }
.lg-timeline .tl-item::before { content: ""; position: absolute; left: -1.52rem; top: .95rem; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.lg-timeline .tl-urteil::before, .lg-timeline .tl-beschluss::before, .lg-timeline .tl-termin::before { border-color: var(--primary); background: var(--primary); }
.lg-timeline .tl-schreiben_ein::before { border-color: var(--blue); }
.lg-timeline .tl-date { font-size: .82rem; color: var(--muted); font-feature-settings: "tnum" 1; padding-top: .1rem; }
.lg-timeline .tl-text { margin: .3rem 0; font-size: .9rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .7rem; }
.gallery .thumb { display: block; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--sunken); color: var(--text-2); }
.gallery .thumb img { display: block; width: 100%; height: 120px; object-fit: cover; }
.gallery .thumb span { display: block; font-size: .74rem; padding: .3rem .45rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery .thumb:hover { border-color: var(--primary); text-decoration: none; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .35rem 1rem; }
.copy-field { display: flex; gap: .4rem; } .copy-field input { flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; }
.input-sm { padding: .28rem .45rem !important; font-size: .82rem !important; }
table.lg-docs td { vertical-align: top; }
@media (max-width: 700px) { .lg-timeline .tl-item { grid-template-columns: 1fr; gap: .2rem; } }

/* ---------- Aufgaben ---------- */
.task-board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: .9rem; align-items: start; overflow-x: auto; }
.task-col { background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem; min-height: 180px; }
.task-col.over { outline: 2px dashed var(--primary); outline-offset: -4px; }
.task-col-head { font-weight: 600; font-size: .85rem; margin: 0 .2rem .6rem; display: flex; justify-content: space-between; color: var(--text-2); }
.task-col-head .count { background: var(--surface); border-radius: 10px; padding: 0 .5rem; font-weight: 500; color: var(--muted); }
.task-drop { display: grid; gap: .5rem; min-height: 120px; }
.task-card { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: var(--radius); padding: .55rem .65rem; cursor: grab; box-shadow: 0 1px 0 rgba(0,0,0,.03); }
.task-card.dragging { opacity: .5; }
.task-card.prio-3 { border-left-color: var(--yellow); } .task-card.prio-4 { border-left-color: var(--red); } .task-card.prio-1 { border-left-color: var(--grey-50); }
.task-card.overdue { background: var(--red-50); }
.task-card .task-title { display: block; font-weight: 600; color: var(--text); font-size: .9rem; margin-bottom: .25rem; }
.task-card .task-meta { font-size: .76rem; color: var(--muted); display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.task-card .company-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.badge.prio-yellow { background: var(--yellow-50); color: var(--yellow); } .badge.prio-red { background: var(--red-50); color: var(--red); } .badge.prio-grey { background: var(--grey-50); color: var(--muted); }
.badge.task-offen { background: var(--blue-50); color: var(--blue); } .badge.task-in_arbeit { background: var(--yellow-50); color: var(--yellow); }
.badge.task-wartet { background: var(--grey-50); color: var(--text-2); } .badge.task-erledigt { background: var(--green-50); color: var(--green); }
.task-status-bar { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters .seg { display: inline-flex; gap: .25rem; }
.progress { height: 6px; background: var(--grey-50); border-radius: 3px; overflow: hidden; margin-bottom: .6rem; } .progress span { display: block; height: 100%; background: var(--primary); }
ul.checklist { list-style: none; padding: 0; margin: 0; } ul.checklist li { padding: .25rem 0; border-bottom: 1px solid var(--grey-50); display: flex; align-items: center; gap: .4rem; }
ul.checklist li.done label { text-decoration: line-through; color: var(--muted); }
@media (max-width: 900px) { .task-board { grid-template-columns: repeat(4, 240px); } }

/* ---------- Datei-Viewer & Dateifilter ---------- */
.viewer { position: fixed; inset: 0; z-index: 100; background: rgba(20, 19, 17, .82); display: none; flex-direction: column; }
.viewer.open { display: flex; }
body.viewer-open { overflow: hidden; }
.viewer-bar { display: flex; align-items: center; gap: .8rem; padding: .55rem 1rem; background: #1d1c19; color: #f1efea; font-size: .9rem; }
.viewer-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.viewer-count { color: #a29d93; font-size: .8rem; }
.viewer-actions { display: flex; gap: .3rem; }
.viewer-actions button, .viewer-actions a { background: #34322d; color: #f1efea; border: 0; border-radius: 5px; min-width: 34px; height: 32px; font-size: 1.05rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.viewer-actions button:hover, .viewer-actions a:hover { background: #4a4740; }
.viewer-body { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 1rem; }
.viewer-body iframe { width: min(1100px, 100%); height: 100%; border: 0; background: #fff; border-radius: 4px; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; cursor: zoom-in; border-radius: 3px; }
.viewer-body img.zoom { max-width: none; max-height: none; cursor: zoom-out; }
.viewer-msg { background: var(--surface); padding: 1.5rem 2rem; border-radius: var(--radius); text-align: center; max-width: 460px; color: var(--text); }
.doc-filter { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: .8rem; }
.doc-filter input, .doc-filter select { padding: .34rem .5rem; font-size: .84rem; width: auto; }
.doc-filter input[type=search] { min-width: 220px; flex: 1; max-width: 340px; }
.viewer-body:has(.viewer-pages), .viewer-body:has(.viewer-text) { align-items: flex-start; }
.viewer-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-bottom: 2rem; }
.viewer-pages canvas { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); max-width: 100%; height: auto; }
.viewer-text { background: #fff; color: var(--text); padding: 1.2rem 1.5rem; border-radius: 4px; width: min(1000px, 100%); white-space: pre-wrap; font-size: .9rem; margin: 0; }

/* Personen: Rollen-Badges */
.badge.role-officer { background: var(--primary-50); color: var(--primary); }
.badge.role-holding { background: var(--blue-50); color: var(--blue); }
.badge.role-contact { background: var(--grey-50); color: var(--text-2); }
.badge.role-party { background: var(--yellow-50); color: var(--yellow); }

/* Menü: aufklappbare Abschnitte */
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; border-radius: 4px; user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: .2rem; }
.nav-group[open] > summary::after { transform: rotate(45deg); }
.nav-group > summary:hover { color: var(--text); }
.nav-group > a { display: flex; }
.badge.role-employee { background: var(--green-50); color: var(--green); }
details.inline-details { display: inline-block; }
details.inline-details > summary { list-style: none; display: inline-flex; }
details.inline-details > summary::-webkit-details-marker { display: none; }

/* Abwesenheitskalender */
.abs-cal th, .abs-cal td { padding: .3rem .15rem; font-size: .72rem; min-width: 22px; }
.abs-cal th:first-child, .abs-cal td:first-child { min-width: 150px; padding-left: .8rem; font-size: .82rem; }
.abs-cal th .muted { font-size: .62rem; font-weight: 400; }
.abs-cal .we { background: var(--grey-50); }
.abs-cal th.today { color: var(--primary); font-weight: 700; }
.abs-cal td.abs-c { background: linear-gradient(to top, var(--c) var(--h, 100%), transparent var(--h, 100%)); border-left: 1px solid #fff; }
.abs-cal td.abs-c.pending { background: repeating-linear-gradient(45deg, var(--c) 0 3px, #fff 3px 6px); }

/* Import-Vorschau: Monate schmal links, Karten-Zuordnung breit */
.import-preview-grid { grid-template-columns: minmax(200px, 1fr) minmax(0, 2.6fr); }
.import-preview-grid td.card-map { width: 45%; }
.import-preview-grid td.card-map select { width: 100%; min-width: 280px; }
@media (max-width: 900px) { .import-preview-grid { grid-template-columns: 1fr; } .import-preview-grid td.card-map select { min-width: 0; } }
