/* ===== Admin ===== */
body { min-height: 100vh; font-size: 15px; }
a { color: inherit; }
[hidden] { display: none !important; }
.app, .login { position: relative; z-index: 1; }

/* Anmeldung */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); padding: 44px; border-radius: 32px; display: grid; gap: 18px; }
.login-card .logo { width: 140px; margin-bottom: 12px; }
.login-card h1 { font-size: 38px; letter-spacing: -0.03em; line-height: 1.05; }
/* Zwei-Faktor-Anmeldung */
.tf-card { width: min(460px, 100%); }
.tf-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.tf-qr { justify-self: center; padding: 12px; border-radius: 18px; background: #fff; box-shadow: 0 10px 30px -18px rgba(30,20,20,.4); }
.tf-qr svg { display: block; width: 210px; height: 210px; }
.tf-manual summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.tf-manual code { display: block; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.8); font-size: 15px; letter-spacing: .08em; word-break: break-all; }
.tf-code { font-size: 26px !important; letter-spacing: .3em; text-align: center; }
.tf-backup { margin: 0; padding: 14px 18px 14px 40px; border-radius: 16px; background: rgba(255,255,255,.8); columns: 2; column-gap: 28px;
  font-family: ui-monospace, Consolas, monospace; font-size: 16px; line-height: 1.9; }

/* Felder */
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.field small { font-size: 12px; color: var(--soft); line-height: 1.4; }
input[type=text], input[type=email], input[type=password], input[type=tel], input:not([type]), textarea, select {
  width: 100%; padding: 11px 14px 9px;
  border: 1px solid rgba(22,22,22,.12); border-radius: 12px;
  background: rgba(255,255,255,.9);
  font-size: 15px; line-height: 1.45;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 92px; }
input:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(188,39,49,.1); }
input[type=color] { width: 42px; height: 40px; padding: 3px; border: 1px solid rgba(22,22,22,.12); border-radius: 10px; background: #fff; cursor: pointer; }
.form-error { min-height: 18px; color: var(--red); font-size: 13px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

.btn { padding: 12px 20px 10px; font-size: 14px; }
.btn-sm { padding: 9px 14px 7px; font-size: 13px; }
.btn-line { background: transparent; border-color: rgba(22,22,22,.16); color: var(--ink); }
.btn-line:hover { background: #fff; }
.btn-text { padding: 8px 10px; border: 0; background: none; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; border-radius: 10px; }
.btn-text:hover { color: var(--ink); background: rgba(22,22,22,.05); }
.btn-danger { color: var(--red); }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; font-size: 15px; }
.icon-btn:hover { background: rgba(22,22,22,.06); color: var(--ink); }

/* Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 24px;
  background: rgba(236,235,233,.78);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; font-weight: 600; }
.brand img { width: 112px; }
.brand span { padding-left: 14px; border-left: 1px solid rgba(22,22,22,.15); color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.env-badge { padding: 4px 10px 2px; border-radius: 100px; background: rgba(22,22,22,.08); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.page { max-width: 1280px; margin: 0 auto; padding: 40px 24px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { margin-top: 10px; font-size: clamp(32px, 4vw, 48px); letter-spacing: -0.03em; line-height: 1.04; }

.card { background: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.9); border-radius: 22px; box-shadow: var(--shadow-sm); }

/* Übersicht */
.p-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.p-card { display: flex; flex-direction: column; overflow: hidden; text-decoration: none; transition: transform .3s var(--ease), box-shadow .3s; }
.p-card:hover { transform: translateY(-3px); box-shadow: 0 30px 50px -30px rgba(30,20,20,.4); }
.p-cover { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #f0e3e0, #e6e3df) center / cover; }
.p-logo { position: absolute; left: 14px; bottom: 14px; display: flex; align-items: center; height: 38px; padding: 6px 14px; border-radius: 100px; background: rgba(255,255,255,.85); }
.p-logo img { max-height: 24px; max-width: 120px; }
.p-status { position: absolute; top: 14px; right: 14px; }
.p-body { padding: 18px 20px 20px; display: grid; gap: 4px; }
.p-body strong { font-size: 18px; letter-spacing: -0.01em; }
.p-body > span { color: var(--muted); }
.p-meta { display: flex; gap: 16px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.p-meta b { color: var(--ink); }
.empty { padding: 60px 30px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 26px; margin-bottom: 8px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 3px; border-radius: 100px; font-size: 12px; font-weight: 600; background: rgba(22,22,22,.07); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-entwurf { background: rgba(255,255,255,.9); }
.pill-aktiv { background: #e7f2ea; color: #2c7a45; }
.pill-archiviert { color: var(--soft); }
.pill-sent { background: #eef0f6; color: #3b4f8a; }
.pill-open { background: #e7f2ea; color: #2c7a45; }

/* Editor-Rahmen */
.ed-head { display: flex; align-items: center; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ed-title { display: grid; gap: 2px; margin-right: auto; min-width: 0; }
.ed-title strong { font-size: 20px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-title span { font-size: 13px; color: var(--muted); }
.save-state { font-size: 13px; color: var(--soft); min-width: 92px; text-align: right; }
.save-state.err { color: var(--red); }
.tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 14px 14px 12px; border: 0; background: none; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-color: var(--red); }
.tab em { font-style: normal; margin-left: 6px; padding: 1px 7px 0; border-radius: 10px; background: rgba(22,22,22,.07); font-size: 12px; }

/* Inhalt: Folienliste | Formular | Vorschau */
.ed-content { display: grid; grid-template-columns: 260px minmax(360px, 1fr) minmax(380px, 1.25fr); height: calc(100vh - 64px - 75px - 47px); }
.ed-content > * { min-height: 0; overflow-y: auto; }
.slide-list { padding: 16px 12px 24px; border-right: 1px solid var(--line); }
.sl-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 8px 9px 10px; margin-bottom: 4px;
  border: 1px solid transparent; border-radius: 14px; background: none;
  text-align: left; cursor: pointer; transition: background .2s;
}
.sl-item:hover { background: rgba(255,255,255,.6); }
.sl-item.on { background: #fff; border-color: rgba(22,22,22,.08); box-shadow: var(--shadow-sm); }
.sl-item.is-hidden .sl-text { opacity: .45; }
.sl-item.drag-over { border-color: var(--red); border-style: dashed; }
.sl-num { flex-shrink: 0; width: 22px; font-size: 12px; font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; }
.sl-thumb { flex-shrink: 0; width: 44px; height: 30px; border-radius: 7px; background: rgba(22,22,22,.06) center / cover; }
.sl-text { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.sl-text b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-text small { font-size: 11px; color: var(--soft); text-transform: uppercase; letter-spacing: .06em; }
.sl-grip { cursor: grab; color: var(--soft); font-size: 14px; padding: 0 2px; }
.sl-sep { height: 1px; margin: 10px 8px; background: var(--line); }
.add-slide { width: 100%; margin-top: 8px; justify-content: center; }

.slide-form { padding: 24px 28px 60px; display: grid; gap: 18px; align-content: start; }
.form-head { display: flex; align-items: center; gap: 8px; }
.form-head h2 { margin-right: auto; font-size: 22px; letter-spacing: -0.02em; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.5; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.55); }
.hint code { font-size: 12px; background: rgba(22,22,22,.06); padding: 1px 5px; border-radius: 5px; }
.section-title { margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Bildfeld */
.media-field { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1.5px dashed rgba(22,22,22,.16); border-radius: 14px; background: rgba(255,255,255,.5); transition: border-color .2s, background .2s; }
.media-field.drop { border-color: var(--red); background: #fff; }
.media-field .mf-thumb { width: 92px; height: 62px; flex-shrink: 0; border-radius: 9px; background: rgba(22,22,22,.05) center / cover no-repeat; }
.media-field .mf-thumb.contain { background-size: contain; background-color: #fff; }
.media-field .mf-text { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.mm-item { position: relative; aspect-ratio: 1; border-radius: 10px; background: rgba(22,22,22,.05) center / cover; cursor: grab; }
.mm-item button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(22,22,22,.7); color: #fff; font-size: 12px; cursor: pointer; opacity: 0; transition: opacity .2s; }
.mm-item:hover button { opacity: 1; }
.mm-add { display: grid; place-items: center; aspect-ratio: 1; border: 1.5px dashed rgba(22,22,22,.18); border-radius: 10px; background: rgba(255,255,255,.5); color: var(--muted); font-size: 22px; cursor: pointer; }
.mm-add.drop { border-color: var(--red); background: #fff; }

/* Listen (Fakten, Legende, Schritte …) */
.list { display: grid; gap: 10px; }
.list-item { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.6); border: 1px solid rgba(22,22,22,.06); }
.list-item-head { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--soft); }
.list-item-head span { margin-right: auto; }
.list-item .row { gap: 8px; }
.list-item .media-field { padding: 6px; }
.list-item .media-field .mf-thumb { width: 64px; height: 44px; }

/* Vorschau */
.preview-pane { padding: 18px 22px 24px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; background: rgba(255,255,255,.25); }
.preview-bar { display: flex; align-items: center; gap: 8px; }
.preview-bar span { margin-right: auto; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(22,22,22,.06); }
.seg button { padding: 6px 12px 4px; border: 0; border-radius: 8px; background: none; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.preview-frame { position: relative; flex: 1; min-height: 240px; display: grid; place-items: start center; }
.preview-scaler { position: relative; overflow: hidden; border-radius: 16px; box-shadow: 0 30px 60px -30px rgba(30,20,20,.45), 0 0 0 1px rgba(22,22,22,.06); background: var(--bg); }
.preview-scaler iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; }

/* Dateien */
.files { padding: 24px; display: grid; gap: 20px; max-width: 1280px; }
.dropzone { display: grid; place-items: center; gap: 6px; padding: 36px 20px; text-align: center; border: 2px dashed rgba(22,22,22,.15); border-radius: 22px; background: rgba(255,255,255,.5); color: var(--muted); cursor: pointer; transition: border-color .2s, background .2s; }
.dropzone strong { color: var(--ink); font-size: 17px; }
.dropzone.drop { border-color: var(--red); background: #fff; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.media-card { overflow: hidden; padding: 0; text-align: left; }
.media-card .mc-img { aspect-ratio: 4 / 3; background: #fff center / cover no-repeat; }
.media-card .mc-img.contain { background-size: contain; }
.media-card .mc-body { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 12px; font-size: 12px; }
.media-card .mc-body span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.media-card.pick { cursor: pointer; border: 2px solid transparent; }
.media-card.pick:hover { border-color: rgba(188,39,49,.4); }
.media-card.pick.sel { border-color: var(--red); }
.uploads { display: grid; gap: 6px; }
.upload-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 12px; background: rgba(255,255,255,.7); font-size: 13px; }
.upload-row.err { color: var(--red); }

/* Empfänger */
.rec { padding: 24px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 24px; align-items: start; max-width: 1400px; }
.rec-section { padding: 24px; display: grid; gap: 16px; }
.rec-section h3 { font-size: 18px; letter-spacing: -0.01em; }
.rec-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rec-table th { padding: 0 10px 10px; text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.rec-table td { padding: 12px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.rec-table td.actions { text-align: right; white-space: nowrap; }
.rec-name strong { display: block; }
.rec-name span { font-size: 13px; color: var(--muted); }
.pin-box { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: rgba(255,255,255,.75); }
.pin-box b { font-size: 24px; letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.pin-box input { width: 120px; font-size: 18px; letter-spacing: .2em; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.mail-frame { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }

/* Auswertung */
.stats { padding: 24px; display: grid; gap: 22px; max-width: 1280px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kpi { padding: 20px 22px; }
.kpi span { display: block; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kpi strong { display: block; margin-top: 8px; font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.kpi small { display: block; margin-top: 6px; font-size: 13px; color: var(--soft); }
.chart-card { padding: 22px 24px; }
.chart-card h3 { font-size: 17px; margin-bottom: 4px; }
.chart-card > p { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 28px minmax(120px, 240px) 1fr 86px; align-items: center; gap: 12px; padding: 4px 6px; border-radius: 8px; font-size: 13px; position: relative; }
.bar-row:hover { background: rgba(22,22,22,.04); }
.bar-row .n { color: var(--soft); font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { height: 12px; }
.bar-row .bar { height: 12px; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--red); transition: width .6s var(--ease); }
.bar-row .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.bar-row.unseen .t, .bar-row.unseen .v { color: var(--soft); font-weight: 400; }
.bar-tip { position: absolute; z-index: 5; right: 100px; top: -34px; padding: 6px 10px 4px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s; }
.bar-row:hover .bar-tip { opacity: 1; }
.r-row { border-top: 1px solid var(--line); }
.r-row:first-of-type { border-top: 0; }
.r-head { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(0, 1fr)) 24px; gap: 12px; align-items: center; width: 100%; padding: 14px 4px; border: 0; background: none; text-align: left; cursor: pointer; font-size: 14px; }
.r-head small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.r-head .chev { transition: transform .3s; color: var(--soft); }
.r-row.open .chev { transform: rotate(90deg); }
.r-detail { padding: 6px 4px 22px; display: grid; gap: 16px; }
.sessions { display: flex; flex-wrap: wrap; gap: 8px; }
.sessions span { padding: 6px 10px 4px; border-radius: 10px; background: rgba(255,255,255,.8); font-size: 12px; color: var(--muted); }
.sessions b { color: var(--ink); }

/* Modal & Hinweise */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(22,22,22,.35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .25s ease both; }
.modal-card { position: relative; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 32px; border-radius: 26px; background: #f7f6f4; box-shadow: 0 40px 80px -30px rgba(0,0,0,.4); }
.modal-card.wide { width: min(1000px, 100%); }
.modal-card.mid { width: min(760px, 100%); }
/* Scrollbalken bei langen Fenstern: Ecken trotzdem rund (sonst wird die rechte Seite gerade) */
.modal-card { clip-path: inset(0 round 26px); scrollbar-width: thin; scrollbar-color: rgba(22,22,22,.22) transparent; }
.modal-card h2 { font-size: 26px; letter-spacing: -0.02em; margin-bottom: 18px; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(22,22,22,.06); font-size: 22px; cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.type-btn { display: grid; gap: 4px; padding: 14px; border: 1px solid rgba(22,22,22,.08); border-radius: 14px; background: #fff; text-align: left; cursor: pointer; transition: border-color .2s, transform .2s; }
.type-btn:hover { border-color: var(--red); transform: translateY(-2px); }
.type-btn b { font-size: 14px; }
.type-btn span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%); padding: 12px 18px 10px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: var(--shadow-sm); animation: fadeUp .3s var(--ease) both; }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 10px); } }

@media (max-width: 1180px) {
  .ed-content { grid-template-columns: 220px minmax(0, 1fr); height: auto; }
  .ed-content > * { overflow: visible; }
  .preview-pane { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); min-height: 520px; }
  .rec { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .ed-content { grid-template-columns: minmax(0, 1fr); }
  .slide-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .bar-row { grid-template-columns: 22px minmax(0, 1fr) 70px; }
  .bar-row .track { grid-column: 2 / -1; grid-row: 2; }
  .r-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 24px; }
  .r-head .hide-sm { display: none; }
}

/* Platzieren auf dem Plan */
.place-stage { position: relative; border-radius: 14px; overflow: hidden; background: #fff; cursor: crosshair; border: 1px solid var(--line); }
.place-stage img { width: 100%; height: auto; }
.place-layer { position: absolute; inset: 0; }
.place-pin { position: absolute; display: grid; place-items: center; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; box-shadow: 0 0 0 2px #fff; cursor: pointer; }
.place-pin:hover { background: var(--ink); }
details.field summary { cursor: pointer; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
input[type=range] { accent-color: var(--red); }

/* KI-Optimierung */
.enhance-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.enh-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; margin-top: 18px; }
.enh-thumb { width: 100%; border-radius: 14px; box-shadow: var(--shadow-sm); }
.enh-wait { display: flex; align-items: center; gap: 18px; padding: 40px 10px; }
.enh-wait b { display: block; font-size: 17px; }
.enh-wait small { color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(188,39,49,.2); border-top-color: var(--red); animation: spin 1s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.enh-compare { position: relative; width: 100%; overflow: hidden; border-radius: 14px; background: #111; cursor: ew-resize; user-select: none; touch-action: none; }
.enh-compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.enh-before { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.enh-handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; pointer-events: none; }
.enh-handle span { position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px; border-radius: 50%; background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.enh-handle span::before { content: "‹ ›"; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; color: var(--red); }
.enh-label { position: absolute; top: 12px; padding: 5px 10px 3px; border-radius: 100px; background: rgba(255,255,255,.85); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; pointer-events: none; }
.enh-label.l { left: 12px; } .enh-label.r { right: 12px; }
@media (max-width: 720px) { .enh-grid { grid-template-columns: minmax(0, 1fr); } }

/* ===== Gemeinsame Oberfläche: Programmwechsel & Startseite ===== */
.app-switch { position: relative; }
#app-switch-btn { display: inline-flex; align-items: center; gap: 8px; }
#app-switch-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.app-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 320px; padding: 8px;
  border-radius: 18px; background: #fff; box-shadow: 0 30px 60px -24px rgba(30,20,20,.4), 0 0 0 1px rgba(22,22,22,.06);
  display: grid; gap: 2px;
}
.app-menu a { display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; text-decoration: none; }
.app-menu a:hover { background: rgba(22,22,22,.04); }
.app-menu a.on { background: rgba(188,39,49,.07); }
.app-menu a:first-child { grid-template-columns: 1fr; border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; margin-bottom: 4px; }
.app-menu i { grid-row: span 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(188,39,49,.08); }
.app-menu i svg, .app-tile .tile-icon svg { width: 18px; height: 18px; fill: none; stroke: var(--red); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.app-menu b { font-size: 14px; }
.app-menu span { font-size: 12px; color: var(--muted); line-height: 1.35; }
/* Programme-Menü als Kachelraster (breit statt lang, damit alle Programme sichtbar sind) */
.app-grid-menu { width: min(1080px, calc(100vw - 32px)); max-height: calc(100vh - 90px); overflow-y: auto; padding: 12px 14px 16px; gap: 6px; }
.app-grid-menu a.mg-home { display: flex; align-items: baseline; gap: 10px; padding: 8px 10px 12px; border-radius: 12px 12px 0 0; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.app-grid-menu .mg-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.app-grid-menu a.mg-tile { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 2px; align-items: start;
  margin: 0; padding: 12px; border-radius: 14px; border: 1px solid rgba(22,22,22,.06); background: rgba(255,255,255,.7); }
.app-grid-menu a.mg-tile:hover { background: #fff; border-color: rgba(188,39,49,.25); box-shadow: 0 10px 24px -16px rgba(30,20,20,.35); }
.app-grid-menu a.mg-tile.on { background: rgba(188,39,49,.06); border-color: rgba(188,39,49,.3); }
.app-grid-menu a.mg-tile b { align-self: center; line-height: 1.25; }
.app-grid-menu a.mg-tile span { grid-column: 1 / -1; margin-top: 6px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.app-grid-menu .mg-folders { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin-top: 6px; align-items: start; }
.app-grid-menu .mg-group { display: grid; gap: 8px; align-content: start; }
.app-grid-menu .mg-group a.menu-folder { margin-top: 0; padding: 8px 4px 2px; }
@media (max-width: 700px) {  /* Handy: zwei Kacheln nebeneinander, ohne Beschreibung */
  .app-grid-menu .mg-tiles, .app-grid-menu .mg-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-grid-menu .mg-folders { grid-template-columns: minmax(0, 1fr); }
  .app-grid-menu .mg-group a.menu-folder { grid-column: 1 / -1; }
  .app-grid-menu a.mg-tile { grid-template-columns: minmax(0, 1fr); row-gap: 8px; padding: 10px 12px; }
  .app-grid-menu a.mg-tile i { width: 30px; height: 30px; }
  .app-grid-menu a.mg-tile span { display: none; }
  .app-grid-menu a.mg-tile b { font-size: 13px; min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
}

.home { max-width: 1180px; margin: 0 auto; padding: clamp(40px, 7vh, 80px) 24px 80px; }
.home h1 { margin-top: 12px; font-size: clamp(38px, 5vw, 64px); letter-spacing: -0.035em; line-height: 1.02; }
.home .lead { margin-top: 14px; max-width: 56ch; color: var(--muted); font-size: 17px; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-top: 40px; }
.app-tile { position: relative; display: grid; gap: 10px; align-content: start; min-height: 220px; padding: 28px; text-decoration: none; transition: transform .3s var(--ease), box-shadow .3s; }
.app-tile:hover { transform: translateY(-4px); box-shadow: 0 34px 60px -30px rgba(30,20,20,.45); }
.app-tile .tile-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 10px; border-radius: 16px; background: rgba(188,39,49,.08); }
.app-tile .tile-icon svg { width: 26px; height: 26px; }
.app-tile strong { font-size: 22px; letter-spacing: -0.02em; }
/* Abgeschaltete Programme (nur für Admins sichtbar) und die Schalter in den Einstellungen */
.off-badge { font-style: normal; margin-left: 6px; padding: 1px 7px 0; border-radius: 10px; background: rgba(22,22,22,.07); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .02em; vertical-align: 2px; }
.app-tile.is-off { opacity: .6; }
/* ERP-Testmodus: Hinweis an der Kachel, Band im ERP, Schalter in den Einstellungen */
.test-badge { font-style: normal; margin-left: 6px; padding: 2px 8px 1px; border-radius: 10px; background: #f59e0b; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em; vertical-align: 3px; }
.tm-warn { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: #fff4e0; color: #7a4a00; font-size: 13px; line-height: 1.5; }
.tm-warn .btn { margin-left: 8px; }
.erp-test-band { position: sticky; top: 0; z-index: 60; background: #f59e0b; color: #fff; text-align: center; font-size: 13px; font-weight: 600; letter-spacing: .02em; padding: 5px 12px; }
.tm-box { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: rgba(22,22,22,.04); }
.tm-box.on { background: #fff7e6; outline: 1px solid #f5c26b; }
.tm-switch { position: relative; flex: none; width: 44px; height: 26px; margin-top: 2px; }
.tm-switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.tm-switch i { position: absolute; inset: 0; border-radius: 13px; background: rgba(22,22,22,.2); transition: background .15s; }
.tm-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.tm-switch input:checked + i { background: #f59e0b; }
.tm-switch input:checked + i::after { transform: translateX(18px); }
.tm-switch input:focus-visible + i { outline: 2px solid var(--ink, #161616); outline-offset: 2px; }
.tm-box b { display: block; }
.tm-box p { margin: 4px 0 0; }
.app-toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.app-toggle { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.6); border: 1px solid rgba(22,22,22,.06); cursor: pointer; }
.app-toggle input { width: 16px; height: 16px; accent-color: var(--red); margin: 0; }
.app-toggle i svg { display: block; width: 18px; height: 18px; fill: none; stroke: var(--red); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.app-toggle:has(input:not(:checked)) { opacity: .55; }
.app-toggle b { font-size: 14px; font-weight: 600; }
.app-tile p { color: var(--muted); line-height: 1.5; }
.app-tile .go { position: absolute; right: 24px; bottom: 22px; color: var(--red); font-weight: 700; transition: transform .3s var(--ease); }
.app-tile:hover .go { transform: translateX(4px); }
.app-tile.soon { border: 1.5px dashed rgba(22,22,22,.14); background: rgba(255,255,255,.35); box-shadow: none; cursor: default; }
.app-tile.soon:hover { transform: none; box-shadow: none; }

/* Benutzermenü & Mitarbeiter */
.user-btn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: var(--red); color: #fff; font: 700 13px/1 var(--font); cursor: pointer; }
.user-btn span { padding-top: 2px; }
.user-menu { width: 260px; }
.um-head { display: grid; gap: 2px; padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.um-head b { font-size: 14px; }
.um-head span { font-size: 12px; color: var(--muted); }
.um-item { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; text-align: left; font: 600 14px/1.3 var(--font); color: var(--ink); cursor: pointer; }
.um-item:hover { background: rgba(22,22,22,.04); }
.users-table select { width: auto; padding: 7px 10px 5px; font-size: 13px; }
.users-table tr.inactive td { opacity: .55; }
.pw-notice { display: grid; gap: 8px; padding: 16px 18px; border-radius: 14px; background: #fff7e8; border: 1px solid #f1d9a6; }
.pw-code { display: flex; align-items: center; gap: 10px; }
.pw-code code { font-size: 20px; font-weight: 700; letter-spacing: .04em; padding: 6px 10px; border-radius: 8px; background: #fff; }
.pw-notice small { font-size: 12px; color: var(--muted); }

/* Arbeitszeiterfassung in der Kopfzeile */
.time-btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 11px; border: 1px solid rgba(22,22,22,.1); border-radius: 100px; background: rgba(255,255,255,.7); font: 600 14px/1 var(--font); color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.time-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.time-btn span { padding-top: 2px; }
.time-btn:hover { background: #fff; }
.time-btn.running { background: var(--ink); border-color: var(--ink); color: #fff; }
.time-btn.running svg { stroke: #e46f67; animation: tick 2s ease-in-out infinite; }
@keyframes tick { 50% { opacity: .45; } }
.time-menu { width: 300px; padding: 14px; gap: 10px; }
.tm-head { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tm-head div { padding: 12px 14px; border-radius: 14px; background: rgba(22,22,22,.04); }
.tm-head span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tm-head b { display: block; margin-top: 4px; font-size: 22px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tm-go { width: 100%; justify-content: center; display: flex; align-items: center; gap: 8px; padding: 14px 18px 12px; font-size: 15px; }
.tm-go small { font-weight: 400; opacity: .7; font-size: 12px; }
.tm-dot { flex: none; width: 9px; height: 9px; border-radius: 2px; background: #e46f67; }
.tm-hint { font-size: 12px; color: var(--soft); text-align: center; margin: -2px 0 0; }
.tm-list { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tm-list span { display: flex; justify-content: space-between; padding: 4px 4px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tm-list b { color: var(--ink); }
.times { display: grid; gap: 18px; }
.times-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.times-bar select { width: auto; }
.times-total { margin-left: auto; font-size: 15px; }
.times-table td { padding: 10px; }
.times-table tr.we td { color: var(--soft); }
.times-table tr.today td { background: rgba(188,39,49,.05); }
.t-day { width: 110px; font-weight: 600; white-space: nowrap; }
.t-sum { width: 70px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.t-chip { display: inline-flex; align-items: center; gap: 6px; margin: 2px 6px 2px 0; padding: 5px 10px 3px; border-radius: 100px; background: rgba(255,255,255,.85); font-size: 13px; font-variant-numeric: tabular-nums; }
.t-chip button { border: 0; background: none; padding: 0 0 2px; color: var(--soft); cursor: pointer; font-size: 11px; }
.t-chip button:hover { color: var(--red); }
.t-none { color: var(--soft); }
.times-export { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.times-export input { width: auto; }

/* Einstellungen: Team */
.team-scroll { overflow-x: auto; }
.team-table input[type=number] { width: 84px; padding: 7px 10px 5px; }
.team-table select { width: auto; max-width: 200px; padding: 7px 10px 5px; font-size: 13px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch i { position: absolute; inset: 0; border-radius: 100px; background: rgba(22,22,22,.18); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.switch input:checked + i { background: var(--red); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px rgba(188,39,49,.25); }

/* Startseite: Hinweise */
.home-notes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.home-notes:empty { display: none; }
.home-note { padding: 10px 16px 8px; border-radius: 100px; background: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.9); font-size: 14px; color: var(--muted); text-decoration: none; }
.home-note b { color: var(--ink); }
.home-note.red { background: var(--red); border-color: var(--red); color: #fff; }
.home-note.red b { color: #fff; }
.home-note:hover { box-shadow: var(--shadow-sm); }

/* Kopfzeile auf dem Smartphone */
@media (max-width: 640px) {
  .topbar { padding: 0 14px; }
  .brand img { width: 92px; }
  .brand span { padding-left: 10px; font-size: 14px; }
  .topbar-right { gap: 4px; }
  .topbar-right .env-badge, #settings { display: none; }
  #app-switch-btn { font-size: 0; gap: 0; padding: 8px; }
  #app-switch-btn svg { width: 20px; height: 20px; }
  .app-menu { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; }
  .time-btn { padding: 0 10px; }
}

/* Benutzerverwaltung */
.um-row { cursor: pointer; }
.um-row:hover td { background: rgba(255,255,255,.6); }
.um-head-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.um-head-row h2 { margin: 0; }
.um-rates { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.um-rates li { display: flex; align-items: center; gap: 14px; padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.6); font-size: 13px; }
.um-rates li span { color: var(--muted); min-width: 90px; }
.um-rates li b { margin-right: auto; }
.um-head-row ~ div input[type=number], .um-head-row ~ div input[type=month] {
  width: 100%; padding: 11px 14px 9px; border: 1px solid rgba(22,22,22,.12); border-radius: 12px;
  background: rgba(255,255,255,.9); font-size: 15px; line-height: 1.45; outline: none;
}

/* Eigenes E-Mail-Konto (Microsoft) */
.ms-code { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 6px 0 16px; padding: 16px 18px; border-radius: 16px; background: rgba(255,255,255,.75); border: 1px solid var(--line); }
.ms-code b { font: 600 26px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.ms-wait { display: flex; align-items: center; gap: 10px; }
.ms-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: ms-pulse 1.2s ease-in-out infinite; }
@keyframes ms-pulse { 50% { opacity: .25; } }

.um-short { display: inline-block; font-size: 12px; letter-spacing: .04em; padding: 2px 8px 1px; border-radius: 6px; background: rgba(22,22,22,.07); }

/* Ordner auf der Startseite */
.home-crumb { display: none; align-items: center; gap: 8px; margin-bottom: 18px; font-size: 14px; color: var(--muted); }
.home-crumb a { color: var(--muted); }
.home-crumb a:hover { color: var(--ink); }
.home-crumb i { font-style: normal; color: var(--soft); }
.home-crumb span { color: var(--ink); font-weight: 600; }
.home.in-folder .home-crumb { display: flex; }
.home.in-folder .home-notes { display: none; }
.folder-tile p { font-weight: 600; color: var(--ink); opacity: .7; }
.folder-tile::before { content: "Ordner"; position: absolute; top: 24px; right: 24px; padding: 4px 10px 2px; border-radius: 100px; background: rgba(22,22,22,.06); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.app-menu a.menu-folder { display: block; margin-top: 6px; padding: 10px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); border-radius: 8px; }
.app-menu a.menu-folder:hover { color: var(--ink); background: none; }

/* Datensatzsperre (locks.js): „Wird gerade von PK bearbeitet“ – liegt über allen anderen Fenstern */
.lock-wait { z-index: 60; }
.lock-card { width: min(460px, 100%); text-align: center; }
.lock-card p { color: var(--muted); line-height: 1.5; }
.lock-card .hint { font-size: 13px; color: var(--soft); margin-top: 12px; }
.lock-card .modal-actions { justify-content: center; }
.lock-short { display: inline-grid; place-items: center; min-width: 64px; height: 64px; padding: 0 14px; margin-bottom: 16px; border-radius: 32px;
  background: var(--red); color: var(--white); font-size: 22px; font-weight: 700; letter-spacing: .04em; }
.lock-pulse { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--apricot); vertical-align: 1px;
  animation: lock-pulse 1.6s ease-in-out infinite; }
@keyframes lock-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .lock-pulse { animation: none; } }
/* Feld „Branche“ (industries.js): Dropdown, bei „Andere …“ ein Textfeld darunter */
.row:has(.ind-field) { align-items: start; }
.ind-field [data-ind-other] { margin-top: 6px; }

/* Einstellungen → Mailversand & Adressen (früher .env) */
.cf-group { border: 1px solid var(--line, rgba(0,0,0,.1)); border-radius: 12px; padding: 10px 14px; }
.cf-group > summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; list-style-position: inside; }
.cf-group[open] > summary { margin-bottom: 2px; }
.cf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.cf-ok { font-size: 12px; color: #2e7d4f; }
.cf-no { font-size: 12px; color: var(--soft); }

/* Telefonfeld: Ländervorwahl · Vorwahl · Rufnummer (portal.js PhoneField) */
.phone-field { display: grid; grid-template-columns: minmax(96px, 128px) minmax(72px, 96px) 1fr; gap: 6px; }
.phone-field select { min-width: 0; text-overflow: ellipsis; }
@media (max-width: 520px) { .phone-field { grid-template-columns: 96px 72px 1fr; } }
