/* Transkript – Weboberfläche. Farben und Maße folgen der nativen Mac-App. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --side: #f2f2f5;
  --panel: #f5f5f7;
  --line: #d9d9de;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --faint: rgba(0, 0, 0, .13);
  --accent: #0a6cff;
  --accent-soft: rgba(10, 108, 255, .16);
  --brand: #2f625c;
  --danger: #c8102e;
  --control: #ffffff;
  --shadow: 0 8px 30px rgba(0, 0, 0, .12);
  --s1: #0a6cff; --s2: #b85c00; --s3: #0b7f8c; --s4: #8b3fc9; --s5: #1f7a3a; --s6: #b0206a;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --side: #252527;
    --panel: #262629;
    --line: #3a3a3e;
    --fg: #f5f5f7;
    --muted: #9a9aa0;
    --faint: rgba(255, 255, 255, .16);
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, .30);
    --brand: #3d7d75;
    --danger: #ff453a;
    --control: #323236;
    --shadow: 0 10px 40px rgba(0, 0, 0, .5);
    --s1: #4aa3ff; --s2: #ffa033; --s3: #40c8d8; --s4: #c77dff; --s5: #45d16a; --s6: #ff6fb1;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font: 15px/1.45 var(--font); color: var(--fg); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

/* --- Bedienelemente ------------------------------------------------------ */
button, select, input { font: inherit; color: inherit; }
button {
  background: var(--control); border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 12px; cursor: pointer; white-space: nowrap;
}
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .45; cursor: default; }
button.big { padding: 8px 16px; border-radius: 10px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { filter: brightness(1.08); border-color: var(--accent); }
button.danger { color: var(--danger); }
.icon-btn { border: 0; background: none; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.icon-btn:hover:not(:disabled) { background: var(--panel); }
.icon-btn svg { width: 20px; height: 20px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select {
  background: var(--control); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; max-width: 100%;
}
input[type=url], input[type=password] {
  background: var(--control); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; width: 100%; min-width: 0;
}
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--faint); overflow: hidden; }
progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 3px; transition: width .4s; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 3px; }
.switch { appearance: none; -webkit-appearance: none; width: 40px; height: 24px; border-radius: 12px; background: var(--faint); position: relative; cursor: pointer; margin: 0; transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.error { color: var(--danger); }
.hint { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.spacer { flex: 1; }

/* --- Anmeldung ----------------------------------------------------------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; background: var(--side); }
.login-card { width: min(400px, 100%); background: var(--bg); border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.login-card img { border-radius: 22%; justify-self: center; }
.login-card h1 { font-size: 26px; text-align: center; letter-spacing: -.01em; }
.login-card > p:first-of-type { text-align: center; color: var(--muted); margin-bottom: 6px; }
.login-card label { font-weight: 600; font-size: 13px; }
.login-card button { margin-top: 4px; }

/* --- Grundaufbau --------------------------------------------------------- */
.app { height: 100%; display: grid; grid-template-columns: 264px minmax(0, 1fr); }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding: 14px 10px 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; padding: 2px 6px 12px; }
.brand img { border-radius: 22%; }
.side-new { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 10px; }
.side-new svg { width: 16px; height: 16px; }
.side h2 { font-size: 12px; font-weight: 600; color: var(--muted); padding: 16px 8px 6px; }
.history { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.history button { display: block; width: 100%; text-align: left; border: 0; background: none; border-radius: 8px; padding: 6px 8px; white-space: normal; }
.history button:hover { background: var(--faint); }
.history button[aria-current=true] { background: var(--accent); color: #fff; }
.history .h-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; font-size: 14px; }
.history .h-sub { display: block; font-size: 12px; color: var(--muted); }
.history button[aria-current=true] .h-sub { color: rgba(255, 255, 255, .8); }
.history-empty { color: var(--muted); font-size: 13px; padding: 4px 8px; flex: 1; }
.side-foot { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.retention { font-size: 12px; color: var(--muted); padding: 0 8px 6px; }
.account { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; text-align: left; padding: 6px 8px; font-size: 13px; }
.account:hover { background: var(--faint); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: #30b455; }
.dot.busy { background: #f0a020; }
.dot.down { background: var(--danger); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.bar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line); min-height: 48px; }
.bar h1 { font-size: 15px; font-weight: 650; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.only-narrow { display: none; }
.view { flex: 1; min-height: 0; overflow-y: auto; padding: 24px; }

/* --- Start --------------------------------------------------------------- */
.start { display: grid; }
.drop { border: 2px dashed var(--faint); border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 32px 20px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .wave { width: 64px; color: var(--muted); }
.drop.over .wave { color: var(--accent); }
.drop h2 { font-size: 20px; font-weight: 600; }
.drop > p { color: var(--muted); max-width: 52ch; }
.link-form { display: flex; gap: 8px; width: min(560px, 100%); margin-top: 4px; }

/* --- Einstellungs-Blatt -------------------------------------------------- */
.setup, .failed, .record { display: grid; align-content: start; justify-items: center; }
.sheet { width: min(560px, 100%); display: grid; gap: 16px; padding-top: 8px; }
.sheet.narrow { width: min(460px, 100%); }
.sheet-head { display: flex; gap: 14px; align-items: center; }
.sheet-head h2 { font-size: 19px; }
.sheet-head p { color: var(--muted); overflow-wrap: anywhere; }
.badge { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.badge svg { width: 22px; }
.fields { background: var(--panel); border-radius: 12px; padding: 4px 16px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; }
.field + .field { border-top: 1px solid var(--line); }
.sheet-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
.failed h2 { font-size: 19px; }

/* --- Aufnahme ------------------------------------------------------------ */
.rec { display: grid; justify-items: center; gap: 14px; padding-top: 48px; text-align: center; }
.rec-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--danger); animation: pulse 1.4s ease-in-out infinite; }
.rec-time { font-size: 54px; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
@keyframes pulse { 50% { opacity: .25; } }

/* --- Verarbeitung -------------------------------------------------------- */
.busy { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.pipeline { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.pipeline figure { display: grid; justify-items: center; gap: 8px; }
.pipeline figcaption { font-size: 12px; color: var(--muted); }
.vessel { width: 84px; height: 138px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--panel); position: relative; overflow: hidden; }
.vessel .fill { position: absolute; inset: auto 0 0 0; height: 0; transition: height .7s ease; }
.source .fill { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 78%, #fff), var(--accent)); }
.target .fill {
  background:
    linear-gradient(var(--panel), var(--panel)) 0 0 / 12px 100% no-repeat,
    linear-gradient(var(--panel), var(--panel)) 100% 0 / 12px 100% no-repeat,
    repeating-linear-gradient(0deg, transparent 0 7px, var(--muted) 7px 10px);
  background-position: 0 0, 100% 0, 0 100%;
}
.flow { display: flex; gap: 5px; }
.flow i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .25; animation: flow 1.2s linear infinite; }
.flow i:nth-child(2) { animation-delay: .2s; }
.flow i:nth-child(3) { animation-delay: .4s; }
@keyframes flow { 30% { opacity: 1; } 60% { opacity: .25; } }
.steps { display: grid; gap: 6px; text-align: left; min-width: 170px; }
.steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.steps li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; }
.steps li.done { color: var(--fg); }
.steps li.done::before { background: var(--muted); }
.steps li.active { color: var(--fg); font-weight: 600; }
.steps li.active::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.busy-status { font-size: 17px; font-variant-numeric: tabular-nums; }
.busy progress { width: min(360px, 80%); }
@media (prefers-reduced-motion: reduce) { .flow i, .rec-dot { animation: none; } .vessel .fill { transition: none; } }

/* --- Ergebnis ------------------------------------------------------------ */
.result { display: flex; flex-direction: column; gap: 12px; padding-bottom: 0; overflow: hidden; }
.result-head h2 { font-size: 18px; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 13px; margin-top: 2px; }
.player { display: flex; align-items: center; gap: 10px; }
.play { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; padding: 0; display: grid; place-items: center; flex: none; }
.play svg { width: 16px; height: 16px; }
.t { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 38px; text-align: center; }
#seek { flex: 1; min-width: 60px; accent-color: var(--accent); }
#rate { font-size: 13px; padding: 3px 4px; }
.controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.seg { display: inline-flex; background: var(--panel); border-radius: 9px; padding: 2px; border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 3px 16px; border-radius: 7px; font-size: 13px; }
.seg button[aria-selected=true] { background: var(--accent); color: #fff; font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; margin-left: auto; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.transcript { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 2px 16px; font-size: 16px; line-height: 1.6; outline-offset: -2px; }
.line { display: grid; grid-template-columns: auto minmax(0, 68ch); justify-content: start; align-items: start; gap: 0 14px; padding: 2px 0; }
.line .ts { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; line-height: 25.6px; cursor: pointer; }
.line .ts:hover { color: var(--accent); }
.transcript.no-times .ts { display: none; }
.transcript.no-times .line { grid-template-columns: minmax(0, 68ch); }
.line p { overflow-wrap: anywhere; }
.w { border-radius: 4px; cursor: pointer; padding: 1px 0; }
.w:hover { background: var(--faint); }
.w.now { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.spk { font-size: 14px; font-weight: 650; margin: 14px 0 2px; color: var(--sc, var(--accent)); }
.spk:first-child { margin-top: 0; }
.spk[data-s="1"] { --sc: var(--s1); } .spk[data-s="2"] { --sc: var(--s2); } .spk[data-s="3"] { --sc: var(--s3); }
.spk[data-s="4"] { --sc: var(--s4); } .spk[data-s="5"] { --sc: var(--s5); } .spk[data-s="6"] { --sc: var(--s6); }
.actions { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 10px 0; flex-wrap: wrap; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; bottom: calc(100% + 6px); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; display: grid; min-width: 250px; z-index: 5; }
.menu button { border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 6px; }
.menu button:hover { background: var(--accent); color: #fff; }

/* --- Dialoge und Hinweis ------------------------------------------------- */
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--fg); padding: 22px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog h2 { font-size: 18px; margin-bottom: 8px; }
dialog h3 { font-size: 13px; font-weight: 600; margin: 16px 0 8px; }
dialog .sheet-actions { margin-top: 20px; }
.limits { margin-top: 12px; display: grid; gap: 4px; font-size: 14px; }
.limits li { display: flex; justify-content: space-between; gap: 12px; }
.limits li span:first-child { color: var(--muted); }
#acc-usage { margin-top: 8px; font-variant-numeric: tabular-nums; }
#acc-server { margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 8px 16px; border-radius: 20px; font-size: 14px; box-shadow: var(--shadow); z-index: 20; max-width: calc(100vw - 32px); }

/* --- Schmale Fenster ----------------------------------------------------- */
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 10; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 9; }
  .only-narrow { display: grid; }
  .view { padding: 16px; }
  .pipeline { gap: 8px; }
  .steps { min-width: 0; }
  .vessel { width: 60px; height: 104px; border-radius: 14px; }
  .link-form { flex-wrap: wrap; }
  .link-form button { flex: 1; }
  .line { gap: 0 10px; }
}

/* --- Drucken: nur das Transkript ----------------------------------------- */
@media print {
  .side, .bar, .player, .controls, .actions, .toast, dialog { display: none !important; }
  .app, .main, .view, .transcript { display: block; height: auto; overflow: visible; }
  body { background: #fff; color: #000; }
  .w.now { background: none; box-shadow: none; }
}
