/* ---------------------------------------------------------------
   Ma Burger Verwaltung — dunkles Design mit Gold/Bronze,
   angelehnt an die Speisekarte und das Logo des Ladens.

   Alle Farben hängen an den Variablen unten. Wer die Optik ändern
   will, ändert nur diesen Block – der Rest der Datei zieht mit.
--------------------------------------------------------------- */
:root {
  --bg: #0B0B0D;            /* fast schwarz – Seitenhintergrund */
  --surface: #141417;       /* Karten, Sidebar */
  --surface-2: #1C1C21;     /* Hover, Eingabefelder */
  --text: #F2EDE3;          /* warmes Off-White */
  --text-secondary: #9C9384;
  --border: #2A2A30;
  --accent: #C9A227;        /* Gold */
  --accent-dark: #E0B93C;   /* helleres Gold für Hover */
  --bronze: #8A6A3B;
  --green: #4ADE80;
  --red: #FF6B5E;
  --yellow: #E8C547;
  /* Flächen in Akzentfarbe tragen dunkle Schrift – Gold auf Weiß liest sich nicht. */
  --on-accent: #14120C;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.5), 0 8px 24px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

/* --- Layout --- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0 12px 20px 12px;
  color: var(--text);
}
.sidebar .brand span { color: var(--accent); }

/* Logo-Wappen neben dem Schriftzug (Sidebar, Kopfleiste, Login) */
.brand, .login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand { justify-content: center; }
.brand-logo { width: 30px; height: 30px; flex-shrink: 0; }
.login-brand .brand-logo { width: 44px; height: 44px; }
/* Goldene Trennlinie unter dem Markenblock der Sidebar */
.sidebar .brand { border-bottom: 1px solid var(--bronze); margin-bottom: 16px; }

.filiale-switch {
  padding: 0 12px 16px 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.filiale-switch label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.filiale-switch select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.filiale-fest {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}

.user-box {
  margin-top: auto;
  padding: 14px 12px 4px 12px;
  border-top: 1px solid var(--border);
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.logout-link { font-size: 13px; color: var(--red); font-weight: 600; }

/* --- Login-Seite --- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  width: 100%;
  max-width: 360px;
}
.login-brand {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--text);
}
.login-brand span { color: var(--accent); }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.login-fehler {
  background: rgba(255,107,94,0.12);
  color: var(--red);
  border: 1px solid rgba(255,107,94,0.35);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  margin-bottom: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.15s ease;
}
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link.active { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.nav-link .emoji { font-size: 16px; width: 20px; text-align: center; }

.main {
  flex: 1;
  padding: 32px 40px;
  max-width: 1400px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px 0; }
h2 { font-size: 19px; font-weight: 600; margin: 0 0 14px 0; }
.subtitle { color: var(--text-secondary); font-size: 14px; margin: 0; }

/* --- Cards / KPI --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.kpi-card .value { color: var(--accent); }
.kpi-card .label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.kpi-card .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.kpi-card .value.warn { color: var(--red); }

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

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; color: var(--on-accent); }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: #24242B; border-color: var(--bronze); }
.btn.danger { background: var(--surface); color: var(--red); border: 1px solid var(--border); padding: 6px 12px; font-size: 13px; }
.btn.danger:hover { background: rgba(255,107,94,0.12); border-color: var(--red); }
.btn.small { padding: 6px 12px; font-size: 13px; }

/* --- Forms --- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,162,39,0.22);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}
.form-row-actions { display: flex; gap: 10px; margin-top: 4px; }

/* --- Tables --- */
/* Jede Tabelle steckt in <div class="table-scroll">: auf schmalen Bildschirmen
   scrollt die Tabelle waagerecht, statt das Layout zu sprengen. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;  /* weiches Scrollen auf iOS */
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge.ok { background: rgba(74,222,128,0.14); color: var(--green); }
.badge.warn { background: rgba(255,107,94,0.14); color: var(--red); }
.badge.info { background: rgba(232,197,71,0.14); color: var(--yellow); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state .emoji { font-size: 40px; margin-bottom: 12px; }

/* --- Dienstplan-Grid --- */
.dp-table { font-size: 13px; }
.dp-table input.dp-cell { width: 100%; padding: 6px 8px; font-size: 13px; text-align: center; }
.dp-table th { text-align: center; }
/* Die Mitarbeiter-Spalte bleibt beim waagerechten Scrollen stehen. Sie braucht
   einen deckenden Hintergrund, damit die Zellen darunter nicht durchscheinen. */
.dp-table th:first-child,
.dp-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  text-align: left;
}
.dp-table tr:hover td:first-child { background: var(--surface-2); }
.week-nav { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.week-nav .kw-label { font-weight: 700; font-size: 16px; min-width: 220px; text-align: center; }

/* --- Einrichtung / Einstellungen --- */
.einrichtung-card { max-width: 440px; }

.hinweis {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}
.hinweis.ok { background: rgba(74,222,128,0.10); color: var(--green); border: 1px solid rgba(74,222,128,0.30); }
.hinweis.warn { background: rgba(255,107,94,0.10); color: var(--red); border: 1px solid rgba(255,107,94,0.30); }

.filiale-block { padding: 16px 0; border-bottom: 1px solid var(--border); }
.filiale-block:last-child { border-bottom: none; padding-bottom: 0; }
.filiale-block:first-of-type { padding-top: 0; }

/* Das Löschen steckt bewusst zugeklappt in einem <details>: es soll nicht
   versehentlich im Vorbeiklicken erwischt werden. */
.loeschen-box summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  padding: 6px 0;
  min-height: 32px;
}
.loeschen-box[open] {
  border: 1px solid rgba(255,107,94,0.35);
  border-radius: var(--radius-sm);
  background: rgba(255,107,94,0.06);
  padding: 12px 14px;
  margin-top: 6px;
}
.loeschen-box[open] summary { margin-bottom: 8px; }
.loeschen-warnung {
  background: rgba(255,107,94,0.10);
  border: 1px solid rgba(255,107,94,0.35);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 13px;
  padding: 10px 12px;
  margin: 0 0 12px 0;
}

/* --- Filial-Vergleich auf dem Dashboard --- */
/* auto-fit sorgt dafür, dass die Spalten auf schmalen Bildschirmen
   von selbst untereinander rutschen – ohne eigene @media-Regel. */
.vergleich-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.vergleich-spalte {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.vergleich-spalte.aktuell { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.vergleich-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  padding-bottom: 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.vergleich-zeile {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
}
.vergleich-zeile .label {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 600;
  margin: 0;
}
.vergleich-zeile .wert { font-size: 15px; font-weight: 600; white-space: nowrap; }
.vergleich-zeile .wert.warn { color: var(--red); }
/* margin-top:auto schiebt den Knopf ans untere Ende – so stehen die Knöpfe
   aller Spalten auf einer Linie, auch wenn eine Spalte kürzer ist. */
.vergleich-wechsel { margin-top: auto; margin-bottom: 2px; justify-content: center; }
.vergleich-spalte .vergleich-zeile:last-of-type { margin-bottom: 12px; }

/* --- Mobile Kopfleiste (am Desktop ausgeblendet) --- */
.mobile-topbar { display: none; }
.nav-backdrop { display: none; }

/* --- Misc --- */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.text-secondary { color: var(--text-secondary); }
.mt-0 { margin-top: 0; }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

/* ===============================================================
   HANDY / TABLET  (bis 768px)
   Sidebar wird zum ausklappbaren Menü hinter dem Hamburger-Icon,
   Formulare stapeln sich einspaltig, Tippflächen werden größer.
   =============================================================== */
@media (max-width: 768px) {
  /* --- Kopfleiste mit Hamburger --- */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding: 0 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 30;
  }
  .mobile-topbar .brand { font-size: 17px; font-weight: 700; padding: 0; }
  .mobile-topbar .brand span { color: var(--accent); }
  .topbar-filiale {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40%;
  }
  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
  }
  .nav-toggle:active { background: var(--surface-2); }
  .nav-toggle-icon { font-size: 22px; line-height: 1; }

  /* --- Sidebar als Schublade von links --- */
  .app-shell { display: block; padding-top: 56px; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100%;
    width: 260px;
    max-width: 82vw;
    padding: 20px 14px;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 0 24px rgba(0,0,0,0.12);
  }
  body.nav-open .sidebar { transform: translateX(0); }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 35;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }  /* Hintergrund nicht mitscrollen */

  .main { padding: 20px 16px 40px 16px; max-width: 100%; }

  /* --- Tippflächen: mindestens 44px hoch --- */
  .nav-link { min-height: 44px; font-size: 15.5px; }
  .btn {
    min-height: 44px;
    padding: 11px 18px;
    justify-content: center;
  }
  .btn.small, .btn.danger { min-height: 44px; padding: 10px 14px; font-size: 14px; }
  input, select, textarea {
    min-height: 44px;
    font-size: 16px;  /* verhindert das Auto-Zoomen von iOS beim Antippen */
  }
  .filiale-switch select { min-height: 44px; font-size: 16px; }

  /* --- Formulare einspaltig --- */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .form-row-actions { flex-direction: column; align-items: stretch; }
  .form-row-actions .btn { width: 100%; }

  /* --- Überschriften / KPI --- */
  h1 { font-size: 23px; }
  .page-header { margin-bottom: 20px; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
  .kpi-card { padding: 16px; }
  .kpi-card .value { font-size: 22px; }
  .card { padding: 16px; }

  /* --- Tabellen: waagerecht scrollen statt umbrechen --- */
  .table-scroll table { min-width: 640px; }
  th, td { padding: 10px 12px; white-space: nowrap; }

  /* --- Dienstplan: schmaler, Mitarbeiter-Spalte bleibt stehen --- */
  .dp-table { min-width: 760px; }
  .dp-table th:first-child,
  .dp-table td:first-child {
    min-width: 130px;
    max-width: 130px;
    white-space: normal;
    border-right: 1px solid var(--border);
  }
  .dp-table input.dp-cell { min-width: 74px; font-size: 15px; }
  .week-nav { flex-wrap: wrap; gap: 8px; }
  .week-nav .kw-label { min-width: 100%; order: -1; font-size: 15px; }
  /* Die drei Wochen-Knöpfe nebeneinander in eine Zeile, ohne Zeilenumbruch im Text. */
  .week-nav .btn { flex: 1 1 auto; padding: 11px 8px; font-size: 13px; white-space: nowrap; }
}
