*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #f5f5f3;
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
  padding: 0;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 210px;
  background: #fff;
  border-right: 1px solid #e8e8e6;
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
}

.sidebar-logo {
  font-size: 16px;
  font-weight: 700;
  color: #111;
  letter-spacing: -0.3px;
  padding: 4px 10px 20px;
  border-bottom: 1px solid #f0f0ee;
  margin-bottom: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #666;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.nav-link:hover { background: #f5f5f3; color: #111; }
.nav-link.active { background: #f0f0ff; color: #111; font-weight: 600; }

/* ── Main content (offset for sidebar) ── */
.page-content {
  margin-left: 210px;
  padding: 32px;
  min-height: 100vh;
}

/* ── Cards ── */
.card {
  background: #fff;
  border: 1px solid #e8e8e6;
  border-radius: 14px;
  padding: 20px 22px;
}

/* ── KPI ── */
.kpi-label {
  font-size: 13px;
  color: #888;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 600;
  color: #111;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 8px;
}

.kpi-value .unit {
  font-size: 17px;
  font-weight: 400;
  color: #888;
}

.kpi-sub {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trend-good { color: #16a34a; }
.trend-bad  { color: #dc2626; }

/* ── Toggle ── */
.toggle-group {
  display: flex;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  overflow: hidden;
}

.toggle-btn {
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 16px;
  cursor: pointer;
  color: #888;
  transition: background 0.15s, color 0.15s;
}

.toggle-btn.active { background: #111; color: #fff; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge--green  { background: #dcfce7; color: #15803d; }
.badge--red    { background: #fee2e2; color: #b91c1c; }
.badge--gray   { background: #f3f4f6; color: #6b7280; }
.badge--amber  { background: #fef3c7; color: #b45309; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid #e5e5e5;
  background: #fff;
  color: #333;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn:hover { background: #f5f5f3; border-color: #d0d0ce; }

.btn--primary { background: #111; color: #fff; border-color: #111; }
.btn--primary:hover { background: #333; border-color: #333; }

.btn--danger { background: #fff; color: #dc2626; border-color: #fecaca; }
.btn--danger:hover { background: #fee2e2; }

.btn--sm { padding: 5px 12px; font-size: 12px; border-radius: 7px; }

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title { font-size: 22px; font-weight: 600; color: #111; letter-spacing: -0.3px; }
.page-date, .page-sub { font-size: 13px; color: #888; margin-top: 2px; }

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #aaa;
  margin-bottom: 20px;
}

.breadcrumb a { color: #888; text-decoration: none; }
.breadcrumb a:hover { color: #111; }

/* ── Form elements ── */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="url"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #e5e5e5;
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  color: #111;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}

input:focus, select:focus, textarea:focus { border-color: #111; }
input::placeholder { color: #bbb; }

select { 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='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #666;
  margin-bottom: 5px;
}

.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* ── Checkbox toggle ── */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #111;
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-row span { font-size: 14px; color: #333; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 660px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f0f0ee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title { font-size: 16px; font-weight: 600; color: #111; }

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #aaa;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  line-height: 1;
}

.modal-close:hover { background: #f5f5f3; color: #333; }

.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f0f0ee;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #bbb;
  text-transform: uppercase;
  margin: 20px 0 10px;
}

.section-label:first-child { margin-top: 0; }

/* ── Dynamic list items (products / invoices in modal) ── */
.dyn-item {
  background: #fafaf9;
  border: 1px solid #eeeeec;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
}

.dyn-item-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.dyn-item-row .form-group { margin-bottom: 0; flex: 1; }

.dyn-remove {
  background: none;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: 7px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s;
}

.dyn-remove:hover { background: #fee2e2; }

.add-item-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: #aaa;
  background: none;
  border: 1px dashed #ddd;
  border-radius: 9px;
  padding: 9px 14px;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}

.add-item-btn:hover { border-color: #111; color: #111; }

/* ── Customer list (kunden.html) ── */
.customer-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #e8e8e6;
  border-radius: 12px;
  margin-bottom: 8px;
  transition: border-color 0.15s;
}

.customer-row:hover { border-color: #ccc; }

.customer-name { font-size: 15px; font-weight: 600; color: #111; flex: 1; min-width: 0; }
.customer-meta { font-size: 12px; color: #aaa; margin-top: 2px; }

.customer-stat { text-align: right; min-width: 90px; }
.customer-stat-label { font-size: 11px; color: #aaa; }
.customer-stat-value { font-size: 14px; font-weight: 600; color: #111; }

.customer-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Customer detail (kunde.html) ── */
.detail-hero {
  background: #fff;
  border: 1px solid #e8e8e6;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-name { font-size: 24px; font-weight: 600; color: #111; letter-spacing: -0.4px; }
.detail-since { font-size: 13px; color: #888; margin-top: 4px; }

.detail-stats {
  display: flex;
  gap: 28px;
  margin-top: 16px;
}

.detail-stat-label { font-size: 11px; color: #aaa; margin-bottom: 3px; }
.detail-stat-value { font-size: 18px; font-weight: 600; color: #111; }

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: #111;
  margin-bottom: 12px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.product-card {
  background: #fff;
  border: 1px solid #e8e8e6;
  border-radius: 12px;
  padding: 16px 18px;
}

.product-card-name { font-size: 14px; font-weight: 600; color: #111; margin-bottom: 8px; }

.invoice-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid #e8e8e6;
  border-radius: 10px;
  margin-bottom: 6px;
}

.invoice-title { font-size: 14px; font-weight: 500; color: #111; flex: 1; min-width: 0; }
.invoice-date  { font-size: 13px; color: #888; white-space: nowrap; }
.invoice-amount { font-size: 14px; font-weight: 600; color: #111; white-space: nowrap; min-width: 80px; text-align: right; }

/* ── Demo badge ── */
.demo-badge {
  font-size: 12px;
  color: #888;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 5px 12px;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #aaa;
  font-size: 14px;
}

.empty-state-icon { font-size: 32px; margin-bottom: 12px; }

/* ── Search ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 9px 14px;
  margin-bottom: 16px;
}

.search-bar input {
  border: none;
  padding: 0;
  font-size: 14px;
  outline: none;
  flex: 1;
  background: transparent;
}

.search-bar svg { color: #bbb; flex-shrink: 0; }
