:root {
  --bg: #f4f5f9;
  --panel: #ffffff;
  --line: #e6e8ef;
  --key: #f1f3f8;
  --text: #1c2233;
  --muted: #6b7286;
  --blue: #3b5bdb;
  --navy: #1e2640;
  --green: #12a150;
  --red: #e5484d;
  --orange: #d97706;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button { font: inherit; cursor: pointer; }
svg { fill: currentColor; }
[hidden] { display: none !important; }

.app { display: flex; height: 100vh; min-height: 560px; }

/* Linke Leiste */
.rail { width: 64px; background: var(--navy); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; }
.rail-spacer { flex: 1; }
.brand { width: 38px; height: 38px; border: 0; cursor: pointer; border-radius: 10px; background: linear-gradient(135deg, #5c7cfa, #3b5bdb); color: #fff; font-weight: 700; font-size: 14px; display: grid; place-items: center; margin-bottom: 14px; letter-spacing: .5px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #3a4466; background: #2c3555; color: #dfe4f5; font-size: 12px; font-weight: 600; margin-top: 6px; }
.rail-btn { position: relative; width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; color: #9aa3c0; display: grid; place-items: center; }
.rail-btn svg { width: 21px; height: 21px; }
.rail-btn:hover { background: #2a3352; color: #fff; }
.rail-btn.active { color: #fff; background: #3b5bdb; }
.badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }

/* Telefon */
.phone { width: 340px; min-width: 300px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }


.dial-foot { height: 96px; display: grid; grid-template-columns: 1fr 64px 1fr; align-items: center; justify-items: center; padding-bottom: 8px; }
.call-btn { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--green); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(18,161,80,.35); }
.call-btn svg { width: 28px; height: 28px; }
.call-btn:hover { filter: brightness(1.08); }
.call-btn:disabled { opacity: .5; cursor: default; }
.call-btn.hangup { background: var(--red); box-shadow: 0 6px 16px rgba(229,72,77,.35); }

/* Listen */
.list-head { padding: 22px 18px 12px; font-weight: 600; font-size: 16px; }
.list { overflow: auto; flex: 1; }
.item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; margin: 2px 8px; border-radius: 10px; cursor: pointer; background: #fff; }
.item:hover { background: var(--key); }
.item.sel { background: #e7ecfd; }
.item .av { width: 34px; height: 34px; border-radius: 50%; background: #e0e7ff; color: #3b5bdb; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.item .meta { flex: 1; min-width: 0; }
.item .t { font-size: 14px; }
.item .s { font-size: 12px; color: var(--muted); }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #eee; color: #444; white-space: nowrap; }
.pill.Leicht { background: #e3f4e1; color: #1f6b1c; }
.pill.Mittel { background: #fff1d6; color: #8a5a00; }
.pill.Schwer { background: #fde3e3; color: #a12a2a; }
.mini-call { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--green); color: #fff; display: grid; place-items: center; flex: none; }
.mini-call svg { width: 17px; height: 17px; }
.mini-call:hover { filter: brightness(1.1); }
.empty { padding: 20px 14px; color: var(--muted); font-size: 13px; }

/* Anruf */
.incall { background: #fff; }
.incall-top { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.big-avatar { width: 84px; height: 84px; border-radius: 50%; background: #e0e7ff; color: #3b5bdb; font-size: 28px; font-weight: 600; display: grid; place-items: center; margin-bottom: 8px; }
.big-avatar.ringing { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(59,91,219,.35); } 50% { box-shadow: 0 0 0 14px rgba(59,91,219,0); } }
.call-name { font-size: 20px; }
.call-number { color: var(--muted); font-size: 13px; }
.call-status { color: var(--muted); font-size: 14px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.call-actions { display: flex; justify-content: center; gap: 26px; padding: 18px 0 26px; align-items: center; }
.round { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #444; font-size: 12px; }
.round svg { width: 48px; height: 48px; padding: 12px; border-radius: 50%; background: #f0f0f0; }
.round.on svg { background: #333; color: #fff; }
.rec { font-size: 11px; color: var(--red); font-weight: 600; display: flex; align-items: center; gap: 5px; opacity: 0; }
.rec.on { opacity: 1; }
.rec i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* Rechte Spalte */
.side { flex: 1; overflow: auto; background: var(--bg); padding: 28px 32px; min-width: 0; }
.side h2 { margin: 0 0 4px; font-weight: 600; font-size: 22px; }
.side h3 { margin: 26px 0 10px; font-size: 15px; font-weight: 600; }
.sub { color: var(--muted); font-size: 13px; }
.card { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 14px 16px; margin-top: 14px; }
.card ul { margin: 6px 0 0; padding-left: 18px; }
.card li { margin: 4px 0; font-size: 14px; }
.hint { background: #f2f7fd; border-color: #cfe1f6; font-size: 13px; color: #24446b; }
.btn { border: 0; border-radius: 8px; padding: 8px 16px; background: var(--blue); color: #fff; }
.btn.ghost { background: #eee; color: #333; }
.welcome { max-width: 560px; }
.welcome ol { padding-left: 20px; line-height: 1.7; font-size: 14px; }

.transcript { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.msg { max-width: 80%; padding: 8px 12px; border-radius: 10px; font-size: 14px; line-height: 1.4; }
.msg.closer { align-self: flex-end; background: #e6f0fb; }
.msg.bewerber { align-self: flex-start; background: #f1f1f1; }
.msg b { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.msg.pending { opacity: .5; font-style: italic; }

.spinner { width: 28px; height: 28px; border: 3px solid #ddd; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px 0 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { color: var(--red); background: #fdf0f0; border: 1px solid #f3c7c7; border-radius: 6px; padding: 12px 14px; font-size: 14px; margin-top: 14px; }

/* Auswertung */
.score-head { display: flex; gap: 22px; align-items: center; margin-top: 16px; }
.score { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; font-weight: 700; color: #fff; flex: none; }
.score small { display: block; font-size: 11px; font-weight: 400; text-align: center; margin-top: -6px; }
.phase { display: grid; grid-template-columns: 210px 1fr 40px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.phase .bar { height: 8px; border-radius: 4px; background: #eee; overflow: hidden; }
.phase .bar i { display: block; height: 100%; }
.phase .note { grid-column: 1 / -1; color: #444; font-size: 13px; }
.phase .note q { color: var(--muted); font-style: italic; display: block; margin-top: 2px; }
.phase.na { color: #aaa; }
.violation { border-left: 4px solid var(--red); background: #fdf3f3; padding: 10px 12px; margin: 8px 0; font-size: 14px; border-radius: 0 4px 4px 0; }
.violation q { display: block; font-style: italic; color: #7a2b2b; margin: 4px 0; }
.goal { display: flex; gap: 10px; font-size: 14px; padding: 5px 0; }
.goal .ic { width: 20px; flex: none; text-align: center; font-weight: 700; }
.goal .ic.y { color: var(--green); } .goal .ic.n { color: var(--red); } .goal .ic.na { color: #bbb; }
.goal .c { color: var(--muted); font-size: 13px; }
.improve { padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.improve em { display: block; color: #24446b; background: #f2f7fd; padding: 6px 10px; border-radius: 4px; margin-top: 5px; font-style: normal; }
details summary { cursor: pointer; font-weight: 600; font-size: 15px; margin-top: 26px; }
audio { width: 100%; margin-top: 10px; }

dialog { border: 0; border-radius: 8px; padding: 24px 26px; width: min(380px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h3 { margin: 0 0 6px; }
dialog p { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
dialog input { width: 100%; padding: 9px 10px; border: 1px solid #ccc; border-radius: 4px; font: inherit; margin-bottom: 14px; }
dialog button { width: 100%; border: 0; border-radius: 4px; padding: 10px; background: var(--blue); color: #fff; }

/* Admin */
.admin { max-width: 1100px; margin: 0 auto; padding: 28px 16px; }
.admin table { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
.admin th, .admin td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.admin th { background: #f7f7f7; font-weight: 600; }
.admin tr.row { cursor: pointer; }
.admin tr.row:hover { background: #f2f7fd; }
.admin .report { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 24px 28px; margin-top: 20px; }

@media (max-width: 760px) {
  .app { flex-direction: column; height: auto; }
  .rail { width: 100%; flex-direction: row; height: 52px; padding: 0 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .avatar { margin: 0 0 0 6px; }
  .rail-btn { width: 44px; }
  .rail-btn.active::before { left: 8px; right: 8px; top: auto; bottom: 0; width: auto; height: 3px; }
  .phone { width: 100%; height: 560px; border-right: 0; }
  .side { padding: 20px 16px; }
  .phase { grid-template-columns: 1fr 70px 30px; }
}
