:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --ink: #16191d;
  --muted: #646a72;
  --line: #e2e4df;
  --accent: #0f7a5c;
  --accent-ink: #ffffff;
  --accent-soft: #e3f2ec;
  --warn: #b4441f;
  --warn-soft: #fbe9e1;
  --live: #1f5fbf;
  --live-soft: #e3ecfa;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 24, 28, .06), 0 4px 16px rgba(20, 24, 28, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111315;
    --surface: #1a1d20;
    --ink: #eceeea;
    --muted: #9aa0a6;
    --line: #2a2e33;
    --accent: #3cc497;
    --accent-ink: #0b1f18;
    --accent-soft: #163329;
    --warn: #f08a63;
    --warn-soft: #3a2119;
    --live: #7aa7ff;
    --live-soft: #1c2a44;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: inherit; }
main { max-width: 1040px; margin: 0 auto; padding: 20px 16px 64px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; font-weight: 600; }
h3 { font-size: .9rem; margin: 18px 0 8px; }
.muted { color: var(--muted); }

/* Kopfzeile */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px max(16px, calc((100% - 1040px) / 2 + 16px));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: 1rem; }
.brand b { font-weight: 700; }
.brand.big { font-size: 1.3rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.top form { margin: 0; }

/* Buttons & Formulare */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 999px; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 4px; }
.link:hover { color: var(--ink); }
input, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Login */
.login { min-height: 80vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.login-card form { display: grid; gap: 14px; margin-top: 18px; }
.login-card label { display: grid; gap: 6px; font-size: .85rem; color: var(--muted); }
.error { background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 10px; margin: 12px 0 0; }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .num { display: block; font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: .8rem; }
.stat.accent { background: var(--accent-soft); border-color: transparent; }
.stat.accent .num { color: var(--accent); }

.notice { background: var(--live-soft); color: var(--live); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
.notice a { font-weight: 600; }

/* Filter & Suche */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; }
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.tab { text-decoration: none; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.tab.active { background: var(--ink); color: var(--bg); }
.search { flex: 1; max-width: 340px; margin: 0; }

/* Anrufliste */
.calls { list-style: none; margin: 0; padding: 0; }
.calls .day { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 18px 4px 6px; }
.call a {
  display: grid; grid-template-columns: 56px minmax(140px, 220px) 1fr auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 6px; text-decoration: none; box-shadow: var(--shadow);
}
.call a:hover { border-color: var(--accent); }
.call.done a { opacity: .62; }
.call .time { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.call .who { display: grid; min-width: 0; }
.call .who b, .call .who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call .who small { color: var(--muted); }
.call .what { display: flex; gap: 6px; align-items: center; min-width: 0; }
.call .text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.call .dur { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.badge.cb { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.urgent { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.live { background: var(--live-soft); color: var(--live); border-color: transparent; }
.badge.ok { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.open { background: var(--ink); color: var(--bg); border-color: transparent; }

.empty { text-align: center; padding: 56px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty p { margin: 4px 0; }

/* Detailseite */
.back { display: inline-block; text-decoration: none; color: var(--muted); margin-bottom: 14px; font-weight: 600; }
.back:hover { color: var(--ink); }
.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.detail-head form { margin: 0; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.grid { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card p { margin: 0 0 10px; }
.concern { font-size: 1.05rem; font-weight: 600; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 16px 0 0; }
.facts dt { font-size: .75rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.facts a { color: var(--accent); }
audio { width: 100%; }
.note { display: grid; gap: 10px; }
.note .btn { justify-self: start; }

.chat { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.chat li { max-width: 78%; padding: 10px 14px; border-radius: 14px; }
.chat li p { margin: 0; white-space: pre-wrap; }
.chat .role { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; color: var(--muted); }
.chat .agent { background: var(--bg); border-top-left-radius: 4px; }
.chat .user { background: var(--accent-soft); justify-self: end; border-top-right-radius: 4px; }
.plain { white-space: pre-wrap; font: inherit; margin: 0; }

@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .call a { grid-template-columns: 48px 1fr auto; }
  .call .what { grid-column: 2 / -1; grid-row: 2; }
  .grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .chat li { max-width: 92%; }
  .search { max-width: none; flex-basis: 100%; }
}
.company { margin: 0 0 2px; font-weight: 600; }
@media (max-width: 760px) {
  .call .what { flex-wrap: wrap; }
  .call .text { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; flex-basis: 100%; }
}
