/* EISEN 2025 – Dark = Standard, Light = wählbar */
:root[data-theme="dark"] {
  --bg: #121212;
  --surface: #1e1e1e;
  --card: #1e1e1e;
  --primary: #c8a2c8;
  --primary-hover: #e0b8e0;
  --text: #ffffff;
  --text2: #b3b3b3;
  --border: #333;
  --ok: #4ade80;
  --error: #f87171;
  --radius: 12px;
  --font: "Inter", system-ui, sans-serif;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #ffffff;
  --card: #ffffff;
  --primary: #7c3aed;
  --primary-hover: #8b5cf6;
  --text: #111111;
  --text2: #444444;
  --border: #e5e5e5;
  --ok: #16a34a;
  --error: #dc2626;
}

/* System-Dark-Mode Fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #121212;
    --surface: #1e1e1e;
    --card: #1e1e1e;
    --primary: #c8a2c8;
    --primary-hover: #e0b8e0;
    --text: #ffffff;
    --text2: #b3b3b3;
    --border: #333;
    --ok: #4ade80;
    --error: #f87171;
  }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #ffffff;
    --surface: #ffffff;
    --card: #ffffff;
    --primary: #7c3aed;
    --primary-hover: #8b5cf6;
    --text: #111111;
    --text2: #444444;
    --border: #e5e5e5;
    --ok: #16a34a;
    --error: #dc2626;
  }
}

/* Globale Basis */
html { color-scheme: dark; }
body { background: var(--bg); color: var(--text); }
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  transition: background .3s, color .3s;
}
@media (max-width: 600px) {
  table { font-size: 0.9rem; }
  th, td { padding: 0.4rem 0.3rem; }
  .container { padding: 0 0.5rem; }
}

.container { width: 100%; max-width: 640px; }

.logo {
  height: 60px;
  margin-bottom: 2rem;
  filter: drop-shadow(0 0 6px var(--primary));
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

h1, h2, h3 { font-weight: 700; letter-spacing: -.02em; margin-bottom: 1rem; }

.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: .9rem;
  margin-bottom: .5rem;
  color: var(--text2);
}

.form-control {
  width: 100%;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  transition: border .2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,.25);
}

/* ========== BUTTONS – nur noch CSS-Variablen ========== */
.btn {
  display: inline-block;
  padding: .75rem 1.5rem;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s;
}

.btn:hover { background: var(--primary-hover); }
.btn:active { transform: scale(.98); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); color: var(--text); }

.message {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: .95rem;
}

.message.success { background: rgba(22,163,74,.12); color: var(--ok); border: 1px solid var(--ok); }
.message.error   { background: rgba(220,38,38,.12); color: var(--error); border: 1px solid var(--error); }
.message.info    { background: rgba(59,130,246,.12); color: #3b82f6; border: 1px solid #3b82f6; }

.checkin-list { list-style: none; display: flex; flex-direction: column; gap: .75rem; }
.checkin-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  padding: .75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.checkin-item.checked-in { border-color: var(--ok); opacity: .75; }
.checkin-item.abgesagt   { opacity: .45; text-decoration: line-through; }

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 2rem;
}

.table-responsive { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}
th, td { padding: .75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--surface); }

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

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  z-index: 1000;
  transition: background .3s, color .3s;
}

@media (max-width: 600px) {
  .btn { width: 100%; text-align: center; }
  .admin-toolbar { flex-direction: column; }
}

.hist-bubble{
  position:absolute;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:8px;
  padding:.5rem 1rem;
  display:none;
  z-index:10;
  font-size:.8rem;
  white-space:nowrap;
}
td:hover .hist-bubble{display:block;}

.duplicate-row {
  background: rgba(220,38,38,.08);
  border-left: 4px solid #dc2626;
}
.duplicate-row td {
  color: #dc2626;
}

/* Handy-Optimierung Einlass-Seite */
.compact-form{display:flex;flex-direction:column;gap:.75rem}
.full-width{width:100%}
.checkin-list{padding:0;margin:0;list-style:none}
.checkin-item{display:flex;justify-content:space-between;align-items:center;padding:.6rem .4rem;border-bottom:1px solid var(--border-color)}
.guest-info{flex:1 1 auto;margin-right:.5rem;word-break:break-word}
.guest-actions{flex-shrink:0;display:flex;gap:.25rem}
.warteliste{color:#facc15}
.abgesagt-text{font-size:.8em;color:#888}
@media(max-width:600px){
  .btn-icon{font-size:1.2rem;padding:.25rem .4rem}
  .btn-secondary.btn-sm{padding:.2rem .35rem;font-size:.8rem}
}

/* ========== PATCH-CSS – einfach unten in styles.css einfügen ========== */

/* 1. Custom-Properties vereinheitlichen */
:root{
  --error-bg:rgba(220,38,38,.08);
  --error-border:#dc2626;
  --ok-bg:rgba(22,163,74,.08);
  --ok-border:#16a34a;
}

/* 2. System-Dark-Mode Fallback */
@media (prefers-color-scheme: light){
  :root:not([data-theme]){
    --bg:#ffffff;
    --surface:#ffffff;
    --card:#ffffff;
    --primary:#7c3aed;
    --primary-hover:#8b5cf6;
    --text:#111111;
    --text2:#444444;
    --border:#e5e5e5;
    --ok:#16a34a;
    --error:#dc2626;
  }
}

/* 3. Motion-Reduce */
@media (prefers-reduced-motion: reduce){
  *{ transition:none !important; animation:none !important; }
}

/* 4. Besserer Fokus */
.form-control:focus,
.btn:focus{
  outline:2px solid var(--primary);
  outline-offset:2px;
}

/* 5. Utility-Klassen */
.mt-2{ margin-top:2rem; }
.text-center{ text-align:center; }
.text-small{ font-size:0.9em; }
.color-text2{ color:var(--text2); }

/* 6. Duplicate-Row über Custom Props */
.duplicate-row{
  background:var(--error-bg);
  border-left:4px solid var(--error-border);
}
.duplicate-row td{ color:var(--error); }

/* 7. Mobile Typografie */
@media (max-width: 600px){
  html{ font-size:15px; }
  .btn{ min-height:44px; }
}

/* 8. Print */
@media print{
  .theme-toggle,.btn,#helpIcon,#dashHelpIcon,#konzHelpIcon,#anmHelpIcon,#stammHelpIcon,#abgHelpIcon{ display:none; }
  body{ background:#fff; color:#000; }
}