/* ---------- Apple-inspiriertes Design ---------- */
:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --grau: #6e6e73;
  --linie: #d2d2d7;
  --akzent: #0071e3;
  --akzent-dunkel: #0058b9;
  --gut: #34c759;
  --warn: #ff9f0a;
  --schlecht: #ff3b30;
  --radius: 18px;
  --schatten: 0 4px 24px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 56px 20px 32px;
  background: linear-gradient(180deg, #fbfbfd 0%, var(--bg) 100%);
}
.hero-inner { max-width: 640px; margin: 0 auto; }
.hero h1 {
  font-size: clamp(32px, 7vw, 48px);
  font-weight: 700;
  letter-spacing: -.02em;
  background: linear-gradient(120deg, #1d1d1f, #0071e3);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p { color: var(--grau); font-size: clamp(15px, 3.5vw, 19px); margin-top: 10px; }

/* ---------- Panels / Karten ---------- */
main { max-width: 680px; margin: 0 auto; padding: 0 16px 40px; }
.panel { display: none; animation: auf .35s ease; }
.panel.active { display: block; }
@keyframes auf { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 26px 22px;
}
.card h2 { font-size: 24px; font-weight: 650; letter-spacing: -.01em; }
.sub { color: var(--grau); font-size: 15px; margin: 8px 0 20px; }

/* ---------- Eingabefelder ---------- */
.feld {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 14px 16px;
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: #fbfbfd;
  margin-bottom: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.feld:focus {
  outline: none;
  border-color: var(--akzent);
  box-shadow: 0 0 0 4px rgba(0,113,227,.12);
}
.area { min-height: 130px; resize: vertical; }

/* ---------- Upload-Feld ---------- */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 32px 20px;
  border: 2px dashed var(--linie);
  border-radius: 14px;
  background: #fbfbfd;
  cursor: pointer;
  text-align: center;
  margin-bottom: 14px;
  transition: border-color .2s, background .2s;
}
.drop:hover, .drop.over { border-color: var(--akzent); background: #f0f7ff; }
.drop-icon { font-size: 34px; }
.drop-text { color: var(--grau); font-size: 15px; }
.drop-name { color: var(--akzent); font-weight: 600; font-size: 15px; }

/* ---------- Buttons ---------- */
.btn {
  width: 100%;
  font: inherit; font-size: 17px; font-weight: 600;
  padding: 15px;
  border: none; border-radius: 12px;
  cursor: pointer;
  transition: transform .1s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--akzent); color: #fff; }
.btn.primary:hover { background: var(--akzent-dunkel); }
.btn:disabled { opacity: .55; cursor: progress; }

/* ---------- Ergebnis ---------- */
.ergebnis { margin-top: 22px; }
.ergebnis:empty { margin-top: 0; }

.lade { display: flex; align-items: center; gap: 12px; color: var(--grau); font-size: 15px; padding: 8px 0; }
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--linie); border-top-color: var(--akzent);
  border-radius: 50%; animation: dreh .8s linear infinite;
}
@keyframes dreh { to { transform: rotate(360deg); } }

.fehler { color: var(--schlecht); font-size: 15px; padding: 12px 0; }

/* Score-Ring */
.score-box { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.ring {
  width: 88px; height: 88px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  font-size: 26px; font-weight: 700; color: #fff;
}
.score-text { font-size: 15px; color: var(--grau); }

.block-titel { font-size: 17px; font-weight: 650; margin: 20px 0 10px; }
.liste { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.liste li { display: flex; gap: 10px; font-size: 15px; align-items: flex-start; }
.liste li::before { flex-shrink: 0; }
.liste.gut li::before { content: "✓"; color: var(--gut); font-weight: 700; }
.liste.schlecht li::before { content: "!"; color: var(--warn); font-weight: 700; }
.liste.ats li::before { content: "⚙"; }

.verb { background: #fbfbfd; border: 1px solid var(--linie); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.verb .stelle { font-weight: 600; font-size: 14px; color: var(--akzent); }
.verb .vorschlag { font-size: 15px; margin-top: 4px; }

/* Markdown-Ausgabe (Anschreiben / Firma) */
.md { font-size: 15.5px; white-space: pre-wrap; }
.md h2, .md h3 { font-size: 17px; margin: 16px 0 6px; }
.md strong { font-weight: 650; }
.kopier { margin-top: 14px; background: #fbfbfd; color: var(--akzent); border: 1px solid var(--linie); }

/* Job-Karten */
.job {
  display: block;
  background: #fbfbfd; border: 1px solid var(--linie);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  text-decoration: none; color: inherit;
  transition: border-color .2s, transform .1s;
}
.job:hover { border-color: var(--akzent); }
.job:active { transform: scale(.99); }
.job .titel { font-weight: 600; font-size: 16px; }
.job .meta { color: var(--grau); font-size: 14px; margin-top: 3px; }
.treffer { color: var(--grau); font-size: 14px; margin-bottom: 14px; }

/* ---------- Tab-Leiste (iOS-Stil) ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--linie);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
}
.tab {
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font: inherit; font-size: 11px; font-weight: 500;
  color: var(--grau);
  transition: color .2s;
}
.tab span { font-size: 22px; }
.tab.active { color: var(--akzent); }

@media (min-width: 540px) {
  .card { padding: 32px 30px; }
}

/* ---------- Topbar (Konto) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--linie);
}
.topbar-inner {
  max-width: 680px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.marke { font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.konto { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.konto-name { color: var(--ink); font-weight: 600; }
.konto-link { color: var(--akzent); text-decoration: none; font-weight: 500; }
.konto-link:hover { text-decoration: underline; }

/* ---------- Auth-Seite ---------- */
.auth-body { display: flex; min-height: 100vh; padding-bottom: 0; }
.auth-wrap {
  margin: auto; width: 100%; max-width: 420px; padding: 32px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
}
.auth-logo {
  font-size: 26px; font-weight: 700; letter-spacing: -.02em; text-decoration: none;
  background: linear-gradient(120deg, #1d1d1f, #0071e3);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-card { width: 100%; }
.auth-wechsel { text-align: center; margin-top: 16px; font-size: 15px; color: var(--grau); }
.auth-wechsel a { color: var(--akzent); text-decoration: none; font-weight: 600; }

/* ---------- Buttons Varianten ---------- */
.btn.grau { background: #e8e8ed; color: var(--ink); }
.btn.grau:hover { background: #dcdce1; }
.btn-klein {
  background: var(--akzent); color: #fff; border: none; border-radius: 10px;
  font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; cursor: pointer;
}
.btn-klein:active { transform: scale(.97); }

/* ---------- Tracker ---------- */
.tracker-kopf { display: flex; align-items: center; justify-content: space-between; }
.login-hinweis { text-align: center; padding: 20px 0; display: flex; flex-direction: column; gap: 12px; }
.login-hinweis p { color: var(--grau); margin-bottom: 6px; }
.leer { color: var(--grau); text-align: center; padding: 24px 0; font-size: 15px; }

.stat-zeile { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.stat-chip { font-size: 13px; font-weight: 600; padding: 5px 11px; border-radius: 20px; background: #f0f0f3; color: var(--grau); }

.bw {
  background: #fbfbfd; border: 1px solid var(--linie); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 12px;
}
.bw-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.bw-firma { font-weight: 650; font-size: 16px; }
.bw-meta { color: var(--grau); font-size: 14px; margin-top: 2px; }
.bw-notiz { font-size: 14px; color: var(--ink); margin-top: 8px; white-space: pre-wrap; }
.bw-fuss { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 12px; }
.bw-akt { background: none; border: none; color: var(--akzent); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; padding: 0; }
.bw-akt:hover { text-decoration: underline; }
.bw-akt.loesch { color: var(--schlecht); }
.frist { font-size: 13px; color: var(--grau); }
.frist.ueberfaellig { color: var(--schlecht); font-weight: 600; }

/* Status-Badges + Chips */
.badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.s-geplant  { background: #eef0f2; color: #5b6470; }
.s-beworben { background: #e3f0ff; color: #0058b9; }
.s-gespraech{ background: #fff2dd; color: #b06f00; }
.s-zusage   { background: #e2f7e7; color: #1a8a39; }
.s-absage   { background: #ffe5e3; color: #c0271c; }

/* Job-Merken-Button in Job-Karte */
.job { display: flex; align-items: center; gap: 10px; }
.job-haupt { flex: 1; text-decoration: none; color: inherit; min-width: 0; }
.job-merken {
  flex-shrink: 0; background: #fff; border: 1px solid var(--akzent); color: var(--akzent);
  font: inherit; font-size: 13px; font-weight: 600; padding: 7px 11px; border-radius: 10px; cursor: pointer;
}
.job-merken:hover { background: #f0f7ff; }
.job-merken:disabled { border-color: var(--gut); color: var(--gut); background: #fff; }

/* ---------- Modal ---------- */
.modal-bg {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.4); display: none; align-items: flex-end; justify-content: center;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.modal-bg.auf { display: flex; animation: einblenden .2s ease; }
@keyframes einblenden { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--card); width: 100%; max-width: 480px;
  border-radius: 22px 22px 0 0; padding: 24px 22px calc(24px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto;
  animation: hoch .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes hoch { from { transform: translateY(100%); } to { transform: none; } }
.modal h3 { font-size: 20px; font-weight: 650; margin-bottom: 16px; }
.feld-label { display: block; font-size: 13px; color: var(--grau); margin: 4px 2px 6px; font-weight: 500; }
.modal-aktionen { display: flex; gap: 12px; margin-top: 8px; }
.modal-aktionen .btn { flex: 1; }

@media (min-width: 540px) {
  .modal-bg { align-items: center; }
  .modal { border-radius: 22px; }
}

/* ---------- Anschreiben mit Freigabe ---------- */
.bw-akt.anschr { font-weight: 600; }
.as-stelle-info { margin-bottom: 14px; }
.as-stelle-firma { font-weight: 650; font-size: 16px; }
.as-stelle-ort { color: var(--grau); font-size: 14px; margin-top: 2px; }
.as-text-area { min-height: 220px; }
.as-freigabe-bereich { margin-top: 18px; }
.as-hinweis {
  background: #fff7e6; border: 1px solid #ffe2a8; color: #8a5a00;
  font-size: 13.5px; font-weight: 500; padding: 10px 13px; border-radius: 11px;
  margin: 4px 0 14px;
}
.as-aktionen { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.as-aktionen .btn { flex: 1; min-width: 160px; font-size: 15px; }

/* ---------- Profil (gespeicherter Lebenslauf) ---------- */
.profil-zeile { display: flex; align-items: center; gap: 12px; margin: -4px 0 14px; flex-wrap: wrap; }
.btn-text {
  background: none; border: none; color: var(--akzent); cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; padding: 4px 0;
}
.btn-text:hover { text-decoration: underline; }
.btn-text:disabled { opacity: .5; cursor: progress; }
.profil-status { font-size: 13px; color: var(--grau); }
