/* ============================================================
   automaix – Stylesheet
   ============================================================ */

:root {
  /* Automaix Markenfarben */
  --anthrazit:        #16181D;
  --weiss:            #FFFFFF;
  --nebelgrau:        #F4F5F7;
  --gruen:            #00C28B;
  --gruen-dunkel:     #00946B;

  --text:             #16181D;
  --text-muted:       #5A5F6B;
  --text-light:       #9499A3;
  --border:           rgba(22,24,29,0.10);

  /* Aliase */
  --primary:          var(--gruen);
  --primary-dark:     var(--gruen-dunkel);
  --primary-light:    #E6F9F2;
  --success:          var(--gruen);
  --success-light:    #E6F9F2;
  --warning:          #F59E0B;
  --warning-light:    #FEF3C7;
  --danger:           #EF4444;
  --danger-light:     #FEE2E2;
  --info:             #3B82F6;
  --info-light:       #DBEAFE;
  --bg:               var(--weiss);
  --surface:          var(--weiss);
  --border-focus:     var(--gruen);

  /* Sidebar */
  --sidebar-bg:       #16181D;
  --sidebar-hover:    #20242C;
  --sidebar-active:   rgba(0,194,139,0.12);
  --sidebar-text:     #9499A3;
  --sidebar-text-active: #FFFFFF;
  --sidebar-w:        256px;

  --topbar-h:         60px;

  /* Formensprache */
  --radius:           10px;
  --radius-sm:        8px;
  --radius-lg:        12px;
  --shadow-sm:        0 1px 2px rgba(22,24,29,.05);
  --shadow:           0 4px 16px rgba(22,24,29,.06);
  --shadow-lg:        0 20px 50px rgba(22,24,29,.12);

  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--nebelgrau);
  color: var(--text);
  line-height: 1.6;
  font-weight: 400;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
svg { display: block; }
.hidden { display: none !important; }

h1, h2, h3, .page-title, .modal-title {
  font-family: var(--font-display);
  font-weight: 500;
}

/* ============================================================
   LAYOUT
   ============================================================ */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.22s ease;
  z-index: 100;
}

.sidebar.collapsed { width: 0; }

/* Logo */
.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

.logo-word {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.03em;
  color: #fff;
  white-space: nowrap;
}

.logo-dot { color: var(--gruen); }

/* Nav */
.sidebar-nav { padding: 10px 10px; flex: 1; }

.nav-section-label {
  color: var(--sidebar-text);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 18px 8px 5px;
  white-space: nowrap;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 400;
  transition: background 0.12s, color 0.12s;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 1px;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,.85);
}

.nav-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 500;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--gruen);
  border-radius: 0 3px 3px 0;
}

.nav-link.active .nav-icon { color: var(--gruen); opacity: 1; }

.nav-icon {
  width: 17px; height: 17px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-link:hover .nav-icon { opacity: 0.9; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
  display: none;
}

.nav-badge:not(:empty) { display: block; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px 0 20px;
  flex-shrink: 0;
  gap: 16px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.page-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}

.topbar-company {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 400;
}

.btn-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
}

.btn-icon:hover { background: var(--nebelgrau); color: var(--text); }
.btn-icon svg { width: 17px; height: 17px; }
.sidebar-toggle { border: none; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.12s;
  white-space: nowrap;
  font-family: var(--font);
}

.btn svg { width: 14px; height: 14px; }

.btn-primary { background: var(--gruen); color: #fff; }
.btn-primary:hover { background: var(--gruen-dunkel); }

.btn-success { background: var(--gruen); color: #fff; }
.btn-success:hover { background: var(--gruen-dunkel); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.9); }

.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--nebelgrau); }

.btn-ghost { background: transparent; border: none; color: var(--text-muted); padding: 6px 10px; }
.btn-ghost:hover { color: var(--text); background: var(--nebelgrau); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-sm svg { width: 12px; height: 12px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.card-header h2 { font-size: 14px; font-weight: 500; }
.card-body { padding: 18px 22px; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
}

.page-header h2 { font-size: 19px; font-weight: 500; letter-spacing: -0.01em; }

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

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px 20px 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.stat-value { font-family: var(--font-display); font-size: 26px; font-weight: 500; line-height: 1.1; color: var(--text); }
.stat-sub   { font-size: 11.5px; color: var(--text-light); }

.stat-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 2px;
}

.stat-icon svg { width: 18px; height: 18px; }
.stat-icon.green  { background: var(--primary-light); color: var(--gruen); }
.stat-icon.blue   { background: #EFF6FF; color: #3B82F6; }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red    { background: var(--danger-light);  color: var(--danger); }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--nebelgrau);
  color: var(--text-light);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 9px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFAFA; }

.table-actions { display: flex; gap: 5px; align-items: center; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 56px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state svg { width: 40px; height: 40px; opacity: 0.22; }
.empty-state strong { font-size: 14px; font-weight: 500; }
.empty-state p { font-size: 12.5px; }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-draft     { background: var(--nebelgrau); color: #9499A3; }
.badge-sent      { background: var(--info-light); color: #2563EB; }
.badge-accepted  { background: var(--primary-light); color: var(--gruen-dunkel); }
.badge-rejected  { background: var(--danger-light); color: var(--danger); }
.badge-paid      { background: var(--primary-light); color: var(--gruen-dunkel); }
.badge-overdue   { background: var(--danger-light); color: var(--danger); }
.badge-open      { background: var(--warning-light); color: #B45309; }
.badge-confirmed { background: var(--primary-light); color: var(--gruen-dunkel); }
.badge-done      { background: var(--primary-light); color: var(--gruen-dunkel); }
.badge-cancelled { background: var(--nebelgrau); color: var(--text-light); text-decoration: line-through; }
.badge-storno    { background: var(--danger-light); color: var(--danger); }
.badge-dunning1  { background: var(--warning-light); color: #92400E; }
.badge-dunning2  { background: #FEF2F2; color: #991B1B; }
.badge-reminder  { background: var(--warning-light); color: #B45309; }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.12s, box-shadow 0.12s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gruen);
  box-shadow: 0 0 0 3px rgba(0,194,139,.12);
}

input.field-invalid { border-color: var(--danger); }
input.field-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.1); }
.field-error { font-size: 11.5px; color: var(--danger); margin-top: 2px; }

input:disabled, select:disabled { opacity: 0.5; cursor: not-allowed; }

textarea { resize: vertical; min-height: 72px; }

.form-divider {
  grid-column: 1 / -1;
  border: none;
  border-top: 1px solid var(--border);
  margin: 2px 0;
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 4px;
  cursor: pointer;
}

.toggle-wrap {
  position: relative;
  width: 40px; height: 22px;
  flex-shrink: 0;
}

.toggle-wrap input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: #D1D5DB;
  border-radius: 11px;
  transition: background 0.18s;
  cursor: pointer;
}

.toggle-track::after {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}

.toggle-wrap input:checked + .toggle-track { background: var(--gruen); }
.toggle-wrap input:checked + .toggle-track::after { transform: translateX(18px); }

.toggle-label { font-size: 13.5px; color: var(--text); font-weight: 400; }
.toggle-sublabel { font-size: 11.5px; color: var(--text-muted); }

/* Tabs (customer modal) */
.modal-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  padding-bottom: 0;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.12s;
  margin-bottom: -1px;
}

.tab-btn.active {
  color: var(--gruen-dunkel);
  border-bottom-color: var(--gruen);
  font-weight: 500;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Contacts sub-list */
.contact-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.contact-item {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--nebelgrau);
  font-size: 13px;
}

/* Activity log */
.activity-log { display: flex; flex-direction: column; gap: 0; }
.activity-log-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.activity-log-item:last-child { border-bottom: none; }
.activity-log-date { color: var(--text-light); font-size: 11.5px; white-space: nowrap; }
.activity-log-text { flex: 1; color: var(--text); line-height: 1.5; }

/* ============================================================
   LINE ITEMS TABLE
   ============================================================ */
.line-items {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 6px;
}

.line-items th {
  background: var(--nebelgrau);
  padding: 7px 9px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}

.line-items td {
  padding: 5px 5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.line-items td input, .line-items td select {
  padding: 5px 8px;
  font-size: 13px;
}

.line-items .col-pos   { width: 36px; text-align: center; color: var(--text-light); }
.line-items .col-desc  { min-width: 160px; }
.line-items .col-qty   { width: 72px; }
.line-items .col-unit  { width: 72px; }
.line-items .col-price { width: 105px; }
.line-items .col-total { width: 105px; font-weight: 500; }
.line-items .col-del   { width: 36px; text-align: center; }

.line-total-section {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.totals-table {
  width: 272px;
  font-size: 13px;
}

.totals-table td { padding: 3px 8px; }
.totals-table .total-row td {
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font-display);
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.totals-table td:last-child { text-align: right; }

.ku-hint {
  font-size: 12px;
  color: var(--gruen-dunkel);
  background: var(--primary-light);
  border: 1px solid rgba(0,194,139,.2);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-top: 6px;
  grid-column: 1 / -1;
}

/* ============================================================
   SEARCH & FILTER BAR
   ============================================================ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 300px;
}

.search-input-wrapper svg {
  position: absolute;
  left: 9px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-light);
}

.search-input-wrapper input { padding-left: 32px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22,24,29,.4);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  padding: 36px 16px;
  overflow-y: auto;
  backdrop-filter: blur(3px);
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 740px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 72px);
}

.modal.modal-lg { max-width: 940px; }
.modal.modal-sm { max-width: 460px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title { font-size: 15px; font-weight: 500; }

.modal-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background 0.12s;
}

.modal-close:hover { background: var(--nebelgrau); color: var(--text); }
.modal-close svg { width: 15px; height: 15px; }

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

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ============================================================
   TOASTS
   ============================================================ */
#toasts {
  position: fixed;
  bottom: 22px; right: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  border-radius: var(--radius);
  background: var(--anthrazit);
  border: none;
  box-shadow: 0 4px 20px rgba(22,24,29,.2);
  font-size: 13px;
  color: #fff;
  min-width: 240px;
  max-width: 360px;
  pointer-events: all;
  animation: slideUp 0.22s ease;
}

.toast.removing { animation: slideDown 0.18s ease forwards; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(10px); }
}

.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--gruen); }
.toast-error   .toast-icon { color: #F87171; }
.toast-info    .toast-icon { color: #93C5FD; }
.toast-warning .toast-icon { color: #FCD34D; }

/* ============================================================
   ACCOUNTING / EÜR
   ============================================================ */
.eur-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.eur-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 18px 14px;
}

.eur-card-label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.eur-card-value { font-family: var(--font-display); font-size: 22px; font-weight: 500; margin-top: 4px; }
.eur-card-value.green { color: var(--gruen-dunkel); }
.eur-card-value.red   { color: var(--danger); }
.eur-card-value.blue  { color: var(--info); }

/* §19 Threshold Widget */
.threshold-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 22px;
}

.threshold-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 500;
}

.threshold-bar-wrap {
  background: var(--nebelgrau);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}

.threshold-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.threshold-bar-fill.safe   { background: var(--gruen); }
.threshold-bar-fill.warn   { background: var(--warning); }
.threshold-bar-fill.danger { background: var(--danger); }

.threshold-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
}

.threshold-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
}

.threshold-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
}

.threshold-dot.safe   { background: var(--gruen); }
.threshold-dot.warn   { background: var(--warning); }
.threshold-dot.danger { background: var(--danger); }

/* Expense section */
.expense-row td:first-child { border-left: 3px solid var(--danger); }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .sidebar, .topbar, .modal-overlay, #toasts { display: none !important; }
  .main-wrapper { margin: 0; }
  .content { padding: 0; overflow: visible; }
  body { background: white; }
}

/* ============================================================
   MISC
   ============================================================ */
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.font-mono  { font-family: 'Courier New', monospace; font-size: 12px; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

.doc-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--gruen-dunkel);
  background: var(--primary-light);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
}

.customer-select-info {
  background: var(--primary-light);
  border: 1px solid rgba(0,194,139,.18);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--gruen-dunkel);
  margin-top: 3px;
}

.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.activity-meta { margin-left: auto; color: var(--text-light); font-size: 11.5px; white-space: nowrap; }

.confirm-body {
  text-align: center;
  padding: 10px 0 4px;
}
.confirm-body svg { width: 44px; height: 44px; color: var(--danger); margin: 0 auto 14px; }
.confirm-body p { color: var(--text-muted); font-size: 13.5px; margin-top: 6px; }

.settings-section { margin-bottom: 28px; }
.settings-section h3 {
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-display);
  margin-bottom: 14px;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.info-box {
  background: var(--nebelgrau);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.info-box.warning {
  background: var(--warning-light);
  border-color: rgba(245,158,11,.2);
  color: #92400E;
}

.info-box.green {
  background: var(--primary-light);
  border-color: rgba(0,194,139,.2);
  color: var(--gruen-dunkel);
}

/* Picker overlay row hover */
.picker-row { cursor: pointer; transition: background .1s; }
.picker-row:hover { background: var(--primary-light); }
.picker-row:hover td { color: var(--gruen-dunkel); }

/* Freitext row in line items */
.li-text-row td { padding-top: 4px !important; padding-bottom: 4px !important; }
.li-text-display {
  font-size: 12.5px;
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0 !important;
  white-space: pre-wrap;
}

/* Receipt upload */
.receipt-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--nebelgrau);
  transition: border-color .15s, color .15s, background .15s;
  margin-top: 6px;
}
.receipt-upload-label:hover,
.receipt-upload-label.has-file {
  border-color: var(--gruen);
  color: var(--gruen-dunkel);
  background: var(--primary-light);
}
.receipt-storage-hint {
  font-size: 11.5px;
  color: var(--text-light);
  margin-top: 5px;
}
.receipt-existing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--primary-light);
  border: 1px solid rgba(0,194,139,.2);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--gruen-dunkel);
}
.receipt-existing-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Receipt badge in table cell */
.receipt-badge {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 5px;
  color: var(--gruen);
  opacity: .8;
}
.receipt-badge svg { width: 12px; height: 12px; }

/* File Sync Permission Banner */
#fs-perm-banner { position:sticky; top:0; z-index:200; }
.fs-perm-bar {
  display:flex; align-items:center; gap:10px; padding:9px 20px;
  background:var(--warning-light); border-bottom:1px solid var(--warning);
  font-size:13px; color:var(--anthrazit);
}
.fs-perm-bar span { flex:1; }

/* Dashboard Charts */
.dash-charts-row { display:flex; gap:14px; margin-bottom:20px; align-items:stretch; }
.dash-chart-main { flex:1; min-width:0; }
.dash-chart-side { width:288px; flex-shrink:0; }
.stat-value-md { font-family:var(--font-display); font-size:20px; font-weight:500; line-height:1.15; color:var(--text); }
@media (max-width:900px){
  .dash-charts-row { flex-direction:column; }
  .dash-chart-side { width:100%; }
}

/* ============================================================
   AUTH SCREEN  (Login / Erstkonfiguration)
   ============================================================ */
.auth-screen-wrap {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--nebelgrau);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 44px 48px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--anthrazit);
  margin-bottom: 24px;
}
.auth-dot { color: var(--gruen); }

.auth-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  color: var(--anthrazit);
  margin-bottom: 4px;
}
.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.auth-hint { font-size: 11px; color: var(--text-light); font-weight: 400; }

.auth-submit-btn {
  width: 100%;
  margin-top: 18px;
  padding: 10px 16px;
  font-size: 14px;
}
.auth-error {
  background: var(--danger-light);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.5;
}

/* ============================================================
   TOPBAR USER DISPLAY
   ============================================================ */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
}
.topbar-user-info {
  display: flex;
  flex-direction: column;
  text-align: right;
  line-height: 1.25;
}
.topbar-user-name { font-size: 13px; font-weight: 500; color: var(--text); }
.topbar-user-role { font-size: 11px; color: var(--text-light); }
.topbar-logout-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}
.topbar-logout-btn:hover { color: var(--danger); border-color: var(--danger); }
