@font-face { font-family: "Space Grotesk"; font-weight: 700; font-display: swap; src: url(/fonts/space-grotesk/space-grotesk-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 400; font-display: swap; src: url(/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 500; font-display: swap; src: url(/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 600; font-display: swap; src: url(/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 700; font-display: swap; src: url(/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-700-normal.woff2) format("woff2"); }

:root {
  --bg: #080B12;
  --surface: #161618;
  --surface-2: #1c1c20;
  --border: #232327;
  --text: #ECEEF2;
  --text-2: #A8B2C8;
  --cyan: #67E8F9;
  --accent: #F59E0B;
  --accent-ink: #1a1204;
  --red: #F87171;
  --green: #4ADE80;
  --yellow: #FACC15;
  --orange: #FB923C;
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 15px/1.5 "Plus Jakarta Sans", system-ui, sans-serif; min-height: 100vh; }
h1, h2, h3 { margin: 0; }
h1 { font: 700 22px/1.1 "Space Grotesk", system-ui, sans-serif; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
h3 { font-size: 15px; font-weight: 700; margin: 18px 0 8px; }
a { color: var(--cyan); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.muted { color: var(--text-2); }
.hint { color: var(--text-2); font-size: 13px; margin: 10px 0 0; }
.error { color: var(--red); font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; min-height: 68px; background: rgba(8,11,18,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; flex: none; background: linear-gradient(135deg, var(--accent), #fbbf24 60%, var(--cyan)); clip-path: polygon(0 0, 100% 0, 62% 55%, 62% 100%, 38% 100%, 38% 55%); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons & Inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: var(--r-sm); border: 1px solid transparent; font: 600 14px/1 inherit; font-family: inherit; cursor: pointer; text-decoration: none; color: var(--text); background: var(--surface-2); transition: background .15s, border-color .15s, opacity .15s; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: #fbb13c; }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { border-color: #3a3a40; background: var(--surface-2); }
.btn.danger-ghost { background: transparent; border-color: rgba(248,113,113,.35); color: var(--red); }
.btn.danger-ghost:hover { background: rgba(248,113,113,.08); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; margin-top: 14px; }
.link { background: none; border: 0; color: var(--cyan); cursor: pointer; font: inherit; font-size: 13px; padding: 0; }
.icon-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); width: 36px; height: 36px; border-radius: var(--r-sm); cursor: pointer; font-size: 15px; }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], input:not([type]), select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid var(--border); background: #0e1119; color: var(--text); font: inherit; font-size: 14px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, .link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: none; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field strong { color: var(--text); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; user-select: none; }

/* Layout */
.layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; padding: 20px 24px 40px; max-width: 1600px; margin: 0 auto; }
.sidebar, .main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; }

/* Ort-Combo */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); max-height: 260px; overflow: auto; box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.combo-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.combo-list li:hover, .combo-list li[aria-selected=true] { background: rgba(245,158,11,.14); }

/* Branchen-Auswahl */
.branch-tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.branch-picker { max-height: 280px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px 10px; background: #0e1119; }
.branch-picker.disabled { opacity: .45; pointer-events: none; }
.branch-group { margin: 6px 0 10px; }
.branch-group > .check { font-weight: 700; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.branch-group .items { display: flex; flex-direction: column; gap: 4px; padding-left: 24px; }
.branch-group .items .check { font-size: 14px; }
.picker-foot { display: flex; justify-content: space-between; margin-top: 6px; font-size: 13px; color: var(--text-2); }

/* Suchen-Liste */
.search-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.search-list li { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer; }
.search-list li:hover, .search-list li.active { border-color: rgba(245,158,11,.6); background: rgba(245,158,11,.05); }
.search-list .s-main { flex: 1; min-width: 0; }
.search-list .s-title { font-weight: 600; font-size: 14px; }
.search-list .s-sub { color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-list .del { background: none; border: 0; color: var(--text-2); cursor: pointer; font-size: 14px; padding: 2px 4px; }
.search-list .del:hover { color: var(--red); }

/* Job & Analyse */
.jobbar { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-radius: var(--r-lg); border: 1px solid rgba(245,158,11,.4); background: rgba(245,158,11,.07); }
.job-text { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 14px; }
.job-text span { color: var(--text-2); overflow-wrap: anywhere; }
.progress { flex: 1; height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; min-width: 120px; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.analyze { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.analyze h2 { margin-bottom: 4px; }
.analyze p { margin: 0; font-size: 14px; }
.analyze-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* Filter & Tabelle */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters select, .filters input[type=search] { width: auto; flex: 1 1 150px; }
.min-score { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.min-score input { width: 72px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border); background: transparent; color: var(--text); font: 500 13px inherit; font-family: inherit; cursor: pointer; }
.chip[aria-pressed=true] { border-color: var(--accent); background: rgba(245,158,11,.12); }
.chip b { font-weight: 700; }
.table-wrap { overflow-x: auto; }
table.leads { width: 100%; border-collapse: collapse; font-size: 14px; }
table.leads th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.leads td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.leads tbody tr { cursor: pointer; }
table.leads tbody tr:hover { background: var(--surface-2); }
.lead-name { font-weight: 600; }
.lead-sub { color: var(--text-2); font-size: 12px; }
.score { display: inline-grid; place-items: center; width: 44px; height: 32px; border-radius: 8px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface-2); color: var(--text-2); }
.score.hot { background: rgba(245,158,11,.18); color: var(--accent); }
.score.warm { background: rgba(250,204,21,.12); color: var(--yellow); }
.score.cold { background: rgba(168,178,200,.08); }
.state { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.state.keine, .state.social, .state.defekt { background: rgba(248,113,113,.14); color: var(--red); }
.state.veraltet { background: rgba(251,146,60,.14); color: var(--orange); }
.state.mittel { background: rgba(250,204,21,.12); color: var(--yellow); }
.state.bestaetigt { background: rgba(245,158,11,.2); color: var(--accent); }
.state.modern { background: rgba(74,222,128,.12); color: var(--green); }
.state.offen { background: var(--surface-2); color: var(--text-2); }
.ai-cell { max-width: 360px; color: var(--text-2); font-size: 13px; }
.empty { text-align: center; color: var(--text-2); padding: 40px 0; margin: 0; }

/* Drawer */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(720px, 100vw); z-index: 40; background: var(--surface); border-left: 1px solid var(--border); transform: translateX(100%); transition: transform .22s ease; overflow-y: auto; }
.drawer.open { transform: none; }
.drawer-inner { padding: 24px; position: relative; }
.drawer .close { position: absolute; top: 18px; right: 18px; }
.backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.5); }
.d-head { padding-right: 48px; }
.d-head h2 { font: 700 24px/1.2 "Space Grotesk", sans-serif; margin-bottom: 6px; }
.d-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--text-2); font-size: 13px; }
.d-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 18px 0; }
.kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; }
.kpi small { display: block; color: var(--text-2); font-size: 12px; }
.kpi b { font-size: 20px; font-variant-numeric: tabular-nums; }
.contact { display: flex; flex-wrap: wrap; gap: 8px; }
.shots { display: grid; grid-template-columns: 3fr 1fr; gap: 10px; align-items: start; }
.shots a { display: block; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; background: #fff; }
.shots img { display: block; width: 100%; height: auto; }
.findings { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.findings li { display: flex; gap: 8px; }
.findings .pts { margin-left: auto; color: var(--text-2); font-variant-numeric: tabular-nums; }
.findings .ok { color: var(--green); }
.findings .bad { color: var(--orange); }
.ai-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; }
.ai-box ul { margin: 6px 0; padding-left: 20px; }
.quote { border-left: 3px solid var(--accent); padding: 8px 12px; margin: 8px 0; background: rgba(245,158,11,.06); border-radius: 0 8px 8px 0; }
.verify { margin-top: 16px; padding: 14px 16px; border-radius: var(--r); border: 1px solid rgba(245,158,11,.45); background: rgba(245,158,11,.06); }
.verify.ok { border-color: var(--border); background: var(--surface-2); }
.verify p { margin: 0 0 10px; font-size: 14px; }
.verify-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.verify-row + .verify-row { margin-top: 8px; }
.verify-row input { flex: 1 1 220px; width: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* Dialoge */
.dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.dialog.wide { width: min(1000px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.dialog-actions.left { justify-content: flex-start; }
.branch-form { display: grid; grid-template-columns: 1.2fr 1fr 2fr 1fr auto auto; gap: 8px; margin: 14px 0 8px; }
.branch-table-wrap { max-height: 50vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-sm); }
table.simple { width: 100%; border-collapse: collapse; font-size: 13px; }
table.simple th, table.simple td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.simple th { position: sticky; top: 0; background: var(--surface-2); }
table.simple td:last-child { white-space: nowrap; text-align: right; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--surface-2); border: 1px solid var(--border); padding: 10px 16px; border-radius: var(--r); box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 14px; max-width: calc(100vw - 32px); }
.toast.err { border-color: rgba(248,113,113,.5); }
.bye { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-content: center; text-align: center; }

/* Responsive */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .branch-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .brand p { display: none; }
  .layout { padding: 16px; gap: 16px; }
  .card { padding: 16px; }
  .jobbar { flex-wrap: wrap; }
  .progress { flex-basis: 100%; order: 3; }
  table.leads thead { display: none; }
  table.leads, table.leads tbody, table.leads tr, table.leads td { display: block; width: 100%; }
  table.leads tr { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
  table.leads td { border: 0; padding: 0; }
  table.leads td:first-child { grid-row: span 5; }
  .ai-cell { max-width: none; }
  .form-grid, .branch-form { grid-template-columns: 1fr; }
  .shots { grid-template-columns: 1fr; }
  .shots a + a { max-width: 60%; }
  .drawer-inner { padding: 18px 16px; }
  .top-actions .btn { min-height: 36px; padding: 6px 10px; }
}

/* Login & Rollen */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { width: min(400px, 100%); }
.login-card .brand { margin-bottom: 24px; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; padding: 0 6px; }
.user-chip b { color: var(--text); }
.muted-row { cursor: default; color: var(--text-2); }
.link.danger { color: var(--red); }
.cost-list { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
body.role-partner .admin-only { display: none !important; }
