/* Besprechungsnotizen
   Gestaltung nach dem Designsystem „Achtsam Führen Software“:
   dunkler Grund, Glas-Falten-Hintergrund, Glaskarten für Eingabe und
   Verarbeitung, eine massive weiße Karte für das Ergebnis. */

@font-face {
  font-family: "Archivo"; font-style: normal; font-display: swap;
  font-weight: 100 900; font-stretch: 62% 125%;
  src: url(fonts/archivo-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Archivo"; font-style: normal; font-display: swap;
  font-weight: 100 900; font-stretch: 62% 125%;
  src: url(fonts/archivo-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-display: swap;
  font-weight: 200 800;
  src: url(fonts/jakarta-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans"; font-style: normal; font-display: swap;
  font-weight: 200 800;
  src: url(fonts/jakarta-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  /* Farben aus dem Designsystem */
  --ink-950: #0a0a0a;
  --fold-ground: #07090d;
  --surface: #ffffff;
  --text: #171717;
  --text-muted: #555555;
  --text-subtle: #6b6b6b;
  --on-dark: #ffffff;
  --on-dark-muted: rgba(255, 255, 255, .78);
  --on-dark-quiet: rgba(255, 255, 255, .58);
  --navy: #1f3a5f;
  --navy-deep: #14233a;
  --sky: #7fa8e0;
  --glass-fill: rgba(255, 255, 255, .06);
  --glass-border: rgba(255, 255, 255, .12);
  --glass-accent-fill: rgba(31, 58, 95, .42);
  --glass-accent-border: rgba(127, 168, 224, .45);
  --glass-shade: rgba(7, 9, 13, .34);
  --glass-btn-fill: rgba(255, 255, 255, .05);
  --glass-btn-border: rgba(255, 255, 255, .3);
  --hair-light: rgba(23, 23, 23, .12);
  --hair-dark: rgba(255, 255, 255, .15);

  /* Rot steht nur für „Aufnahme läuft“ und für Fehler */
  --signal: #ff6b5e;
  --signal-on-light: #b3261e;

  /* Tonspur (liest app.js aus) */
  --trace-base: rgba(255, 255, 255, .18);
  --trace-bar: #ffffff;

  --display: "Archivo", "Segoe UI", system-ui, sans-serif;
  --body: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;

  --r-btn: 6px;
  --r-row: 10px;
  --r-glass: 16px;
  --r-card: 20px;
  --blur-glass: 12px;
  --blur-header: 14px;
  --shadow-stack: 0 30px 60px -30px rgba(0, 0, 0, .45);
  --shadow-fab: 0 10px 30px -8px rgba(0, 0, 0, .45);
  --ease: cubic-bezier(.22, 1, .36, 1);

  --bar-h: 60px;
  --gutter: clamp(16px, 3vw, 48px);
  --tabs-h: 0px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--fold-ground); color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--on-dark);
  font: 400 1rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; }

.display {
  font-family: var(--display); font-weight: 800; font-stretch: 114%;
  letter-spacing: -.01em; line-height: 1.04;
}
.eyebrow {
  font: 700 .75rem/1.4 var(--body); letter-spacing: .14em; text-transform: uppercase;
  color: var(--on-dark-muted);
}
.count { font-family: var(--body); font-weight: 600; font-stretch: 100%; letter-spacing: 0; color: var(--on-dark-quiet); }

.ico {
  width: 1.25rem; height: 1.25rem; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------------------------------------------------------- Hintergrund */

.fold {
  position: fixed; inset: 0; z-index: -2;
  width: 100vw; height: 100vh; height: 100lvh; display: block;
  background:
    radial-gradient(120% 90% at 78% 30%, rgba(31, 79, 138, .55), transparent 60%),
    var(--fold-ground);
}
.scrim {
  position: fixed; inset: 0; z-index: -1; height: 100lvh;
  background: linear-gradient(90deg, rgba(0, 0, 0, .74) 0%, rgba(0, 0, 0, .55) 40%, rgba(0, 0, 0, .2) 70%, rgba(0, 0, 0, .06) 100%);
}

/* ---------------------------------------------------------------- Kopf */

.bar {
  position: sticky; top: 0; z-index: 20;
  height: var(--bar-h);
  background: rgba(10, 10, 10, .72);
  -webkit-backdrop-filter: blur(var(--blur-header)); backdrop-filter: blur(var(--blur-header));
  border-bottom: 1px solid var(--hair-dark);
}
.bar-in {
  max-width: 84rem; height: 100%; margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.bar h1 {
  display: flex; align-items: center; gap: .65rem; min-width: 0;
  font: 700 1.0625rem/1.1 var(--display); font-stretch: 108%; letter-spacing: -.005em;
}
.bar h1 span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mark { width: 1.75rem; height: 1.75rem; flex: none; fill: none; stroke: var(--on-dark); stroke-width: 1.8; }
.mark-dot { fill: var(--sky); stroke: none; }
.bar-tools { display: flex; align-items: center; gap: .75rem; flex: none; }
#btnLogout .ico { display: none; }

/* Verbrauch: was bei Claude und Groq noch frei ist */
.usage { position: relative; display: flex; gap: 1.125rem; margin-right: .25rem; }
button.use { background: none; border: 0; padding: .3rem .1rem; margin: -.3rem -.1rem; color: inherit; cursor: pointer; text-align: left; border-radius: 4px; }
button.use:hover .use-name { color: var(--on-dark); }
.use-pop {
  position: absolute; top: calc(100% + 1rem); right: 0; z-index: 30; width: min(22rem, calc(100vw - 2rem));
  padding: 1rem 1.125rem; border: 1px solid var(--glass-border); border-radius: var(--r-glass);
  background: rgba(16, 20, 28, .96); box-shadow: var(--shadow-fab);
  font-size: .875rem; line-height: 1.5;
}
.use-pop p { color: var(--on-dark-muted); }
.use-pop .use-forecast { margin-top: .6rem; color: var(--on-dark); }
.use-pop label { display: block; margin: .8rem 0 .35rem; font-weight: 600; }
.use-pop-row { display: flex; gap: .5rem; }
.use-pop-row input { flex: 1; min-width: 0; height: 2.5rem; }
.use { display: grid; grid-template-columns: auto auto; column-gap: .45rem; align-items: baseline; font-size: .75rem; line-height: 1.2; cursor: default; }
.use-name { font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--on-dark-quiet); font-size: .6875rem; }
.use strong { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.use-bar { grid-column: 1 / -1; height: 3px; margin-top: .3rem; border-radius: 2px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.use-bar i { display: block; height: 100%; width: 100%; background: var(--sky); border-radius: 2px; transition: width .5s var(--ease); }
.use.low strong { color: #ffd08a; }
.use.low .use-bar i { background: #ffb347; }
.use.out strong { color: var(--signal); }
.use.out .use-bar i { background: var(--signal); }

.lang { display: flex; border: 1px solid var(--glass-btn-border); border-radius: var(--r-btn); overflow: hidden; }
.lang button {
  border: 0; background: transparent; height: 2.375rem; padding: 0 .75rem;
  font: 700 .75rem/1 var(--body); letter-spacing: .06em; color: var(--on-dark-muted);
}
.lang button + button { border-left: 1px solid var(--glass-btn-border); }
.lang button[aria-pressed="true"] { background: var(--surface); color: var(--ink-950); }
.lang button:focus-visible { outline-offset: -3px; }

main { max-width: 84rem; margin: 0 auto; padding: 1.5rem var(--gutter) calc(4rem + var(--tabs-h)); }

/* ------------------------------------------------------------- Knöpfe */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .625rem;
  height: 3rem; padding: 0 1.5rem;
  border: 1px solid transparent; border-radius: var(--r-btn);
  font: 700 .875rem/1 var(--body); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  transition: transform .2s var(--ease), background .2s, box-shadow .2s, border-color .2s;
}
.btn:not(:disabled):hover { transform: translateY(-2px); }
.btn:not(:disabled):active { transform: scale(.98); }
.btn-s { height: 2.5rem; padding: 0 .875rem; font-size: .75rem; gap: .45rem; }
.btn-s .ico { width: 1.05rem; height: 1.05rem; }

.btn-light { background: var(--surface); color: var(--ink-950); }
.btn-light:not(:disabled):hover { background: #e9e9e9; }
.btn-glass {
  background: var(--glass-btn-fill); border-color: var(--glass-btn-border); color: var(--on-dark);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.btn-glass:not(:disabled):hover { background: rgba(255, 255, 255, .14); }
.btn-navy { background: var(--navy); color: var(--on-dark); }
.btn-navy:not(:disabled):hover { background: var(--navy-deep); box-shadow: 0 10px 24px -10px rgba(31, 58, 95, .6); }
.btn-line { background: transparent; border-color: #d6d4cf; color: var(--ink-950); }
.btn-line:not(:disabled):hover { border-color: var(--ink-950); }

.link {
  background: none; border: 0; padding: .25rem 0;
  font-size: .9375rem; color: var(--on-dark-muted);
  text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .35); text-underline-offset: .22em;
}
.link:not(:disabled):hover { color: var(--on-dark); text-decoration-color: currentColor; }

/* ---------------------------------------------------------------- Glas */

.glass {
  padding: 1.25rem 1.375rem;
  border: 1px solid var(--glass-border); border-radius: var(--r-glass);
  /* Glas-Füllung aus dem Designsystem, darunter ein dunkler Schleier:
     so bleibt kleine Schrift auch über hellen Falten lesbar. */
  background: linear-gradient(var(--glass-fill), var(--glass-fill)), var(--glass-shade);
  -webkit-backdrop-filter: blur(var(--blur-glass)); backdrop-filter: blur(var(--blur-glass));
}
.glass-accent { border-color: var(--glass-accent-border); background: linear-gradient(var(--glass-accent-fill), var(--glass-accent-fill)), var(--glass-shade); }

.notice { margin-bottom: 1.5rem; }
.notice h2 { font: 700 1.125rem/1.3 var(--body); margin-bottom: .5rem; }
.notice ul { margin: .5rem 0; padding-left: 1.2rem; list-style: disc; }
.notice .actions { margin-top: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ------------------------------------------------------- Eingabefelder */

input[type="text"], input[type="password"], input[type="search"], select {
  width: 100%; height: 2.75rem; padding: 0 .8rem;
  border: 1px solid rgba(255, 255, 255, .2); border-radius: var(--r-btn);
  background-color: rgba(255, 255, 255, .06);
  font-size: .9375rem; color: var(--on-dark);
  transition: border-color .2s, background-color .2s;
}
input::placeholder { color: var(--on-dark-quiet); opacity: 1; }
input[type="text"]:hover, input[type="password"]:hover, input[type="search"]:hover, select:hover { border-color: rgba(255, 255, 255, .4); }
input:disabled, select:disabled { opacity: .55; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 2.2rem; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .55rem center; background-size: 1.2rem;
}
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

input[type="checkbox"] {
  -webkit-appearance: none; appearance: none;
  width: 1.25rem; height: 1.25rem; margin: 0; flex: none;
  border: 1.5px solid rgba(255, 255, 255, .5); border-radius: 4px;
  background: transparent center / 1rem no-repeat; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
input[type="checkbox"]:checked {
  background-color: var(--surface); border-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a0a0a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
input[type="checkbox"]:disabled { opacity: .5; cursor: not-allowed; }

/* ----------------------------------------------------------- Anmeldung */

.login { max-width: 34rem; margin: 9vh 0 0; }
.login-title { font-size: clamp(2rem, 7vw, 4rem); margin-bottom: 1.75rem; -webkit-hyphens: manual; hyphens: manual; }
.login-title .bw {
  display: inline-block;
  animation: blurWord .95s var(--ease) both; animation-delay: calc(120ms + var(--i, 0) * 90ms);
}
@keyframes blurWord { from { filter: blur(10px); opacity: 0; transform: translateY(-44px); } to { filter: blur(0); opacity: 1; transform: none; } }
.login form { max-width: 28rem; }
.login label { display: block; margin-bottom: .5rem; }
.login-row { display: flex; gap: .75rem; }
.login-row input { flex: 1; min-width: 0; height: 3rem; }
.login.inline { margin: 0 0 1.5rem; max-width: none; }
.login.inline .login-title { display: none; }
.login.inline form { max-width: none; border-color: var(--glass-accent-border); background: linear-gradient(var(--glass-accent-fill), var(--glass-accent-fill)), var(--glass-shade); }
.hint { margin-bottom: .9rem; }
.err { color: var(--signal); margin-top: .7rem; font-size: .9375rem; }
.err:empty { display: none; }

/* -------------------------------------------------------------- Aufbau */

.app {
  display: grid; grid-template-columns: minmax(18rem, 23.5rem) minmax(0, 1fr);
  gap: 1.5rem; align-items: start;
}
.stage { min-width: 0; max-width: 54rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.125rem; }
.pane-rec { display: grid; grid-template-columns: minmax(0, 1fr); gap: .875rem; }
/* Nur „backwards“: Bleibt die Animation nach dem Ende aktiv, sieht das Glas der
   Karten darin den Hintergrund nicht mehr und wird nicht unscharf. */
.app > .library, .stage > * { animation: rise .9s var(--ease) backwards; }
.stage > * { animation-delay: 120ms; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ----------------------------------------------------------- Aufnahme */

.recorder { padding: 1.5rem 1.625rem 1.375rem; }

.rec-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem;
  margin-top: .6rem;
}
.timer {
  display: block;
  font-family: var(--display); font-weight: 800; font-stretch: 118%;
  font-size: clamp(3.5rem, 8.4vw, 6rem); line-height: .92; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, .35);
  transition: color .4s;
}
.timer.long { font-size: clamp(2.75rem, 6.6vw, 4.75rem); }
.is-recording .timer, .is-paused .timer { color: var(--on-dark); }

.rec-buttons { display: flex; gap: .75rem; padding-bottom: .3rem; }
.rec-btn { height: 3.25rem; padding: 0 1.5rem; }
.rec-btn .dot {
  width: .8rem; height: .8rem; border-radius: 50%; background: #d63a2f; flex: none;
  transition: border-radius .25s var(--ease);
}
.is-recording .rec-btn .dot, .is-paused .rec-btn .dot { border-radius: 2px; }

.trace { display: block; width: 100%; height: 56px; margin-top: .9rem; }

.state { margin-top: .3rem; font-size: .9375rem; color: var(--on-dark-muted); }
.state:empty { display: none; }
.state.live { color: var(--on-dark); }
.state.live::before, .strip-dot {
  content: ""; display: inline-block; width: .6rem; height: .6rem; border-radius: 50%;
  background: var(--signal); margin-right: .55rem; vertical-align: .04em;
  animation: pulse 1.6s ease-in-out infinite;
}
.state.bad { color: var(--signal); }
@keyframes pulse { 50% { opacity: .25; } }

.opts {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr) minmax(0, 1.25fr); gap: .9rem 1rem;
  margin-top: 1.1rem;
}
.opts label { display: block; min-width: 0; }
.opts label > span { display: block; font-size: .8125rem; font-weight: 500; color: var(--on-dark-muted); margin-bottom: .35rem; }
.opts .wide { grid-column: 1 / -1; }

.consent {
  display: flex; align-items: flex-start; gap: .7rem;
  margin-top: 1.125rem; font-size: .9375rem; line-height: 1.45; cursor: pointer;
}
.consent input { margin-top: .08rem; }
.consent.ask { color: var(--signal); }
.consent.ask input { border-color: var(--signal); }

.upload { margin-top: .8rem; display: flex; flex-wrap: wrap; gap: .25rem 1.75rem; }

/* ---------------------------------------------------------- Fortschritt */

.progress > p { font-size: .9375rem; font-weight: 600; }
.meter { height: 3px; background: rgba(255, 255, 255, .18); border-radius: 2px; margin-top: .65rem; overflow: hidden; }
.meter div { height: 100%; width: 0; background: var(--on-dark); transition: width .5s var(--ease); }
#progErrors li {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  margin-top: .8rem; font-size: .9375rem; color: #ffb4ab;
}
.progress details { margin-top: 1rem; }

details > summary { cursor: pointer; font-size: .9375rem; color: var(--on-dark-muted); }
details > summary:hover { color: var(--on-dark); }

.transcript { margin-top: .75rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9375rem; line-height: 1.65; max-width: 40rem; }

/* Läuft eine Aufnahme, während man eine Notiz liest */
.strip {
  position: sticky; top: calc(var(--bar-h) + .75rem); z-index: 10;
  display: flex; align-items: center; gap: .5rem .75rem;
  padding: .55rem .6rem .55rem 1rem;
  background: rgba(20, 35, 58, .94);
  box-shadow: var(--shadow-fab);
}
.strip-dot { margin-right: 0; flex: none; }
.strip.is-idle .strip-dot { animation: none; background: var(--sky); }
.strip-text { font-size: .9375rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-timer { font: 700 .9375rem/1 var(--body); font-variant-numeric: tabular-nums; color: var(--on-dark-muted); margin-right: auto; }

/* -------------------------------------------------------------- Ablage */

.library {
  position: sticky; top: calc(var(--bar-h) + 1.5rem);
  max-height: calc(100vh - var(--bar-h) - 3rem);
  display: flex; flex-direction: column;
  padding: 1.25rem 0 0;
}
.library > * { margin-left: 1.125rem; margin-right: 1.125rem; }
.lib-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.lib-head h2 { font-size: 1.5rem; }
.lib-head .count { font-size: .9375rem; margin-left: .2rem; }

.lib-tools, .sel-bar { display: flex; align-items: center; gap: .5rem; margin-top: 1rem; min-height: 2.75rem; }
.search { position: relative; flex: 1; min-width: 0; display: block; }
.search .ico { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--on-dark-quiet); pointer-events: none; }
.search input { padding-left: 2.4rem; }
.lib-tools .btn { height: 2.75rem; }

.sel-count { font-size: .9375rem; font-weight: 600; margin-right: auto; white-space: nowrap; }
.sel-bar .link { white-space: nowrap; }
.sel-bar { flex-wrap: wrap; }
.lib-head, .lib-tools, .sel-bar, .storage-note, .lib-empty { flex: none; }
.sel-wide { flex: 1 1 auto; }
.sel-words { flex: 0 0 auto; width: auto; height: 2.5rem; font-size: .8125rem; padding-left: .6rem; }
.redo select + select { border-radius: 0 var(--r-btn) var(--r-btn) 0; }
.redo select:not(:last-child) { border-radius: 0; }
.lib-kind { color: #a9c6ee; font-weight: 600; }
.post-edit { display: grid; gap: 1.1rem; max-width: 44rem; }
.edit-field { display: block; }
.edit-field > span { display: block; font: 700 .75rem/1.4 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--navy); margin-bottom: .4rem; }
.doc textarea {
  display: block; width: 100%; padding: .7rem .8rem; resize: vertical;
  border: 1px solid #d6d4cf; border-radius: var(--r-btn); background: var(--surface); color: var(--text);
  font: inherit; font-size: 1.0625rem; line-height: 1.6;
}
.doc textarea:hover { border-color: var(--ink-950); }
.post-edit input[type="text"] { height: 3rem; font-size: 1.125rem; font-weight: 600; }
.post-lead { font-size: 1.1875rem; line-height: 1.55; font-weight: 500; }
.post-sources { font-size: .9375rem; color: var(--text-muted); }
.toast.busy::before {
  content: ""; width: .9rem; height: .9rem; flex: none; border-radius: 50%;
  border: 2px solid rgba(23, 23, 23, .2); border-top-color: var(--navy); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.lib-list {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  margin: .5rem 0 0; padding: 0 .5rem .25rem;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent;
  -webkit-mask-image: linear-gradient(#000 calc(100% - 1.25rem), transparent);
  mask-image: linear-gradient(#000 calc(100% - 1.25rem), transparent);
}
.lib-group h3 { padding: 1rem .625rem .4rem; }
.lib-row {
  display: flex; align-items: center; gap: .125rem;
  border: 1px solid transparent; border-radius: var(--r-row);
  transition: background .2s, border-color .2s;
}
.lib-row + .lib-row { margin-top: 2px; }
.lib-row:hover { background: rgba(255, 255, 255, .06); }
.lib-row[aria-current="true"] { background: var(--glass-accent-fill); border-color: var(--glass-accent-border); }
.lib-row.is-picked { background: rgba(255, 255, 255, .1); }

.lib-open {
  flex: 1; min-width: 0; text-align: left; background: none; border: 0;
  padding: .7rem .25rem .7rem .625rem; border-radius: var(--r-row);
  transition: transform .3s var(--ease);
}
.lib-row:hover .lib-open { transform: translateX(4px); }
.lib-open:focus-visible { outline-offset: -2px; }
.lib-open strong {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  font-weight: 600; font-size: .9375rem; line-height: 1.35; overflow-wrap: anywhere;
}
.lib-meta { display: flex; flex-wrap: wrap; gap: 0 .75rem; margin-top: .2rem; font-size: .8125rem; line-height: 1.4; color: var(--on-dark-muted); }
.lib-meta .open-todos { color: #a9c6ee; font-weight: 600; }
.lib-hit { display: block; margin-top: .25rem; font-size: .8125rem; line-height: 1.4; color: var(--on-dark-quiet); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-hit mark, .lib-open strong mark { background: rgba(127, 168, 224, .35); color: inherit; border-radius: 2px; padding: 0 1px; }

.lib-pick { display: flex; align-items: center; align-self: stretch; padding: 0 .25rem 0 .7rem; cursor: pointer; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 2.5rem; height: 2.5rem; padding: 0;
  background: none; border: 1px solid transparent; border-radius: var(--r-btn); color: var(--on-dark-muted);
  transition: background .2s, color .2s, border-color .2s, opacity .2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .12); color: var(--on-dark); }
.row-del { margin-right: .3rem; opacity: 0; }
.lib-row:hover .row-del, .lib-row:focus-within .row-del, .lib-row[aria-current="true"] .row-del { opacity: 1; }
.row-del:hover { color: #ffb4ab; }
@media (hover: none) { .row-del { opacity: .8; } }

.storage-note.bad { color: #ffb4ab; }
.lib-empty { padding: 1.25rem 0 .25rem; color: var(--on-dark-muted); font-size: .9375rem; }
.storage-note {
  margin-top: .25rem; padding: .8rem 0 .95rem; border-top: 1px solid var(--hair-dark);
  font-size: .8125rem; line-height: 1.45; color: var(--on-dark-quiet);
}

/* ------------------------------------------------------------ Protokoll */

.doc {
  position: relative;
  color-scheme: light;
  background: var(--surface); color: var(--text);
  border-radius: var(--r-card);
  padding: clamp(1.375rem, 3.6vw, 3rem);
  box-shadow: var(--shadow-stack);
}
.doc :focus-visible { outline-color: var(--navy); }

.doc-back {
  display: inline-flex; align-items: center; gap: .35rem;
  background: none; border: 0; padding: .25rem 0; margin: -.25rem 0 1.1rem;
  font: 700 .75rem/1 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--navy);
}

.doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.doc-title {
  min-width: 0; font-size: clamp(1.625rem, 3.6vw, 2.75rem); text-wrap: balance;
  overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto;
}
.doc .icon-btn { color: var(--text-subtle); }
.doc .icon-btn:hover { background: rgba(23, 23, 23, .07); color: var(--text); }
.doc-meta { margin-top: .7rem; font-size: .9375rem; color: var(--text-muted); }

.rename { display: flex; flex-wrap: wrap; gap: .6rem; width: 100%; }
.doc input[type="text"], .doc select {
  background-color: var(--surface); border-color: #d6d4cf; color: var(--text);
}
.doc input[type="text"]:hover, .doc select:hover { border-color: var(--ink-950); }
.doc select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23171717' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
}
.rename input { flex: 1 1 16rem; height: 3rem; font-size: 1.0625rem; font-weight: 600; }

.doc h3 {
  font: 700 .75rem/1.4 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--navy);
  margin: 2.25rem 0 .7rem;
}
.doc-body { font-size: 1.0625rem; line-height: 1.65; max-width: 41rem; }
.doc-body > p { margin-top: 1.5rem; }
.doc-body .muted { color: var(--text-muted); }

.doc-body ul.plain { padding-left: 1.15rem; list-style: disc; }
.doc-body ul.plain li + li { margin-top: .4rem; }
.doc-body ul.plain li::marker { color: var(--text-subtle); }

.todos li { display: flex; gap: .8rem; align-items: flex-start; padding: .7rem 0; border-top: 1px solid var(--hair-light); }
.todos li:last-child { border-bottom: 1px solid var(--hair-light); }
.todos input[type="checkbox"] { margin-top: .22rem; border-color: #9a9a9a; }
.todos input[type="checkbox"]:checked {
  background-color: var(--navy); border-color: var(--navy);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.todos label { display: block; cursor: pointer; }
.todos .who { display: flex; flex-wrap: wrap; gap: 0 1.25rem; font-size: .875rem; line-height: 1.45; color: var(--text-muted); margin-top: .15rem; }
.todos li.done label > span:first-child { text-decoration: line-through; color: var(--text-subtle); }

.doc-actions { margin-top: 2.25rem; align-items: center; }
.doc-actions + .doc-actions { margin-top: .75rem; }
.redo { display: flex; max-width: 100%; }
.redo .btn { border-radius: var(--r-btn) 0 0 var(--r-btn); }
.redo select { height: 3rem; width: auto; min-width: 0; border-left: 0; border-radius: 0 var(--r-btn) var(--r-btn) 0; }
.doc-actions .btn-del { margin-left: auto; }
.btn-del:not(:disabled):hover { border-color: var(--signal-on-light); color: var(--signal-on-light); }
.doc-state { margin-top: .9rem; font-size: .9375rem; color: var(--text-muted); min-height: 1.6em; }
.doc-state.bad { color: var(--signal-on-light); }
.doc details { margin-top: 1.25rem; }
.doc details > summary { color: var(--text-muted); }
.doc details > summary:hover { color: var(--text); }
.doc .transcript { color: var(--text); }

.doc > * { animation: docIn .5s var(--ease) both; }
@keyframes docIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------- Meldung mit Rückweg */

.toast {
  position: fixed; left: 50%; bottom: calc(1.5rem + var(--tabs-h)); z-index: 40;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 1.25rem;
  width: max-content; max-width: calc(100vw - 2rem); padding: .7rem .8rem .7rem 1.1rem;
  background: var(--surface); color: var(--text); color-scheme: light;
  border-radius: var(--r-row); box-shadow: var(--shadow-fab);
  font-size: .9375rem; font-weight: 600;
  animation: toastIn .45s var(--ease) both;
}
.toast .link {
  color: var(--navy); font: 700 .75rem/1 var(--body); letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none; padding: .6rem .5rem; white-space: nowrap;
}
.toast .link:hover { color: var(--navy-deep); text-decoration: underline; }
.toast :focus-visible { outline-color: var(--navy); }
@keyframes toastInFlat { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* --------------------------------------------------------- Breit / Schmal */

.tabs { display: none; }

@media (min-width: 60rem) {
  .app[data-view="doc"] .pane-rec { display: none; }
  .app[data-view="list"] .strip { display: none !important; }
  .doc-back { display: none; }
}

@media (max-width: 59.99rem) {
  :root { --tabs-h: calc(4rem + env(safe-area-inset-bottom, 0px)); }

  .scrim { background: linear-gradient(180deg, rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, .4) 55%, rgba(0, 0, 0, .55) 100%); }

  main { padding-top: 1rem; }
  .app { display: block; }
  .app[data-view="rec"] .library, .app[data-view="doc"] .library,
  .app[data-view="list"] .pane-rec, .app[data-view="doc"] .pane-rec { display: none; }
  .stage { max-width: none; }
  .app[data-view="list"] .stage { margin-bottom: .875rem; }

  .strip {
    position: fixed; top: auto; left: .75rem; right: .75rem; z-index: 25;
    bottom: calc(var(--tabs-h) + .6rem);
  }
  body.has-strip main { padding-bottom: calc(8rem + var(--tabs-h)); }
  body.has-strip .toast { bottom: calc(5.4rem + var(--tabs-h)); }
  .doc-head .icon-btn { position: absolute; top: clamp(.7rem, 2.6vw, 2.4rem); right: clamp(.7rem, 2.6vw, 2.4rem); }

  .library { position: static; max-height: none; }
  .lib-list { overflow: visible; -webkit-mask-image: none; mask-image: none; }
  #btnNew { display: none; }

  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; height: var(--tabs-h); padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(10, 10, 10, .9);
    -webkit-backdrop-filter: blur(var(--blur-header)); backdrop-filter: blur(var(--blur-header));
    border-top: 1px solid var(--hair-dark);
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
    background: none; border: 0; border-top: 2px solid transparent;
    font: 700 .6875rem/1 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--on-dark-quiet);
    transition: color .2s, border-color .2s;
  }
  .tab .ico { width: 1.4rem; height: 1.4rem; }
  .tab[aria-current="true"] { color: var(--on-dark); border-top-color: var(--sky); }
  .tab .count { font-weight: 700; color: inherit; opacity: .7; }
  .tab:focus-visible { outline-offset: -4px; }
}

@media (max-width: 40rem) {
  .bar h1 { font-size: .9375rem; }
  .btn-s { padding: 0 .7rem; }
  .recorder { padding: 1.25rem 1.125rem 1.125rem; }
  .opts { grid-template-columns: 1fr; }
  .rec-head { flex-direction: column; align-items: stretch; }
  .timer { font-size: clamp(3.5rem, 19vw, 5rem); }
  .timer.long { font-size: clamp(2.6rem, 14.5vw, 4rem); }
  .rec-buttons { flex-wrap: wrap; padding-bottom: 0; }
  .rec-buttons .btn { flex: 1; padding: 0 1rem; }
  .login-row { flex-direction: column; }
  .doc { border-radius: var(--r-glass); }
  .doc-actions .btn, .redo { width: 100%; }
  .redo { flex-direction: column-reverse; gap: .75rem; }
  .redo .btn, .redo select { width: 100%; border-radius: var(--r-btn); border: 1px solid #d6d4cf; }
  .doc-actions .btn-del { margin-left: 0; }
  .strip .btn { padding: 0 .65rem; }
  .bar-tools { gap: .5rem; }
  .usage { gap: .6rem; margin-right: 0; }
  .use-name { display: none; }
  #useGroq { display: none; }
  .use-pop { position: fixed; top: calc(var(--bar-h) + .5rem); right: 1rem; }
  #btnLogout { width: 2.5rem; padding: 0; }
  #btnLogout .ico { display: block; width: 1.2rem; height: 1.2rem; }
  #btnLogout span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .toast { left: 1rem; right: 1rem; width: auto; max-width: none; transform: none; justify-content: space-between; animation-name: toastInFlat; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:not(:disabled):hover, .lib-row:hover .lib-open { transform: none; }
}

@media print {
  .fold, .scrim, .bar, .library, .pane-rec, .strip, .tabs, .toast, .login, .notice,
  .doc-actions, .doc-state, .doc-back, .doc .icon-btn { display: none !important; }
  html, body { background: #fff; }
  main { padding: 0; }
  .app { display: block; }
  .doc { box-shadow: none; padding: 0; border-radius: 0; }
}
