:root {
  --bg: #0f1115;
  --card: #171a21;
  --text: #f2f4f8;
  --muted: #b7bcc7;
  --line: #262b36;
  --btn: #232838;
  --primary: #dc3545;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 20% 0%, #1a1f2d 0%, var(--bg) 55%);
}

.bg { min-height: 100%; }

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(15,17,21,0.75);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.brand { font-weight: 700; letter-spacing: 0.2px; }

.card {
  background: rgba(23,26,33,0.92);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  margin-bottom: 14px;
}

h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 12px 0 10px; color: var(--muted); }

.form label { display:block; margin: 10px 0 6px; color: var(--muted); font-size: 13px; }

input, select, textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0f121a;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

input:focus, select:focus, textarea:focus { border-color: rgba(220,53,69,0.6); }

.row {
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 720px) {
  .grid2 { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 22px; }
}

.btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--btn);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn.primary {
  background: linear-gradient(135deg, rgba(220,53,69,1) 0%, rgba(220,53,69,0.7) 100%);
  border-color: rgba(220,53,69,0.5);
}

.topbar-actions { display:flex; gap: 8px; flex-wrap: wrap; }

.alert {
  border: 1px solid rgba(220,53,69,0.4);
  background: rgba(220,53,69,0.12);
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.hint { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }
.sr-only { position:absolute; left:-9999px; }

.table-wrap { overflow:auto; border-radius: 12px; border: 1px solid var(--line); }
.table { width:100%; border-collapse: collapse; min-width: 420px; }
.table th, .table td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--muted); font-weight: 600; background: rgba(15,18,26,0.6); }
.table tr:last-child td { border-bottom: none; }

.result { margin-top: 14px; }
.traffic {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 900px) {
  .traffic { grid-template-columns: repeat(3, 1fr); }
}
.light {
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 12px;
  background: #0f121a;
}
.light-title { font-weight: 800; margin-bottom: 8px; }
.light-body { color: var(--text); line-height: 1.35; font-size: 14px; }

.light.red { outline: 2px solid rgba(255, 74, 74, 0.35); }
.light.yellow { outline: 2px solid rgba(255, 210, 77, 0.28); }
.light.green { outline: 2px solid rgba(98, 255, 147, 0.22); }

.list { margin-top: 12px; }
textarea { resize: vertical; }

/* Kalender-Statusfarben */
.RES{background:#dbeafe;color:#1e3a8a;}
.INV{background:#93c5fd;color:#1e3a8a;}
.RES_INV{background:#1d4ed8;color:#fff;font-weight:600;}
.PAID{background:#22c55e;color:#fff;font-weight:600;}

.statusSelect{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.15);
  font-weight:700;
  width:100%;
  outline:none;
}

.statusSel.RES { background:#dbeafe; color:#1e3a8a; }
.statusSel.INV { background:#93c5fd; color:#1e3a8a; }
.statusSel.RES_INV { background:#1d4ed8; color:#ffffff; }
.statusSel.PAID { background:#22c55e; color:#ffffff; font-weight:600; }
.btn.danger { background:#dc2626; color:#fff; border:0; }

/* =========================
   GLOBAL MODAL CONTRAST FIX
   ========================= */

/* Overlay */
#editModal,
#customerModal,
.modal-overlay,
[data-modal-overlay="1"] {
  background: rgba(0,0,0,.60) !important;
}

/* Modal-Container (deine Modals sind oft als "div style=background:#fff" gebaut) */
#editModal > div,
#customerModal > div,
.modal,
.modal-content,
[data-modal="1"] {
  background: #ffffff !important;
  color: #111827 !important;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0,0,0,.35);
}

/* Headlines + Labels im Modal: IMMER dunkel */
#editModal h1, #editModal h2, #editModal h3, #editModal h4,
#customerModal h1, #customerModal h2, #customerModal h3, #customerModal h4,
#editModal label, #customerModal label,
#editModal .title, #customerModal .title,
#editModal .modal-title, #customerModal .modal-title {
  color: #111827 !important;
  font-weight: 700 !important;
  opacity: 1 !important;
}

/* Wenn du Labels als "hint" styled hast -> im Modal dunkler */
#editModal .hint,
#customerModal .hint,
#editModal small,
#customerModal small {
  color: #374151 !important;   /* dunkles Grau */
  opacity: 1 !important;
}

/* Inputs/Selects/Textarea im Modal: readable */
#editModal input,
#editModal select,
#editModal textarea,
#customerModal input,
#customerModal select,
#customerModal textarea {
  background: #0b1220 !important;  /* behält deine dunklen Felder */
  color: #ffffff !important;
  border: 1px solid rgba(255,255,255,.12) !important;
}

/* Placeholder */
#editModal input::placeholder,
#editModal textarea::placeholder,
#customerModal input::placeholder,
#customerModal textarea::placeholder {
  color: rgba(255,255,255,.55) !important;
}

/* Disabled */
#editModal input:disabled,
#editModal select:disabled,
#customerModal input:disabled,
#customerModal select:disabled {
  opacity: .75 !important;
  cursor: not-allowed;
}

/* Fehlertext */
#editModal #modalError,
#customerModal #modalError,
#editModal .error,
#customerModal .error {
  color: #b00020 !important;
  font-weight: 700;
}

/* =====================================
   CUSTOMER EDIT MODAL – CONTRAST FIX
   ===================================== */

#customerEditModal {
  background: rgba(0,0,0,.6) !important;
}

/* Modal-Box */
#customerEditModal > div,
#customerEditModal .modal,
#customerEditModal .modal-content {
  background: #ffffff !important;
  color: #111827 !important;
  border-radius: 16px;
  box-shadow: 0 30px 70px rgba(0,0,0,.35);
}

/* Überschrift */
#customerEditModal h1,
#customerEditModal h2,
#customerEditModal h3,
#customerEditModal .modal-title {
  color: #111827 !important;
  font-weight: 800 !important;
  opacity: 1 !important;
}

/* Labels IMMER lesbar */
#customerEditModal label {
  color: #1f2937 !important;
  font-weight: 600 !important;
  opacity: 1 !important;
}

/* Hilfetexte */
#customerEditModal .hint,
#customerEditModal small {
  color: #4b5563 !important;
  opacity: 1 !important;
}

/* Inputs behalten Dark-Style, aber gut lesbar */
#customerEditModal input,
#customerEditModal select,
#customerEditModal textarea {
  background: #0b1220 !important;
  color: #ffffff !important;
  border: 1px solid rgba(255,255,255,.15) !important;
}

/* Placeholder */
#customerEditModal input::placeholder,
#customerEditModal textarea::placeholder {
  color: rgba(255,255,255,.55) !important;
}

/* Disabled */
#customerEditModal input:disabled,
#customerEditModal select:disabled {
  opacity: .7 !important;
}

/* Buttons */
#customerEditModal .btn {
  font-weight: 700;
}

/* Fehlertexte */
#customerEditModal .error,
#customerEditModal #modalError {
  color: #b00020 !important;
  font-weight: 700;
}
