/* ============================================
   Haushahn - Zentrales Stylesheet
   Mobile-First, Responsive Design
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --color-primary: #2c6fad;
  --color-primary-dark: #1e4f7a;
  --color-primary-light: #e8f1fa;
  --color-accent: #f59e0b;
  --color-accent-dark: #d97706;
  --color-success: #10b981;
  --color-success-light: #d1fae5;
  --color-danger: #ef4444;
  --color-danger-light: #fee2e2;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-text: #1e293b;
  --color-text-light: #64748b;
  --color-text-muted: #94a3b8;
  --color-bg: #f1f5f9;
  --color-white: #ffffff;
  --color-border: #e2e8f0;
  --color-border-dark: #cbd5e1;
  --sidebar-width: 260px;
  --header-height: 56px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--color-primary-dark);
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, #1e3a5f 0%, #162d4a 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow: hidden;
}
.sidebar.open {
  transform: translateX(0);
}

.sidebar-brand {
  padding: 20px 20px 16px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 0;
}
.sidebar-brand small {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  display: block;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
  min-height: 0;
}
.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.35);
  padding: 16px 20px 6px;
  font-weight: 600;
}
.nav-section-label.sec-vermieter { color: #60a5fa; border-left: 3px solid #3b82f6; padding-left: 17px; }
.nav-section-label.sec-persoenlich { color: #4ade80; border-left: 3px solid #22c55e; padding-left: 17px; }
.nav-section-label.sec-mieter { color: #fbbf24; border-left: 3px solid #f59e0b; padding-left: 17px; }

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.75);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.nav-item a:hover,
.nav-item a.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-left-color: var(--color-accent);
}
.nav-item a .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

/* Submenu */
.nav-item.has-submenu > a::after {
  content: '';
  margin-left: auto;
  border: 4px solid transparent;
  border-top-color: rgba(255,255,255,0.4);
  transition: transform var(--transition);
}
.nav-item.has-submenu.open > a::after {
  transform: rotate(180deg);
}
.submenu-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.nav-item.has-submenu.open > .submenu-items {
  max-height: 1200px;
}
.submenu-items a {
  padding-left: 52px;
  font-size: 13px;
}

/* Collapsible section toggle headers */
.nav-section-toggle {
  font-size: 13px !important;
  font-weight: 600 !important;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255,255,255,0.55) !important;
  padding: 12px 20px !important;
}
.nav-section-toggle:hover {
  color: #fff !important;
}
.nav-section-toggle.sec-vermieter { color: #60a5fa !important; }
.nav-section-toggle.sec-persoenlich { color: #4ade80 !important; }
.nav-section-toggle.sec-mieter { color: #fbbf24 !important; }

/* Sublabels within collapsible sections */
.nav-sublabel {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.3);
  padding: 10px 20px 4px 52px;
  font-weight: 600;
  list-style: none;
}
.nav-sublabel.sec-vermieter { color: #60a5fa; }
.nav-sublabel.sec-persoenlich { color: #4ade80; }
.nav-sublabel.sec-mieter { color: #fbbf24; }

/* Nested submenus (e.g. Objekte > Häuser & Wohnungen) */
.submenu-items .nav-item.has-submenu > a::after {
  border-width: 3px;
}
.submenu-items .submenu-items a {
  padding-left: 72px;
  font-size: 12px;
}
.submenu-items .nav-item.has-submenu.open > .submenu-items {
  max-height: 400px;
}
/* Submenu items with icons */
.submenu-items .nav-item > a {
  padding-left: 36px;
  gap: 10px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  padding: 8px 0;
  transition: color var(--transition);
}
.sidebar-footer a:hover {
  color: #fff;
}

/* --- Backdrop (Mobile) --- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
}
.sidebar-backdrop.show {
  display: block;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* --- Header / Topbar --- */
.topbar {
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding-left: 16px;
  padding-right: 16px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 22px;
  transition: background var(--transition);
}
.menu-toggle:hover {
  background: var(--color-bg);
}

.topbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-user {
  font-size: 13px;
  color: var(--color-text-light);
}
.view-mode-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 6px; border: 1px solid #334155;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; background: transparent; color: #94a3b8;
}
.view-mode-toggle:hover { border-color: #60a5fa; color: #60a5fa; }
.view-mode-toggle.mode-privat { background: rgba(34,197,94,0.12); color: #22c55e; border-color: rgba(34,197,94,0.3); }
.view-mode-toggle.mode-verwaltung { background: rgba(59,130,246,0.12); color: #60a5fa; border-color: rgba(59,130,246,0.3); }
.topbar-user strong {
  color: var(--color-text);
}

/* --- Page Content --- */
.page-content {
  flex: 1;
  padding: 16px;
}

/* --- Cards --- */
.card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-body {
  padding: 20px;
}

/* --- Dashboard Grid --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.stat-card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--color-primary-light); color: var(--color-primary); }
.stat-icon.green { background: var(--color-success-light); color: var(--color-success); }
.stat-icon.amber { background: var(--color-warning-light); color: var(--color-warning); }
.stat-icon.red { background: var(--color-danger-light); color: var(--color-danger); }

.stat-info h3 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}
.stat-info p {
  font-size: 13px;
  color: var(--color-text-light);
  margin-top: 2px;
}

/* Clickable stat cards */
a.stat-card-link {
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--transition), transform var(--transition);
}
a.stat-card-link:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: inherit;
}

/* --- Tables --- */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table th,
table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
table th {
  background: var(--color-bg);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-light);
  white-space: nowrap;
}
table tr:hover {
  background: var(--color-primary-light);
}

/* --- Forms --- */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-white);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(44,111,173,0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  color: #fff;
}
.btn-accent {
  background: var(--color-accent);
  color: #fff;
}
.btn-accent:hover {
  background: var(--color-accent-dark);
  color: #fff;
}
.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-success:hover {
  background: #059669;
  color: #fff;
}
.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
  color: #fff;
}
.btn-outline {
  background: transparent;
  border-color: var(--color-border-dark);
  color: var(--color-text);
}
.btn-outline:hover {
  background: var(--color-bg);
  border-color: var(--color-text-light);
  color: var(--color-text);
}
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}
.btn-block {
  width: 100%;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
}
.badge-success {
  background: var(--color-success-light);
  color: #065f46;
}
.badge-danger {
  background: var(--color-danger-light);
  color: #991b1b;
}
.badge-warning {
  background: var(--color-warning-light);
  color: #92400e;
}
.badge-info {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

/* --- Alerts / Messages --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-error {
  background: var(--color-danger-light);
  color: #991b1b;
  border: 1px solid #fca5a5;
}
.alert-success {
  background: var(--color-success-light);
  color: #065f46;
  border: 1px solid #6ee7b7;
}
.alert-warning {
  background: var(--color-warning-light);
  color: #92400e;
  border: 1px solid #fcd34d;
}
.alert-info {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border: 1px solid #93c5fd;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
}
.empty-state p {
  font-size: 15px;
}

/* --- Lists --- */
.item-list {
  list-style: none;
}
.item-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.item-list li:last-child {
  border-bottom: none;
}

/* --- Calendar --- */
.calendar-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.calendar-table th {
  padding: 8px 4px;
  font-size: 12px;
  text-align: center;
  background: var(--color-bg);
}
.calendar-table td {
  border: 1px solid var(--color-border);
  vertical-align: top;
  padding: 4px;
  min-height: 80px;
  height: 80px;
}
.calendar-day-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-light);
  padding: 2px 4px;
}
.calendar-event {
  background: var(--color-primary-light);
  border-left: 3px solid var(--color-primary);
  border-radius: 3px;
  padding: 2px 6px;
  margin-top: 2px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Kanban --- */
.kanban-board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.kanban-column {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--color-border);
}
.kanban-column-header {
  font-weight: 700;
  font-size: 14px;
  padding: 8px 4px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-column-header .count {
  background: var(--color-border);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--color-text-light);
}
.kanban-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow var(--transition);
}
.kanban-card:hover {
  box-shadow: var(--shadow-md);
}
.kanban-card:active {
  cursor: grabbing;
}
.kanban-card h4 {
  font-size: 14px;
  margin-bottom: 4px;
}
.kanban-card p {
  font-size: 12px;
  color: var(--color-text-light);
}
.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.kanban-card-meta .badge {
  font-size: 11px;
  padding: 2px 8px;
}
.kanban-card .due-date {
  font-size: 11px;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kanban-card .due-date.overdue {
  color: var(--color-danger);
  font-weight: 600;
}

/* --- Checkbox Group --- */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  font-size: 14px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  transition: all var(--transition);
}
.checkbox-label:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

/* --- Profile --- */
.profile-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.profile-field:last-child {
  border-bottom: none;
}
.profile-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-light);
}
.profile-value {
  font-size: 15px;
  color: var(--color-text);
}

/* --- Upload Box --- */
.upload-box {
  border: 2px dashed var(--color-border-dark);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
}
.upload-box:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.upload-box p {
  color: var(--color-text-light);
  margin-top: 8px;
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-light); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.page-header {
  margin-bottom: 20px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
}
.page-header p {
  color: var(--color-text-light);
  font-size: 14px;
  margin-top: 4px;
}

/* --- Login Page (standalone) --- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: linear-gradient(135deg, #1e3a5f 0%, #2c6fad 50%, #1e4f7a 100%);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
}
.login-brand {
  text-align: center;
  margin-bottom: 28px;
}
.login-brand h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-primary-dark);
}
.login-brand p {
  font-size: 14px;
  color: var(--color-text-light);
  margin-top: 4px;
}
.login-card .form-group {
  margin-bottom: 18px;
}
.login-card .btn {
  margin-top: 8px;
}

.password-wrapper {
  position: relative;
}
.password-wrapper input {
  padding-right: 44px;
}
.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--color-text-muted);
  padding: 4px;
  transition: color var(--transition);
}
.toggle-password:hover {
  color: var(--color-text);
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
}
.login-footer a {
  color: var(--color-text-light);
}
.login-footer a:hover {
  color: var(--color-primary);
}

/* ============================================
   Responsive Breakpoints
   ============================================ */

/* --- Bottom Navigation (Mobile) --- */
.bottom-nav {
  display: none; /* hidden on desktop */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--color-border);
  z-index: 1001;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px 6px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--color-primary);
}
.bottom-nav-item.active svg {
  stroke: var(--color-primary);
}
.bottom-nav-item svg {
  stroke: var(--color-text-muted);
  transition: stroke 0.2s;
}
.bottom-nav-item:hover svg {
  stroke: var(--color-primary);
}

/* --- A2HS Install Banner --- */
.a2hs-banner {
  position: fixed;
  bottom: 70px;
  left: 12px;
  right: 12px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  padding: 14px 16px;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.a2hs-content {
  display: flex;
  align-items: center;
  gap: 12px;
}
.a2hs-content strong {
  display: block;
  font-size: 14px;
  color: var(--color-text);
}
.a2hs-content small {
  font-size: 12px;
  color: var(--color-text-light);
}
.a2hs-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.a2hs-dismiss {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
}
.a2hs-install {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.a2hs-install:hover {
  background: var(--color-primary-dark);
}

/* --- Mobile Bottom Sheet Menu --- */
.mm-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1099;
}
.mm-backdrop.show {
  display: block;
}
.mobile-menu {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  background: var(--color-bg);
  flex-direction: column;
  max-height: 70vh;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
  overflow: hidden;
}
.mobile-menu.open {
  display: flex;
}
.mm-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0 4px;
  flex-shrink: 0;
  cursor: pointer;
}
.mm-handle-bar {
  width: 36px;
  height: 4px;
  background: var(--color-border-dark);
  border-radius: 2px;
}
.mm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 16px 8px;
  flex-shrink: 0;
}
.mm-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
}
.mm-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--color-bg-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 18px;
  line-height: 1;
}
.mm-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.mm-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  font-weight: 600;
  padding: 14px 0 6px;
}
.mm-section:first-child {
  padding-top: 0;
}
.mm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 8px;
}
.mm-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 4px 10px;
  background: var(--color-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
  min-height: 72px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.mm-item:hover,
.mm-item:active {
  background: var(--color-primary-light);
  color: var(--color-text);
}
.mm-item svg {
  width: 22px;
  height: 22px;
  stroke: var(--color-primary);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.mm-item.mm-danger svg {
  stroke: var(--color-danger);
}
.mm-item.mm-danger {
  color: var(--color-danger);
}

/* Mobile-only fixes (< 640px) */
@media (max-width: 639px) {
  /* Bottom navigation visible on mobile */
  .bottom-nav {
    display: flex;
  }

  /* Hide hamburger menu toggle - bottom nav replaces it */
  .menu-toggle {
    display: none;
  }

  /* iOS safe area + bottom nav spacing */
  body {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }

  /* Prevent horizontal overflow */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }
  .page-content {
    overflow-x: hidden;
    padding: 12px;
  }

  /* Page header: stack on mobile */
  .page-header.flex-between {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-header.flex-between > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-header.flex-between > div:last-child .btn {
    flex: 1;
    text-align: center;
    min-width: 0;
  }
  .page-header h1 {
    font-size: 18px;
  }

  /* Tables: make scrollable, smaller text */
  .table-container {
    margin: 0 -14px;
    padding: 0 14px;
  }
  table {
    font-size: 12px;
  }
  table th, table td {
    padding: 8px 8px;
    white-space: nowrap;
  }

  /* Cards: less padding on mobile */
  .card-body {
    padding: 12px;
  }
  .card-header {
    padding: 10px 12px;
    font-size: 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Stat cards: compact on mobile */
  .stat-card {
    padding: 12px;
    gap: 10px;
  }
  .stat-icon {
    width: 36px;
    height: 36px;
  }
  .stat-icon svg {
    width: 18px;
    height: 18px;
  }
  .stat-info h3 {
    font-size: 18px;
  }
  .stat-info p {
    font-size: 11px;
  }

  /* Item list: stack on mobile */
  .item-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .item-list li .flex {
    width: 100%;
  }

  /* Forms: full width on mobile */
  .form-actions {
    flex-direction: column;
    padding-bottom: 60px;
  }
  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Extra scroll space so keyboard doesn't hide submit button */
  .card-body form {
    padding-bottom: 40px;
  }

  /* Dashboard: force 2 columns for stat cards */
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }

  /* Buttons: touch-friendly sizing */
  .btn {
    padding: 10px 14px;
    font-size: 13px;
    min-height: 44px;
  }
  .btn-sm {
    padding: 8px 12px;
    min-height: 36px;
  }

  /* Calendar: tiny cells on mobile */
  .calendar-table td {
    height: 60px;
    min-height: 60px;
    padding: 2px;
  }
  .calendar-table th {
    font-size: 10px;
    padding: 4px 2px;
  }
  .calendar-day-num {
    font-size: 11px;
  }
  .calendar-event {
    font-size: 9px;
    padding: 1px 3px;
  }

  /* ALL inline grids: force single column on mobile */
  div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Inline flex that wraps buttons - keep side by side but smaller */
  div[style*="display: flex"][style*="gap"] {
    flex-wrap: wrap !important;
  }

  /* Fix inline max-width cards */
  div[style*="max-width"] {
    max-width: 100% !important;
  }

  /* Kanban: force single column */
  .kanban-board {
    grid-template-columns: 1fr !important;
  }

  /* Sidebar: full width on mobile with safe area */
  .sidebar {
    width: 85vw;
    max-width: 300px;
  }

  /* Topbar: compact on mobile */
  .topbar {
    padding: 0 14px;
    gap: 8px;
  }
  .topbar-title {
    font-size: 15px;
  }
  .topbar-user {
    display: none;
  }

  /* A2HS banner: above bottom nav */
  .a2hs-banner {
    bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 8px);
  }

  /* Form actions: extra bottom padding for bottom nav */
  .form-actions {
    padding-bottom: 20px;
  }

  /* Mobile touch-friendly inputs */
  .form-control,
  input[type="text"],
  input[type="email"],
  input[type="date"],
  input[type="number"],
  input[type="password"],
  select.form-control,
  textarea.form-control {
    font-size: 16px !important;
    min-height: 44px;
  }
  .btn {
    min-height: 44px;
  }
  .btn-sm {
    min-height: 38px;
  }

  /* Fix select elements overflowing */
  select.form-control,
  .form-group select {
    max-width: 100%;
  }

  /* Waste calendar mobile fixes */
  .waste-chip {
    min-width: 100% !important;
  }
  .waste-day {
    flex-direction: column;
    gap: 8px;
  }
  .waste-date {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .waste-date-day {
    font-size: 16px !important;
  }

  /* Floor plan editor: not usable on mobile */
  .editor-layout {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }
  .editor-toolbar {
    max-height: none;
    border-right: none !important;
    border-bottom: 1px solid #e2e8f0;
  }
  .editor-canvas-wrap {
    min-height: 50vh;
  }
}

/* Tablet (>= 640px) */
@media (min-width: 640px) {
  .page-content {
    padding: 24px;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }

  .login-card {
    padding: 40px 36px;
  }
}

/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
  .sidebar {
    transform: translateX(0);
  }

  .main-content {
    margin-left: var(--sidebar-width);
  }

  .menu-toggle {
    display: none;
  }

  .sidebar-backdrop {
    display: none !important;
  }

  .page-content {
    padding: 28px 32px;
  }

  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .kanban-board {
    grid-template-columns: repeat(3, 1fr);
  }

  .calendar-table td {
    min-height: 100px;
    height: 100px;
  }
}

/* Large Desktop (>= 1280px) */
@media (min-width: 1280px) {
  .page-content {
    padding: 32px 40px;
    max-width: 1400px;
  }

  .dashboard-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ── Nav Badges ─────────────────────────────── */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #ef4444;
  border-radius: 9px;
  margin-left: auto;
  line-height: 1;
}
.bnav-badge {
  position: absolute;
  top: 2px;
  right: 50%;
  transform: translateX(14px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: #ef4444;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid #fff;
}

/* ── Mobile Enhancements (2026-03) ────────────── */
@media (max-width: 639px) {
  /* Task modal: full screen on mobile */
  .task-modal {
    border-radius: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
  }
  .task-modal-overlay {
    align-items: stretch !important;
  }
  .task-modal-header {
    padding: 12px 16px !important;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
    border-bottom: 1px solid var(--color-border);
  }
  .task-modal-header h2 {
    font-size: 16px !important;
  }
  .task-modal-body {
    padding: 12px 16px !important;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .task-modal-footer {
    padding: 10px 16px !important;
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
    gap: 6px !important;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .task-modal-footer .btn {
    flex: 1;
    min-width: 0;
    font-size: 12px !important;
    padding: 8px 10px !important;
  }
  .modal-close {
    min-width: 44px;
    min-height: 44px;
    font-size: 28px !important;
  }

  /* Checklist items: more padding for touch */
  .checklist-item {
    padding: 10px 4px !important;
    min-height: 44px;
  }
  .checklist-del {
    min-width: 36px;
    min-height: 36px;
    font-size: 18px !important;
  }
  .checklist-add-row input {
    min-height: 44px;
  }

  /* Comments: touch-friendly */
  .comment-input-row {
    gap: 6px !important;
  }
  .comment-input-row input {
    min-height: 44px;
  }
  .comment-input-row .btn {
    min-height: 44px;
    padding: 8px 12px !important;
  }

  /* Wizard steps: scrollable horizontally */
  .wiz-step {
    padding: 6px 10px !important;
    font-size: 11px !important;
    min-height: 36px;
  }

  /* Tables on mobile: card-like stacking for specific pages */
  .mobile-stack td {
    display: block;
    text-align: left !important;
    padding: 4px 8px !important;
    border: none !important;
  }
  .mobile-stack tr {
    display: block;
    border-bottom: 2px solid var(--color-border);
    padding: 8px 0;
  }
  .mobile-stack thead {
    display: none;
  }

  /* Fix: Projekt modal on mobile */
  #projektModalOverlay > div {
    width: 95vw !important;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Forward section: better touch */
  .forward-section input,
  .forward-section textarea {
    min-height: 44px;
  }

  /* Prevent zoom on select focus (iOS) */
  select {
    font-size: 16px !important;
  }

  /* Better spacing for inline edit forms */
  .checklist-section textarea,
  #checklistDescInput {
    min-height: 60px;
  }
}

/* ============================================
   PHASE 2 - Utility Classes & Modern Design
   ============================================ */

/* --- Spacing Utilities --- */
.m-0 { margin: 0; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.p-2 { padding: 8px; } .p-3 { padding: 12px; } .p-4 { padding: 16px; } .p-5 { padding: 20px; }
.px-3 { padding-left: 12px; padding-right: 12px; } .px-4 { padding-left: 16px; padding-right: 16px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; } .py-3 { padding-top: 12px; padding-bottom: 12px; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }

/* --- Flex Utilities --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.shrink-0 { flex-shrink: 0; }

/* --- Grid Utilities --- */
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
@media (max-width: 639px) {
  .grid-2 { grid-template-columns: 1fr !important; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr) !important; }
  .grid-1-mobile { grid-template-columns: 1fr !important; }
  .sm\:grid-2 { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* --- Text Utilities --- */
.text-xs { font-size: 11px; } .text-sm { font-size: 13px; } .text-base { font-size: 15px; }
.text-lg { font-size: 18px; } .text-xl { font-size: 22px; } .text-2xl { font-size: 28px; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.text-muted { color: var(--color-text-muted); }
.text-light { color: var(--color-text-light); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-primary { color: var(--color-primary); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.d-inline { display: inline; }
.d-inline-flex { display: inline-flex; }
.d-none { display: none; }
.d-block { display: block; }
.w-full { width: 100%; }
.overflow-x-auto { overflow-x: auto; }
.col-span-full { grid-column: 1 / -1; }
.min-w-0 { min-width: 0; }
.leading-relaxed { line-height: 1.7; }
.whitespace-pre { white-space: pre-wrap; }
.font-extrabold { font-weight: 800; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }
.p-0 { padding: 0; }
.text-left { text-align: left; }

/* --- Modern Card Variants --- */
.card-glass {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.card-stat {
  display: block;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}
.card-stat:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: inherit;
}
.card-stat .stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
}
.card-stat .stat-label {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
}
.card-stat .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-stat .stat-icon svg {
  width: 20px;
  height: 20px;
}
.stat-icon.amber { background: #fef3c7; color: #d97706; }
.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
@media (max-width: 639px) {
  .card-stat { padding: 12px 14px; }
  .card-stat .stat-value { font-size: 22px; }
  .card-stat .stat-label { font-size: 11px; }
  .card-stat .stat-icon { width: 32px; height: 32px; border-radius: 8px; }
  .card-stat .stat-icon svg { width: 16px; height: 16px; }
}

/* --- Progress Bar --- */
.progress-bar {
  height: 8px;
  background: var(--color-bg);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar .progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-success) 100%);
}
.progress-bar.danger .progress-fill {
  background: linear-gradient(90deg, var(--color-warning) 0%, var(--color-danger) 100%);
}

/* --- Status Dots --- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.green { background: var(--color-success); box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); }
.status-dot.red { background: var(--color-danger); box-shadow: 0 0 6px rgba(239, 68, 68, 0.4); }
.status-dot.yellow { background: var(--color-warning); box-shadow: 0 0 6px rgba(245, 158, 11, 0.4); }
.status-dot.blue { background: var(--color-primary); box-shadow: 0 0 6px rgba(44, 111, 173, 0.4); }

/* --- Modern Badges --- */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.badge-pill.success { background: var(--color-success-light); color: #065f46; }
.badge-pill.danger { background: var(--color-danger-light); color: #991b1b; }
.badge-pill.warning { background: var(--color-warning-light); color: #92400e; }
.badge-pill.info { background: #dbeafe; color: #1e40af; }
.badge-pill.neutral { background: #f1f5f9; color: #475569; }

/* --- SVG Icon Defaults --- */
.icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + 12px + env(safe-area-inset-top, 0px));
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(400px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--color-white);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border-left: 4px solid var(--color-primary);
  animation: toast-in 0.3s ease;
  font-size: 14px;
}
.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-danger); }
.toast.warning { border-left-color: var(--color-warning); }
.toast .toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  line-height: 1;
}
@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* --- Wizard Step Component --- */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.wizard-step {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
}
.wizard-step::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-border);
  border-radius: 3px;
}
.wizard-step.active {
  color: var(--color-primary);
}
.wizard-step.active::after {
  background: var(--color-primary);
}
.wizard-step.done {
  color: var(--color-success);
}
.wizard-step.done::after {
  background: var(--color-success);
}
.wizard-step .step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-bg);
  font-size: 12px;
  margin-bottom: 4px;
}
.wizard-step.active .step-number {
  background: var(--color-primary);
  color: #fff;
}
.wizard-step.done .step-number {
  background: var(--color-success);
  color: #fff;
}

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--color-bg) 25%, #e8edf2 50%, var(--color-bg) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 16px; margin-bottom: 8px; }
.skeleton-title { height: 24px; width: 60%; margin-bottom: 12px; }
.skeleton-card { height: 120px; border-radius: var(--radius-md); }
@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
}
.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}
.empty-state p {
  font-size: 14px;
  margin-top: 8px;
}

/* --- Responsive Table Enhancement --- */
@media (max-width: 639px) {
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
  }
  .table-responsive table {
    min-width: 600px;
  }
  /* Card-style table for mobile */
  .table-cards tbody tr {
    display: block;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 8px;
  }
  .table-cards thead { display: none; }
  .table-cards td {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border: none !important;
    font-size: 14px;
  }
  .table-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 12px;
    flex-shrink: 0;
    margin-right: 8px;
  }
}

/* --- Mobile Bottom Nav (optional, added via template) --- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  z-index: 1000;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
@media (max-width: 639px) {
  .bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
  .page-content {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item svg {
  width: 22px;
  height: 22px;
}
.bottom-nav-item.active {
  color: var(--color-primary);
}
.bottom-nav-item:hover {
  color: var(--color-primary);
}

/* --- Floating Action Button --- */
.fab {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(44, 111, 173, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 900;
  transition: all 0.2s;
}
.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(44, 111, 173, 0.45);
}
.fab svg {
  width: 24px;
  height: 24px;
}
@media (min-width: 640px) {
  .fab { bottom: 24px; }
}

/* --- Smooth Page Transitions --- */
.page-content {
  animation: page-fade-in 0.2s ease;
}
@keyframes page-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Better Form Styling --- */
input:focus, select:focus, textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(44, 111, 173, 0.15);
  outline: none;
}
.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-light);
  margin-bottom: 4px;
  display: block;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}
.breadcrumbs a {
  color: var(--color-text-light);
  transition: color 0.2s;
}
.breadcrumbs a:hover {
  color: var(--color-primary);
}
.breadcrumbs .sep {
  color: var(--color-border-dark);
}

/* --- Chip / Tag --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--color-bg);
  color: var(--color-text-light);
  border: 1px solid var(--color-border);
}
.chip.primary { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.chip.success { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.chip.warning { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.chip.danger { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
