:root {
  --brand-500: #79b649;
  --brand-600: #689f3f;
  --ink: #0f172a;
  --muted: #475569;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(2,6,23,.06);
  --shadow-md: 0 10px 20px rgba(2,6,23,.08);
  --radius: 14px;
  --radius-sm: 12px;
  --focus: 0 0 0 .25rem rgba(121,182,73,.25);
}

html, body {
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--brand-600);
}

  a:hover {
    color: var(--brand-500);
  }

.container-app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 992px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
}

.sidebar {
  position: sticky;
  top: 16px;
  background: linear-gradient(180deg, #0f172a 0%, #111827 60%, #0b1220 100%);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-md);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 14px 10px;
  border-bottom: 1px solid rgba(226,232,240,.15);
  margin-bottom: 12px;
}

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(121,182,73,.18);
  border: 1px solid rgba(121,182,73,.35);
}

.brand-title {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .2px;
}

.nav-vertical {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(255,255,255,.78);
  text-decoration: none;
}

  .nav-item:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
  }

  .nav-item.active {
    background: rgba(121,182,73,.18);
    border: 1px solid rgba(121,182,73,.35);
    color: #fff;
  }

.nav-divider {
  height: 1px;
  margin: 10px 6px;
  background: rgba(226,232,240,.12);
}

.nav-sub {
  margin-left: 10px;
  padding-left: 14px;
  font-size: 13px;
  color: rgba(255,255,255,.68);
}

  .nav-sub:hover {
    color: rgba(255,255,255,.9);
  }

.content {
  min-height: 70vh;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  margin: 6px 0 18px 0;
  letter-spacing: -.3px;
}

.cardx {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

  .cardx + .cardx {
    margin-top: 14px;
  }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 1200px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .kpis {
    grid-template-columns: 1fr;
  }
}

.kpi {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: #fff;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  margin-top: 4px;
}

.kpi-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: #fff;
}

.badge-warn {
  border-color: rgba(245,158,11,.35);
  background: rgba(245,158,11,.10);
  color: #92400e;
}

.badge-danger {
  border-color: rgba(220,38,38,.35);
  background: rgba(220,38,38,.10);
  color: #991b1b;
}

.btn-primary {
  background-color: var(--brand-500);
  border-color: var(--brand-500);
  font-weight: 700;
  border-radius: 12px;
}

  .btn-primary:hover {
    background-color: var(--brand-600);
    border-color: var(--brand-600);
  }

.btn-outline-primary {
  color: var(--brand-600);
  border-color: rgba(121,182,73,.45);
  font-weight: 700;
  border-radius: 12px;
}

  .btn-outline-primary:hover {
    background: rgba(121,182,73,.12);
    border-color: rgba(121,182,73,.55);
    color: var(--brand-600);
  }

.form-control, .form-select {
  border-radius: 12px;
  border-color: var(--border);
  min-height: 44px;
}

  .form-control:focus, .form-select:focus {
    border-color: rgba(121,182,73,.55);
    box-shadow: var(--focus);
  }

.helptext {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.kpi.kpi-action {
  background-color: var(--brand-500);
  color: #fff;
  border: none;
}
@media (max-width: 991px) {
  .sidebar {
    display: none;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .container-app {
    padding: 12px 12px 84px;
  }
}

.mobile-topbar {
  display: none;
}

@media (max-width: 991px) {
  .mobile-topbar {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
  }

    .mobile-topbar .brand-title {
      color: var(--ink);
    }
}

.mobile-nav {
  display: none;
}

@media (max-width: 991px) {

  /* Sidebar aus */
  .sidebar {
    display: none;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .container-app {
    padding: 12px 12px 84px;
  }

  /* Topbar */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
  }

  /* Bottom Nav */
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    height: 64px;
    z-index: 30;
  }

  .mobile-nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--muted);
    text-decoration: none;
  }

  .mobile-nav-primary {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    background: var(--brand-500);
    border-radius: 16px;
    margin: 8px;
  }
}


.nav-logout {
  background: none;
  border: none;
  text-align: left;
  width: 100%;
  color: rgba(255,255,255,.6);
}

  .nav-logout:hover {
    background: rgba(220,38,38,.12);
    color: #fecaca;
  }

.mobile-logout {
  background: none;
  border: none;
  font-size: 14px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
}

  .mobile-logout:hover {
    background: rgba(220,38,38,.08);
    color: #991b1b;
  }

.meal-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.meal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.meal-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  max-width: 70%;
}

.meal-kcal {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.meal-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meal-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.meal-actions {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dashboard-meal-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

  .dashboard-meal-row:last-child {
    border-bottom: none;
  }

.dashboard-meal-main {
  flex: 1;
  min-width: 0;
}

.dashboard-meal-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  word-break: break-word;
}

.dashboard-meal-kcal {
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
}

  .dashboard-meal-kcal span {
    font-size: 12px;
    color: var(--muted);
    margin-left: 2px;
  }

.meal-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.meal-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}

.kpi-over {
  border-color: rgba(220, 38, 38, 0.6);
  background: rgba(220, 38, 38, 0.08);
}

  .kpi-over .kpi-value {
    color: #b91c1c;
  }

  .kpi-over .kpi-sub {
    font-weight: 700;
    color: #7f1d1d;
  }

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(121,182,73,.18);
  border: 1px solid rgba(121,182,73,.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

  .brand-badge img {
    width: 20px;
    height: 20px;
    object-fit: contain;
  }

.ingredient-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

  .ingredient-list li {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
    border-bottom: 1px dashed var(--border);
  }

.ingredient-name {
  color: var(--ink);
}

.ingredient-amount {
  color: var(--muted);
  white-space: nowrap;
}

.mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(121,182,73,.15);
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

.menu-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 18px;
}

/* === Dropdown Menu === */
.mobile-menu {
  position: absolute;
  top: 58px;
  right: 12px;
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 60;
}

.mobile-menu-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  text-align: left;
  background: none;
  border: none;
}

  .mobile-menu-item:hover {
    background: rgba(121,182,73,.12);
  }

.mobile-menu-divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--border);
}

.mobile-menu-item.danger {
  color: #b91c1c;
}

  .mobile-menu-item.danger:hover {
    background: rgba(220,38,38,.1);
  }

/* Desktop ausblenden */
@media (min-width: 992px) {
  .mobile-topbar,
  .mobile-menu {
    display: none;
  }
}