/* JEQK Cockpit – Gestaltung nach jeqk.de: Poppins, Source Serif 4 kursiv als Akzent,
   Papier/Tinte, Salbei, feine Linien statt Karten, Pillen als Schaltflächen. Mobil zuerst. */

@font-face { font-family: Poppins; font-style: normal; font-weight: 300; font-display: swap; src: url(fonts/poppins-latin-300-normal.woff2) format("woff2"); }
@font-face { font-family: Poppins; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/poppins-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Poppins; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/poppins-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Poppins; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/poppins-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/source-serif-4-latin-400-italic.woff2) format("woff2"); }

:root {
  --paper: #fff;
  --ink: #1a1a1a;
  --mute: #767676;
  --rule: #d8d8d4;
  --sage: #8fa98b;
  --sage-ink: #4f6b4c;
  --wash: #f4f5f1;
  --warn: #b0741a;
  --bad: #a8443d;
  --scrim: rgba(20, 22, 20, 0.45);
  --pad: clamp(20px, 3.2vw, 48px);
  --h: 56px;
  --tabs: 64px;
  --serif: "Source Serif 4", Georgia, serif;
  --ease-state: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141614;
    --ink: #ecede8;
    --mute: #a2a79f;
    --rule: #323631;
    --sage-ink: #a9c4a4;
    --wash: #1c1f1c;
    --warn: #e0b060;
    --bad: #e69089;
    --scrim: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 Poppins, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration-color: var(--sage); text-underline-offset: 3px; overflow-wrap: anywhere; }
a:hover { color: var(--sage-ink); }
.acc { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--sage-ink); letter-spacing: -0.01em; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: 0.5; cursor: default; }
:focus-visible { outline: 2px solid var(--sage-ink); outline-offset: 3px; border-radius: 4px; }

/* Wortmarke */
.mark { font-size: 16px; font-weight: 400; letter-spacing: -0.02em; white-space: nowrap; }
.mark b { font-weight: 700; }

/* Überschriften */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mute);
}
.eyebrow::before { content: ""; width: 40px; height: 1px; background: currentColor; }
.title { font-size: clamp(40px, 11vw, 72px); font-weight: 500; line-height: 0.98; letter-spacing: -0.045em; margin-bottom: clamp(24px, 4vw, 40px); }
h3 { font-size: 12px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--mute); }

/* Schaltflächen */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: transform 0.2s var(--ease-state);
}
.pill:active { transform: scale(0.97); }
.pill.ghost { background: none; color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }
.pill.ghost:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.pill.danger { background: none; color: var(--bad); box-shadow: inset 0 0 0 1px var(--rule); }
.link { min-height: 44px; padding: 0 4px; font-size: 14px; color: var(--mute); }
.link:hover { color: var(--ink); }

/* Anmeldung */
.login { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.login .hdr { position: static; }
.login-card { align-self: center; width: min(100%, 520px); padding: 24px var(--pad) 72px; display: grid; }
.login-card .title { margin-bottom: 32px; }
.login-card label { font-size: 12px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--mute); }
.login-card input {
  width: 100%;
  min-height: 52px;
  margin-bottom: 8px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: none;
  font-size: 18px;
  outline-offset: 6px;
}
.login-card .pill { margin-top: 24px; justify-self: start; }
.error { min-height: 24px; color: var(--bad); font-size: 14px; }

/* Kopfzeile */
.hdr {
  position: sticky;
  top: 0;
  z-index: 5;
  height: var(--h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 var(--pad);
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

/* Bereiche: am Handy als Leiste unten, ab Tablet in der Kopfzeile */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabs) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--paper);
  border-top: 1px solid var(--rule);
}
.tabs button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mute);
}
.tabs button::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.tabs button[aria-current="page"] { color: var(--ink); }
.tabs button[aria-current="page"]::before { background: var(--sage); }

#app > main { padding: clamp(28px, 5vw, 56px) var(--pad) calc(var(--tabs) + 48px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }

/* Filter */
.chips { display: flex; gap: 8px; margin: 0 calc(var(--pad) * -1) 8px; padding: 4px var(--pad) 16px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--rule);
  font-size: 14px;
  white-space: nowrap;
}
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--paper); box-shadow: none; }
.chips .count { margin-left: 8px; opacity: 0.6; font-variant-numeric: tabular-nums; }

/* Listen: Zeilen mit feinen Linien */
.list { border-bottom: 1px solid var(--rule); }
.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  width: 100%;
  min-height: 72px;
  padding: 16px 0;
  text-align: left;
  border-top: 1px solid var(--rule);
  transition: padding 0.3s var(--ease-expo), background-color 0.2s var(--ease-state);
}
button.row:hover { background: var(--wash); padding-left: 12px; padding-right: 12px; }
.row-title { font-size: 18px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.25; overflow-wrap: anywhere; }
.row-sub { color: var(--mute); font-size: 14px; overflow-wrap: anywhere; }
.row-side { display: flex; align-items: center; gap: 16px; }
.row-meta { color: var(--mute); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { padding: 48px 0; color: var(--mute); border-top: 1px solid var(--rule); }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--mute); }
.status.ok::before { background: var(--sage); }
.status.warn::before { background: var(--warn); }
.status.bad::before { background: var(--bad); }
.status.info::before { background: var(--ink); }

/* Detail: am Handy als Blatt von unten, ab Tablet als Seitenleiste */
.backdrop { position: fixed; inset: 0; z-index: 9; background: var(--scrim); }
.drawer {
  position: fixed;
  inset: 12px 0 0 0;
  z-index: 10;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  animation: sheet 0.45s var(--ease-expo);
}
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
.drawer-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px var(--pad) 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.drawer-head h2 { font-size: clamp(24px, 6vw, 32px); font-weight: 500; line-height: 1.05; letter-spacing: -0.035em; overflow-wrap: anywhere; }
#drawer-body { display: grid; gap: 32px; padding: 24px var(--pad) calc(48px + env(safe-area-inset-bottom)); }
.block { display: grid; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.note { color: var(--mute); font-size: 14px; }
.facts { display: grid; grid-template-columns: 1fr; margin: 0; border-bottom: 1px solid var(--rule); }
.facts dt { padding-top: 10px; border-top: 1px solid var(--rule); color: var(--mute); font-size: 12px; }
.facts dd { margin: 0; padding-bottom: 10px; overflow-wrap: anywhere; }
.placeholder { color: var(--mute); font-family: var(--serif); font-style: italic; }
/* Ablauf: die Schritte eines Leads */
.steps { margin: 0; padding: 0; list-style: none; display: grid; }
.steps li { position: relative; display: grid; gap: 2px; padding: 0 0 18px 28px; color: var(--mute); }
.steps li::before { content: ""; position: absolute; left: 3px; top: 8px; width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--mute); background: var(--paper); z-index: 1; }
.steps li::after { content: ""; position: absolute; left: 6px; top: 16px; bottom: -8px; width: 1px; background: var(--rule); }
.steps li:last-child { padding-bottom: 0; }
.steps li:last-child::after { display: none; }
.steps li.done { color: var(--ink); }
.steps li.done::before { background: var(--ink); box-shadow: none; }
.steps li.done::after { background: var(--ink); }
.steps li.now { color: var(--ink); }
.steps li.now::before { left: 1px; top: 6px; width: 11px; height: 11px; background: var(--sage); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sage) 25%, transparent); }
.steps li.now.bad::before { background: var(--bad); box-shadow: none; }
.steps li.now .step-label { font-weight: 500; }
.steps li.off { color: var(--mute); }
.step-hint { color: var(--mute); font-size: 14px; }

/* „Der Agent arbeitet gerade daran" */
.working { display: inline-flex; align-items: center; gap: 8px; color: var(--sage-ink); font-weight: 500; }
.working::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--sage); animation: ping 2.4s ease-out infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(143, 169, 139, 0.6); } 70%, 100% { box-shadow: 0 0 0 8px rgba(143, 169, 139, 0); } }

ul.plain { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
ul.plain li { padding-left: 16px; position: relative; overflow-wrap: anywhere; }
ul.plain li::before { content: ""; position: absolute; left: 0; top: 0.7em; width: 6px; height: 1px; background: var(--mute); }
.mailtext {
  margin: 0;
  padding: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: 15px;
  background: var(--wash);
  border-radius: 4px;
}
.timeline { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.timeline li { display: grid; gap: 2px; padding-left: 16px; border-left: 1px solid var(--rule); }
.timeline time { color: var(--mute); font-size: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabs) + 16px + env(safe-area-inset-bottom));
  z-index: 20;
  transform: translateX(-50%);
  max-width: calc(100% - 40px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
}

@media (min-width: 720px) {
  .tabs {
    top: 0;
    bottom: auto;
    left: 50%;
    right: auto;
    z-index: 7;
    transform: translateX(-50%);
    display: flex;
    gap: 32px;
    width: max-content;
    height: var(--h);
    padding: 0;
    background: none;
    border: 0;
  }
  .tabs button { grid-auto-flow: column; gap: 8px; font-size: 14px; }
  #app > main { padding-bottom: 96px; }
  .row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: center; gap: 24px; padding: 20px 0; }
  .row-side { justify-content: flex-end; min-width: 220px; }
  .chips { flex-wrap: wrap; overflow: visible; }
  .drawer { inset: 0 0 0 auto; width: min(100%, 600px); border-radius: 0; border-left: 1px solid var(--rule); animation-name: side; }
  @keyframes side { from { transform: translateX(40px); opacity: 0; } }
  .facts { grid-template-columns: 160px 1fr; }
  .facts dt, .facts dd { padding: 10px 0; border-top: 1px solid var(--rule); font-size: inherit; }
  .facts dt { font-size: 14px; }
  .toast { bottom: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
