:root {
  --primary: #1e3a8a;
  --primary-hover: #172554;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #cbd5e1;
  --border-light: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  padding: 18px 24px;
  font-size: 13px;
  line-height: 1.5;
}

/* HEADER & NAVIGATION */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  padding: 14px 22px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 14px;
}

.header-brand h1 {
  font-size: 1.25rem;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.nav-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-tab {
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 8px 15px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  color: #334155;
  font-size: 0.83rem;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  background: #e2e8f0;
  color: var(--text);
}

.nav-tab.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(30, 58, 138, 0.25);
}

.nav-tab-admin {
  color: #92400e;
  background: #fef3c7;
  border-color: #fde68a;
}

.nav-tab-admin.active {
  background: #b45309;
  color: #ffffff;
  border-color: #b45309;
}

/* SUB-NAVIGATION */
.subnav {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  background: #e2e8f0;
  padding: 5px;
  border-radius: 10px;
}

.subtab {
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: 7px;
  font-weight: 600;
  cursor: pointer;
  color: #475569;
  font-size: 0.82rem;
  transition: all 0.15s ease;
}

.subtab:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
}

.subtab.active {
  background: #ffffff;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.subtab-admin.active {
  color: #b45309;
}

.subcontent { display: none; }
.subcontent.active { display: block; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.03);
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.card h2 {
  font-size: 1.08rem;
  color: #1e293b;
  font-weight: 700;
}

/* BUTTONS */
.btn {
  border: none;
  padding: 8px 14px;
  border-radius: 7px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #ffffff; color: #334155; border: 1px solid var(--border); }
.btn-secondary:hover { background: #f1f5f9; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-admin { background: #b45309; color: #fff; }
.btn-admin:hover { background: #92400e; }

/* TABELLEN & MATRIX */
.table-matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
}

.table-matrix th,
.table-matrix td {
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid #f1f5f9;
  padding: 9px 11px;
  vertical-align: middle;
  text-align: left;
}

.table-matrix th:last-child,
.table-matrix td:last-child {
  border-right: none;
}

.table-matrix tr:last-child td {
  border-bottom: none;
}

.table-matrix thead th {
  background: #f8fafc;
  font-weight: 700;
  color: #334155;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--border-light);
}

.table-matrix tbody tr:hover {
  background: #f8fafc;
}

.tfoot-summary td {
  background: #f8fafc;
  border-top: 2px solid var(--border);
  font-size: 0.8rem;
}

/* URLAUBSKALENDER TABELLE */
.vac-calendar-container {
  overflow-x: auto;
  border-radius: 8px;
}

.vac-table th,
.vac-table td {
  padding: 6px 4px;
  text-align: center;
  font-size: 0.75rem;
  min-width: 28px;
}

.vac-table th:first-child,
.vac-table td:first-child {
  text-align: left;
  padding-left: 10px;
  min-width: 150px;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
  border-right: 2px solid var(--border-light);
}

/* STATUS BADGES */
.status-badge {
  padding: 4px 9px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.74rem;
  display: inline-block;
  white-space: nowrap;
}

.status-anfrage { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.status-eingegangen { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.status-arbeit { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.status-teile { background: #fee2e2; color: #991b1b; border: 1px solid #fecdd3; }
.status-fertig { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* DIENSTPLAN SCHICHT-CHIPS */
.shift-chip {
  border-radius: 7px;
  padding: 7px 9px;
  border-left: 4px solid transparent;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  line-height: 1.3;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.shift-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.shift-chip.werkstatt { background: #fffbeb; border-left-color: #d97706; color: #92400e; }
.shift-chip.annahme { background: #fdf2f8; border-left-color: #db2777; color: #9d174d; }
.shift-chip.laden { background: #eff6ff; border-left-color: #2563eb; color: #1e40af; }
.shift-chip.neurad { background: #f0fdf4; border-left-color: #16a34a; color: #166534; }
.shift-chip.endkontrolle { background: #f5f3ff; border-left-color: #7c3aed; color: #5b21b6; }
.shift-chip.buero { background: #f1f5f9; border-left-color: #475569; color: #334155; }
.shift-chip.homeoffice { background: #ecfdf5; border-left-color: #059669; color: #065f46; }
.shift-chip.feiertag { background: #fef9c3; border-left-color: #ca8a04; color: #854d0e; font-weight: 700; }
.shift-chip.sperrtag { background: #fee2e2; border-left-color: #dc2626; color: #991b1b; font-weight: 700; }
.shift-chip.frei { text-align: center; color: #94a3b8; background: #f8fafc; border-left-color: #cbd5e1; }

/* FORMULARE */
.collapsible-form {
  display: none;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.collapsible-form.active {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  align-items: end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
}

input, select, textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: #ffffff;
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.15);
}

/* MODALS */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  padding: 22px;
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.25);
  max-height: 90vh;
  overflow-y: auto;
}

/* EILAUFTRÄGE */
tr.order-urgent {
  background: #fff1f2 !important;
  border-left: 5px solid #e11d48 !important;
}

.urgent-badge {
  background: #e11d48;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 800;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 80mm THERMODRUCK FÜR KASSENBON & LAUFZETTEL */
.receipt-container,
.order-slip-container {
  width: 80mm;
  max-width: 80mm;
  background: #ffffff;
  color: #000000;
  padding: 8px;
  margin: 0 auto;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  line-height: 1.35;
  border: 1px solid #e2e8f0;
}

.receipt-header,
.order-slip-header {
  text-align: center;
  border-bottom: 1px dashed #000;
  padding-bottom: 6px;
  margin-bottom: 6px;
}

.receipt-shop {
  font-size: 14px;
  font-weight: bold;
  text-transform: uppercase;
}

.receipt-title,
.order-slip-title {
  font-size: 13px;
  font-weight: bold;
  margin: 4px 0;
  text-align: center;
}

.receipt-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px;
}

.receipt-qr {
  text-align: center;
  margin: 8px 0;
}

.receipt-qr img {
  width: 120px;
  height: 120px;
}

.receipt-footer {
  text-align: center;
  border-top: 1px dashed #000;
  padding-top: 6px;
  margin-top: 6px;
  font-size: 10px;
}

.order-slip-section {
  border-bottom: 1px dashed #000;
  padding-bottom: 6px;
  margin-bottom: 6px;
}

@media print {
  .no-print, header, .nav-tabs, .subnav, .btn, .collapsible-form {
    display: none !important;
  }
  body {
    padding: 0;
    background: #fff;
  }
  .card {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .table-matrix {
    font-size: 8pt;
  }
}

/* 80mm DRUCK-ISOLATION FÜR LAUFZETTEL & KUNDENBELEGE */
@media print {
  body.printing-slip * {
    visibility: hidden !important;
  }
  body.printing-slip #slip-print-area,
  body.printing-slip #slip-print-area * {
    visibility: visible !important;
  }
  body.printing-slip #slip-print-area {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 80mm !important;
    max-width: 80mm !important;
    margin: 0 !important;
    padding: 4mm !important;
    border: none !important;
    box-shadow: none !important;
  }
}

/* AUFTRAGSSTATUS FARBEN: TERMINIERT (BLAU) & EINGETROFFEN (GRÜN) */
tr.row-status-terminiert {
  background-color: #f0f9ff !important;
  border-left: 5px solid #0284c7 !important;
}
tr.row-status-terminiert:hover {
  background-color: #e0f2fe !important;
}

tr.row-status-eingetroffen {
  background-color: #f0fdf4 !important;
  border-left: 5px solid #16a34a !important;
}
tr.row-status-eingetroffen:hover {
  background-color: #dcfce7 !important;
}

/* FARBIGE STATUS-DROPDOWNS & BADGES */
select.status-select-terminiert,
.badge-status-terminiert {
  background-color: #e0f2fe !important;
  color: #0369a1 !important;
  border: 2px solid #7dd3fc !important;
  font-weight: 800 !important;
}

select.status-select-eingetroffen,
.badge-status-eingetroffen {
  background-color: #dcfce7 !important;
  color: #15803d !important;
  border: 2px solid #86efac !important;
  font-weight: 800 !important;
}

select.status-select-fertig,
.badge-status-fertig {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
  border: 2px solid #cbd5e1 !important;
  font-weight: 800 !important;
}
