/* =========================================================================
   Werkstatt Core – Admin Panel
   Design-System im Next.js/Vercel-Stil (monochrom, hairline, viel Motion).
   Kein Build, keine externen Abhängigkeiten (Geist-Font optional via CDN).
   ========================================================================= */

:root {
  /* Interaktions-Akzent (Fokus, Links, aktive Zustände, Switch, Spinner) */
  --accent: #0070f3;
  --accent-2: #3291ff;
  --accent-soft: #e8f1ff;
  --accent-contrast: #ffffff;

  /* Signatur-Button (schwarz auf weiß) */
  --primary-bg: #171717;
  --primary-hover: #000000;
  --primary-fg: #ffffff;

  /* Flächen */
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --bg-elev-2: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-muted: #f4f4f5;
  --bg-hover: #f4f4f5;
  --bg-active: #f0f0f1;
  --bg-input: #ffffff;
  --logo-bg: #171717;
  --logo-fg: #ffffff;

  /* Text */
  --text: #171717;
  --text-muted: #666666;
  --text-faint: #8f8f8f;

  /* Linien */
  --border: #ebebeb;
  --border-strong: #e2e2e2;
  --ring: rgba(0, 112, 243, 0.32);

  /* Status */
  --green: #1a8245; --green-soft: #e6f6ec;
  --amber: #bb6a00; --amber-soft: #fdf2dc;
  --red: #e5484d; --red-soft: #fdeaea;
  --blue: #0070f3; --blue-soft: #e8f1ff;
  --violet: #7c3aed; --violet-soft: #f1eafe;
  --slate-soft: #f0f0f1;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 16px 60px rgba(0, 0, 0, 0.14);
  --shadow-pop: 0 8px 30px rgba(0, 0, 0, 0.10);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --sidebar-w: 252px;

  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="dark"] {
  --accent: #3291ff;
  --accent-2: #52a8ff;
  --accent-soft: #0e2748;
  --accent-contrast: #0a0a0a;

  --primary-bg: #ededed;
  --primary-hover: #ffffff;
  --primary-fg: #0a0a0a;

  --bg: #0a0a0a;
  --bg-elev: #0f0f0f;
  --bg-elev-2: #161616;
  --bg-sidebar: #0a0a0a;
  --bg-muted: #1a1a1a;
  --bg-hover: #1a1a1a;
  --bg-active: #1f1f1f;
  --bg-input: #121212;
  --logo-bg: #ededed;
  --logo-fg: #0a0a0a;

  --text: #ededed;
  --text-muted: #a1a1a1;
  --text-faint: #707070;

  --border: #2a2a2a;
  --border-strong: #383838;
  --ring: rgba(50, 145, 255, 0.4);

  --green: #3fcf73; --green-soft: #0e2a18;
  --amber: #f5a623; --amber-soft: #2c2008;
  --red: #ff5a5f; --red-soft: #2e1416;
  --blue: #3291ff; --blue-soft: #0e2748;
  --violet: #a571f5; --violet-soft: #1f1638;
  --slate-soft: #1f1f1f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.7);
  --shadow-pop: 0 10px 36px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.018em; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

/* =========================================================================
   ANIMATIONEN
   ========================================================================= */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes pop { from { transform: scale(0.95) translateY(6px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px) scale(0.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { transform: translateX(28px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ---- Boot / Spinner ---------------------------------------------------- */
.boot { display: grid; place-items: center; height: 100vh; gap: 16px; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2.5px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.65s linear infinite;
}
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }

/* =========================================================================
   AUTH
   ========================================================================= */
.auth-wrap {
  min-height: 100vh;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(60% 50% at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
  position: relative;
}
.auth-wrap::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 30%, #000, transparent 75%);
  mask-image: radial-gradient(70% 60% at 50% 30%, #000, transparent 75%);
  opacity: 0.5;
}
.auth-card {
  position: relative;
  width: 100%; max-width: 400px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 34px 32px;
  animation: cardIn 0.5s var(--ease);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-brand .logo { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 22px; background: var(--logo-bg); box-shadow: var(--shadow); }
.auth-brand .name { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.auth-brand .sub { font-size: 12px; color: var(--text-muted); }
.auth-card h1 { font-size: 24px; margin-bottom: 5px; letter-spacing: -0.03em; }
.auth-card .lead { color: var(--text-muted); margin-bottom: 24px; font-size: 13.5px; }
.auth-foot { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.auth-foot-hint { font-size: 12px; text-align: center; }

/* =========================================================================
   LAYOUT
   ========================================================================= */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--bg-sidebar);
  color: var(--text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 16px 14px;
  border-right: 1px solid var(--border);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.sidebar .brand .logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 18px; background: var(--logo-bg); flex: none; box-shadow: var(--shadow-sm); }
.sidebar .brand .name { font-weight: 600; font-size: 14px; line-height: 1.2; letter-spacing: -0.015em; }
.sidebar .brand .sub { font-size: 11px; color: var(--text-faint); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; margin: 4px -4px; padding: 0 4px; }
.nav::-webkit-scrollbar { width: 6px; }
.nav-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); padding: 16px 10px 6px; font-weight: 600; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text-muted); cursor: pointer; border: none; background: none;
  width: 100%; text-align: left; font-size: 13.5px; font-weight: 500;
  transition: background 0.14s ease, color 0.14s ease;
}
.nav-item::before {
  content: ""; position: absolute; left: 2px; top: 50%; transform: translateY(-50%) scaleY(0);
  width: 3px; height: 17px; border-radius: 3px; background: var(--accent);
  transition: transform 0.2s var(--ease);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-active); color: var(--text); font-weight: 600; }
.nav-item.active::before { transform: translateY(-50%) scaleY(1); }
.nav-item .ic { display: inline-flex; }
.nav-item .ico { width: 17px; height: 17px; flex: none; opacity: 0.9; }
.nav-item.active .ico { opacity: 1; }
.nav-item .badge { margin-left: auto; }

.side-foot { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 6px; border-radius: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12.5px; color: #fff; flex: none; }
.user-chip .meta { min-width: 0; flex: 1; }
.user-chip .nm { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .rl { font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px; height: 60px;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .burger { display: none; }
.topbar h1 { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.topbar .grow { flex: 1; }

.content { padding: 26px 28px 64px; }
.content > * { animation: viewIn 0.4s var(--ease); }

.view-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.view-head .titles h2 { font-size: 24px; letter-spacing: -0.03em; }
.view-head .titles p { color: var(--text-muted); margin: 4px 0 0; font-size: 13.5px; }
.view-head .actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* =========================================================================
   BUTTONS / INPUTS
   ========================================================================= */
.btn {
  --bg-btn: var(--bg-elev);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg-btn); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s var(--ease), box-shadow 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn .ico { width: 15px; height: 15px; }
.btn.primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-fg); font-weight: 500; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: var(--shadow-sm); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 36%, var(--border)); }
.btn.danger:hover { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 50%, var(--border)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 12px; gap: 5px; }
.btn.icon { padding: 8px; }
.btn.icon.sm { padding: 5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.block { width: 100%; padding: 10px 14px; }

.iconbtn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-muted); cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.08s var(--ease);
}
.iconbtn:hover { color: var(--text); background: var(--bg-hover); border-color: var(--border-strong); }
.iconbtn:active { transform: scale(0.94); }
.iconbtn .ico { width: 16px; height: 16px; }

.field { margin-bottom: 15px; }
.field > label:not(.switch) { display: block; font-size: 12.5px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.field .hint { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }
.input, .select, textarea.input {
  width: 100%; padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg-input); color: var(--text);
  font-size: 13.5px; font-family: inherit; transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.input:hover, .select:hover, textarea.input:hover { border-color: var(--text-faint); }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.input::placeholder { color: var(--text-faint); }
textarea.input { resize: vertical; min-height: 76px; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f8f8f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 600; margin: 12px 0 14px; grid-column: 1/-1; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13px; }
.switch input { display: none; }
.switch .track { width: 38px; height: 22px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background 0.18s var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.18s var(--ease); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elev); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 0 11px; height: 36px; min-width: 220px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.search .ico { color: var(--text-faint); width: 15px; height: 15px; flex: none; }
.search input { border: none; background: none; outline: none; color: var(--text); font-size: 13.5px; width: 100%; font-family: inherit; }
.search input::placeholder { color: var(--text-faint); }

.seg { display: inline-flex; background: var(--bg-muted); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg button { border: none; background: none; color: var(--text-muted); padding: 5px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }

/* =========================================================================
   CARDS / KPIS
   ========================================================================= */
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s var(--ease); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .ic .ico { width: 16px; height: 16px; color: var(--text-muted); }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 18px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 17px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 9px;
  position: relative; overflow: hidden;
  animation: cardIn 0.5s var(--ease) backwards;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s var(--ease);
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.kpi:nth-child(1) { animation-delay: 0.02s; }
.kpi:nth-child(2) { animation-delay: 0.07s; }
.kpi:nth-child(3) { animation-delay: 0.12s; }
.kpi:nth-child(4) { animation-delay: 0.17s; }
.kpi:nth-child(5) { animation-delay: 0.22s; }
.kpi:nth-child(6) { animation-delay: 0.27s; }
.kpi .kpi-ico { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; }
.kpi .kpi-ico svg { width: 19px; height: 19px; }
.kpi .lbl { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.kpi .val { font-size: 28px; font-weight: 650; letter-spacing: -0.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 11.5px; color: var(--text-faint); }
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.dash-grid > * { animation: fadeInUp 0.5s var(--ease) backwards; }
.dash-grid > *:nth-child(2) { animation-delay: 0.08s; }

/* =========================================================================
   TABLES
   ========================================================================= */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-elev); box-shadow: var(--shadow-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); font-weight: 600; padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--bg-elev); position: sticky; top: 0; z-index: 1; }
table.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr { cursor: pointer; transition: background 0.12s ease; animation: rowIn 0.35s var(--ease) backwards; }
table.tbl tbody tr:nth-child(1) { animation-delay: 0.01s; }
table.tbl tbody tr:nth-child(2) { animation-delay: 0.03s; }
table.tbl tbody tr:nth-child(3) { animation-delay: 0.05s; }
table.tbl tbody tr:nth-child(4) { animation-delay: 0.07s; }
table.tbl tbody tr:nth-child(5) { animation-delay: 0.09s; }
table.tbl tbody tr:nth-child(6) { animation-delay: 0.11s; }
table.tbl tbody tr:nth-child(7) { animation-delay: 0.13s; }
table.tbl tbody tr:nth-child(8) { animation-delay: 0.15s; }
table.tbl tbody tr:nth-child(n+9) { animation-delay: 0.17s; }
table.tbl tbody tr:hover { background: var(--bg-hover); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .muted { color: var(--text-muted); }
table.tbl .mono { font-family: var(--mono); font-size: 12px; color: var(--text-muted); letter-spacing: -0.02em; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transform: translateX(4px); transition: opacity 0.14s ease, transform 0.14s ease; }
table.tbl tr:hover .row-actions { opacity: 1; transform: translateX(0); }
.cell-strong { font-weight: 600; }
.cell-2 { display: flex; flex-direction: column; gap: 1px; }
.cell-2 .s { font-size: 11.5px; color: var(--text-faint); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 3px 9px; border-radius: 99px; line-height: 1.45; white-space: nowrap; }
.badge .ico { width: 12px; height: 12px; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-green { background: var(--green-soft); color: var(--green); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-violet { background: var(--violet-soft); color: var(--violet); }
.b-slate { background: var(--slate-soft); color: var(--text-muted); }

.avatar-sm { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff; flex: none; }
.cell-user { display: flex; align-items: center; gap: 10px; }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 13px 4px 0; color: var(--text-faint); font-size: 12.5px; }
.pagination .pg { display: flex; gap: 6px; }

/* Empty / loading states */
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); animation: fadeInUp 0.4s var(--ease); }
.empty .ico { width: 44px; height: 44px; margin: 0 auto 14px; color: var(--text-faint); opacity: 0.6; }
.empty h3 { font-size: 15px; margin-bottom: 6px; color: var(--text); }
.empty p { font-size: 13px; margin: 0 0 18px; }
.center-load { display: grid; place-items: center; padding: 70px; }
.skeleton { background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-elev-2) 50%, var(--bg-muted) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }

/* =========================================================================
   DRAWER / MODAL
   ========================================================================= */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 90; opacity: 0; animation: fade 0.2s ease forwards; }
:root[data-theme="dark"] .scrim { background: rgba(0, 0, 0, 0.62); }

.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 96vw); background: var(--bg-elev); z-index: 100; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; border-left: 1px solid var(--border); transform: translateX(100%); animation: slideIn 0.32s var(--ease) forwards; }
.drawer.wide { width: min(840px, 98vw); }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; pointer-events: none; }
.modal .box { pointer-events: auto; width: min(450px, 96vw); background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: pop 0.2s var(--ease) forwards; overflow: hidden; }

.ov-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.ov-head .t { min-width: 0; }
.ov-head h2 { font-size: 18px; letter-spacing: -0.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-head .s { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; font-family: var(--mono); letter-spacing: -0.02em; }
.ov-head .x { margin-left: auto; }
.ov-body { padding: 22px; overflow-y: auto; flex: 1; }
.ov-foot { display: flex; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); background: var(--bg-elev); }
.ov-foot .grow { flex: 1; }

/* Detail view */
.detail-section { margin-bottom: 24px; }
.detail-section h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 11px; font-weight: 600; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }
.kv dd.empty-val { color: var(--text-faint); }

.mini-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-tbl th { text-align: left; color: var(--text-faint); font-weight: 600; padding: 7px 8px; border-bottom: 1px solid var(--border); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.mini-tbl td { padding: 8px; border-bottom: 1px solid var(--border); }
.mini-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }

.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 4px; bottom: 4px; width: 1.5px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item::before { content: ""; position: absolute; left: -18px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--bg-elev); }
.tl-item .when { font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); }
.tl-item .what { font-size: 13px; font-weight: 600; margin-top: 1px; }
.tl-item .chg { font-size: 12px; color: var(--text-muted); }

/* Totals box */
.totals { margin-top: 8px; }
.totals .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.totals .row.grand { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 11px; font-size: 17px; font-weight: 650; letter-spacing: -0.02em; }
.totals .row .muted { color: var(--text-muted); }

/* Permission matrix */
.perm-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm-tbl th, .perm-tbl td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
.perm-tbl th { text-align: center; font-size: 11px; text-transform: uppercase; color: var(--text-faint); font-weight: 600; }
.perm-tbl td:first-child, .perm-tbl th:first-child { text-align: left; }
.perm-tbl td.ctr { text-align: center; }
.checkbox { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

/* line item editor */
.li-row { display: grid; grid-template-columns: 90px 1.6fr 70px 90px 64px 70px 34px; gap: 8px; align-items: center; margin-bottom: 8px; }
.li-row .input { padding: 7px 9px; font-size: 12.5px; }
.li-head { font-size: 10.5px; text-transform: uppercase; color: var(--text-faint); font-weight: 600; letter-spacing: 0.03em; }

/* =========================================================================
   TOASTS
   ========================================================================= */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast { display: flex; align-items: flex-start; gap: 11px; background: var(--bg-elev); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 12px 15px; box-shadow: var(--shadow-pop); animation: toastIn 0.28s var(--ease); }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--blue); }
.toast .ico { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.toast.success .ico { color: var(--green); }
.toast.error .ico { color: var(--red); }
.toast.info .ico { color: var(--blue); }
.toast .msg { font-size: 13px; font-weight: 500; }
.toast .msg .sub { font-size: 12px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }

/* Misc */
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.inline-err { background: var(--red-soft); color: var(--red); border-radius: var(--radius-sm); padding: 10px 13px; font-size: 12.5px; font-weight: 500; margin-bottom: 15px; animation: fadeInUp 0.25s var(--ease); }
.banner { display: flex; align-items: center; gap: 10px; background: var(--amber-soft); color: var(--amber); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.banner .ico { width: 16px; height: 16px; flex: none; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 120; transform: translateX(-100%); transition: transform 0.28s var(--ease); width: 264px; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .topbar .burger { display: inline-grid; }
  .content { padding: 18px 16px 48px; }
  .topbar { padding: 0 16px; }
  .view-head .titles h2 { font-size: 21px; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 120px 1fr; }
  .li-row { grid-template-columns: 1fr 1fr; }
}
.sb-scrim { display: none; }
@media (max-width: 860px) {
  .sb-scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(2px); z-index: 110; animation: fade 0.2s ease forwards; opacity: 0; }
}

/* Bewegung reduzieren */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; transition-duration: 0.001ms !important; }
}

/* =========================================================================
   LABOR · FIN/VIN-Decoder
   ========================================================================= */
.nav-item .exp-badge { font-size: 9px; padding: 1px 6px; letter-spacing: 0.03em; text-transform: uppercase; }

.exp-note { display: flex; gap: 11px; align-items: flex-start; background: var(--violet-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--violet) 22%, var(--border)); border-radius: var(--radius); padding: 12px 15px; font-size: 13px; margin-bottom: 18px; line-height: 1.5; }
.exp-note .ic .ico { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--violet); }
.exp-note strong { font-weight: 600; }

.vin-inputrow { display: flex; align-items: center; gap: 11px; }
.vin-inputrow > .ic .ico { width: 18px; height: 18px; color: var(--text-muted); flex: none; }
.vin-input { font-family: var(--mono); font-size: 17px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 500; }
.vin-input::placeholder { letter-spacing: 0.04em; font-weight: 400; }
.vin-counter { font-size: 12px; color: var(--text-faint); flex: none; font-variant-numeric: tabular-nums; }
.vin-counter.ok { color: var(--green); }

.vin-samples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.vin-samples .btn .mono { font-size: 11px; opacity: 0.65; }

.vin-result { margin-top: 20px; }
.vin-status { display: flex; flex-wrap: wrap; gap: 8px; }
.vin-warn { display: flex; gap: 9px; align-items: flex-start; background: var(--amber-soft); color: var(--amber); border-radius: var(--radius-sm); padding: 10px 13px; font-size: 12.5px; margin-top: 10px; line-height: 1.5; }
.vin-warn .ic .ico { width: 15px; height: 15px; flex: none; margin-top: 1px; }

.vin-cells { display: grid; grid-template-columns: repeat(17, 1fr); gap: 5px; margin: 18px 0 12px; }
.vin-cell { position: relative; border: 1px solid var(--border); border-radius: 8px; padding: 18px 0 6px; text-align: center; background: var(--bg-elev); transition: transform 0.15s var(--ease); }
.vin-cell:hover { transform: translateY(-2px); }
.vin-cell .pos { position: absolute; top: 3px; left: 0; right: 0; font-size: 9px; color: var(--text-faint); font-family: var(--mono); }
.vin-cell .ch { display: block; font-family: var(--mono); font-size: 18px; font-weight: 600; line-height: 1; }
.vin-cell .mk { display: block; font-size: 8.5px; margin-top: 3px; color: var(--text-muted); font-weight: 500; }
.vin-cell.empty .ch { color: var(--text-faint); font-weight: 400; }
.vin-cell.wmi { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 28%, var(--border)); }
.vin-cell.vds { background: var(--violet-soft); border-color: color-mix(in srgb, var(--violet) 26%, var(--border)); }
.vin-cell.vis { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 26%, var(--border)); }
.vin-cell.key { box-shadow: inset 0 0 0 1.5px var(--border-strong); }

.vin-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.vin-legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.vin-legend .sw.wmi { background: var(--blue); }
.vin-legend .sw.vds { background: var(--violet); }
.vin-legend .sw.vis { background: var(--green); }

.vin-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; align-items: start; }
.vin-online { margin-top: 6px; }

/* Rückrufe (NHTSA) */
.vin-recall { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; margin-top: 10px; background: var(--bg-elev); }
.vin-recall .rc-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.vin-recall p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; }

/* HSN/TSN-Eingabe */
.hsn-inputrow { display: flex; gap: 16px; flex-wrap: wrap; }
.hsn-field { display: flex; flex-direction: column; gap: 6px; }
.hsn-field.grow { flex: 1; min-width: 160px; }
.hsn-field > label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.hsn-num { max-width: 150px; text-align: center; letter-spacing: 0.32em; }
.tags .badge.mono { font-family: var(--mono); letter-spacing: 0.02em; }

@media (max-width: 860px) {
  .vin-cells { grid-template-columns: repeat(9, 1fr); }
  .vin-cards { grid-template-columns: 1fr; }
  .vin-cell .ch { font-size: 15px; }
  .vin-input { font-size: 15px; letter-spacing: 0.08em; }
  .hsn-field, .hsn-field.grow { width: 100%; }
  .hsn-num { max-width: 100%; }
}
