/* ============================================================
   CORE – Main Stylesheet
   ============================================================ */

:root {
  --bg:          #0f1117;
  --surface:     #1a1d27;
  --surface-2:   #22263a;
  --border:      #2e3248;
  --accent:      #6366f1;
  --accent-hover:#818cf8;
  --danger:      #ef4444;
  --success:     #22c55e;
  --warning:     #f59e0b;
  --text:        #e2e8f0;
  --text-muted:  #94a3b8;
  --sidebar-w:   240px;
  --radius:      10px;
  --shadow:      0 4px 24px rgba(0,0,0,.4);
  --font:        'Inter', system-ui, -apple-system, sans-serif;
  color-scheme:  dark;
}

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

html { font-size: 16px; }

body {
  font-family: var(--font);
  background:  var(--bg);
  color:       var(--text);
  min-height:  100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Login Page ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display:    flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 40%, #1e2140 0%, var(--bg) 70%);
}

.login-card {
  background: var(--surface);
  border:     1px solid var(--border);
  border-radius: 16px;
  padding:    2.5rem;
  width:      100%;
  max-width:  400px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo h1 {
  font-size:   2rem;
  font-weight: 800;
  letter-spacing: .1em;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p {
  color:     var(--text-muted);
  font-size: .875rem;
  margin-top: .25rem;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display:     block;
  font-size:   .8125rem;
  font-weight: 500;
  color:       var(--text-muted);
  margin-bottom: .4rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.form-control {
  width:        100%;
  background:   var(--bg);
  border:       1px solid var(--border);
  border-radius: var(--radius);
  color:        var(--text);
  padding:      .65rem 1rem;
  font-size:    .9375rem;
  font-family:  var(--font);
  transition:   border-color .2s, box-shadow .2s;
  outline:      none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow:   0 0 0 3px rgba(99,102,241,.2);
}

.form-control::placeholder { color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display:       inline-flex;
  align-items:   center;
  gap:           .5rem;
  padding:       .65rem 1.25rem;
  border-radius: var(--radius);
  font-size:     .9375rem;
  font-weight:   600;
  font-family:   var(--font);
  cursor:        pointer;
  border:        none;
  transition:    background .2s, transform .1s, box-shadow .2s;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--accent);
  color:      #fff;
  width:      100%;
  justify-content: center;
}

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

.btn-secondary {
  background: var(--surface-2);
  color:      var(--text);
  border:     1px solid var(--border);
}

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

.btn-danger {
  background: transparent;
  color:      var(--danger);
  border:     1px solid var(--danger);
}

.btn-danger:hover { background: rgba(239,68,68,.1); }

.btn-sm { padding: .4rem .85rem; font-size: .8125rem; }

/* ── Alert ───────────────────────────────────────────────────── */
.alert {
  padding:       .75rem 1rem;
  border-radius: var(--radius);
  font-size:     .875rem;
  margin-bottom: 1rem;
  display:       none;
}

.alert.show { display: block; }
.alert-error   { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.alert-success { background: rgba(34,197,94,.12);  color: #86efac;  border: 1px solid rgba(34,197,94,.3); }

/* ── App Layout ─────────────────────────────────────────────── */
.app-layout {
  display:    flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width:      var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display:    flex;
  flex-direction: column;
  position:   fixed;
  top:        0; left: 0; bottom: 0;
  z-index:    100;
  transition: transform .3s;
}

.sidebar-logo {
  padding:     1.5rem 1.25rem 1rem;
  font-size:   1.25rem;
  font-weight: 800;
  letter-spacing: .08em;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  border-bottom: 1px solid var(--border);
  margin-bottom: .5rem;
}

.sidebar-nav { flex: 1; padding: .5rem 0; }

.nav-item {
  display:       flex;
  align-items:   center;
  gap:           .75rem;
  padding:       .7rem 1.25rem;
  color:         var(--text-muted);
  font-size:     .9rem;
  font-weight:   500;
  cursor:        pointer;
  transition:    color .15s, background .15s;
  border-radius: 0;
  text-decoration: none;
  position:      relative;
}

.nav-item:hover {
  color:      var(--text);
  background: rgba(255,255,255,.04);
}

.nav-item.active {
  color:      var(--accent);
  background: rgba(99,102,241,.1);
}

.nav-item.active::before {
  content:    '';
  position:   absolute;
  left:       0; top: 0; bottom: 0;
  width:      3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-icon { font-size: 1.1rem; width: 1.25rem; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.user-info {
  display:     flex;
  align-items: center;
  gap:         .75rem;
  margin-bottom: .75rem;
}

.user-avatar {
  width:        36px;
  height:       36px;
  border-radius: 50%;
  background:   var(--accent);
  display:      flex;
  align-items:  center;
  justify-content: center;
  font-weight:  700;
  font-size:    .875rem;
  flex-shrink:  0;
}

.user-name  { font-size: .875rem; font-weight: 600; }
.user-role  { font-size: .75rem;  color: var(--text-muted); }

/* ── Main Content ────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex:        1;
  padding:     2rem;
  min-height:  100vh;
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size:   1.75rem;
  font-weight: 700;
  color:       var(--text);
}

.page-subtitle {
  color:     var(--text-muted);
  font-size: .9rem;
  margin-top: .25rem;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       1.5rem;
}

.card-header {
  display:       flex;
  align-items:   center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size:   1rem;
  font-weight: 600;
}

/* ── Stats Grid ──────────────────────────────────────────────── */
.stats-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap:                   1.25rem;
  margin-bottom:         2rem;
}

.stat-card {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       1.25rem 1.5rem;
  display:       flex;
  align-items:   center;
  gap:           1rem;
}

.stat-icon {
  width:         48px;
  height:        48px;
  border-radius: 12px;
  display:       flex;
  align-items:   center;
  justify-content: center;
  font-size:     1.4rem;
  flex-shrink:   0;
}

.stat-icon.purple { background: rgba(99,102,241,.15);  color: var(--accent); }
.stat-icon.green  { background: rgba(34,197,94,.15);   color: var(--success); }
.stat-icon.yellow { background: rgba(245,158,11,.15);  color: var(--warning); }
.stat-icon.red    { background: rgba(239,68,68,.15);   color: var(--danger); }

.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8125rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Table ───────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width:           100%;
  border-collapse: collapse;
  font-size:       .9rem;
}

thead { background: var(--surface-2); }

th {
  padding:    .75rem 1rem;
  text-align: left;
  font-size:  .75rem;
  font-weight: 600;
  color:      var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}

td {
  padding:    .85rem 1rem;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

tr:hover td { background: rgba(255,255,255,.02); }

/* ── Badge ───────────────────────────────────────────────────── */
.badge {
  display:       inline-flex;
  align-items:   center;
  padding:       .2rem .6rem;
  border-radius: 999px;
  font-size:     .75rem;
  font-weight:   600;
}

.badge-admin { background: rgba(99,102,241,.2);  color: var(--accent); }
.badge-user  { background: rgba(148,163,184,.15); color: var(--text-muted); }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position:        fixed;
  inset:           0;
  background:      rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index:         200;
  display:         flex;
  align-items:     center;
  justify-content: center;
  opacity:         0;
  pointer-events:  none;
  transition:      opacity .2s;
}

.modal-overlay.open {
  opacity:        1;
  pointer-events: all;
}

.modal {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: 16px;
  padding:       2rem;
  width:         100%;
  max-width:     460px;
  box-shadow:    var(--shadow);
  transform:     translateY(12px);
  transition:    transform .2s;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display:       flex;
  align-items:   center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-title { font-size: 1.125rem; font-weight: 700; }

.modal-close {
  background: none;
  border:     none;
  color:      var(--text-muted);
  font-size:  1.25rem;
  cursor:     pointer;
  line-height: 1;
  padding:    .25rem;
}

.modal-close:hover { color: var(--text); }

.modal-footer {
  display:         flex;
  justify-content: flex-end;
  gap:             .75rem;
  margin-top:      1.5rem;
}

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner {
  width:   20px;
  height:  20px;
  border:  2px solid rgba(255,255,255,.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ───────────────────────────────────────────────────── */
.toast-container {
  position:  fixed;
  bottom:    1.5rem;
  right:     1.5rem;
  z-index:   999;
  display:   flex;
  flex-direction: column;
  gap:       .5rem;
}

.toast {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       .75rem 1.25rem;
  font-size:     .875rem;
  box-shadow:    var(--shadow);
  animation:     slide-in .25s ease;
  max-width:     320px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }

@keyframes slide-in {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Utility ─────────────────────────────────────────────────── */
.flex          { display: flex; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2         { gap: .5rem; }
.gap-3         { gap: .75rem; }
.mt-1          { margin-top: .25rem; }
.mb-4          { margin-bottom: 1rem; }
.text-muted    { color: var(--text-muted); }
.text-sm       { font-size: .875rem; }
.w-full        { width: 100%; }
.hidden        { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Tiles (Dashboard) ───────────────────────────────────────── */
.tile-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap:                   1.25rem;
}

.tile {
  display:       flex;
  align-items:   center;
  gap:           1.25rem;
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: 14px;
  padding:       1.5rem;
  text-decoration: none;
  color:         var(--text);
  cursor:        pointer;
  transition:    border-color .2s, background .2s, transform .15s;
  position:      relative;
}

.tile:not(.tile-disabled):hover {
  border-color: var(--accent);
  background:   rgba(99,102,241,.06);
  transform:    translateY(-2px);
}

.tile-disabled {
  opacity: .5;
  cursor:  not-allowed;
}

.tile-icon {
  width:         64px;
  height:        64px;
  border-radius: 16px;
  display:       flex;
  align-items:   center;
  justify-content: center;
  flex-shrink:   0;
}

.tile-icon.purple { background: rgba(99,102,241,.15);  color: var(--accent); }
.tile-icon.green  { background: rgba(34,197,94,.15);   color: var(--success); }
.tile-icon.yellow { background: rgba(245,158,11,.15);  color: var(--warning); }
.tile-icon.gray   { background: rgba(148,163,184,.1);  color: var(--text-muted); }

.tile-body     { flex: 1; }
.tile-title    { font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }
.tile-desc     { font-size: .8125rem; color: var(--text-muted); line-height: 1.5; }

.tile-arrow {
  font-size:  1.5rem;
  color:      var(--text-muted);
  transition: color .2s, transform .2s;
}

.tile:not(.tile-disabled):hover .tile-arrow {
  color:     var(--accent);
  transform: translateX(3px);
}

.tile-badge {
  position:      absolute;
  top:           .75rem;
  right:         .75rem;
  background:    var(--surface-2);
  border:        1px solid var(--border);
  border-radius: 999px;
  font-size:     .7rem;
  font-weight:   700;
  padding:       .2rem .6rem;
  color:         var(--text-muted);
}

/* ── Activity Table ──────────────────────────────────────────── */
.action-badge {
  display:       inline-flex;
  align-items:   center;
  padding:       .2rem .65rem;
  border-radius: 6px;
  font-size:     .75rem;
  font-weight:   600;
  font-family:   monospace;
}

.action-login       { background: rgba(34,197,94,.12);   color: #86efac; }
.action-user-create { background: rgba(99,102,241,.12);  color: #a5b4fc; }
.action-user-update { background: rgba(245,158,11,.12);  color: #fcd34d; }
.action-user-delete { background: rgba(239,68,68,.12);   color: #fca5a5; }
.action-default     { background: rgba(148,163,184,.1);  color: var(--text-muted); }

@media (max-width: 600px) {
  .tile-grid { grid-template-columns: 1fr; }
}
.tile-icon.red   { background: rgba(239,68,68,.15);   color: var(--danger); }

/* ── Light Mode ──────────────────────────────────────────────── */
html.light-mode {
  --bg:         #f4f6fb;
  --surface:    #ffffff;
  --surface-2:  #eef1f8;
  --border:     #dde1ed;
  --text:       #1e293b;
  --text-muted: #64748b;
  --shadow:     0 4px 24px rgba(0,0,0,.08);
  color-scheme: light;
}

html.light-mode .login-page {
  background: radial-gradient(ellipse at 60% 40%, #e0e4f6 0%, var(--bg) 70%);
}

html.light-mode tr:hover td { background: rgba(0,0,0,.02); }

html.light-mode .nav-item:hover {
  background: rgba(0,0,0,.04);
}

html.light-mode .spinner {
  border-color: rgba(0,0,0,.15);
  border-top-color: #fff;
}

/* ── Profile Page ────────────────────────────────────────────── */
.profile-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap:                   1.5rem;
}

.profile-grid .btn-primary {
  width: auto;
  justify-content: center;
}

/* Theme Toggle */
.theme-toggle-row {
  display: flex;
  gap: 1rem;
}

.theme-option {
  flex: 1;
  cursor: pointer;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: .75rem;
  transition: border-color .2s;
  text-align: center;
}

.theme-option:hover { border-color: var(--accent); }

.theme-option.active {
  border-color: var(--accent);
  background: rgba(99,102,241,.07);
}

.theme-label {
  font-size: .8125rem;
  font-weight: 600;
  margin-top: .6rem;
  color: var(--text-muted);
}

.theme-option.active .theme-label { color: var(--accent); }

.theme-preview {
  border-radius: 8px;
  height: 70px;
  display: flex;
  overflow: hidden;
}

.theme-preview-dark  { background: #0f1117; border: 1px solid #2e3248; }
.theme-preview-light { background: #f4f6fb; border: 1px solid #dde1ed; }

.tp-sidebar {
  width: 28%;
  height: 100%;
}

.theme-preview-dark  .tp-sidebar { background: #1a1d27; border-right: 1px solid #2e3248; }
.theme-preview-light .tp-sidebar { background: #ffffff;  border-right: 1px solid #dde1ed; }

.tp-content {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
}

.tp-bar {
  height: 8px;
  border-radius: 4px;
}

.tp-bar.short { width: 60%; }

.theme-preview-dark  .tp-bar { background: #22263a; }
.theme-preview-light .tp-bar { background: #e2e8f0; }

/* User info link in sidebar */
.user-info-link {
  display:     flex;
  align-items: center;
  gap:         .75rem;
  margin-bottom: .75rem;
  text-decoration: none;
  color:       inherit;
  border-radius: var(--radius);
  padding:     .35rem .5rem;
  margin-left: -.5rem;
  margin-right: -.5rem;
  transition:  background .15s;
}

.user-info-link:hover {
  background: rgba(99,102,241,.08);
  color: inherit;
}

/* ── Sub-Nav (Sidebar) ───────────────────────────────────────── */
.nav-sub {
  padding-left: 2.75rem;
  font-size:    .85rem;
}

/* ── Admin Section (Dashboard) ───────────────────────────────── */
.admin-section {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: 14px;
  overflow:      hidden;
  grid-column:   1 / -1;
}

.admin-main-tile {
  background:    transparent;
  border:        none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.admin-subtiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.subtile {
  display:         flex;
  align-items:     center;
  gap:             .85rem;
  padding:         1rem 1.25rem;
  text-decoration: none;
  color:           var(--text);
  transition:      background .15s;
  border-right:    1px solid var(--border);
}

.subtile:last-child { border-right: none; }

/* Subtiles als eigenständige Leiste (auf Unterseiten) */
.admin-subtiles-page {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  overflow:      hidden;
}

.subtile:hover { background: rgba(99,102,241,.05); }

.subtile-icon {
  width:         36px;
  height:        36px;
  border-radius: 10px;
  display:       flex;
  align-items:   center;
  justify-content: center;
  flex-shrink:   0;
}

.subtile-icon.green  { background: rgba(34,197,94,.15);  color: var(--success); }
.subtile-icon.yellow { background: rgba(245,158,11,.15); color: var(--warning); }
.subtile-icon.red    { background: rgba(239,68,68,.15);  color: var(--danger); }

.subtile-body  { flex: 1; }
.subtile-title { font-size: .875rem; font-weight: 600; }
.subtile-desc  { font-size: .75rem;  color: var(--text-muted); margin-top: .1rem; }
.subtile-arrow { color: var(--text-muted); font-size: 1.1rem; flex-shrink: 0; }

/* ── Mobile Topbar & Hamburger ───────────────────────────────── */
.mobile-topbar {
  display:     none;
  align-items: center;
  gap:         .75rem;
  padding:     .75rem 0 1.25rem;
}

.mobile-logo {
  font-size:   1.1rem;
  font-weight: 800;
  letter-spacing: .08em;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hamburger {
  background: none;
  border:     none;
  cursor:     pointer;
  padding:    .3rem;
  display:    flex;
  flex-direction: column;
  gap:        5px;
}

.hamburger span {
  display:       block;
  width:         22px;
  height:        2px;
  background:    var(--text);
  border-radius: 2px;
  transition:    background .2s;
}

.sidebar-overlay {
  display:    none;
  position:   fixed;
  inset:      0;
  background: rgba(0,0,0,.5);
  z-index:    99;
}

.sidebar-overlay.show { display: block; }

/* ── Essensplan ──────────────────────────────────────────────── */
.week-nav {
  display:     flex;
  align-items: center;
  gap:         1rem;
  margin:      0 0 1.25rem;
}
.week-label {
  flex:        1;
  text-align:  center;
  font-weight: 600;
  font-size:   .95rem;
  color:       var(--text);
}
.meal-card { padding: 0; overflow: hidden; }

.meal-table-wrapper { overflow-x: auto; }

.meal-table {
  width:           100%;
  border-collapse: collapse;
  table-layout:    fixed;
}
.meal-table th,
.meal-table td {
  padding:    .5rem .6rem;
  border:     1px solid var(--border);
  vertical-align: top;
}
.meal-table th {
  background:  var(--surface-2);
  font-size:   .8rem;
  font-weight: 600;
  text-align:  center;
  white-space: nowrap;
  color:       var(--text-muted);
}
.meal-slot-header { width: 90px; }
.meal-table th .th-day  { font-weight: 600; }
.meal-table th .th-sep  { color: var(--text-muted); font-weight: 400; margin: 0 .1rem; }
.meal-table th .th-date { font-size: .78rem; color: var(--text-muted); font-weight: 400; }
.meal-slot-label {
  font-size:   .8rem;
  font-weight: 600;
  color:       var(--text-muted);
  white-space: nowrap;
  background:  var(--surface-2);
  width:       90px;
}
/* Custom Picker */
.meal-td { padding: .4rem .45rem !important; vertical-align: top !important; }

.meal-text-input {
  width:              100%;
  background-color:   var(--surface-2) !important;
  border:             1px solid transparent !important;
  border-radius:      12px;
  padding:            .55rem .75rem;
  font-size:          .85rem;
  color:              var(--text) !important;
  font-family:        inherit;
  box-sizing:         border-box;
  -webkit-appearance: none;
  appearance:         none;
  transition:         border-color .15s, box-shadow .15s, background-color .15s;
}
.meal-text-input:hover  { border-color: var(--border) !important; }
.meal-text-input:focus  { outline: none; background-color: var(--surface) !important; border-color: var(--accent) !important; box-shadow: 0 0 0 3px rgba(99,102,241,.18); }

.meal-picker { position: relative; }
.picker-trigger {
  width:        100%;
  display:      flex;
  align-items:  center;
  gap:          .3rem;
  padding:      .35rem .45rem;
  background:   var(--surface-2);
  border:       1px solid var(--border);
  border-radius: 8px;
  color:        var(--text);
  font-size:    .78rem;
  font-family:  inherit;
  cursor:       pointer;
  text-align:   left;
  min-width:    0;
  transition:   border-color .15s, background .15s;
}
.picker-trigger:hover              { border-color: var(--accent); }
.meal-picker.open .picker-trigger  { border-color: var(--accent); background: var(--surface); }
.picker-label   { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.picker-protein { font-size: .68rem; color: var(--accent); font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.picker-chevron { width: 11px; height: 11px; flex-shrink: 0; transition: transform .2s; }
.meal-picker.open .picker-chevron  { transform: rotate(180deg); }

/* Shared floating dropdown */
.picker-dropdown {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: 10px;
  box-shadow:    0 8px 32px rgba(0,0,0,.2);
  overflow-y:    auto;
  max-height:    280px;
}
.picker-option {
  display:     flex;
  align-items: center;
  gap:         .5rem;
  padding:     .55rem .85rem;
  cursor:      pointer;
  font-size:   .85rem;
  transition:  background .1s;
}
.picker-option:first-child  { border-radius: 10px 10px 0 0; }
.picker-option:last-child   { border-radius: 0 0 10px 10px; }
.picker-option:hover        { background: var(--surface-2); }
.picker-option.sel          { color: var(--accent); }
.opt-name                   { flex: 1; }
.opt-protein                { font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
.picker-option.sel .opt-protein { color: var(--accent); }

/* Fixer Slot (kein Dropdown, z.B. Morgen/Nachmittag) */
.meal-fixed {
  display:     flex;
  align-items: center;
  gap:         .35rem;
  padding:     .3rem .45rem;
  font-size:   .78rem;
  color:       var(--text-muted);
}
.meal-fixed-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Status buttons per Slot */
.slot-status { display: flex; gap: .2rem; margin-top: .3rem; }
.status-btn {
  background:    var(--surface-2);
  border:        1px solid var(--border);
  border-radius: 20px;
  padding:       .18rem .5rem;
  font-size:     .72rem;
  cursor:        pointer;
  line-height:   1.4;
  color:         var(--text-muted);
  white-space:   nowrap;
  transition:    background .15s, border-color .15s, color .15s;
}
.status-btn:hover  { border-color: var(--accent); color: var(--text); }
.status-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Protein row */
.protein-row td { background: var(--surface-2); border-top: 2px solid var(--border) !important; }
.protein-cell   { text-align: center; font-size: .8rem; white-space: nowrap; }

/* Protein goal bar */
.protein-goal-bar { margin-bottom: 1rem; padding: .75rem 1rem; }

/* Mobile: Karten pro Tag */
.meal-mobile  { display: none; }
.meal-day-card { margin-bottom: 1rem; padding: 1rem; }
.meal-day-header {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  margin-bottom:   .75rem;
}
.meal-day-title   { font-size: .9rem; font-weight: 700; color: var(--accent); }
.meal-day-protein { font-size: .85rem; font-weight: 700; }

.meal-mobile-row {
  display:               grid;
  grid-template-columns: 80px 1fr;
  gap:                   .5rem;
  align-items:           start;
  padding:               .5rem 0;
  border-bottom:         1px solid var(--border);
}
.meal-mobile-row:last-child { border-bottom: none; }
.meal-mobile-label {
  font-size:   .8rem;
  font-weight: 600;
  color:       var(--text-muted);
  padding-top: .42rem;
}
.meal-mobile-cell { display: flex; flex-direction: column; gap: .35rem; }
.meal-mobile-cell .picker-trigger { font-size: .85rem; padding: .4rem .6rem; }
.meal-mobile-cell .status-btn     { font-size: .8rem; padding: .22rem .5rem; }

/* Menü-Liste */
.menu-item {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  gap:             1rem;
  padding:         .75rem 0;
  border-bottom:   1px solid var(--border);
}
.menu-item:last-child  { border-bottom: none; }
.menu-item-info        { display: flex; flex-direction: column; gap: .1rem; flex: 1; min-width: 0; }
.menu-item-name        { font-weight: 600; font-size: .9rem; }
.menu-item-protein     { font-size: .82rem; color: var(--accent); }
.menu-item-notes       { font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Mobile Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .mobile-topbar { display: flex; }

  /* Page header: Stack title + button vertical */
  .page-header.flex {
    flex-direction: column !important;
    align-items:    flex-start !important;
    gap:            .75rem;
  }

  /* Modal: full width */
  .modal {
    margin:    1rem;
    padding:   1.25rem;
    max-width: calc(100vw - 2rem);
  }

  /* Admin subtiles: stack vertical */
  .admin-subtiles {
    grid-template-columns: 1fr;
  }

  .subtile {
    border-right:  none;
    border-bottom: 1px solid var(--border);
  }

  .subtile:last-child { border-bottom: none; }

  /* Roles card header */
  .card-header {
    flex-wrap: wrap;
    gap:       .75rem;
  }

  /* Table action buttons: smaller gap */
  .flex.gap-2 { gap: .35rem; }
  .btn-sm { padding: .35rem .6rem; font-size: .75rem; }

  /* Card: weniger Padding damit Tabellen mehr Platz haben */
  .card { padding: .75rem; }

  /* Kein horizontales Scrollen auf Seitenebene */
  html, body { overflow-x: hidden; }

  /* Tabellen: kein scroll, fixe Breite */
  .table-wrapper { overflow-x: hidden; }
  table { table-layout: fixed; width: 100%; }
  td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  th { overflow: hidden; white-space: nowrap; }

  /* Essensplan-Zellen: kein clip, damit Input + Status-Buttons sichtbar bleiben */
  .meal-td { overflow: visible !important; white-space: normal !important; }

  /* Spalten auf Mobile ausblenden */
  .hide-mobile { display: none !important; }

  /* Tile-Grid: eine Spalte */
  .tile-grid { grid-template-columns: 1fr; }
}
