/* ============================================================
   EINBAUAUFTRÄGE DASHBOARD – Stylesheet
   ============================================================ */

:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #dbeafe;
  --success:       #16a34a;
  --success-light: #dcfce7;
  --warning:       #d97706;
  --warning-light: #fef3c7;
  --danger:        #dc2626;
  --danger-light:  #fee2e2;
  --info:          #0891b2;
  --info-light:    #e0f2fe;

  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --border:        #e2e8f0;
  --border-2:      #cbd5e1;

  --text:          #0f172a;
  --text-2:        #475569;
  --text-3:        #94a3b8;

  --sidebar-w:     240px;
  --sidebar-bg:    #0f172a;
  --sidebar-text:  #cbd5e1;
  --sidebar-hover: #1e293b;
  --sidebar-active:#2563eb;

  --radius:        10px;
  --radius-lg:     16px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.08);
  --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.08);

  --transition:    0.2s ease;
}

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

html, body { height: 100%; font-family: 'Inter', system-ui, -apple-system, sans-serif;
             font-size: 14px; color: var(--text); background: var(--bg); }

/* ============================================================
   LAYOUT
   ============================================================ */
.layout { display: flex; height: 100vh; overflow: hidden; }

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

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  border-bottom: 1px solid #1e293b;
}

.sidebar-brand svg { color: var(--primary); flex-shrink: 0; }

.nav-menu { list-style: none; padding: 12px 0; flex: 1; }

.nav-section {
  padding: 16px 18px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 6px;
  margin: 1px 8px;
  font-size: 13.5px;
  transition: background var(--transition), color var(--transition);
}

.nav-item a svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item a:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active a { background: var(--primary); color: #fff; }

.sidebar-footer {
  border-top: 1px solid #1e293b;
  padding: 14px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}

.user-name { font-size: 12.5px; font-weight: 600; color: #e2e8f0; }
.user-role { font-size: 11px; color: var(--text-3); text-transform: capitalize; }

.btn-logout {
  margin-left: auto;
  padding: 6px;
  border-radius: 6px;
  color: var(--text-3);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}
.btn-logout svg { width: 16px; height: 16px; }
.btn-logout:hover { color: var(--danger); background: rgba(220,38,38,.1); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.sidebar-toggle {
  display: none;
  padding: 6px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text-2);
}
.sidebar-toggle svg { width: 20px; height: 20px; display: block; }

.page-title { font-size: 18px; font-weight: 700; color: var(--text); }

.topbar-meta { margin-left: auto; font-size: 12px; color: var(--text-3); }

.page-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

.kpi-card:hover { box-shadow: var(--shadow-md); }

.kpi-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }

.kpi-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }

.kpi-sub { font-size: 12px; color: var(--text-3); }

.kpi-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.kpi-icon svg { width: 18px; height: 18px; }

.kpi-icon.blue   { background: var(--primary-light); color: var(--primary); }
.kpi-icon.green  { background: var(--success-light); color: var(--success); }
.kpi-icon.orange { background: var(--warning-light); color: var(--warning); }
.kpi-icon.red    { background: var(--danger-light);  color: var(--danger); }
.kpi-icon.teal   { background: var(--info-light);    color: var(--info); }

/* ============================================================
   CHARTS GRID
   ============================================================ */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-title { font-size: 14px; font-weight: 700; color: var(--text); }

.chart-canvas-wrap { position: relative; }

/* ============================================================
   DATA TABLE
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

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

.card-title { font-size: 14px; font-weight: 700; }

.table-wrap { overflow-x: auto; }

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

th {
  background: var(--surface-2);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th a { color: inherit; text-decoration: none; }
th a:hover { color: var(--primary); }

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light);  color: var(--danger);  }
.badge-info    { background: var(--info-light);    color: var(--info);    }
.badge-neutral { background: var(--border);        color: var(--text-2);  }

/* ============================================================
   FORMS & FILTERS
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.form-control {
  padding: 7px 12px;
  border: 1px solid var(--border-2);
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition);
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.form-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; display: block; }

.form-group { margin-bottom: 16px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

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

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); }

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

.btn-outline {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-2);
}
.btn-outline:hover { background: var(--surface-2); }

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

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.page-link {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background var(--transition);
}

.page-link:hover, .page-link.active {
  background: var(--primary);
  color: #fff;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--text); margin-top: 10px; }
.login-logo p  { font-size: 13px; color: var(--text-2); margin-top: 4px; }

.alert {
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-danger  { background: var(--danger-light);  color: var(--danger); border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #86efac; }
.alert-info    { background: var(--info-light);    color: var(--info);    border: 1px solid #7dd3fc; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; }

.modal-close {
  width: 30px; height: 30px;
  border: none; background: none; cursor: pointer;
  border-radius: 6px; color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; transition: background var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body    { padding: 20px 24px; }
.modal-footer  { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ============================================================
   DETAIL GRID
   ============================================================ */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.detail-item { display: flex; flex-direction: column; gap: 3px; }
.detail-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.detail-value { font-size: 14px; color: var(--text); font-weight: 500; }

/* ============================================================
   SYNC PAGE
   ============================================================ */
.sync-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-bottom: 24px; }

.sync-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.sync-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.sync-card p  { font-size: 13px; color: var(--text-2); margin-bottom: 16px; line-height: 1.5; }

/* Progress */
.progress-wrap { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress-bar  { height: 100%; background: var(--primary); border-radius: 99px; transition: width 0.4s ease; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .charts-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 16px; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-green  { color: var(--success); }
.text-red    { color: var(--danger); }
.text-muted  { color: var(--text-3); }
.font-bold   { font-weight: 700; }
.mt-4  { margin-top: 16px; }
.mb-4  { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex  { display: flex; align-items: center; }
.flex-wrap { flex-wrap: wrap; }

/* Numbers */
.num { font-variant-numeric: tabular-nums; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }
