* { box-sizing: border-box; margin: 0; padding: 0; }
button, [role="button"] { touch-action: manipulation; }

:root {
  --bg:            #f1f5f9;
  --bg2:           #ffffff;
  --bg3:           #f8fafc;
  --border:        #e2e8f0;
  --border2:       #cbd5e1;
  --text:          #0f172a;
  --text2:         #64748b;
  --text3:         #94a3b8;
  --primary:       #2563eb;
  --primary-light: #eff6ff;
  --accent:        #2563eb;
  --red:           #dc2626;
  --green:         #16a34a;
  --radius-sm:     4px;   /* Inputs, kleine Chips, Checkboxen */
  --radius-md:     8px;   /* Buttons, kleine Cards, kleine Modals */
  --radius-lg:     12px;  /* große Cards, Modals, Container */
  --radius-pill:   999px; /* Pills, Badges */
  --space-1:       4px;
  --space-2:       8px;
  --space-3:       12px;
  --space-4:       16px;
  --space-5:       24px;
  --space-6:       32px;
}

body {
  font-family: 'Inter Variable', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  min-height: 100dvh;
}

.topbar {
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  padding: 0 16px;
  display: flex;
  align-items: center;
  height: 52px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: rgba(0,0,0,.15) 0px 2px 4px 0px;
}
.topbar-logo { font-weight: 800; font-size: 15px; letter-spacing: -.3px; white-space: nowrap; color: #f8fafc; }
.topbar-logo span { color: var(--primary); }
.topbar-nav { display: flex; gap: 2px; margin-left: 6px; }
.nav-btn {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
  transition: background .1s, color .1s;
  white-space: nowrap;
}
.nav-btn:hover { background: #1e293b; color: #f8fafc; }
.nav-btn.active { background: #1d4ed8; color: #ffffff; font-weight: 600; }
.topbar-spacer { flex: 1; }
.date-controls { display: flex; align-items: center; gap: 6px; position: relative; }
.date-nav {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  color: #94a3b8;
  transition: border-color .1s, color .1s;
  line-height: 1;
}
.date-nav:hover { border-color: #93c5fd; color: #93c5fd; }
.date-display {
  font-weight: 600;
  font-size: 13px;
  min-width: 180px;
  text-align: center;
  padding: 5px 12px;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: #1e293b;
  color: #f8fafc;
  user-select: none;
  transition: border-color .1s;
}
.date-display:hover { border-color: #93c5fd; }

.dp-popup {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: rgba(15,23,42,.15) 0px 4px 32px 0px;
  z-index: 1000;
  padding: 12px;
  width: 260px;
}
.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.dp-header-label {
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
}
.dp-header-label:hover { background: var(--bg); }
.dp-nav { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px 8px; cursor: pointer; font-size: 12px; color: var(--text2); }
.dp-nav:hover { border-color: var(--primary); color: var(--primary); }

.dp-weekdays {
  display: grid;
  grid-template-columns: 32px repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.dp-wd { text-align: center; font-size: 10px; font-weight: 700; color: var(--text2); padding: 2px; text-transform: uppercase; }
.dp-wd.kw-label { color: transparent; font-size: 9px; }
.dp-grid {
  display: grid;
  grid-template-columns: 32px repeat(7, 1fr);
  gap: 2px;
}
.dp-kw { font-size: 9px; font-weight: 700; color: var(--text3); text-align: center; padding: 5px 2px; }
.dp-day {
  text-align: center;
  padding: 5px 2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: background .1s;
}
.dp-day:hover { background: var(--primary-light); color: var(--primary); }
.dp-day.today { font-weight: 700; color: var(--primary); }
.dp-day.selected { background: var(--primary); color: #ffffff; }
.dp-day.other-month { color: var(--text3); }
.dp-day.weekend { color: var(--text2); }
.dp-day.selected.weekend { color: #ffffff; }

.dp-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.dp-month {
  text-align: center;
  padding: 8px 4px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}
.dp-month:hover { background: var(--primary-light); color: var(--primary); }
.dp-month.selected { background: var(--primary); color: #ffffff; }
.dp-month.current-month { font-weight: 700; }

.main { display: flex; height: calc(100dvh - 52px); overflow: hidden; }

.sidebar {
  width: 190px;
  border-right: 1px solid var(--border);
  background: var(--bg2);
  padding: 14px 12px;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
@media (max-width: 767px) {
  .sidebar {
    display: none;
    position: absolute;
    top: 52px;
    left: 0;
    z-index: 20;
    height: calc(100dvh - 52px);
    box-shadow: 4px 0 16px rgba(0,0,0,.18);
  }
  .sidebar.mobile-open { display: flex; }
  #sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 52px 0 0 0;
    z-index: 19;
    background: rgba(0,0,0,.25);
  }
  #sidebar-backdrop.active { display: block; }
  #btn-sidebar-toggle { display: inline-flex !important; }
  .topbar-nav { display: none; }
  #sync-badge { display: none; }
  #topbar-brand { display: none !important; }
  #btn-undo { display: none !important; }
  #help-btn { display: none !important; }
  #btn-screenshot { display: none !important; }
  #topbar-username { display: none; }
  .date-display { min-width: 80px !important; padding: 4px 7px !important; font-size: 11px !important; }
  .topbar { padding: 0 6px; gap: 3px; }
  .card-grid-2 { grid-template-columns: 1fr !important; }
}
.sidebar-section { margin-bottom: 18px; }
.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text2);
  margin-bottom: 7px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 12px;
}
.stat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  flex-shrink: 0;
}
.stat-val { font-weight: 700; font-size: 13px; }
.sidebar-sep { border: none; border-top: 1px solid var(--border); margin: 10px 0; }

.btn-export {
  width: 100%;
  margin-top: 8px;
  padding: 9px 10px;
  min-height: 38px;
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .15s, transform .08s;
  -webkit-tap-highlight-color: transparent;
}
.btn-export:hover  { background: var(--primary-light); color: #1d4ed8; }
.btn-export:active { transform: scale(.98); }
@media (max-width: 768px) { .btn-export { min-height: 44px; } }

.content { flex: 1; overflow: auto; padding: 14px 18px calc(72px + env(safe-area-inset-bottom)); }

.group-summary-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.group-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.group-chip-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.group-chip-label { color: var(--text2); }
.group-chip-count { font-weight: 700; }

/* v1.12.15: In .tag-filter-bar das geerbte margin-left:auto neutralisieren — die Buttons
   sollen linksbündig unter den Counter-Chips starten, nicht jeder erste rechtsbündig. */
.tag-filter-bar > .filter-btn { margin-left: 0; }
.filter-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 14px;
  min-height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: white;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text2);
  font-weight: 500;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
  -webkit-tap-highlight-color: transparent;
}
.filter-btn:hover  { border-color: var(--primary); color: var(--primary); }
.filter-btn:active { transform: scale(.97); }
.filter-btn:disabled { opacity: .45; cursor: not-allowed; }
.filter-btn.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); font-weight: 600; }
@media (max-width: 768px) { .filter-btn { min-height: 36px; } }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg2);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: none;
}
thead tr { background: #f8fafc; }
th {
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text2);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
td { padding: 5px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfd; }

tr.group-header td {
  background: #f1f5f9;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
}
tr.group-header:hover td { background: #f1f5f9; }

tr.group-summary td {
  background: #fafbff;
  font-size: 11px;
  color: var(--text2);
  padding: 4px 10px;
  border-bottom: 2px solid var(--border);
  font-style: italic;
}
tr.group-summary:hover td { background: #fafbff; }

.gruppe-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

.status-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-md);
  white-space: nowrap;
}
.s-Anwesend     { background: #dcfce7;  color: #15803d; }
.s-Frei         { background: #f1f5f9;  color: #64748b; }
.s-Urlaub       { background: #dbeafe;  color: #1d4ed8; }
.s-KRO          { background: #fee2e2;  color: #dc2626; }
.s-KRA          { background: #fee2e2;  color: #ef4444; }
.s-KKR          { background: #fef2f2;  color: #f87171; }
.s-KRU          { background: #fff1f2;  color: #be123c; }
.kru-row{display:grid;grid-template-columns:1fr 1fr;gap:10px;grid-column:1/-1}.kru-row label{color:#be123c}
.s-Stundenabbau { background: #e0e7ff;  color: #4338ca; }
.s-WF           { background: #bfdbfe;  color: #1e40af; }
.s-Lehrgang     { background: #cffafe;  color: #0e7490; }
.s-TEVD         { background: #e0e7ff;  color: #4338ca; }
.s-TEFB         { background: #eef2ff;  color: #4f46e5; }
.s-VD           { background: #dbeafe;  color: #1d4ed8; }
.s-KBS          { background: #eef2ff;  color: #6366f1; }
.s-KBNSo        { background: #f5f3ff;  color: #7c3aed; }
.s-KBNWi        { background: #ede9fe;  color: #7c3aed; }

select, input[type="time"], input[type="text"] {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 12px;
  background: var(--bg3);
  color: var(--text);
  font-family: inherit;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.time-input { width: 86px; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.time-input::placeholder { color: var(--border2); font-size: 11px; letter-spacing: 0; }
.status-select { min-width: 120px; }
.bemerk-input { width: 130px; }

.cell-total  { font-weight: 600; }
.warn-tuerkis      { background: #cffafe !important; color: #0e7490 !important; border-color: #67e8f9 !important; }
.warn-tuerkis-card { background: linear-gradient(180deg, #ecfeff 0%, #cffafe 100%) !important; border-color: #67e8f9 !important; }
.cell-dash   { color: var(--border2); }

tr.wochenende td { background: #f8fafc; }
tr.heute td { background: rgba(37,99,235,.04) !important; border-bottom-color: rgba(37,99,235,.15) !important; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); }
.empty-state h3 { font-size: 15px; margin-bottom: 6px; color: var(--text); }

.mgmt-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.card-title { font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.beamter-list { display: flex; flex-direction: column; gap: 6px; max-height: 75vh; overflow-y: auto; }
.beamter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg3);
}
.beamter-name { flex: 1; font-weight: 500; }
.beamter-meta { font-size: 11px; color: var(--text2); white-space: nowrap; }
.beamter-actions { display: flex; gap: 4px; flex-shrink: 0; }
.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 10px;
  min-height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg3);
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  color: var(--text2);
  transition: border-color .15s, color .15s, background .15s, transform .08s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-sm:hover  { border-color: var(--primary); color: var(--primary); }
.btn-sm:active { transform: scale(.97); }
.btn-sm.danger:hover { border-color: var(--red); color: var(--red); background: #fff5f5; }
.btn-sm:disabled { opacity: .45; cursor: not-allowed; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  min-height: 32px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s, transform .08s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn:hover    { border-color: var(--primary); color: var(--primary); }
.btn:active   { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-xs       { padding: 4px 8px;  min-height: 26px; font-size: 11px; gap: 4px; }
.btn-md       { padding: 8px 16px; min-height: 38px; font-size: 13px; gap: 6px; }
.btn-ghost    { background: transparent; }
.btn-ghost:hover  { background: var(--bg3); }
.btn-danger   { color: var(--red);   border-color: #fca5a5; background: #fff5f5; }
.btn-danger:hover { color: var(--red); border-color: var(--red); background: #fef2f2; }
.btn-success  { color: var(--green); border-color: #86efac; background: #f0fdf4; }
.btn-success:hover { color: var(--green); border-color: var(--green); background: #ecfdf5; }
.btn-solid    { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-solid:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text2);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .08s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.icon-btn:hover  { background: var(--bg3); color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger:hover { background: #fef2f2; }

.btn-primary.btn-inline { width: auto; }

.split-2col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.split-2col-divider > * + * { padding-left: var(--space-4); border-left: 1px solid var(--border); }
.split-2col-divider > *:first-child { padding-right: var(--space-4); }
@media (max-width: 768px) {
  .split-2col { grid-template-columns: 1fr; gap: var(--space-4); }
  .split-2col-divider > * + * { padding-left: 0; border-left: none; border-top: 1px solid var(--border); padding-top: var(--space-4); }
  .split-2col-divider > *:first-child { padding-right: 0; }
}

.mw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
@media (max-width: 480px) {
  .mw-grid { grid-template-columns: 1fr; gap: var(--space-3); }
}

.btn-primary, .btn-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  transition: background .15s, border-color .15s, color .15s, transform .08s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:active, .btn-cancel:active { transform: scale(.97); }
.btn-primary:disabled, .btn-cancel:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 768px) {
  .btn-primary, .btn-cancel { min-height: 44px; }
  .btn-md   { min-height: 44px; }
  .btn      { min-height: 40px; }
  .btn-sm   { min-height: 36px; }
  .btn-xs   { min-height: 32px; }
  .icon-btn { width: 40px; height: 40px; }
}

.form-group { margin-bottom: 12px; }
.form-label { font-size: 11px; font-weight: 600; color: var(--text2); margin-bottom: var(--space-1); display: block; text-transform: uppercase; letter-spacing: .04em; }
.form-input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 13px; font-family: inherit; background: var(--bg3); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.form-input:disabled { opacity: .55; cursor: not-allowed; background: var(--bg); }

.input {
  width: 100%;       /* v1.10.2: füllt Container — verhindert Overflow in 2-Spalten-Layouts */
  max-width: 100%;
  padding: 6px 10px;
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg2);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.input:focus    { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.input:disabled { opacity: .55; cursor: not-allowed; background: var(--bg); }
.input-sm { padding: 4px 8px; min-height: 28px; font-size: 12px; }
@media (max-width: 768px) {
  .form-input, .input { font-size: 16px; min-height: 40px; } /* verhindert iOS auto-zoom */
  .input-sm           { font-size: 14px; min-height: 36px; }
}

.checkbox {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
@media (max-width: 768px) { .checkbox { width: 18px; height: 18px; } }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); cursor: pointer; }
@media (max-width: 768px) {
  input[type="checkbox"], input[type="radio"] { min-width: 18px; min-height: 18px; }
}

.monat-tfoot-print { display: none; }

.tabbar {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 100%;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
}
.tabbar::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  min-height: 30px;
  flex: 1 1 0;
  background: transparent;
  border: none;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s, transform .08s;
  -webkit-tap-highlight-color: transparent;
}
.tab:hover        { color: var(--text); background: var(--bg3); }
.tab:active       { transform: scale(.98); }
.tab.active       { color: var(--text); font-weight: 600; background: var(--bg2); }
.tab.active:hover { background: var(--bg2); }
@media (max-width: 768px) {
  .tab { min-height: 36px; padding: 7px 12px; }
}
.plan-konto-value{font-size:clamp(14px,5vw,22px);white-space:normal;word-break:break-word}
@media (max-width:600px){
.card-row-actions{width:100%!important;justify-content:flex-start!important;flex-wrap:wrap}
.plan-konto-box{padding:12px 8px!important}
.plan-konto-grid{gap:6px!important}
.grid-3-mobile-stack{grid-template-columns:1fr 1fr!important}
.duz-cond-row{flex-direction:column!important;align-items:flex-start!important;gap:2px!important}
.duz-cond-row>span:last-child{padding-left:0!important}
.sperre-form{grid-template-columns:1fr!important}
}
.sperre-form{margin-top:12px;display:grid;grid-template-columns:1fr 1fr;gap:10px;align-items:end}
.sperre-form label{font-size:11px;color:var(--text2);display:flex;flex-direction:column;gap:3px;min-width:0}
.sperre-input{width:100%;min-width:0;box-sizing:border-box;padding:7px 10px;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--bg3);font:14px/1.2 inherit;min-height:0;-webkit-appearance:none;appearance:none}
.sperre-input:focus{outline:none;border-color:var(--primary)}
@media (max-width: 420px) {
  .grid-3-mobile-stack { grid-template-columns: 1fr !important; }
}
html, body { overflow-x: hidden; max-width: 100vw; position: relative; }
.content { max-width: 100%; overflow-x: hidden; }
@media (max-width: 768px) {
  .content > * { max-width: 100%; }
  .content > div[style*="display:flex"]:not([style*="wrap"]) { flex-wrap: wrap; }
}
.btn-primary { width: 100%; padding: 9px 16px; background: var(--primary); color: #ffffff; border: none; border-radius: var(--radius-md); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; letter-spacing: -0.1px; }
.btn-primary:hover { background: #1d4ed8; }
.btn-cancel { width: 100%; padding: 9px 16px; background: var(--bg3); color: var(--text2); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 13px; cursor: pointer; font-family: inherit; margin-top: 6px; }

.month-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  background: var(--bg2);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.month-stat { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 4px; }
.month-stat strong { color: var(--text); }

.monat-switch { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.monat-switch button {
  padding: 4px 12px; font-size: 12px; font-weight: 500; border: none; cursor: pointer;
  background: var(--bg3); color: var(--text2); transition: background .1s, color .1s;
}
.monat-switch button.ms-active {
  background: var(--primary); color: #fff; font-weight: 700;
}

.mg-table-wrap { overflow-x: auto; }
.mg-table {
  border-collapse: collapse; font-size: 11px; background: var(--bg3);
  border-radius: var(--radius-md); overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.mg-table th {
  padding: 4px 3px; text-align: center; font-weight: 600;
  color: var(--text2); background: var(--bg2); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.mg-table td {
  padding: 2px 3px; border-bottom: 1px solid var(--border); text-align: center; vertical-align: middle;
}
.mg-table .mg-name-th { text-align: left; padding: 4px 8px; min-width: 130px; }
.mg-table .mg-name-td { text-align: left; padding: 3px 8px; white-space: nowrap; }
.mg-table .mg-we { background: #f1f5f9; }
.mg-table .mg-feiertag { background: #fef9ec; }
.mg-table .mg-today-col { background: #eff6ff !important; }
.mg-table .mg-sep td {
  background: var(--bg2); font-size: 11px; font-weight: 700; color: var(--text2);
  padding: 4px 8px; border-top: 2px solid var(--border);
}
.mg-pill {
  display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 5px;
  border-radius: var(--radius-md); white-space: nowrap; cursor: pointer; line-height: 1.3;
}
.mg-pill-dash { color: #cbd5e1; font-size: 12px; }
.mg-rolle-badge {
  display: inline-block; font-size: 9px; font-weight: 700; padding: 1px 4px;
  border-radius: var(--radius-sm); background: #e0e7ff; color: #4338ca; margin-left: 4px;
  vertical-align: middle;
}

#ge-preview table { border-collapse: collapse; width: 100%; font-size: 12px; margin-top: 8px; }
#ge-preview th { background: var(--bg2); padding: 4px 8px; font-weight: 600; text-align: left; border-bottom: 1px solid var(--border); }
#ge-preview td { padding: 4px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ge-warn-error { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; border-radius: var(--radius-sm); padding: 5px 10px; font-size: 12px; margin-bottom: 4px; }
.ge-warn-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; border-radius: var(--radius-sm); padding: 5px 10px; font-size: 12px; margin-bottom: 4px; }

.absence-wrap { overflow-x: auto; }
.absence-table {
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  font-size: 12px;
  min-width: 900px;
}
.absence-table th {
  padding: 6px 4px;
  text-align: center;
  font-weight: 600;
  color: var(--text2);
  border-bottom: 2px solid var(--border);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-right: 1px solid var(--border);
  min-width: 32px;
}
.absence-table th.row-label { min-width: 110px; text-align: left; padding-left: 12px; }
.absence-table td {
  padding: 5px 4px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border2);
  vertical-align: middle;
}
.absence-table td.row-label { text-align: left; padding-left: 12px; font-weight: 600; font-size: 11px; border-right: 1px solid var(--border); }
.absence-table tr:last-child td { border-bottom: none; }

.abs-cell { width: 32px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); font-weight: 700; font-size: 12px; margin: 1px auto; }
.abs-ok     { background: #dcfce7;  color: #15803d; }
.abs-warn   { background: #fef9c3;  color: #a16207; }   /* > 5 */
.abs-danger { background: #fee2e2;  color: #dc2626; }   /* ≥ 7 */
.abs-zero   { color: var(--border2); }
.abs-we     { color: var(--text3); font-weight: 400; }
.abs-header-we { background: var(--bg3); }

.abs-total-row td { background: var(--bg3); font-weight: 700; border-top: 1px solid var(--border); }
.abs-total-cell { cursor: pointer; transition: background 0.12s; }
.abs-total-cell:hover { background: #eff6ff !important; }
.abs-total-cell.abs-day-selected { background: #dbeafe !important; }

.group-row-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 360px;
  max-width: 92vw;     /* v1.10: Mobile-safe — verhindert horizontalen Overflow */
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: rgba(15,23,42,.15) 0px 4px 32px 0px;
  position: relative;  /* v1.10: ermöglicht .modal-close-x positionierung */
}
.modal.modal-sm { width: 380px; }
.modal.modal-md { width: 520px; }
.modal.modal-lg { width: 680px; }
.modal.modal-xl { width: 900px; }

.modal-close-x {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text2);
  transition: background .15s, color .15s, transform .08s;
  -webkit-tap-highlight-color: transparent;
}
.modal-close-x:hover  { background: var(--bg3); color: var(--text); }
.modal-close-x:active { transform: scale(.92); }
@media (max-width: 768px) {
  .modal-close-x { width: 40px; height: 40px; top: 8px; right: 8px; }
  .modal { padding: 20px; }
}

.modal-title { font-weight: 600; font-size: 15px; margin-bottom: 18px; color: var(--text); letter-spacing: -0.13px; padding-right: 36px; }

.hidden { display: none !important; }

.birthday-badge {
  display: inline-block;
  margin-left: 5px;
  font-size: 13px;
  vertical-align: middle;
  animation: bday-pop .4s ease;
}
@keyframes bday-pop {
  0%   { transform: scale(0.5); opacity:0; }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1);   opacity:1; }
}
.birthday-row td:first-child { background: rgba(37,99,235,.08) !important; }

.gesund-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.gesund-row:last-child { border-bottom: none; }
.gesund-row input[type=checkbox] { width: 17px; height: 17px; cursor: pointer; flex-shrink: 0; }
.gesund-row label { cursor: pointer; flex: 1; }

.db-page { padding: 16px; max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.db-block { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.db-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.db-block-title { font-size: 13px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.db-block-body { padding: 14px 16px; }
.db-block-empty { padding: 14px 16px; color: var(--text2); font-size: 12px; font-style: italic; }

.db-dienst-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.db-dienst-table th { padding: 5px 8px; background: var(--bg3); border-bottom: 2px solid var(--border); font-size: 10px; text-transform: uppercase; font-weight: 600; color: var(--text2); white-space: nowrap; }
.db-dienst-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.db-dienst-table tr:last-child td { border-bottom: none; }
.db-dienst-table tr.db-group-header td { background: var(--bg3); font-weight: 700; font-size: 11px; text-transform: uppercase; color: var(--text2); padding: 4px 8px; }
.db-dienst-table tr.birthday-row { background: #fefce8; }

.db-vg-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.db-vg-table th { padding: 5px 8px; background: var(--bg3); border-bottom: 2px solid var(--border); font-size: 10px; text-transform: uppercase; font-weight: 600; color: var(--text2); }
.db-vg-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.db-vg-table tr:last-child td { border-bottom: none; }

.db-mdm-img { width: 100%; max-height: 400px; object-fit: contain; border-radius: var(--radius-md); display: block; margin-bottom: 10px; background: var(--bg3); }
.db-mdm-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.db-mdm-text { font-size: 13px; color: var(--text2); }
.db-mdm-edit { background: var(--bg3); border-top: 1px solid var(--border); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }

.db-gesund-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.db-gesund-row:last-child { border-bottom: none; }

#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--bg, #f1f5f9);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  padding: 48px 24px 32px;
}
#login-overlay.hidden { display: none; }
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 32px rgba(0,0,0,.09);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo-title {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.5px;
}
.login-logo-sub {
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px;
}
.login-card-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
  color: var(--text);
}
.login-card-sub {
  color: var(--text2);
  font-size: 12px;
  margin-bottom: 20px;
  line-height: 1.6;
}
.login-error {
  color: var(--red);
  font-size: 12px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(220,38,38,.06);
  border: 1px solid rgba(220,38,38,.2);
  border-radius: var(--radius-md);
}
.pw-strength { height: 3px; border-radius: var(--radius-sm); margin-top: 4px; transition: background .2s, width .2s; }
.auth-badge {
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  white-space: nowrap;
  transition: opacity .15s;
}
.auth-badge:hover { opacity: .8; }
.auth-badge-master { background: rgba(15,23,42,.12); color: #0f172a; border-color: rgba(15,23,42,.25); }
.auth-badge-gelb   { background: rgba(234,179,8,.12); color: #854d0e; border-color: rgba(234,179,8,.35); }
.auth-badge-rot    { background: rgba(220,38,38,.1);  color: #dc2626; border-color: rgba(220,38,38,.25); }
.auth-badge-blau   { background: rgba(37,99,235,.1);  color: #1d4ed8; border-color: rgba(37,99,235,.25); }
.auth-badge-adler  { background: rgba(124,58,237,.1); color: #7c3aed; border-color: rgba(124,58,237,.25); }
.auth-badge-view   { background: rgba(100,116,139,.1);color: #475569; border-color: rgba(100,116,139,.25); }

#topbar-user { display:none; align-items:center; gap:7px; cursor:pointer; padding:3px 10px 3px 3px; border-radius:var(--radius-pill); border:1.5px solid rgba(59,130,246,.35); background:rgba(59,130,246,.08); transition:background .15s,border-color .15s; text-decoration:none; }
#topbar-user:hover { background:rgba(59,130,246,.16); border-color:rgba(59,130,246,.6); }
#topbar-avatar { width:26px; height:26px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:11px; color:#fff; flex-shrink:0; box-shadow:0 0 0 2px #0f172a,0 0 0 3.5px rgba(59,130,246,.55); }
#topbar-username { font-size:12px; color:#cbd5e1; max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#notif-btn { position:relative; display:none; align-items:center; justify-content:center; background:none; border:none; color:#94a3b8; font-size:17px; cursor:pointer; padding:4px 8px; border-radius:var(--radius-md); transition:background .15s; }
#notif-btn:hover { background:rgba(255,255,255,.08); }
#help-btn { display:flex; align-items:center; justify-content:center; background:none; border:none; color:#94a3b8; cursor:pointer; padding:4px 8px; border-radius:var(--radius-md); transition:background .15s,color .15s; text-decoration:none; flex-shrink:0; }
#help-btn:hover { background:rgba(255,255,255,.08); color:#f8fafc; }
#notif-badge { position:absolute; top:1px; right:1px; min-width:16px; height:16px; background:#ef4444; color:#fff; border-radius:var(--radius-md); font-size:9px; font-weight:700; line-height:16px; text-align:center; padding:0 3px; display:none; pointer-events:none; }
#notif-panel { position:fixed; top:50px; right:12px; width:340px; max-height:480px; background:var(--bg2); border:1px solid var(--border2); border-radius:var(--radius-lg); box-shadow:0 8px 32px rgba(0,0,0,.18); z-index:1200; display:none; flex-direction:column; overflow:hidden; }
#notif-panel.open { display:flex; }
.notif-item { padding:10px 14px; border-bottom:1px solid var(--border); }
.notif-item.unread { background:#eff6ff; }
.notif-item-head { display:flex; align-items:center; gap:6px; margin-bottom:var(--space-1); }
.notif-typ-badge { font-size:10px; font-weight:700; padding:1px 6px; border-radius:var(--radius-sm); color:#fff; }
.notif-time { font-size:10px; color:var(--text3); margin-left:auto; white-space:nowrap; }
.notif-text { font-size:12px; color:var(--text); line-height:1.4; }
.notif-detail { font-size:11px; color:var(--text2); margin-top:2px; }

.setup-step-ind { font-size:11px; color:var(--text3); font-weight:600; text-transform:uppercase; letter-spacing:.5px; margin-bottom:16px; }
.setup-token-box { background:#0f172a; color:#a5f3fc; font-family:monospace; font-size:19px; font-weight:700; letter-spacing:3px; border-radius:var(--radius-md); padding:14px 20px; text-align:center; margin:12px 0; border:1px solid #1e3a5f; word-break:break-all; }
.login-step-back { background:none; border:none; color:var(--text2); font-size:12px; cursor:pointer; padding:0; margin-top:10px; }
.login-step-back:hover { color:var(--primary); }
.login-has-badge { display:inline-block; padding:2px 8px; border-radius:var(--radius-sm); font-size:11px; font-weight:600; }

#readonly-notice {
  background: rgba(37,99,235,.06);
  border-bottom: 1px solid rgba(37,99,235,.18);
  padding: 6px 18px;
  font-size: 12px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
#readonly-notice:hover { background: rgba(37,99,235,.1); }
.sync-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  min-height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg3);
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  color: var(--text2);
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .08s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.sync-btn:hover  { border-color: var(--primary); color: var(--primary); }
.sync-btn:active { transform: scale(.97); }
.sync-btn:disabled { opacity: .45; cursor: not-allowed; }
.sync-btn.edit-active { background: rgba(220,38,38,.1); color: #dc2626; border-color: rgba(220,38,38,.25); font-weight: 600; }
@media (max-width: 768px) { .sync-btn { min-height: 36px; } }
body.read-only-mode .content select,
body.read-only-mode .content input[type="time"],
body.read-only-mode .content input[type="text"],
body.read-only-mode .content input[type="number"] {
  pointer-events: none;
  opacity: 0.45;
}
body.read-only-mode .btn-primary,
body.read-only-mode .btn-danger,
body.read-only-mode .filter-btn { pointer-events: none; opacity: 0.4; }
body.read-only-mode #profil-pw-save-btn,
body.read-only-mode #vg-save-btn,
body.read-only-mode #vg-add-btn,
body.read-only-mode #sport-add-btn,
body.read-only-mode #sport-save-btn,
body.read-only-mode #urlaub-jahr-filter-bar .filter-btn,
body.read-only-mode .filter-btn.view-allowed { pointer-events: auto !important; opacity: 1 !important; }
body.read-only-mode #login-overlay .btn-primary,
body.read-only-mode #login-overlay input,
body.read-only-mode #login-overlay select { pointer-events: auto !important; opacity: 1 !important; }
body.read-only-mode #modal-sport-eintrag select,
body.read-only-mode #modal-sport-eintrag input { pointer-events: auto !important; opacity: 1 !important; }
body.read-only-mode #modal-sport-eintrag .btn-primary { pointer-events: auto !important; opacity: 1 !important; }
body.read-only-mode .content select.view-allowed { pointer-events: auto !important; opacity: 1 !important; }
body.read-only-mode #urlaub-filter-bar select,
body.read-only-mode #urlaub-filter-bar .filter-btn { pointer-events: auto !important; opacity: 1 !important; }
body.read-only-mode .urlaub-year-bar select { pointer-events: auto !important; opacity: 1 !important; }
body.mat-va-mode #mat-modal select,
body.mat-va-mode #mat-modal input,
body.mat-va-mode #mat-modal textarea,
body.mat-va-mode #mat-modal .btn-primary { pointer-events: auto !important; opacity: 1 !important; }
body.mat-va-mode .content #material-gruppe-filter,
body.mat-va-mode .content [onclick*="openMatModal"],
body.mat-va-mode .content [onclick*="openWartungModal"],
body.mat-va-mode .content [onclick*="matAussondern"],
body.mat-va-mode .content [onclick*="matReaktivieren"] { pointer-events: auto !important; opacity: 1 !important; }

.card-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }

.urlaub-year-bar { display:flex; align-items:center; gap:12px; margin-bottom:24px; flex-wrap:wrap; }
.urlaub-section  { margin-bottom: 40px; }
.urlaub-month-title {
  font-size:13px; font-weight:600; color:var(--primary);
  padding:6px 0 6px; border-bottom:1px solid var(--border); margin-bottom:8px;
  letter-spacing:-0.13px;
}
.urlaub-wrap { overflow-x:auto; }
.urlaub-table { border-collapse:collapse; font-size:11px; white-space:nowrap; }
.urlaub-table th {
  border:1px solid var(--border); padding:3px 2px; text-align:center;
  font-weight:500; color:var(--text2); background:var(--bg2);
}
.urlaub-table td { border:1px solid var(--border); padding:0; text-align:center; }
.urlaub-name {
  text-align:left !important; padding:3px 8px !important;
  min-width:130px; font-weight:500; font-size:11px; color:var(--text);
}
.urlaub-group-sep td {
  background:var(--bg2); font-size:10px; font-weight:600;
  text-transform:uppercase; letter-spacing:.05em;
  color:var(--text2); padding:3px 8px; text-align:left;
}
.urlaub-cell {
  width:26px; min-width:26px; height:22px;
  cursor:pointer; font-size:10px; font-weight:600;
  transition:filter .1s; position:relative;
}
.urlaub-cell:hover:not(.u-we) { filter:brightness(.88); }
.urlaub-cell.u-urlaub    { background:#dbeafe;  color:#1d4ed8; }
.urlaub-cell.u-green     { background:#dcfce7;  color:#15803d; }
.urlaub-cell.u-yellow    { background:#fef9c3;  color:#a16207; }
.urlaub-cell.u-red       { background:#fee2e2;  color:#dc2626; }
.urlaub-cell.u-we-urlaub { background:#bfdbfe;  color:#1d4ed8; cursor:pointer; }
.urlaub-cell.u-aza       { background:#e0e7ff;  color:#4338ca; cursor:default; }
.gt-row td { background:rgba(94,106,210,.1); border-left:3px solid var(--accent) !important; }
.gt-row td:first-child { border-left:3px solid var(--accent) !important; }
.urlaub-cell.u-sperre    {
  background: repeating-linear-gradient(45deg, rgba(220,38,38,.18), rgba(220,38,38,.18) 3px, transparent 3px, transparent 7px);
  cursor: not-allowed !important; color:#dc2626; font-size:8px;
}
.urlaub-cell.u-sperre:hover { filter:none !important; }
.urlaub-cell.u-changed   { background:#fee2e2; color:#dc2626; }
.urlaub-cell.u-changed::after {
  content:''; position:absolute; top:50%; left:10%; right:10%;
  height:2px; background:#dc2626; opacity:.7;
}
.urlaub-cell.u-other   { background:#f5f3ff; color:#7c3aed; font-size:9px; }
.urlaub-cell.u-we      { background:var(--bg3); color:var(--text2); cursor:default; }
.urlaub-th-we          { background:var(--bg3) !important; color:var(--text2) !important; }
.urlaub-soll-table { width:100%; border-collapse:collapse; font-size:12px; }
.urlaub-soll-table th, .urlaub-soll-table td { border:1px solid var(--border); padding:4px 8px; }
.urlaub-soll-table th { background:var(--bg2); font-weight:500; text-align:left; font-size:11px; color:var(--text2); text-transform:uppercase; }
.urlaub-soll-table td { text-align:center; }
.urlaub-soll-table td:first-child { text-align:left; }
.sperre-item { display:flex; align-items:center; gap:10px; padding:5px 0; border-bottom:1px solid var(--border); font-size:12px; }
.sperre-item:last-child { border-bottom:none; }

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(60px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 200;
  box-shadow: 0 -1px 0 var(--border);
}
.bnav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text2);
  font-family: inherit;
  padding: 4px 2px;
  transition: color .15s;
  min-width: 0;
  position: relative;
}
.bnav-btn:hover { color: var(--text); }
.bnav-btn.active { color: var(--primary); }
.bnav-btn.active::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--primary);
  border-radius: 0 0 2px 2px;
}
.bnav-btn svg { flex-shrink: 0; }
.bnav-label { font-size: 10px; font-weight: 500; letter-spacing: -0.1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 54px; }

.import-stat { display:flex; justify-content:space-between; align-items:center; padding:5px 0; border-bottom:1px solid var(--border); font-size:12px; color:var(--text2); }
.import-stat:last-child { border:none; }
.import-stat strong { color:var(--text); font-weight:600; }

#bnav-mehr-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
}
#bnav-mehr-backdrop.active { display: block; }
#bnav-mehr-menu {
  display: none;
  position: fixed;
  bottom: calc(60px + env(safe-area-inset-bottom));
  right: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,.14);
  padding: 10px;
  z-index: 201;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 222px;
}
#bnav-mehr-menu.open { display: grid; }
.bnav-mehr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: var(--radius-md);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text2);
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.bnav-mehr-item:hover { background: var(--bg3); color: var(--text); }
.bnav-mehr-item.active { background: #eff6ff; color: var(--primary); }
.bnav-mehr-item svg { flex-shrink: 0; }
@media (max-width: 767px) {
  .bnav-secondary { display: none !important; }
  #nav-mehr { display: flex !important; }
}
@media (min-width: 768px) {
  #nav-mehr { display: none !important; }
  #bnav-mehr-menu, #bnav-mehr-backdrop { display: none !important; }
}
@media (max-width: 767px) {
  .form-input,
  input[type="password"],
  input[type="date"],
  input[type="email"] { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
