:root,
[data-theme="dark"] {
  --bg:#0E0F12; --panel:#15171C; --panel2:#1B1E25; --line:#2A2E37;
  --text:#E8EAEF; --muted:#9097A3; --accent:#FF7A1A; --accent-ink:#1A0E03;
  --ok:#36C26B; --input:#101216;
}
[data-theme="light"] {
  --bg:#F3F4F6; --panel:#FFFFFF; --panel2:#F7F8FA; --line:#E4E7EC;
  --text:#15171C; --muted:#5B616E; --accent:#E5640A; --accent-ink:#FFFFFF;
  --ok:#1F9D55; --input:#FFFFFF;
}

* { box-sizing:border-box; }
html,body { margin:0; padding:0; }
body {
  background:var(--bg); color:var(--text);
  font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  -webkit-font-smoothing:antialiased;
}

/* ---------- App-Layout mit Sidebar ---------- */
.app { display:flex; min-height:100vh; }
.sidebar {
  width:230px; flex-shrink:0; background:var(--panel); border-right:1px solid var(--line);
  display:flex; flex-direction:column; padding:16px 12px;
}
.main { flex:1; min-width:0; max-width:1140px; padding:20px 18px 48px; }

.brand { display:flex; align-items:center; gap:11px; padding:0 4px; }
.brand-mark {
  width:38px; height:38px; border-radius:10px; background:var(--accent); color:var(--accent-ink);
  display:flex; align-items:center; justify-content:center; font-weight:800; font-size:15px; letter-spacing:-.02em;
}
.brand-name { font-size:16px; font-weight:800; letter-spacing:-.01em; }
.brand-sub { color:var(--muted); font-weight:600; font-size:12px; }
.brand-tag { font-size:11.5px; color:var(--muted); }

.nav { display:flex; flex-direction:column; gap:3px; margin-top:20px; flex:1; }
.nav-item {
  display:block; padding:9px 12px; border-radius:9px; color:var(--text);
  text-decoration:none; font-size:13.5px; font-weight:600;
}
.nav-item:hover { background:var(--panel2); }
.nav-item.active { background:var(--accent); color:var(--accent-ink); }
.nav-item.disabled { color:var(--muted); opacity:.45; cursor:default; font-weight:500; }
.nav-item.disabled:hover { background:transparent; }
.side-foot { display:flex; gap:8px; padding-top:12px; }

.icon-btn {
  width:36px; height:36px; border-radius:9px; border:1px solid var(--line); background:var(--panel);
  color:var(--text); display:flex; align-items:center; justify-content:center; cursor:pointer;
  font-size:16px; text-decoration:none;
}
.icon-btn.small { width:30px; height:30px; font-size:14px; }

@media (max-width:860px) {
  .app { flex-direction:column; }
  .sidebar {
    width:auto; flex-direction:row; align-items:center; gap:10px;
    border-right:none; border-bottom:1px solid var(--line); padding:10px 12px; overflow-x:auto;
  }
  .nav { flex-direction:row; margin-top:0; gap:4px; flex:1; overflow-x:auto; }
  .nav-item.disabled { display:none; }
  .brand-tag, .brand-sub { display:none; }
  .main { padding:16px 14px 40px; }
}

/* ---------- Panels / Grid ---------- */
.grid { display:grid; grid-template-columns:minmax(0,1fr); gap:16px; }
.col { display:flex; flex-direction:column; gap:16px; }
@media (min-width:960px) {
  .grid { grid-template-columns:minmax(0,1.05fr) minmax(0,1fr); align-items:start; }
}
.panel { background:var(--panel); border:1px solid var(--line); border-radius:16px; overflow:hidden; }
.panel-head { padding:13px 16px; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; gap:10px; }
.panel-body { padding:16px; }

/* ---------- Labels / Inputs ---------- */
.field-label { font-size:10.5px; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); font-weight:700; }
.field-label.strong { color:var(--text); }
.input {
  width:100%; background:var(--input); color:var(--text); border:1px solid var(--line);
  border-radius:9px; padding:9px 11px; font-size:14px; font-family:inherit; outline:none;
}
.input:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
textarea.input { resize:vertical; }
select.input { appearance:none; -webkit-appearance:none; cursor:pointer; }
.select-mini { width:auto; max-width:200px; padding:6px 10px; font-size:13px; }

.datasheet { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.f { display:flex; flex-direction:column; gap:6px; }
.f.wide { grid-column:1 / -1; }

/* ---------- Segmented control + Chips ---------- */
.seg { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; margin-top:9px; }
.seg-btn {
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px;
  padding:12px 6px; border-radius:11px; background:transparent; border:1.5px solid var(--line);
  color:var(--text); cursor:pointer; text-align:center;
}
.seg-btn.active { background:var(--panel2); border-color:var(--tint,var(--accent)); }
.seg-label { font-size:12.5px; font-weight:700; }
.seg-sub { font-size:10px; color:var(--muted); }
.chips { display:flex; flex-wrap:wrap; gap:7px; margin-top:9px; }
.chip {
  font-size:12.5px; font-weight:700; padding:7px 12px; border-radius:999px;
  background:transparent; color:var(--text); border:1.5px solid var(--line); cursor:pointer;
}
.chip.active { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }
.style-hint { font-size:11.5px; color:var(--muted); margin-top:8px; }

/* ---------- Buttons ---------- */
.btn-primary { background:var(--accent); color:var(--accent-ink); border:none; border-radius:11px; padding:11px 16px; font-weight:800; font-size:14px; cursor:pointer; }
.btn-primary.block { display:block; width:100%; margin-top:16px; padding:13px; font-size:14.5px; }
.btn-primary:disabled { opacity:.7; cursor:default; }
.btn-ghost { font-size:13px; font-weight:700; padding:10px 14px; border-radius:10px; border:1px solid var(--line); background:transparent; color:var(--text); cursor:pointer; text-decoration:none; display:inline-block; }
.btn-ghost.tiny { font-size:12px; padding:6px 10px; border-radius:8px; }
.btn-danger { color:#E5484D; border-color:rgba(229,72,77,.4); }
.mini-btn { font-size:11.5px; font-weight:700; color:var(--muted); background:transparent; border:1px solid var(--line); border-radius:8px; padding:5px 9px; cursor:pointer; }
.mini-btn.primary { color:var(--accent-ink); background:var(--accent); border-color:var(--accent); font-weight:800; padding:5px 11px; }

/* ---------- Preview ---------- */
.preview-head { background:var(--panel2); }
.preview-title { display:flex; align-items:center; gap:8px; font-size:12.5px; font-weight:700; }
.dot { width:9px; height:9px; border-radius:999px; background:var(--accent); display:inline-block; }
.preview-actions { display:flex; align-items:center; gap:6px; }
.output { white-space:pre-wrap; line-height:1.62; font-size:14.5px; color:var(--text); min-height:120px; }
.output.placeholder { color:var(--muted); font-size:13.5px; }
.output.mono { font-family:ui-monospace,"SF Mono",Menlo,monospace; }
.sk { height:12px; border-radius:6px; background:var(--panel2); margin-bottom:9px; }
.head-tools { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.pdf-status { margin-bottom:12px; font-size:12.5px; color:var(--muted); background:var(--panel2); border:1px solid var(--line); border-radius:9px; padding:9px 11px; }
.pdf-status.loading { color:var(--accent); }
.pdf-images { display:flex; flex-direction:column; gap:10px; margin-bottom:12px; }
.pdf-img-card { border:1px solid var(--line); border-radius:10px; overflow:hidden; background:var(--panel2); }
.pdf-img-card img { width:100%; display:block; }
.pdf-img-actions { display:flex; gap:8px; padding:8px; }

/* ---------- Fahrzeuge-Seite ---------- */
.list-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:18px; flex-wrap:wrap; }
.page-title { font-size:21px; font-weight:800; letter-spacing:-.01em; }
.list-tools { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.form-actions { display:flex; align-items:center; gap:10px; margin-top:16px; }
.form-msg { font-size:12.5px; color:var(--muted); }

.vehicle-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; }
.vcard { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:14px; display:flex; flex-direction:column; }
.vcard-top { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; }
.vcard h3 { margin:0 0 3px; font-size:15px; font-weight:800; }
.vmeta { font-size:12.5px; color:var(--muted); line-height:1.5; margin-bottom:10px; }
.vprice { font-weight:800; font-size:15px; }
.vprice small { font-weight:600; color:var(--muted); font-size:12px; }
.badge { font-size:10px; font-weight:800; padding:3px 8px; border-radius:999px; text-transform:uppercase; letter-spacing:.06em; white-space:nowrap; }
.badge.aktiv { background:rgba(54,194,107,.16); color:var(--ok); }
.badge.verkauft { background:rgba(255,122,26,.16); color:var(--accent); }
.badge.archiviert { background:var(--panel2); color:var(--muted); }
.vcard-actions { display:flex; gap:6px; flex-wrap:wrap; margin-top:13px; }
.empty { color:var(--muted); font-size:14px; padding:30px 4px; text-align:center; }

/* ---------- Login ---------- */
.login-body { display:flex; align-items:center; justify-content:center; min-height:100vh; }
.login-card { background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:26px; width:320px; max-width:90vw; }
.login-form { display:flex; flex-direction:column; margin-top:18px; }
.login-error { color:#E5484D; font-size:12.5px; margin-top:8px; }

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