/* ============================================================================
   STORNI HAUSHALT — ARCHITECTURAL STUDIO INTERFACE (INTER + JETBRAINS MONO)
   ============================================================================ */

:root,
[data-theme="light"] {
  --bg: #F2F4F7;
  --surface: #FFFFFF;
  --surface-subtle: #F8FAFC;
  --surface-hover: #F1F5F9;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  --ink: #0F172A;
  --ink-secondary: #475569;
  --ink-muted: #64748B;

  --sidebar-bg: #11161D;
  --sidebar-surface: #1A222D;
  --sidebar-border: #252F3D;
  --sidebar-ink: #F8FAFC;
  --sidebar-muted: #94A3B8;

  --primary: #0F172A;
  --primary-hover: #1E293B;
  --primary-ink: #FFFFFF;

  --accent: #0D7A5F;
  --accent-hover: #0A634D;
  --accent-soft: #DCFCE7;
  --accent-ink: #065F46;

  --blue: #1D4ED8;
  --blue-soft: #DBEAFE;

  --warn: #B45309;
  --warn-soft: #FEF3C7;

  --danger: #BE123C;
  --danger-hover: #9F1239;
  --danger-soft: #FFE4E6;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 28px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.22);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 11px;
  --radius-lg: 14px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg: #0B0F15;
  --surface: #131922;
  --surface-subtle: #19212D;
  --surface-hover: #202A38;
  --border: #253041;
  --border-strong: #34435A;

  --ink: #F1F5F9;
  --ink-secondary: #94A3B8;
  --ink-muted: #64748B;

  --sidebar-bg: #080B10;
  --sidebar-surface: #131922;
  --sidebar-border: #1E2837;
  --sidebar-ink: #F1F5F9;
  --sidebar-muted: #94A3B8;

  --primary: #F1F5F9;
  --primary-hover: #FFFFFF;
  --primary-ink: #0F172A;

  --accent: #10B981;
  --accent-hover: #059669;
  --accent-soft: rgba(16, 185, 129, 0.16);
  --accent-ink: #34D399;

  --blue: #60A5FA;
  --blue-soft: rgba(96, 165, 250, 0.16);

  --warn: #FBBF24;
  --warn-soft: rgba(251, 191, 36, 0.16);

  --danger: #FB7185;
  --danger-hover: #F43F5E;
  --danger-soft: rgba(251, 113, 133, 0.16);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 52px rgba(0, 0, 0, 0.65);
}

/* ============================================================================
   UNBREAKABLE NATIVE SCROLL FOUNDATION
   ============================================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: auto !important;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: scroll !important;
  -webkit-text-size-adjust: 100%;
  -webkit-overflow-scrolling: touch;
}

body {
  margin: 0;
  padding: 0;
  height: auto !important;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: visible !important;
  touch-action: pan-y pinch-zoom;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

canvas {
  touch-action: pan-y !important;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
   GLOBAL DROP OVERLAY (NEVER BLOCKS POINTER / WHEEL / TOUCH)
   ============================================================================ */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  pointer-events: none !important;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.drop-overlay-box {
  background: var(--surface);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  padding: 36px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
}

.drop-overlay-icon {
  width: 40px;
  height: 40px;
  fill: var(--accent);
}

/* ============================================================================
   AUTH SCREEN
   ============================================================================ */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  overflow-y: auto;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 28px;
  box-shadow: var(--shadow-md);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.auth-brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ============================================================================
   APP SHELL & ARCHITECTURAL SIDEBAR
   ============================================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100dvh;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  border-right: 1px solid var(--sidebar-border);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
}

.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  flex-shrink: 0;
}

.brand-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--sidebar-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--sidebar-muted);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
}

.live-dot.offline {
  background: #EF4444;
}

.sidebar-scan-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 13.5px;
  transition: background 0.16s var(--ease), transform 0.12s var(--ease);
}

.sidebar-scan-btn:hover {
  background: var(--accent-hover);
}

.sidebar-scan-btn:active {
  transform: scale(0.985);
}

.sidebar-scan-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.nav-section-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748B;
  padding: 8px 10px 2px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-muted);
  font-weight: 500;
  font-size: 13.5px;
  text-align: left;
  position: relative;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.nav-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-ink);
}

.nav-btn.active {
  background: var(--sidebar-surface);
  color: #FFFFFF;
  font-weight: 600;
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #10B981;
}

.nav-btn.active svg {
  opacity: 1;
  color: #34D399;
}

.nav-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #E2E8F0;
}

.nav-count.warn {
  background: rgba(245, 158, 11, 0.22);
  color: #FCD34D;
}

.sidebar-bottom {
  border-top: 1px solid var(--sidebar-border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

.user-strip:hover {
  background: rgba(255, 255, 255, 0.06);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.avatar.lg {
  width: 38px;
  height: 38px;
  font-size: 14px;
  border-radius: 9px;
}

.user-info {
  min-width: 0;
  flex: 1;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--sidebar-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--sidebar-muted);
}

.sidebar-tools {
  display: flex;
  gap: 6px;
}

.sidebar-icon-btn {
  flex: 1;
  height: 34px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--sidebar-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--sidebar-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.sidebar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #FFFFFF;
}

.sidebar-icon-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* ============================================================================
   MOBILE HEADER & QUICK MODULE STRIP
   ============================================================================ */
.mobile-header {
  display: none;
}

.mobile-module-strip {
  display: none;
}

/* ============================================================================
   MAIN WORKSPACE
   ============================================================================ */
.workspace {
  min-width: 0;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 32px 72px;
}

/* Undo Bar */
.undo-bar {
  position: sticky;
  top: 12px;
  z-index: 80;
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-md);
}

.undo-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.undo-btn {
  padding: 5px 11px;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 12.5px;
}

.undo-close {
  color: inherit;
  opacity: 0.7;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
}

/* View Header */
.view-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.view-head-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.view-title {
  margin: 0;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.view-meta-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
}

.head-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ============================================================================
   BUTTONS, INPUTS & CONTROLS
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease);
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn:active {
  transform: scale(0.985);
}

.btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex-shrink: 0;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

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

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

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

.btn-danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #FFFFFF;
}

.btn-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.btn-full {
  width: 100%;
  height: 40px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.icon-btn.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 122, 95, 0.14);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.checkbox-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.form-error {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 600;
}

/* ============================================================================
   CARDS, KPI STRIPS & SUBTABS
   ============================================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-xs);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  transition: border-color 0.15s var(--ease), transform 0.12s var(--ease);
}

button.kpi-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.kpi-val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.kpi-sub {
  font-size: 12px;
  color: var(--ink-muted);
}

/* Sub-Tab Bar & Filter Chips (Horizontal Scroll without Blocking Vertical Swipe) */
.subtab-bar,
.chip-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.subtab-bar::-webkit-scrollbar,
.chip-bar::-webkit-scrollbar {
  display: none;
}

.subtab-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius-sm);
  width: fit-content;
  max-width: 100%;
}

.subtab-btn {
  padding: 7px 14px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.subtab-btn:hover {
  color: var(--ink);
}

.subtab-btn.active {
  background: var(--primary);
  color: var(--primary-ink);
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.14s var(--ease);
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-hover);
  color: var(--ink-secondary);
  white-space: nowrap;
}

.badge.ok {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

/* ============================================================================
   QUICK ENTRY BAR
   ============================================================================ */
.quick-bar {
  display: flex;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: var(--shadow-xs);
}

.quick-bar input {
  border: none;
  box-shadow: none !important;
  font-size: 14.5px;
  min-height: 38px;
  background: transparent;
}

/* ============================================================================
   HEUTE (DAILY COCKPIT)
   ============================================================================ */
.today-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.compact-list {
  display: flex;
  flex-direction: column;
  divide-y: 1px solid var(--border);
}

.compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.compact-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.compact-row:first-child {
  padding-top: 0;
}

.compact-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.compact-title {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-sub {
  font-size: 12px;
  color: var(--ink-muted);
}

/* Mülltonnen-Karten (Delitzsch Abfuhrplan) */
.bin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.bin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  transition: border-color 0.15s var(--ease), transform 0.12s var(--ease);
}

button.bin-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.bin-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bin-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.bin-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex-shrink: 0;
}

.bin-date {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.kpi-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.month-heading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  padding: 14px 0 6px;
}

.month-heading:first-child {
  padding-top: 0;
}

/* ============================================================================
   EINKAUFSLISTE & SUPERMARKT-ANSICHT
   ============================================================================ */
.store-mode-banner {
  background: var(--accent-soft);
  border: 1px solid rgba(13, 122, 95, 0.28);
  color: var(--accent-ink);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
}

.aisle-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  margin-bottom: 12px;
}

.aisle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-secondary);
}

.aisle-dot-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.aisle-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.shop-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s var(--ease);
}

.shop-row:last-child {
  border-bottom: none;
}

.shop-row:hover {
  background: var(--surface-subtle);
}

.shop-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.14s var(--ease);
}

.shop-check:hover {
  border-color: var(--accent);
}

.shop-check.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.shop-check svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.shop-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shop-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.shop-name {
  font-size: 14.5px;
  font-weight: 600;
}

.shop-row.done .shop-name {
  text-decoration: line-through;
  color: var(--ink-muted);
}

.shop-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-muted);
}

.shop-qty-pill {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  background: var(--surface-hover);
  color: var(--ink);
  white-space: nowrap;
}

.shop-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Supermarkt-Ansicht (Einhändiger Einkaufs-Modus) */
.store-mode .shop-row {
  padding: 16px 16px;
  cursor: pointer;
}

.store-mode .shop-check {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.store-mode .shop-name {
  font-size: 16.5px;
  font-weight: 700;
}

.store-mode .shop-qty-pill {
  font-size: 14px;
  padding: 5px 11px;
  background: var(--primary);
  color: var(--primary-ink);
}

.store-mode .shop-actions {
  display: none !important;
}

.checked-section {
  margin-top: 8px;
}

.checked-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
}

/* ============================================================================
   VORRAT (STOCK INVENTORY)
   ============================================================================ */
.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}

.search-box input {
  padding-left: 34px;
}

.search-box svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  fill: var(--ink-muted);
  pointer-events: none;
}

.bulk-bar {
  background: var(--primary);
  color: var(--primary-ink);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
  gap: 12px;
}

.stock-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 11px;
  transition: border-color 0.15s var(--ease);
}

.stock-card:hover {
  border-color: var(--border-strong);
}

.stock-card.low {
  border-left: 3px solid var(--warn);
}

.stock-card.empty {
  border-left: 3px solid var(--danger);
}

.stock-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.stock-title-wrap {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.stock-title {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
}

.stock-sub {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.stock-qty-box {
  text-align: right;
  flex-shrink: 0;
}

.stock-qty-val {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
}

.fill-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-hover);
  overflow: hidden;
}

.fill-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.25s var(--ease);
}

.fill-bar.warn {
  background: var(--warn);
}

.fill-bar.danger {
  background: var(--danger);
}

.stock-forecast-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-secondary);
}

.stock-quick-btns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.q-btn {
  height: 30px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  transition: background 0.14s var(--ease), border-color 0.14s var(--ease);
}

.q-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.q-btn.plus {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: transparent;
}

/* ============================================================================
   KÜCHE: WOCHENPLAN & REZEPTE
   ============================================================================ */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  padding-bottom: 4px;
}

.day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 195px;
}

.day-card.today {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.day-name {
  font-size: 13px;
  font-weight: 700;
}

.day-date {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-muted);
}

.meal-slots {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}

.meal-pill {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}

.meal-slot-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.meal-title {
  font-size: 12.5px;
  font-weight: 600;
  padding-right: 18px;
  word-break: break-word;
}

.meal-del {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1;
}

.meal-del:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.day-add-btn {
  margin-top: auto;
  width: 100%;
  height: 28px;
  border-radius: var(--radius-xs);
  border: 1px dashed var(--border-strong);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.day-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ing-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ing-tag {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
}

.ing-tag.ok {
  border-color: rgba(13, 122, 95, 0.3);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.ing-tag.miss {
  border-color: rgba(180, 83, 9, 0.28);
  background: var(--warn-soft);
  color: var(--warn);
}

/* ============================================================================
   FINANZEN: AUSGLEICH, BUDGET, AUSGABEN, FIXKOSTEN & CHARTS
   ============================================================================ */
.split-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 14px;
}

.balance-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.balance-pos {
  color: var(--accent-ink);
  font-weight: 700;
}

.balance-neg {
  color: var(--danger);
  font-weight: 700;
}

.settlement-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.budget-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.chart-box {
  position: relative;
  height: 220px;
  width: 100%;
}

.ledger-table {
  display: flex;
  flex-direction: column;
}

.ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.ledger-row:last-child {
  border-bottom: none;
}

/* ============================================================================
   HAUSHALT: AUFGABEN, MÜLL & TERMINE, PINNWAND, GARANTIEN
   ============================================================================ */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-xs);
}

.note-card.color-amber {
  border-top: 3px solid #D97706;
}

.note-card.color-green {
  border-top: 3px solid #0D7A5F;
}

.note-card.color-blue {
  border-top: 3px solid #2563EB;
}

.note-card.color-slate {
  border-top: 3px solid #334155;
}

.note-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.5px;
  color: var(--ink-secondary);
  line-height: 1.5;
  flex: 1;
}

/* ============================================================================
   NUTZER & BERECHTIGUNGEN
   ============================================================================ */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.perm-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.perm-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ============================================================================
   EMPTY STATES
   ============================================================================ */
.empty-box {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* ============================================================================
   UNBREAKABLE MODAL SYSTEM (FULL VIEWPORT + INNER SCROLL)
   ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 23, 42, 0.56);
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 28px 16px calc(48px + env(safe-area-inset-bottom));
}

.modal-dialog {
  margin: auto 0;
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.modal-dialog.wide {
  max-width: 780px;
}

.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.modal-head h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

/* Scan Dropzone & Review Lines inside Modal */
.scan-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 26px 18px;
  text-align: center;
  background: var(--surface-subtle);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.scan-dropzone:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.scan-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scan-line-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1.65fr) 136px 68px 74px 78px 28px;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}

.scan-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 13px;
}

.warn-banner {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  border: 1px solid rgba(180, 83, 9, 0.28);
  color: var(--warn);
  font-size: 13px;
  font-weight: 600;
}

.danger-banner {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid rgba(190, 18, 60, 0.28);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.stock-head-btns {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */
.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 2600;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--ink);
  color: var(--surface);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  max-width: 340px;
}

.toast.error {
  background: var(--danger);
  color: #FFFFFF;
}

/* ============================================================================
   MOBILE BOTTOM NAVIGATION & RESPONSIVE BREAKPOINTS
   ============================================================================ */
.mobile-nav {
  display: none;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    background: var(--sidebar-bg);
    color: var(--sidebar-ink);
    border-bottom: 1px solid var(--sidebar-border);
  }

  .mobile-header-left {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
  }

  .mobile-header-left img {
    width: 26px;
    height: 26px;
    border-radius: 6px;
  }

  .mobile-header-title {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .m-head-btn {
    height: 32px;
    padding: 0 10px;
    border-radius: var(--radius-xs);
    background: var(--sidebar-surface);
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-ink);
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }

  .m-head-btn.accent {
    background: var(--accent);
    border-color: var(--accent);
    color: #FFFFFF;
  }

  .m-head-btn svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
  }

  .mobile-module-strip {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    scrollbar-width: none;
  }

  .mobile-module-strip::-webkit-scrollbar {
    display: none;
  }

  .m-strip-btn {
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-secondary);
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    white-space: nowrap;
  }

  .m-strip-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-ink);
  }

  .workspace {
    padding: 18px 14px calc(108px + env(safe-area-inset-bottom));
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bin-grid,
  .kpi-grid-3 {
    grid-template-columns: 1fr;
  }

  .today-grid,
  .split-grid,
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
  }

  .m-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 2px;
    border-radius: var(--radius-xs);
    color: var(--ink-muted);
    font-size: 11px;
    font-weight: 600;
    position: relative;
  }

  .m-nav-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
  }

  .m-nav-btn.active {
    color: var(--accent);
  }

  .m-badge {
    position: absolute;
    top: 2px;
    right: 18%;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent);
    color: #FFFFFF;
    font-family: var(--font-mono);
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .toast-stack {
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: 14px;
    right: 14px;
  }

  .toast {
    max-width: 100%;
  }
}

@media (max-width: 680px) {
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .scan-line-row {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 6px;
  }

  .scan-line-row .sl-inc {
    grid-column: span 1;
  }

  .scan-line-row .sl-name {
    grid-column: span 10;
  }

  .scan-line-row .sl-del {
    grid-column: span 1;
    justify-self: end;
  }

  .scan-line-row .sl-loc {
    grid-column: span 5;
  }

  .scan-line-row .sl-qty {
    grid-column: span 2;
  }

  .scan-line-row .sl-unit {
    grid-column: span 2;
    display: block;
  }

  .scan-line-row .sl-price {
    grid-column: span 3;
  }

  .modal-backdrop {
    padding: 12px 10px calc(36px + env(safe-area-inset-bottom));
  }
}
