/* ============================================================
   CleanHub – Design System
   Farben: Ink #0A0E1A | Brand #2563EB | Sidebar #0D1117
   Font: Inter
   ============================================================ */

:root {
  --brand:       #2563EB;
  --brand-dark:  #1D4ED8;
  --brand-light: #EFF4FF;
  --brand-50:    #EFF4FF;
  --brand-100:   #DBEAFE;
  --ink:         #0A0E1A;
  --ink-2:       #3D4358;
  --ink-3:       #8B90A4;
  --ink-4:       #BCC0CF;
  --surface:     #F4F5F8;
  --surface-2:   #ECEDF2;
  --border:      #E4E6ED;
  --white:       #FFFFFF;
  --sidebar:     #1C2333;
  --sidebar-2:   #242E42;
  --sidebar-3:   #2D3A52;
  --success:     #059669;
  --success-bg:  #ECFDF5;
  --warning:     #D97706;
  --warning-bg:  #FFFBEB;
  --danger:      #DC2626;
  --danger-bg:   #FEF2F2;
  --info:        #2563EB;
  --info-bg:     #EFF4FF;
  --radius-sm:   6px;
  --radius:      9px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  20px;
  --shadow-xs:   0 1px 2px rgba(10,14,26,.06);
  --shadow-sm:   0 1px 3px rgba(10,14,26,.08), 0 1px 2px rgba(10,14,26,.04);
  --shadow-card: 0 4px 6px -1px rgba(10,14,26,.07), 0 2px 4px -1px rgba(10,14,26,.05);
  --shadow-md:   0 10px 24px rgba(10,14,26,.09), 0 2px 6px rgba(10,14,26,.05);
  --shadow-lg:   0 20px 40px rgba(10,14,26,.12), 0 4px 12px rgba(10,14,26,.06);
  --sidebar-w:   220px;
  --topbar-h:    54px;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--surface);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
  line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
img { max-width: 100%; display: block; }
input, select, textarea { font-family: inherit; }
[x-cloak] { display: none !important; }

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

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  transition: transform 0.22s cubic-bezier(.4,0,.2,1);
  border-right: 1px solid rgba(255,255,255,.08);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 49;
  backdrop-filter: blur(2px);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: var(--topbar-h);
  border-bottom: 1px solid rgba(255,255,255,.05);
  flex-shrink: 0;
}
.sidebar-logo-mark {
  width: 30px;
  height: 30px;
  background: var(--brand);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37,99,235,.35);
}
.sidebar-logo-name {
  color: white;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: -.3px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logo-sub {
  color: #374151;
  font-size: 10px;
  line-height: 1;
}
.sidebar-close {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  color: #6B7280;
  padding: 4px;
  border-radius: 6px;
}
.sidebar-close:hover { color: white; background: rgba(255,255,255,.08); }

.sidebar-nav {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #64748B;
  padding: 14px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: #A8B4CC;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 1px;
  transition: background .1s, color .1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.10); color: #E2E8F4; }
.nav-item.active { background: rgba(59,130,246,.28); color: white; border-left: 2px solid #3B82F6; }
.nav-item svg { flex-shrink: 0; opacity: .9; }
.nav-item.active svg { opacity: 1; }

.sidebar-user {
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,.09);
  flex-shrink: 0;
}
.sidebar-user-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .1s;
}
.sidebar-user-inner:hover { background: var(--sidebar-2); }
.sidebar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #E5E7EB;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 10.5px;
  color: #4B5675;
  line-height: 1.2;
}
.sidebar-user-menu {
  position: absolute;
  bottom: 100%;
  left: 0; right: 0;
  margin-bottom: 4px;
  background: #161B27;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  z-index: 100;
}
.sidebar-menu-item {
  display: block;
  padding: 10px 14px;
  font-size: 12.5px;
  color: #B0BCCE;
  transition: background .1s, color .1s;
}
.sidebar-menu-item:hover { background: rgba(255,255,255,.10); color: white; }
.sidebar-menu-item.danger { color: #EF4444; }
.sidebar-menu-item.danger:hover { background: rgba(239,68,68,.1); }
.sidebar-menu-divider { border-top: 1px solid rgba(255,255,255,.06); margin: 2px 0; }

/* ── Main Content Area ───────────────────────────────────── */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 30;
  flex-shrink: 0;
}
.topbar-hamburger {
  display: none;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  flex-shrink: 0;
}
.topbar-hamburger:hover { background: var(--surface); }
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}
.topbar-bc-root { color: var(--ink-3); }
.topbar-bc-current { color: var(--ink); font-weight: 600; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  overflow: hidden;
  flex-shrink: 0;
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Page Content ────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 0;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 24px;
  background: white;
  border-bottom: 1px solid var(--border);
}
.page-header-left {}
.page-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.4px;
  line-height: 1.2;
}
.page-subtitle {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 3px;
}
.page-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.page-body {
  padding: 20px 24px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.card-subtitle {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 1px;
}
.card-body {
  padding: 18px;
}
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ── KPI Cards ───────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .02em;
  margin-bottom: 12px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.8px;
  line-height: 1;
  margin-bottom: 6px;
}
.kpi-meta {
  font-size: 12px;
  color: var(--ink-3);
}
.kpi-value.success { color: var(--success); }
.kpi-value.warning { color: var(--warning); }
.kpi-value.danger  { color: var(--danger); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background .12s, transform .08s, box-shadow .12s;
  text-decoration: none;
  line-height: 1;
}
.btn:active { transform: scale(.98); }
.btn svg { flex-shrink: 0; }

.btn-primary { background: var(--brand); color: white; box-shadow: 0 1px 3px rgba(37,99,235,.3); }
.btn-primary:hover { background: var(--brand-dark); box-shadow: 0 4px 12px rgba(37,99,235,.35); }

.btn-secondary { background: white; color: var(--ink); border: 1.5px solid var(--border); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface); }

.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }

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

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #047857; }

.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-xs { padding: 4px 8px; font-size: 11.5px; border-radius: 5px; }
.btn-lg { padding: 11px 20px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.form-error { font-size: 11.5px; color: var(--danger); margin-top: 4px; }

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--ink);
  background: white;
  outline: none;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-input.error,
.form-select.error { border-color: var(--danger); }
.form-input::placeholder { color: var(--ink-4); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%238B90A4' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 36px;
}
.form-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
  border-radius: 4px;
}
.form-row { display: grid; gap: 14px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
}
.checkbox-row label { font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-success  { background: var(--success-bg); color: var(--success); }
.badge-warning  { background: var(--warning-bg); color: var(--warning); }
.badge-danger   { background: var(--danger-bg);  color: var(--danger); }
.badge-info     { background: var(--brand-50);   color: var(--brand); }
.badge-brand    { background: var(--brand-100);  color: var(--brand-dark); }
.badge-neutral  { background: var(--surface-2);  color: var(--ink-2); border: 1px solid var(--border); }
.badge-purple   { background: #F5F3FF; color: #7C3AED; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.table {
  width: 100%;
  border-collapse: collapse;
}
table.table thead th {
  padding: 9px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--ink-2);
  vertical-align: middle;
}
table.table tbody tr:hover td { background: rgba(244,245,248,.6); }
table.table tbody tr:last-child td { border-bottom: none; }
.cell-primary { color: var(--ink); font-weight: 600; }
.cell-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.cell-mono { font-family: 'SF Mono', monospace; font-size: 12px; color: var(--ink-3); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: var(--success-bg); border: 1px solid rgba(5,150,105,.2); color: #065F46; }
.alert-error   { background: var(--danger-bg);  border: 1px solid rgba(220,38,38,.2);  color: #991B1B; }
.alert-warning { background: var(--warning-bg); border: 1px solid rgba(217,119,6,.2);  color: #92400E; }
.alert-info    { background: var(--brand-50);   border: 1px solid rgba(37,99,235,.2);  color: #1E40AF; }

/* ── Toast Notifications ─────────────────────────────────── */
.toast-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 320px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  font-weight: 500;
}
.toast-success { background: var(--success-bg); border-color: rgba(5,150,105,.2); color: #065F46; }
.toast-error   { background: var(--danger-bg);  border-color: rgba(220,38,38,.2);  color: #991B1B; }
.toast-info    { background: var(--brand-50);   border-color: rgba(37,99,235,.2);  color: #1E40AF; }
.toast-warning { background: var(--warning-bg); border-color: rgba(217,119,6,.2);  color: #92400E; }

/* ── Progress Bar ────────────────────────────────────────── */
.progress { background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: var(--brand);
  transition: width .6s ease;
}
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
}
.empty-icon { width: 48px; height: 48px; color: var(--ink-4); margin: 0 auto 14px; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 20px; max-width: 320px; }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--radius-lg);
  width: fit-content;
  margin-bottom: 20px;
}
.tab-btn {
  padding: 7px 16px;
  border-radius: var(--radius);
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  transition: all .15s;
}
.tab-btn.active {
  background: white;
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}
.tab-btn:hover:not(.active) { color: var(--ink); }

/* ── Filters ─────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-bar .form-input,
.filter-bar .form-select {
  width: auto;
  min-width: 0;
  padding: 7px 11px;
  font-size: 13px;
}
.filter-bar .form-select { padding-right: 32px; }
.search-wrap {
  position: relative;
}
.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.search-wrap .form-input { padding-left: 34px; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: white;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  transition: all .1s;
}
.pg-btn:hover { background: var(--surface); border-color: var(--ink-4); }
.pg-btn.active { background: var(--brand); border-color: var(--brand); color: white; }

/* ── Grid Helpers ────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-main-aside { display: grid; grid-template-columns: 1fr 320px; gap: 20px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-center  { display: flex; align-items: center; gap: 8px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }

/* ── Divider ─────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Avatar ──────────────────────────────────────────────── */
.avatar {
  border-radius: var(--radius);
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-sm  { width: 28px; height: 28px; }
.avatar-md  { width: 36px; height: 36px; }
.avatar-lg  { width: 48px; height: 48px; }
.avatar-xl  { width: 64px; height: 64px; }
.avatar-2xl { width: 80px; height: 80px; }

/* ── Auth Layout ─────────────────────────────────────────── */
.auth-wrap {
  display: flex;
  min-height: 100vh;
  background: var(--surface);
}
.auth-panel {
  width: 400px;
  min-width: 400px;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 40px;
}
.auth-panel-inner {}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 48px;
}
.auth-logo-mark {
  width: 38px;
  height: 38px;
  background: var(--brand);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(37,99,235,.4);
}
.auth-logo-name { color: white; font-weight: 700; font-size: 15px; line-height: 1.2; }
.auth-logo-sub  { color: #6B7280; font-size: 11px; }
.auth-tagline {
  color: white;
  font-size: 27px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -.5px;
  margin-bottom: 12px;
}
.auth-tagline-sub {
  color: #6B7280;
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 28px;
}
.auth-features { display: flex; flex-direction: column; gap: 8px; }
.auth-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  padding: 10px 14px;
  color: #9CA3AF;
  font-size: 13px;
}
.auth-panel-footer { color: #374151; font-size: 11px; }
.auth-mobile-brand { display: none; }

.auth-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}
.auth-form-wrap { width: 100%; max-width: 360px; }

.auth-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 36px;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.4px;
  margin-bottom: 4px;
}
.auth-card .subtitle {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 28px;
}
.auth-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.auth-label-row label { font-size: 12px; font-weight: 600; color: var(--ink); margin: 0; }
.auth-label-row a { font-size: 12px; color: var(--brand); font-weight: 600; }
.auth-label-row a:hover { text-decoration: underline; }
.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.auth-remember label { font-size: 13px; color: var(--ink-2); cursor: pointer; font-weight: 500; }

/* ── Admin Layout ────────────────────────────────────────── */
.admin-shell {
  display: flex;
  min-height: 100vh;
}
.admin-sidebar {
  width: 210px;
  min-width: 210px;
  background: #1A0533;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 54px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.admin-logo-mark {
  width: 28px;
  height: 28px;
  background: #7C3AED;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}
.admin-logo-name { color: white; font-weight: 700; font-size: 13px; line-height: 1.2; }
.admin-logo-sub  { color: #6B21A8; font-size: 10px; }
.admin-nav { flex: 1; padding: 8px; overflow-y: auto; }
.admin-nav-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: #A8B4CC;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 1px;
  transition: background .1s, color .1s;
}
.admin-nav-item:hover { background: rgba(255,255,255,.05); color: #E5E7EB; }
.admin-nav-item.active { background: rgba(124,58,237,.25); color: #DDD6FE; }
.admin-sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.admin-user-avatar { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name { font-size: 12px; font-weight: 600; color: #E5E7EB; line-height: 1.2; }
.admin-user-role { font-size: 10.5px; color: #6B21A8; }
.admin-logout { color: #EF4444; display: flex; align-items: center; padding: 4px; border-radius: 6px; }
.admin-logout:hover { background: rgba(239,68,68,.1); }
.admin-main { flex: 1; min-width: 0; overflow-y: auto; }

/* ── Detail Info List ────────────────────────────────────── */
.info-list { display: flex; flex-direction: column; }
.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--surface);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--ink-3); font-size: 12px; flex-shrink: 0; }
.info-value { color: var(--ink); font-weight: 500; text-align: right; }

/* ── User Inline ─────────────────────────────────────────── */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-cell img { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,14,26,.5);
  backdrop-filter: blur(4px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: white;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Wochentag-Picker ────────────────────────────────────── */
.day-picker { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.day-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: white;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  transition: all .12s;
}
.day-btn.active { background: var(--brand); border-color: var(--brand); color: white; }

/* ── Responsive ──────────────────────────────────────────── */
/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-main-aside { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  /* Sidebar: ausblenden, per Hamburger öffnen */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; }
  .sidebar-close { display: flex; }
  .main-wrap { margin-left: 0 !important; }
  .topbar-hamburger { display: flex; }
  .topbar-breadcrumb { display: none; }

  /* Layout */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-main-aside { grid-template-columns: 1fr; }
  .form-row.cols-2,
  .form-row.cols-3,
  .form-row.cols-4 { grid-template-columns: 1fr; }

  /* Seite */
  .page-header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .page-body { padding: 12px 16px; }
  .page-title { font-size: 17px; }

  /* page-actions: scrollbar horizontal */
  #page-actions { display: flex !important; overflow-x: auto; gap: 6px; padding-bottom: 2px; }
  #page-actions .btn { white-space: nowrap; flex-shrink: 0; }

  /* Cards */
  .card-header { flex-wrap: wrap; gap: 8px; }
  .card-body { padding: 14px; }

  /* Tabellen: horizontal scrollbar */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Filter-Bar: stacked */
  .filter-bar { flex-wrap: wrap; gap: 8px; }
  .filter-bar .form-input,
  .filter-bar .form-select { min-width: 0; flex: 1; }

  /* Auth */
  .auth-panel { display: none; }
  .auth-right { padding: 24px 16px; }
  .auth-mobile-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 22px; font-weight: 800; color: #0A0E1A; font-size: 17px; letter-spacing: -.3px; }

  /* Tabs: horizontal scroll */
  .tabs { overflow-x: auto; flex-wrap: nowrap; gap: 4px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; }

  /* KPI kleiner */
  .kpi-card { padding: 12px 14px; }
  .kpi-value { font-size: 22px; }
  .kpi-label { font-size: 11px; }

  /* Buttons in Card-Headern */
  .card-header .btn { font-size: 11px; padding: 5px 10px; }

  /* Admin-Sidebar */
  .admin-sidebar { width: 180px; min-width: 180px; }

  /* Modals */
  #bab-editor { max-width: calc(100vw - 32px) !important; left: 16px !important; }
}

@media (max-width: 600px) {
  /* KPI: 2 Spalten */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-value { font-size: 20px; }
  .kpi-meta { display: none; }

  /* Seite noch kompakter */
  .page-body { padding: 10px 12px; }
  .page-header { padding: 10px 12px; }
  .page-title { font-size: 16px; }
  .page-subtitle { font-size: 11.5px; }

  /* Cards */
  .card { border-radius: 10px; }
  .card-body { padding: 12px; }
  .card-header { padding: 10px 12px; }
  .card-title { font-size: 13.5px; }

  /* Toast: volle Breite */
  .toast-wrap { width: calc(100vw - 24px); right: 12px; left: 12px; }

  /* Tabelle: kleinere Schrift */
  .table thead th { padding: 7px 8px; font-size: 10.5px; }
  .table tbody td { padding: 9px 8px; font-size: 12.5px; }
  .cell-primary { font-size: 13px; }
  .cell-sub { font-size: 11px; }

  /* Buttons: etwas kleiner */
  .btn { font-size: 12.5px; padding: 7px 12px; }
  .btn-sm { font-size: 11.5px; padding: 5px 10px; }
  .btn-xs { font-size: 11px; padding: 3px 7px; }
  .btn-block { width: 100%; }

  /* Form */
  .form-input, .form-select, .form-textarea { font-size: 15px; } /* 15px verhindert iOS Zoom */
  .form-label { font-size: 11.5px; }

  /* Topbar kompakter */
  .topbar { padding: 0 12px; }
  .topbar-avatar { width: 30px; height: 30px; font-size: 12px; }

  /* Info-List */
  .info-row { flex-direction: column; gap: 2px; padding: 8px 0; }
  .info-label { min-width: 0; font-size: 10.5px; }
  .info-value { font-size: 13px; }

  /* Badge kleiner */
  .badge { font-size: 10px; padding: 2px 6px; }

  /* Divider kompakter */
  .divider { margin: 12px 0; }

  /* Filter-Bar: untereinander */
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-select,
  .filter-bar .form-input { width: 100%; }

  /* Tabs kleiner */
  .tab-btn { padding: 7px 12px; font-size: 12px; }

  /* Checkbox-Row */
  .checkbox-row { gap: 8px; }
  .form-checkbox { width: 18px; height: 18px; }

  /* Form-Row: immer 1 Spalte */
  .form-row { grid-template-columns: 1fr !important; }

  /* Verstecke unwichtige Spalten in Tabellen */
  .hide-mobile { display: none !important; }

  /* Floating BAB-Editor */
  #bab-editor {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    border-radius: 16px 16px 0 0 !important;
    max-width: 100% !important;
    padding: 16px !important;
    box-shadow: 0 -4px 32px rgba(0,0,0,.2) !important;
  }

  /* Sticky Bottom-Aktionen */
  .mobile-sticky-bottom {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: white;
    padding: 12px 16px;
    border-top: 1px solid #E4E6ED;
    box-shadow: 0 -4px 16px rgba(0,0,0,.08);
    z-index: 50;
    display: flex;
    gap: 8px;
  }
}

/* Touch-Verbesserungen */
@media (hover: none) and (pointer: coarse) {
  /* Größere Touch-Targets */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .nav-item { min-height: 40px; }
  .tab-btn { min-height: 38px; }
  .form-input, .form-select { min-height: 44px; }
  /* 16px verhindert den iOS-Fokus-Zoom — deshalb ist maximum-scale nicht mehr nötig */
  .form-input, .form-select, .form-textarea { font-size: 16px; }
  .btn-xs { min-height: 32px; padding: 6px 10px; }

  /* Kein Hover-Effekt auf Touch */
  .btn:hover { transform: none !important; }

  /* Tabellen-Zeilen größer */
  .table tbody td { padding: 12px 8px; }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .toast-wrap, .btn { display: none !important; }
  .main-wrap { margin-left: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ── Safe Area (iPhone Notch / Home Indicator) ──────────── */
.sidebar {
  padding-bottom: env(safe-area-inset-bottom);
}
.page-body {
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.topbar {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.mobile-sticky-bottom {
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

/* ── Touch-Scroll Verbesserungen ──────────────────────────── */
.table-wrap,
.tabs,
#page-actions {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.table-wrap::-webkit-scrollbar,
.tabs::-webkit-scrollbar { display: none; }

/* ── Tap-Highlight entfernen ─────────────────────────────── */
* { -webkit-tap-highlight-color: transparent; }
a, button, .btn, .nav-item, .tab-btn {
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

/* ── Input Zoom verhindern (iOS) ─────────────────────────── */
@media (max-width: 600px) {
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="password"],
  input[type="tel"],
  input[type="date"],
  input[type="time"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ═══ UX-Patch: Utility-Klassen (Basis zum schrittweisen Abbau von Inline-Styles) ═══ */
.badge { display:inline-block; padding:2px 8px; border-radius:8px; font-size:10px; font-weight:700; letter-spacing:.02em; }
.badge-green  { background:#ECFDF5; color:#065F46; }
.badge-amber  { background:#FEF3C7; color:#B45309; }
.badge-red    { background:#FEE2E2; color:#991B1B; }
.badge-blue   { background:#EFF6FF; color:#1E40AF; }
.badge-grey   { background:#F1F5F9; color:#64748B; }
.badge-purple { background:#F3E8FF; color:#7C3AED; }
.txt-ok    { color:#059669; } .txt-warn { color:#D97706; }
.txt-bad   { color:#DC2626; } .txt-dim  { color:#8B90A4; }
.txt-right { text-align:right; }
.fw-6 { font-weight:600; } .fw-7 { font-weight:700; } .fw-8 { font-weight:800; }
.notice { border-radius:12px; padding:12px 16px; font-size:12.5px; line-height:1.6; margin-bottom:14px; border:1px solid; }
.notice-info { background:#EFF6FF; border-color:#BFDBFE; color:#1E40AF; }
.notice-warn { background:#FFFBEB; border-color:#FDE68A; color:#92400E; }
.notice-ok   { background:#ECFDF5; border-color:#A7F3D0; color:#065F46; }
.notice-bad  { background:#FEF2F2; border-color:#FECACA; color:#991B1B; }


/* ═══════════════════════════════════════════════════════════
   Sidebar 2.0 — Filter + Accordion, im bestehenden Designsystem
   ═══════════════════════════════════════════════════════════ */

/* ── Menü-Filter: wirkt wie ein natives Sidebar-Element ── */
.sidebar-filter {
  display: flex; align-items: center; gap: 8px;
  margin: 2px 8px 6px;
  padding: 7px 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius);
  transition: border-color .15s, background .15s;
}
.sidebar-filter svg { color: #64748B; flex-shrink: 0; }
.sidebar-filter input {
  flex: 1; min-width: 0;
  background: transparent; border: none; outline: none;
  color: #E2E8F4; font: inherit; font-size: 12.5px;
}
.sidebar-filter input::placeholder { color: #64748B; }
.sidebar-filter:focus-within {
  background: rgba(255,255,255,.08);
  border-color: rgba(59,130,246,.55);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.sidebar-filter button {
  background: none; border: none; cursor: pointer;
  color: #64748B; font-size: 11px; line-height: 1;
  padding: 2px 3px; border-radius: 4px;
}
.sidebar-filter button:hover { color: #E2E8F4; background: rgba(255,255,255,.10); }

/* ── Gruppen-Kopf: Typografie des alten Labels, als ganze Klickfläche ── */
.nav-group { margin-bottom: 1px; }
.nav-group-toggle {
  /* Button-Reset: erbt sonst UA-Font/Farbe → sah "kaputt" aus */
  appearance: none; background: none; border: none;
  width: 100%; cursor: pointer;
  font: inherit; text-align: left;

  display: flex; align-items: center; gap: 7px;
  padding: 11px 8px 4px;
  font-size: 10px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  color: #64748B;
  transition: color .15s;
  user-select: none;
}
.nav-group-toggle:hover { color: #94A3B8; }
.nav-group-toggle:focus-visible { outline: 2px solid rgba(59,130,246,.6); outline-offset: 2px; border-radius: 4px; }

/* Aktiv-Punkt: zeigt "hier bist du gerade" auch bei zugeklappter Gruppe */
.nav-group-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand, #2563EB);
  box-shadow: 0 0 6px rgba(59,130,246,.8);
  flex-shrink: 0;
  opacity: 0; transform: scale(.4);
  transition: opacity .2s, transform .2s;
}
.nav-group-toggle.has-active .nav-group-dot { opacity: 1; transform: scale(1); }
.nav-group-toggle.has-active { color: #94A3B8; }

.nav-chevron {
  margin-left: auto;
  color: #3E4A5E;
  transition: transform .22s cubic-bezier(.4,0,.2,1), color .15s;
}
.nav-group-toggle:hover .nav-chevron { color: #94A3B8; }
.nav-group.collapsed .nav-chevron { transform: rotate(-90deg); }

/* ── Weiches Auf-/Zuklappen ohne JS-Höhenmessung (Grid-Trick) ── */
.nav-group-items {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows .24s cubic-bezier(.4,0,.2,1);
}
.nav-group.collapsed .nav-group-items { grid-template-rows: 0fr; }
.nav-group.filter-open .nav-group-items { grid-template-rows: 1fr !important; }
.nav-group.filter-open .nav-chevron { transform: rotate(0deg) !important; }
.nav-group-items > .nav-group-items-inner { overflow: hidden; min-height: 0; }

@media (prefers-reduced-motion: reduce) {
  .nav-group-items, .nav-chevron, .nav-group-dot { transition: none; }
}
