body {
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0;
  background: #23272f url('../Hintergrund.jpg') no-repeat center center fixed;
  background-size: cover;
  color: #f1f1f1;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Header-Bereich */
.page-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 20px 0;
  background: transparent;
  border-radius: 16px;
}

.page-logo {
  max-width: 150px;
  margin-bottom: 0;
  padding: 10px;
  background: rgba(44, 49, 58, 0.5);
  border: 2px solid #ff9800;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(255, 152, 0, 0.3);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.page-logo:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(255, 152, 0, 0.4);
}

.page-title {
  font-size: 2.5em;
  font-weight: 300;
  margin: 30px 0 10px 0;
  color: #ff9800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.page-subtitle {
  font-size: 1.2em;
  color: #b0bec5;
  margin-bottom: 30px;
}

.back-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ff9800;
  color: #23272f;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
  transition: all 0.3s ease;
}

.back-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

#nutzerInfoBox {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 160px;
  background: rgba(35, 39, 47, 0.85);
  border-radius: 0 0 0 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  padding: 10px 14px;
  gap: 8px;
  backdrop-filter: blur(10px);
}

.container, .container * { position: relative; z-index: 1; }
h2, h3 {
  color: #FFA900;
  letter-spacing: 1px;
}
h2 {
  text-align: center;
  margin-top: 20px;
  font-size: 2em;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Mobile Responsive - Erweiterte Optimierungen */
@media (max-width: 768px) {
  /* Viewport und Basis-Anpassungen */
  html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
  }
  
  body {
    font-size: 14px;
    padding-bottom: 20px;
  }
  
  /* Header-Anpassungen */
  .page-logo {
    max-width: 100px;
    padding: 6px;
  }
  
  .page-title {
    font-size: 1.5em;
    margin: 20px 0 8px 0;
  }
  
  .page-subtitle {
    font-size: 0.9em;
    margin-bottom: 20px;
  }
  
  /* Back-Button für Mobile */
  .back-btn {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 10001;
    padding: 10px 15px;
    font-size: 0.9em;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    min-height: 44px; /* Touch-Target */
    display: flex;
    align-items: center;
  }
  
  /* Nutzerinfo-Box */
  #nutzerInfoBox {
    position: fixed;
    top: 0;
    right: 0;
    width: auto;
    min-width: 140px;
    max-width: 200px;
    padding: 8px 10px;
    font-size: 0.85em;
    z-index: 10000;
    border-radius: 0 0 0 10px;
  }
  
  #nutzerInfoBox button {
    padding: 10px 12px;
    font-size: 0.85em;
    min-height: 44px; /* Touch-Target */
    width: 100%;
    margin-bottom: 6px;
  }
  
  /* Container */
  .container {
    padding: 10px;
    margin-top: 60px; /* Platz für fixierte Elemente */
  }
  
  /* Formulare */
  form {
    padding: 15px 12px;
    margin-bottom: 20px;
  }
  
  label {
    font-size: 0.95em;
    margin-top: 14px;
  }
  
  input, textarea, select {
    padding: 14px 12px;
    font-size: 16px; /* Verhindert Zoom auf iOS */
    min-height: 44px; /* Touch-Target */
    border-radius: 6px;
  }
  
  textarea {
    min-height: 100px;
    font-size: 14px;
  }
  
  /* Buttons */
  button, .reset-btn {
    padding: 14px 20px;
    font-size: 1em;
    min-height: 48px; /* Touch-Target */
    width: 100%;
    margin-top: 16px;
    border-radius: 8px;
    touch-action: manipulation;
  }
  
  /* Vertrag-Grid für Mobile */
  .vertrag-grid {
    gap: 16px;
    margin-top: 16px;
  }
  
  .vertrag-card {
    min-width: 100%;
    max-width: 100%;
    padding: 20px 16px;
    border-radius: 12px;
    margin-bottom: 0;
  }
  
  .vertrag-card .vertrag-kunde {
    font-size: 1.15em;
  }
  
  .vertrag-card .vertrag-projekt {
    font-size: 0.95em;
  }
  
  .vertrag-card .vertrag-actions {
    gap: 12px;
    margin-top: 16px;
  }
  
  .vertrag-card .vertrag-actions .vertrag-action-btn,
  .vertrag-card .vertrag-actions .vertrag-action-link {
    min-height: 48px; /* Touch-Target */
    padding: 14px 16px;
    font-size: 0.95em;
  }
  
  /* Tabellen für Mobile */
  table {
    font-size: 0.85em;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  th, td {
    padding: 10px 8px;
    font-size: 0.9em;
    min-width: 80px;
  }
  
  /* Filter-Bereich */
  .sortierbereich {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  
  select {
    width: 100%;
    min-height: 48px;
  }
}

/* Sehr kleine Bildschirme (Smartphones im Portrait) */
@media (max-width: 480px) {
  body {
    font-size: 13px;
  }
  
  .container {
    padding: 8px;
    margin-top: 50px;
  }
  
  .page-title {
    font-size: 1.3em;
    margin: 15px 0 6px 0;
  }
  
  .page-subtitle {
    font-size: 0.85em;
  }
  
  form {
    padding: 12px 10px;
  }
  
  .vertrag-card {
    padding: 16px 12px;
  }
  
  .vertrag-card .vertrag-kunde {
    font-size: 1.05em;
  }
  
  /* Back-Button noch kompakter */
  .back-btn {
    padding: 8px 12px;
    font-size: 0.85em;
  }
  
  .back-btn span:last-child {
    display: none; /* Text verstecken, nur Pfeil */
  }
  
  #nutzerInfoBox {
    min-width: 120px;
    max-width: 160px;
    padding: 6px 8px;
    font-size: 0.8em;
  }
  
  #nutzerInfoBox button {
    padding: 8px 10px;
    font-size: 0.8em;
    min-height: 40px;
  }
}
form {
  margin-bottom: 36px;
  background: #20232a;
  padding: 28px 28px 16px 28px;
  border-radius: 14px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.13);
}
label {
  display: block;
  margin-top: 18px;
  font-weight: 500;
  color: #FFA900;
  font-size: 1.08em;
}
input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  margin-top: 7px;
  border: 1.5px solid #444a57;
  border-radius: 8px;
  background: #23272f;
  color: #f1f1f1;
  font-size: 1.08em;
  transition: border 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 4px #0002;
}
input:focus, textarea:focus, select:focus {
  border: 1.5px solid #FFA900;
  outline: none;
  background: #23272f;
  box-shadow: 0 2px 12px #FFA90055;
}
textarea { resize: vertical; min-height: 48px; }
button, .reset-btn {
  background: linear-gradient(90deg, #FFA900 0%, #FFA900 100%);
  color: #23272f;
  border: none;
  border-radius: 8px;
  padding: 14px 32px;
  font-size: 1.13em;
  font-weight: 700;
  margin-top: 24px;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(255,152,0,0.10);
  transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}
button:hover, .reset-btn:hover {
  background: linear-gradient(90deg, #FFA900 0%, #FFA900 100%);
  color: #181b22;
  box-shadow: 0 4px 24px rgba(255,152,0,0.18);
}
.delete-btn {
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  font-size: 1.08em;
  font-weight: 600;
  margin-left: 8px;
  transition: background 0.2s;
}
.delete-btn:hover {
  background: #c0392b;
}
.vertrag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 22px;
  justify-content: flex-start;
}
.vertrag-card {
  background: #23272f;
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  padding: 28px 24px 18px 24px;
  min-width: 270px;
  max-width: 340px;
  flex: 1 1 270px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: box-shadow 0.2s, transform 0.2s;
  border: 1.5px solid #444a57;
}
.vertrag-card:hover {
  box-shadow: 0 10px 40px #FFA90033, 0 4px 24px #0008;
  transform: translateY(-3px) scale(1.025);
  border: 1.5px solid #FFA900;
}
.vertrag-card .vertrag-kunde {
  font-size: 1.28em;
  font-weight: 800;
  color: #FFA900;
  margin-bottom: 2px;
  letter-spacing: 0.5px;
}
.vertrag-card .vertrag-projekt {
  font-size: 1.08em;
  color: #b0b0b0;
  margin-bottom: 2px;
}
.vertrag-card .vertrag-status {
  font-size: 1em;
  color: #FFA900;
  margin-bottom: 2px;
}
.vertrag-card .vertrag-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  width: 100%;
}
.vertrag-card .vertrag-actions .vertrag-action-btn,
.vertrag-card .vertrag-actions .vertrag-action-link {
  width: 100%;
  display: block;
  box-sizing: border-box;
  font-size: 0.95em;
  padding: 12px 16px;
  border-radius: 8px;
  border: none;
  background: #444a57;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s, color 0.2s, transform 0.1s;
}
.vertrag-card .vertrag-actions .vertrag-action-btn:hover,
.vertrag-card .vertrag-actions .vertrag-action-link:hover {
  background: #FFA900;
  color: #23272f;
  transform: translateY(-1px);
}
.vertrag-card .vertrag-actions .vertrag-action-link-btn {
  background: #ff9800;
  color: #fff;
}
.vertrag-card .vertrag-actions .vertrag-action-link-btn:hover {
  background: #ff8800;
  color: #fff;
}
.vertrag-card .vertrag-actions .vertrag-delete {
  background: #e74c3c;
  color: #fff;
}
.vertrag-card .vertrag-actions .vertrag-delete:hover {
  background: #c0392b;
  color: #fff;
}
.small {
  font-size: 0.95em;
  color: #b0b0b0;
  margin-top: 2px;
  display: block;
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 18px;
  background: #23272f;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
}
th, td {
  padding: 12px 10px;
  text-align: left;
}
th {
  background: #23272f;
  color: #FFA900;
  font-weight: 600;
  font-size: 1.05em;
  border-bottom: 2px solid #444a57;
  user-select: none;
}
td {
  background: #2c313a;
  border-bottom: 1px solid #353a45;
  color: #f1f1f1;
  font-size: 1em;
}
tr:last-child td {
  border-bottom: none;
}
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.9em;
  font-weight: 600;
}
.status-pending {
  background: #ff9800;
  color: #23272f;
}
.status-unterzeichnet {
  background: #4caf50;
  color: #fff;
}
.status-abgelehnt {
  background: #e74c3c;
  color: #fff;
}
.status-abgelaufen {
  background: #9e9e9e;
  color: #fff;
}
/* Tablet-Ansicht */
@media (max-width: 900px) and (min-width: 769px) {
  .container { 
    padding: 15px; 
    max-width: 95%;
  }
  form { 
    padding: 20px 16px; 
  }
  th, td { 
    font-size: 0.95em; 
    padding: 10px 8px; 
  }
  .vertrag-card {
    max-width: calc(50% - 14px);
    min-width: calc(50% - 14px);
  }
}

/* Mobile - Tabellen als Cards */
@media (max-width: 600px) {
  table, thead, tbody, th, td, tr { 
    display: block; 
  }
  
  thead tr { 
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  tr { 
    margin-bottom: 16px;
    background: #23272f;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid #444a57;
  }
  
  td { 
    padding: 8px 0;
    border-bottom: 1px solid #353a45;
    position: relative;
    padding-left: 50%;
    text-align: left;
    min-height: 32px;
  }
  
  td:before {
    content: attr(data-label) ": ";
    position: absolute;
    left: 0;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    font-weight: 600;
    color: #ff9800;
  }
  
  td:last-child {
    border-bottom: none;
  }
  
  th { 
    display: none; 
  }
}

/* Modernes Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: linear-gradient(135deg, #2c313a 0%, #1e2127 100%);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  max-width: 800px;
  width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s ease;
  border: 2px solid #444a57;
}

.modal-overlay.show .modal-container {
  transform: scale(1) translateY(0);
}

.modal-header {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
  padding: 20px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #e65100;
}

.modal-title {
  color: #fff;
  margin: 0;
  font-size: 1.5em;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  font-size: 2em;
  font-weight: bold;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.modal-body {
  padding: 30px;
  max-height: 60vh;
  overflow-y: auto;
  background: #2c313a;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling auf iOS */
}

.modal-footer {
  background: #1e2127;
  padding: 20px 30px;
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  border-top: 2px solid #444a57;
}

/* Mobile Modal Optimierungen */
@media (max-width: 768px) {
  .modal-container {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
  
  .modal-header {
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  
  .modal-title {
    font-size: 1.2em;
  }
  
  .modal-close {
    width: 44px; /* Touch-Target */
    height: 44px;
    font-size: 1.8em;
  }
  
  .modal-body {
    padding: 20px 16px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .modal-footer {
    padding: 16px;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    bottom: 0;
    background: #1e2127;
    border-top: 2px solid #444a57;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
  }
  
  .modal-footer .btn {
    width: 100%;
    min-height: 48px; /* Touch-Target */
    padding: 14px 20px;
    font-size: 1em;
  }
  
  /* Form-Elemente im Modal */
  .form-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .form-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
  }
  
  .form-label {
    font-size: 0.9em;
    margin-bottom: 8px;
  }
  
  .form-input, .form-select, .form-textarea {
    padding: 14px 12px;
    font-size: 16px; /* Verhindert Zoom auf iOS */
    min-height: 44px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .form-textarea {
    min-height: 120px;
  }
}

/* Modal Form Styling */
.form-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #444a57;
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.section-title {
  color: #ff9800;
  font-size: 1.2em;
  font-weight: 600;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 15px;
}

.form-row.full {
  grid-template-columns: 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  color: #b0bec5;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.95em;
}

.form-input {
  padding: 12px 15px;
  background: #23272f;
  border: 2px solid #444a57;
  border-radius: 8px;
  color: #f1f1f1;
  font-size: 1em;
  transition: all 0.3s ease;
}

.form-input:focus {
  outline: none;
  border-color: #ff9800;
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.1);
}

.form-select {
  padding: 12px 15px;
  background: #23272f;
  border: 2px solid #444a57;
  border-radius: 8px;
  color: #f1f1f1;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.form-select:focus {
  outline: none;
  border-color: #ff9800;
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.1);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: #ff9800;
  color: #23272f;
}

.btn-primary:hover {
  background: #e67300;
  transform: translateY(-2px);
}

.btn-secondary {
  background: #444a57;
  color: #f1f1f1;
}

.btn-secondary:hover {
  background: #555a67;
}

.btn-danger {
  background: #e74c3c;
  color: #fff;
}

.btn-danger:hover {
  background: #c0392b;
}

.help-text {
  font-size: 0.85em;
  color: #888;
  margin-top: 5px;
}

