/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* === DESIGN TOKENS (Sapphire) === */
:root {
  --primary: #1f3855;
  --secondary: #007cb0;
  --bg: #f8fafc;
  --surface: #f8fafc;
  --surface-container: #edeff4;
  --surface-container-low: #f4f7f9;
  --surface-container-high: #e7edf3;
  --surface-container-highest: #dde3ea;
  --on-surface: #191c1e;
  --on-surface-variant: #42474e;
  --outline: #72777e;
  --outline-variant: #c2c7ce;
  --error: #ba1a1a;
  --radius: 12px;
  --radius-sm: 8px;
  --touch: 48px;
  --nav-height: 72px;
  --header-height: 56px;
}

/* === BASE === */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--on-surface);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: var(--nav-height);
}

/* === HEADER === */
header {
  background: var(--bg);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 0 20px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo .material-symbols-outlined {
  color: var(--secondary);
  font-size: 24px;
}

.header-zebra {
  height: 32px;
  width: auto;
  object-fit: contain;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -0.03em;
}

header .subtitle { display: none; }

.header-subtitle {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Hide global header when in wizard flow */
body.wizard-active header { display: none; }

/* === BOTTOM NAV === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  height: var(--nav-height);
  background: var(--primary);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -4px 24px rgba(31,56,85,0.18);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  border-top: 2px solid transparent;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  padding: 8px 4px 10px;
  transition: color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.nav-item .material-symbols-outlined { font-size: 22px; }

.nav-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-item.active {
  color: var(--secondary);
  border-top-color: var(--secondary);
}

.nav-item--dummy {
  opacity: 0.35;
  cursor: default;
}

/* === TABS (hidden, replaced by bottom nav) === */
.tabs { display: none; }
.tab-btn { display: none; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Material tab padding */
#tab-material { padding: 20px 16px 24px; }

/* === FORMS === */
.field { margin-bottom: 20px; }

label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--on-surface-variant);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  height: var(--touch);
  padding: 0 14px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--on-surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  appearance: none;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(0,124,176,0.12);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231f3855' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* === BUTTONS === */
.btn-primary {
  width: 100%;
  height: var(--touch);
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 4px 16px rgba(31,56,85,0.2);
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
  height: var(--touch);
  background: #fff;
  color: var(--primary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0 16px;
  transition: background 0.15s;
}

.btn-secondary:hover { background: var(--surface-container-low); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-danger {
  flex: 1;
  height: var(--touch);
  padding: 0 12px;
  background: #dc2626;
  color: #fff;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* === BANNER === */
.banner {
  position: fixed;
  bottom: var(--nav-height);
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  z-index: 200;
  border-radius: var(--radius) var(--radius) 0 0;
}
.banner.success { background: #15803d; color: #fff; }
.banner.error { background: var(--error); color: #fff; }

/* === AUTOCOMPLETE === */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: #fff;
  border: 2px solid var(--secondary);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  list-style: none;
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.autocomplete-list li {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--outline-variant);
}
.autocomplete-list li:hover { background: var(--surface-container-low); }
.autocomplete-list li:last-child { border-bottom: none; }

/* ===== WIZARD ===== */
.wizard-screen { display: none; padding-bottom: 170px; }
.wizard-screen.active { display: block; }

/* Wizard Header — full width navy bar, sticky at very top when in wizard-active mode */
.wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  color: #fff;
  padding: 14px 16px;
  position: sticky;
  top: var(--header-height);
  z-index: 10;
}

body.wizard-active .wizard-header {
  top: 0; /* header is hidden, stick to very top */
}

.wizard-title {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}

.wizard-badge {
  font-size: 0.65rem;
  font-weight: 800;
  background: var(--secondary);
  color: #fff;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wizard-body { padding: 20px 16px; }

.wizard-footer {
  position: fixed;
  bottom: var(--nav-height);
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px;
  background: rgba(248,250,252,0.97);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--outline-variant);
  z-index: 10;
}

.wizard-footer-split { display: flex; gap: 8px; }
.wizard-footer-split .btn-secondary { flex: 1; margin-top: 0; }
.wizard-footer-split .btn-primary { flex: 2; margin-top: 0; }

.wizard-fehler {
  padding: 16px;
  color: var(--error);
  font-size: 0.9rem;
  text-align: center;
}

.btn-back {
  background: none;
  border: none;
  color: var(--secondary);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* === SCREEN 1: START (Daily Entry) === */
.wizard-start {
  padding: 32px 20px 24px;
}

.start-eyebrow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--secondary);
  margin-bottom: 6px;
}

.start-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 4px;
}

.start-date {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 4px;
}

.start-divider {
  margin: 16px 0 28px;
  height: 3px;
  width: 48px;
  background: var(--secondary);
  border-radius: 2px;
}

.start-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  margin-bottom: 32px;
}

.start-tile {
  background: var(--primary);
  border: none;
  border-radius: 16px;
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  box-shadow: 0 4px 20px rgba(31,56,85,0.18);
  -webkit-tap-highlight-color: transparent;
}

.start-tile:active { transform: scale(0.97); opacity: 0.9; }

.start-tile .material-symbols-outlined {
  font-size: 2.2rem;
  color: var(--secondary);
}

.start-tile span:last-child {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.btn-start { display: none; } /* replaced by tiles */

/* === MA GRID === */
.wizard-section-heading {
  padding-left: 16px;
  border-left: 4px solid var(--secondary);
  margin: 16px 16px 16px;
}

.wizard-section-heading small {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--secondary);
}

.wizard-section-heading h2 {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--primary);
}

.ma-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 4px 16px 16px;
}

.ma-kachel {
  position: relative;
  background: var(--surface-container-highest);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.ma-kachel.selected {
  background: var(--primary);
  border-color: var(--secondary);
}

.ma-kachel-icon {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ma-kachel-icon svg { width: 40px; height: 40px; }

.ma-kachel-foto {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 26px;
  width: 100%;
  height: calc(100% - 26px);
  object-fit: cover;
  object-position: center top;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.ma-kachel.selected .ma-kachel-foto {
  opacity: 0.85;
}
.ma-kachel:not(.selected) .ma-kachel-icon svg path,
.ma-kachel:not(.selected) .ma-kachel-icon svg circle { fill: rgba(31,56,85,0.25); }
.ma-kachel.selected .ma-kachel-icon svg path,
.ma-kachel.selected .ma-kachel-icon svg circle { fill: var(--secondary); }

.ma-kachel-name {
  background: rgba(255,255,255,0.4);
  backdrop-filter: blur(4px);
  color: var(--primary);
  font-size: 0.58rem;
  font-weight: 800;
  padding: 4px 4px;
  text-align: center;
  position: relative;
  z-index: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.ma-kachel.selected .ma-kachel-name {
  background: rgba(31,56,85,0.88);
  color: #fff;
}

.ma-check {
  position: absolute;
  top: 5px; right: 5px;
  background: var(--secondary);
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.6rem;
  font-weight: 900;
  align-items: center;
  justify-content: center;
  display: none;
}
.ma-kachel.selected .ma-check { display: flex; }

/* === PROJECT LIST === */
.projekt-suche-zeile {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface-container-low);
  border-bottom: 1px solid var(--outline-variant);
}

.projekt-suche-zeile input {
  flex: 1;
  height: var(--touch);
  padding: 0 14px;
  font-size: 0.95rem;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.projekt-suche-zeile input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(0,124,176,0.12);
}

.btn-qr {
  width: var(--touch);
  height: var(--touch);
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.projekt-section-label {
  padding: 12px 16px 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--on-surface-variant);
}

.projekt-liste { padding: 8px 0; }

.projekt-item {
  display: block;
  padding: 14px 16px;
  margin: 6px 12px;
  cursor: pointer;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  border-left: 3px solid transparent;
  transition: border-color 0.15s, background 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.projekt-item:active {
  border-left-color: var(--secondary);
  background: var(--surface-container-low);
}

.projekt-item-nr {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.projekt-item-adresse {
  font-size: 0.78rem;
  color: var(--on-surface-variant);
  margin-top: 3px;
  line-height: 1.4;
}

.btn-ocr {
  background: var(--secondary);
  font-size: 0.9rem;
}

/* === OCR Scanner === */
.ocr-video-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
}
.ocr-video-wrap video {
  width: 100%;
  display: block;
}
/* Dunkle Overlay-Bereiche oben und unten */
.ocr-video-wrap::before,
.ocr-video-wrap::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2;
  pointer-events: none;
}
.ocr-video-wrap::before {
  top: 0;
  height: 42%;
}
.ocr-video-wrap::after {
  bottom: 0;
  height: 42%;
}
/* Scan-Linie */
.ocr-scanline {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 42%;
  height: 16%;
  border: 2px solid var(--secondary);
  border-radius: 6px;
  z-index: 3;
  pointer-events: none;
  box-shadow: 0 0 0 9999px transparent;
}
.ocr-scanline-label {
  position: absolute;
  top: -20px;
  left: 0;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* === QR === */
.qr-container { padding: 14px; }
.qr-video { width: 100%; border-radius: var(--radius); background: #000; display: block; }
.qr-status { font-size: 0.8rem; color: var(--on-surface-variant); text-align: center; margin-top: 8px; }

/* === KONTEXT BAR (Screen 4) === */
.kontext-bar {
  background: rgba(0,0,0,0.15);
  padding: 10px 16px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
  position: sticky;
  top: 56px; /* below wizard-header */
  z-index: 9;
}

body.wizard-active .kontext-bar { top: 52px; } /* wizard-header is ~52px tall */

.kontext-bar strong { color: #fff; font-weight: 700; }

/* === STUNDEN BUTTONS === */
.stunden-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.btn-stunden {
  aspect-ratio: 1;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(31,56,85,0.15);
  font-family: inherit;
}

.btn-stunden.active {
  background: var(--secondary);
  box-shadow: 0 2px 12px rgba(0,124,176,0.3);
  transform: scale(1.06);
}

.stunden-fein {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  background: var(--surface-container-high);
  border-radius: var(--radius-sm);
  padding: 6px;
}

.btn-fein {
  flex: 1;
  height: 44px;
  background: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.btn-fein-lg {
  flex: 2;
  height: 56px;
  font-size: 1.2rem;
  font-weight: 900;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
  transition: opacity 0.15s;
  box-shadow: 0 3px 10px rgba(31,56,85,0.2);
}
.btn-fein-lg:active { opacity: 0.8; }

.stunden-anzeige {
  flex: 3;
  text-align: center;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--primary);
  height: 56px;
  line-height: 56px;
}

/* === TEXTAREA === */
.field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
  background: #fff;
  color: var(--on-surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.field textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(0,124,176,0.12);
}

/* === S4: PER-MA TÄTIGKEIT === */
.s4-taetigkeit-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--secondary);
  margin-top: 14px;
  margin-bottom: 4px;
}
.s4-taetigkeit-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
  background: #fff;
  color: var(--on-surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.s4-taetigkeit-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(0,124,176,0.12);
}

/* === ZUSAMMENFASSUNG === */
.zusammenfassung-liste { padding: 16px 16px 8px; }

.zusammen-ma-sektion { margin-bottom: 28px; }

.zusammen-ma-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 10px;
  padding: 0 2px;
}

.zusammen-ma-header span:first-child {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--primary);
}

.zusammen-ma-badge {
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  padding: 3px 10px;
  border-radius: 6px;
}

.zusammen-eintraege {
  background: var(--surface-container-low);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border-left: 4px solid var(--secondary);
}

.zusammen-eintrag {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
}

.zusammen-eintrag + .zusammen-eintrag {
  border-top: 1px solid rgba(0,0,0,0.05);
}

.zusammen-eintrag-info { flex: 1; }

.zusammen-eintrag-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--outline);
  margin-bottom: 2px;
  display: block;
}

.zusammen-eintrag-nr {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--on-surface);
  margin-bottom: 6px;
}

.zusammen-eintrag-detail {
  font-size: 0.78rem;
  color: var(--on-surface-variant);
  margin-top: 2px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.zusammen-eintrag-stunden {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--primary);
  margin-top: 6px;
}

.btn-edit-eintrag {
  background: #fff;
  border: 1px solid var(--outline-variant);
  border-radius: 6px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--primary);
  flex-shrink: 0;
  margin-left: 10px;
  transition: background 0.15s;
}
.btn-edit-eintrag:hover { background: var(--surface-container-high); }

.gesamt-bar {
  background: var(--primary);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  margin: 0 0 8px;
}

.gesamt-bar-wert {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--secondary);
}

/* === EDIT OVERLAY === */
.edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31,56,85,0.5);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.edit-overlay[hidden] { display: none; }

.edit-overlay-box {
  background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 -8px 40px rgba(31,56,85,0.2);
}

/* Footer innerhalb Overlays (nicht fixed) */
.overlay-footer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--outline-variant);
  background: var(--bg);
}
.overlay-footer .btn-danger { flex: 1; margin-top: 0; }
.overlay-footer .btn-primary { flex: 2; margin-top: 0; }

/* === SUCCESS SCREEN === */
.success-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}
.success-icon { font-size: 3rem; margin-bottom: 16px; }
.success-title { font-size: 1.4rem; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.success-sub { font-size: 0.9rem; color: var(--on-surface-variant); line-height: 1.5; }

/* === EDIT PROJEKT === */
.edit-projekt-label {
  padding: 12px 14px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--on-surface);
  background: #fff;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.edit-projekt-label::after {
  content: '▾';
  color: var(--secondary);
  font-size: 0.85rem;
}
.edit-projekt-label.open {
  border-color: var(--secondary);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.edit-projekt-liste {
  border: 1px solid var(--secondary);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: #fff;
  max-height: 180px;
  overflow-y: auto;
}
.edit-projekt-liste .projekt-option {
  padding: 11px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid var(--outline-variant);
  color: var(--on-surface);
}
.edit-projekt-liste .projekt-option:last-child { border-bottom: none; }
.edit-projekt-liste .projekt-option:hover,
.edit-projekt-liste .projekt-option.aktiv { background: rgba(0,124,176,0.08); color: var(--secondary); font-weight: 600; }

/* === MODUS POPUP === */
.modus-intro {
  font-size: 0.9rem;
  color: var(--on-surface-variant);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modus-intro strong { color: var(--primary); }

.modus-options { display: flex; flex-direction: column; gap: 10px; }

.modus-option {
  background: var(--surface-container-low);
  border: 2px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
  width: 100%;
}

.modus-option:hover, .modus-option:active {
  border-color: var(--secondary);
  background: #fff;
}

.modus-option-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 5px;
}

.modus-option-desc {
  font-size: 0.78rem;
  color: var(--on-surface-variant);
  line-height: 1.45;
}

/* === TOAST === */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 400;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(31,56,85,0.25);
}

/* ===== BERICHT ===== */
.bericht-screen { display: none; }
.bericht-screen.active { display: block; }

.bericht-filter {
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
}

.bericht-filter-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.bericht-filter-btn {
  flex: 1;
  padding: 8px 4px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}

.bericht-filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.bericht-custom-range {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.bericht-custom-range input[type="date"] {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
}

.bericht-liste {
  padding: 12px 16px;
  padding-bottom: calc(var(--nav-height) + 60px);
}

.bericht-loading {
  text-align: center;
  color: #94a3b8;
  padding: 32px 0;
  font-size: 0.9rem;
}

.bericht-leer {
  text-align: center;
  color: #94a3b8;
  padding: 32px 0;
  font-size: 0.9rem;
}

.bericht-eintrag {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.bericht-eintrag-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.bericht-eintrag-datum {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
}

.bericht-eintrag-stunden {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.bericht-eintrag-projekt {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 2px;
}

.bericht-eintrag-kommentar {
  font-size: 0.8rem;
  color: #64748b;
}

#bericht-gesamt {
  position: fixed;
  bottom: var(--nav-height);
  left: 0; right: 0;
}
}

/* ===== MATERIAL WIZARD ===== */
.mat-screen { display: none; }
.mat-screen.active { display: block; }

.mat-header {
  background: var(--primary);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.btn-back-light {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 0.8rem;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  padding: 4px 0;
}

.mat-header-info {
  flex: 1;
  overflow: hidden;
}

.mat-header-projekt {
  color: rgba(255,255,255,0.75);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mat-header-datum {
  color: #7dd3fc;
  font-size: 0.72rem;
}

.mat-modi {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.mat-modus-btn {
  flex: 1;
  padding: 8px 4px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.mat-modus-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Oft-benutzt Kategorie-Tabs */
.mat-kat-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 8px;
  scrollbar-width: none;
}

.mat-kat-tabs::-webkit-scrollbar { display: none; }

.mat-kat-tab {
  white-space: nowrap;
  border: 1.5px solid #cbd5e1;
  border-radius: 20px;
  padding: 5px 13px;
  font-size: 0.73rem;
  font-weight: 600;
  color: #64748b;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.mat-kat-tab.active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}

/* Artikel-Grid */
.mat-artikel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  max-height: 190px;
  overflow-y: auto;
  padding-right: 2px;
}

.mat-artikel-btn {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  word-break: break-word;
}

.mat-artikel-btn.selected {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}

/* Mengen-Box */
.mat-menge-box {
  background: #fff;
  border: 1.5px solid var(--primary);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 12px 0;
}

.mat-menge-label {
  font-size: 0.7rem;
  color: #64748b;
  margin-bottom: 6px;
}

.mat-menge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mat-menge-controls {
  display: contents;
}

.mat-menge-btn {
  background: #f1f5f9;
  border: none;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
}

.mat-menge-input {
  flex: 1;
  min-width: 0;
  text-align: center;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 4px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
}

.mat-einheit-select {
  flex: 1;
  min-width: 0;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 4px;
  font-size: 0.85rem;
  font-family: inherit;
}

.mat-einheit-badge {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--secondary);
  background: #e8f4fb;
  border-radius: 6px;
  padding: 6px 6px;
  text-align: center;
  min-width: 0;
}

.mat-hinzufuegen-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Wachsende Liste */
.mat-liste-label {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 6px;
}

.mat-liste-eintrag {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mat-liste-eintrag-name {
  font-size: 0.8rem;
  color: #1e293b;
  flex: 1;
}

.mat-liste-eintrag-menge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  margin-left: 8px;
}

/* Suche-Modus */
.mat-suche-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.mat-suche-liste {
  max-height: 200px;
  overflow-y: auto;
}

.mat-suche-item {
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  color: #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mat-suche-item:hover, .mat-suche-item.selected {
  background: #e0e7ef;
}

.mat-suche-item-einheit {
  font-size: 0.75rem;
  color: #64748b;
}

/* Freitext-Modus */
.mat-freitext-name {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  margin-bottom: 8px;
  box-sizing: border-box;
}

/* Zusammenfassung M3 */
.mat-sum-eintrag {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.mat-sum-eintrag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mat-sum-eintrag-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
}

.mat-sum-eintrag-menge {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 10px;
}

.mat-sum-eintrag-actions {
  display: flex;
  gap: 6px;
}

.mat-sum-btn-edit,
.mat-sum-btn-del {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
  border-radius: 4px;
}

.mat-sum-btn-edit:hover { background: #e0e7ef; }
.mat-sum-btn-del:hover { background: #fee2e2; }

.mat-sum-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.mat-leer {
  text-align: center;
  color: #94a3b8;
  padding: 32px 0;
  font-size: 0.9rem;
}
