:root {
  --navy-900: #061529; --navy-800: #0a1f3c; --navy-700: #12325c; --navy-600: #1c4a82;
  --ink: #17202e; --muted: #5d6b7f; --line: #d9e0ea; --paper: #f3f6fa; --card: #ffffff;
  --amber: #f5a623; --amber-deep: #c9791a; --green: #1f9d6b; --red: #c0392b; --violet: #6b4fa8;
  --shadow: 0 1px 2px rgba(10,31,60,.06), 0 8px 24px -12px rgba(10,31,60,.22);
  --mono: "IBM Plex Mono", ui-monospace, monospace; --sans: "IBM Plex Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0; font-family: var(--sans); color: var(--ink); background-color: var(--paper);
  background-image: linear-gradient(rgba(28,74,130,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(28,74,130,.05) 1px, transparent 1px);
  background-size: 28px 28px; -webkit-font-smoothing: antialiased;
}

/* Topbar */
.topbar { background: linear-gradient(135deg, var(--navy-800), var(--navy-700)); color: #fff; border-bottom: 3px solid var(--amber); box-shadow: var(--shadow); }
.topbar__inner { max-width: 1240px; margin: 0 auto; padding: 18px 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand__mark { width: 40px; height: 40px; flex: none; border-radius: 9px; background: repeating-linear-gradient(45deg, var(--amber) 0 6px, var(--navy-900) 6px 12px); box-shadow: inset 0 0 0 2px rgba(255,255,255,.85); }
.brand__text h1 { margin: 0; font-size: 1.3rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.brand__text p { margin: 3px 0 0; font-size: .8rem; color: #b9c7dc; }
.topbar__right { display: flex; align-items: center; gap: 16px; }
.logout { color: #b9c7dc; font-size: .78rem; text-decoration: none; border: 1px solid rgba(255,255,255,.18); padding: 7px 12px; border-radius: 8px; }
.logout:hover { background: rgba(255,255,255,.08); color: #fff; }

/* Tabs */
.tabs { background: var(--navy-900); }
.tabs__inner { max-width: 1240px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; overflow-x: auto; }
.tab { flex: none; background: transparent; border: none; color: #9fb2cc; font-family: var(--sans); font-size: .86rem; font-weight: 600; padding: 13px 16px; cursor: pointer; border-bottom: 3px solid transparent; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.tab:hover { color: #fff; }
.tab.is-active { color: #fff; border-bottom-color: var(--amber); }
.tab__count { font-family: var(--mono); font-size: .7rem; color: #7f93b0; background: rgba(255,255,255,.06); padding: 2px 6px; border-radius: 5px; }

/* Toolbar */
.toolbar { position: sticky; top: 0; z-index: 20; background: rgba(243,246,250,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.toolbar__inner { max-width: 1240px; margin: 0 auto; padding: 12px 28px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.langswitch { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.langswitch__btn { font-family: var(--sans); font-size: .82rem; font-weight: 600; color: var(--muted); border: none; background: transparent; padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.langswitch__btn:hover { color: var(--navy-700); }
.langswitch__btn.is-active { background: var(--navy-800); color: #fff; }
.langswitch__btn:disabled, .langswitch__btn.is-disabled { opacity: .38; cursor: not-allowed; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend .mark { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }

/* Highlight-Farben */
.hl-luecke { background: rgba(192,57,43,.22); border-bottom: 2px solid var(--red); }
.hl-produkt { background: rgba(107,79,168,.18); border-bottom: 2px solid var(--violet); }
.hl-pruefen { background: rgba(245,166,35,.28); border-bottom: 2px solid var(--amber-deep); }
mark[class^="hl-"] { color: inherit; padding: 0 2px; border-radius: 2px; }

/* App / Folien */
.app { max-width: 1240px; margin: 0 auto; padding: 24px 28px; }
.loading { padding: 60px; text-align: center; color: var(--muted); font-family: var(--mono); }

.slide { display: grid; grid-template-columns: 300px 1fr; gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; overflow: hidden; box-shadow: var(--shadow); }
.slide__thumb { position: relative; background: #0a1f3c; display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--line); }
.slide__thumb img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; display: block; }
.slide__thumbhint { position: absolute; bottom: 8px; right: 8px; background: rgba(6,21,41,.8); color: #fff; font-size: .68rem; padding: 3px 7px; border-radius: 6px; pointer-events: none; }

.slide__body { padding: 16px 20px; min-width: 0; }
.slide__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.slide__nr { font-family: var(--mono); font-weight: 700; color: var(--navy-800); font-size: .95rem; }
.slide__badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: .66rem; font-weight: 700; padding: 2px 7px; border-radius: 5px; color: #fff; }
.badge--luecke { background: var(--red); } .badge--produkt { background: var(--violet); } .badge--pruefen { background: var(--amber-deep); }
.slide__edited { font-size: .68rem; color: var(--green); font-weight: 600; }
.slide__editbtn { margin-left: auto; }

.slide__text { font-size: .9rem; line-height: 1.6; color: #2b3648; white-space: normal; overflow-wrap: anywhere; }
.slide__editwrap { display: flex; flex-direction: column; gap: 10px; }
.slide__edit { width: 100%; min-height: 160px; font-family: var(--sans); font-size: .9rem; line-height: 1.6; color: var(--ink); padding: 12px 14px; border: 1px solid var(--navy-600); border-radius: 9px; resize: vertical; }
.slide__edit:focus { outline: none; box-shadow: 0 0 0 3px rgba(28,74,130,.15); }
.slide__editactions { display: flex; gap: 8px; }

.btn { font-family: var(--sans); font-size: .82rem; font-weight: 600; padding: 9px 15px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; background: var(--navy-800); color: #fff; }
.btn:hover { background: var(--navy-700); }
.btn--ghost { background: #fff; color: var(--navy-700); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--navy-600); color: var(--navy-800); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.savestate { font-size: .72rem; font-weight: 600; opacity: 0; transition: opacity .2s; }
.savestate.show { opacity: 1; }
.savestate--saving { color: var(--muted); } .savestate--saved { color: var(--green); } .savestate--reset { color: var(--red); }

/* Bulk-Bar */
.toolbar__actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.btn--danger { background: var(--red); }
.btn--danger:hover { background: #a2301f; }
#bulk-download.is-disabled { opacity: .4; pointer-events: none; }

/* Audio-Zeile */
.slide__audio { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn--gen { background: var(--green); }
.btn--gen:hover { background: #17835a; }
.btn--gen:disabled { background: #a9b6c6; cursor: not-allowed; }
.audio-none { font-size: .74rem; color: var(--muted); }
.miniplayer { display: inline-flex; align-items: center; gap: 9px; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 5px 11px; }
.mp__play { background: var(--navy-800); color: #fff; border: none; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: .66rem; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.mp__play:hover { background: var(--navy-700); }
.mp__track { position: relative; width: 150px; max-width: 42vw; height: 7px; background: var(--line); border-radius: 4px; cursor: pointer; touch-action: none; }
.mp__track:hover { background: #c7d0dd; }
.mp__prog { position: absolute; left: 0; top: 0; height: 100%; width: 0; background: var(--amber); border-radius: 4px; pointer-events: none; }
.mp__time { font-family: var(--mono); font-size: .72rem; color: var(--muted); white-space: nowrap; }
.genstate { font-size: .74rem; font-weight: 600; opacity: 0; display: inline-flex; align-items: center; gap: 6px; }
.genstate.show { opacity: 1; }
.genstate--loading { color: var(--navy-700); } .genstate--done { color: var(--green); } .genstate--err { color: var(--red); }
.spinner { width: 13px; height: 13px; border: 2px solid rgba(28,74,130,.25); border-top-color: var(--navy-700); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 110; background: rgba(6,21,41,.55); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal__box { background: #fff; border-radius: 14px; max-width: 480px; width: 100%; padding: 26px 26px 20px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); border-top: 3px solid var(--amber); }
.modal__title { margin: 0 0 10px; font-size: 1.1rem; color: var(--navy-800); }
.modal__msg { margin: 0 0 20px; font-size: .9rem; line-height: 1.55; color: #37455c; white-space: pre-line; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; }

/* Fortschritt (Bulk) */
.progress { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 105; }
.progress[hidden] { display: none; }
.progress__box { background: var(--navy-900); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: 0 12px 30px -10px rgba(0,0,0,.5); min-width: 260px; }
.progress__txt { font-size: .8rem; font-weight: 600; }
.progress__track { margin-top: 8px; height: 6px; background: rgba(255,255,255,.15); border-radius: 4px; overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--amber); transition: width .2s; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(6,21,41,.9); display: flex; align-items: center; justify-content: center; padding: 32px; }
.lightbox[hidden] { display: none; }
.lightbox__img { max-width: 96vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.lightbox__close { position: absolute; top: 18px; right: 24px; background: none; border: none; color: #fff; font-size: 2.2rem; line-height: 1; cursor: pointer; }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--navy-900); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: .85rem; box-shadow: 0 12px 30px -10px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; border-left: 3px solid var(--amber); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 760px) {
  .slide { grid-template-columns: 1fr; }
  .slide__thumb { border-right: none; border-bottom: 1px solid var(--line); max-height: 200px; }
  .app, .toolbar__inner, .topbar__inner { padding-left: 14px; padding-right: 14px; }
}

/* ---------- Login (unverändert) ---------- */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background-color: var(--navy-900); background-image: radial-gradient(1200px 600px at 70% -10%, rgba(28,74,130,.55), transparent 60%), linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: auto, 30px 30px, 30px 30px; }
.login { width: 100%; max-width: 420px; }
.login__card { background: var(--card); border-radius: 16px; padding: 34px 32px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.6); border-top: 3px solid var(--amber); }
.login__brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login__brand h1 { margin: 0; font-size: 1.15rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--navy-800); }
.login__brand p { margin: 3px 0 0; font-size: .78rem; color: var(--muted); }
.login__form { display: flex; flex-direction: column; }
.field__label { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); display: block; margin-bottom: 5px; }
.override-input, .login__input { width: 100%; font-family: var(--mono); font-size: .9rem; color: var(--ink); padding: 12px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.login__input { margin-bottom: 16px; min-height: 46px; }
.login__input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(245,166,35,.18); }
.login__btn { background: var(--navy-800); color: #fff; border: none; justify-content: center; padding: 13px; font-size: .95rem; width: 100%; }
.login__btn:hover { background: var(--navy-700); }
.login__error { margin: -6px 0 14px; padding: 9px 12px; font-size: .82rem; color: #a12a1a; background: #fdece9; border: 1px solid #f4c9c1; border-radius: 8px; }
.login__foot { margin: 20px 0 0; font-size: .72rem; color: var(--muted); text-align: center; }

/* ---------------- Projektübersicht ---------------- */
.crumbs { background: #fff; border-bottom: 1px solid var(--line); }
.crumbs__inner { max-width: 1180px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 10px; }
.crumbs__back { background: none; border: none; cursor: pointer; font: inherit; font-size: .84rem;
                font-weight: 600; color: var(--navy-700); padding: 4px 0; }
.crumbs__back:hover { text-decoration: underline; }
.crumbs__sep { color: var(--line); }
.crumbs__projekt { font-size: .84rem; color: var(--muted); }

.projekte { max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px; }
.projekte__head { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
                  justify-content: space-between; margin-bottom: 22px; }
.projekte__title { margin: 0; font-size: 1.3rem; font-weight: 700; color: var(--navy-800); }
.projekte__sub { margin: 4px 0 0; font-size: .84rem; color: var(--muted); }
.projekte__grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }

.pcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
         padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.pcard__head { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.pcard__name { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--navy-800); }
.pcard__tools { display: flex; gap: 4px; flex: none; }
.pcard__desc { margin: 0; font-size: .82rem; color: var(--muted); }
.pcard__meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .78rem; color: var(--muted); }
.pcard__warn { color: var(--amber-deep); font-weight: 600; }

.pcard__bars { display: flex; flex-direction: column; gap: 7px; }
.pbar { display: grid; grid-template-columns: 46px 1fr 62px; align-items: center; gap: 9px; }
.pbar__label { font-size: .7rem; font-weight: 700; text-transform: uppercase;
               letter-spacing: .08em; color: var(--muted); }
.pbar__track { height: 7px; background: var(--paper); border-radius: 4px; overflow: hidden; }
.pbar__fill { height: 100%; border-radius: 4px; transition: width .3s ease; }
.pbar__fill--audio { background: var(--green); }
.pbar__fill--video { background: var(--violet); }
.pbar__num { font-family: var(--mono); font-size: .72rem; color: var(--muted); text-align: right;
             font-variant-numeric: tabular-nums; }

.pcard__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px;
               border-top: 1px solid var(--line); padding-top: 12px; }
.pcard__list li { display: flex; align-items: center; gap: 4px; }
.pcard__praes { flex: 1; text-align: left; background: none; border: none; cursor: pointer; font: inherit;
                padding: 7px 9px; border-radius: 7px; display: flex; flex-direction: column; gap: 2px; }
.pcard__praes:hover { background: var(--paper); }
.pcard__praesname { font-size: .87rem; font-weight: 600; color: var(--ink); }
.pcard__praesnum { font-size: .72rem; color: var(--muted); font-family: var(--mono); }
.pcard__open { align-self: flex-start; }

.btn--sm { padding: 5px 9px; font-size: .78rem; }
.btn--danger-ghost:hover { border-color: var(--red); color: var(--red); }

.folien[hidden], .projekte[hidden] { display: none !important; }

#prompt .modal__box { max-width: 480px; }
#prompt .modal__msg { white-space: pre-line; }

@media (max-width: 720px) {
  .projekte__grid { grid-template-columns: 1fr; }
  .pcard { padding: 16px; }
}

/* ---------------- Video ---------------- */
/* Eigene Zeile unter der Tonzeile, violett abgesetzt, damit Ton und Video
   auf den ersten Blick auseinanderzuhalten sind. */
.slide__video {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--line);
}
.btn--video { background: var(--violet); color: #fff; border: none; flex: none; white-space: nowrap; }
.btn--video:hover { background: #593f92; }
.btn--video:disabled { background: #a9b6c6; cursor: not-allowed; }

.vid__none { font-size: .78rem; color: var(--muted); }
.vid__state { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; }
.vid__state--work { color: var(--violet); }
.vid__state--old { color: var(--amber-deep); background: #fdf3e2; border: 1px solid #f3ddb4;
                   border-radius: 6px; padding: 3px 8px; }
.vid__state--err { color: var(--red); }

.slide__titel { font-size: .78rem; color: var(--muted); font-style: italic; }

/* Vorschau */
.videomodal {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  background: rgba(10,20,35,.86); padding: 24px;
}
.videomodal__box { width: min(1100px, 96vw); }
.videomodal__box video { width: 100%; max-height: 82vh; border-radius: 10px; background: #000; display: block; }

/* unbestimmter Fortschritt: der Server arbeitet, die Dauer ist offen */
.progress__bar--pulse { animation: pulsebar 1.4s ease-in-out infinite; }
@keyframes pulsebar { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

@media (max-width: 720px) {
  .slide__video { gap: 6px; }
  .vid__state--old { width: 100%; }
}
