:root {
  --bg: #0a1628; --bg2: #0f1f3a; --bg3: #162a4a; --border: #1e3a5f;
  --text: #e0e8f0; --text2: #7a9ab8; --accent: #2d8cf0; --accent2: #1a6fc4;
  --fresh-c: #4ade80; --frozen-c: #818cf8; --canned-c: #f59e0b; --dry-c: #a78b6b;
  --breakfast-c: #fbbf24; --dinner-c: #f97316; --snack-c: #a3e635;
  --danger: #ef4444; --success: #22c55e; --warning: #f59e0b;
  --radius: 12px; --radius-sm: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; font-size: 15px; line-height: 1.5;
}

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--bg2); border-right: 1px solid var(--border);
  padding: 24px 0; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; flex-shrink: 0; display: flex; flex-direction: column;
}
.sidebar-logo { padding: 0 20px 24px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sidebar-logo h1 { font-size: 15px; font-weight: 700; }
.sidebar-logo p { font-size: 11px; color: var(--text2); margin-top: 2px; }
.nav-section { padding: 0 12px 8px; }
.nav-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text2); padding: 8px 8px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text2); font-size: 13px; font-weight: 500;
  transition: all .15s; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(45,140,240,.18); color: var(--accent); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { margin-top: auto; padding: 16px 20px 0; border-top: 1px solid var(--border); font-size: 11px; color: var(--text2); }

.main { flex: 1; overflow-y: auto; }
.topbar {
  position: sticky; top: 0; z-index: 60; background: var(--bg);
  border-bottom: 1px solid var(--border); padding: 0 24px; height: 48px;
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.topbar-title { font-size: 15px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.trip-selector {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 4px 10px; border-radius: var(--radius-sm); font-size: 12px; cursor: pointer;
}
.trip-selector:focus { outline: none; border-color: var(--accent); }

.content { max-width: 860px; margin: 0 auto; padding: 32px 24px; }
.page { display: none; }
.page.active { display: block; }
.page-header { margin-bottom: 28px; }
.page-header h2 { font-size: 22px; font-weight: 700; }
.page-header p { color: var(--text2); margin-top: 4px; font-size: 13px; }

/* Cards */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-title { font-size: 15px; font-weight: 600; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Mobile Nav */
.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg2); border-top: 1px solid var(--border); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); z-index: 50; }
.mobile-nav-inner { display: flex; justify-content: space-around; align-items: stretch; }
.mobile-nav-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 6px; border-radius: var(--radius-sm); background: none; border: none; cursor: pointer; color: var(--text2); font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; transition: color .15s; min-width: 44px; flex: 1; }
.mobile-nav-btn svg { width: 20px; height: 20px; }
.mobile-nav-btn.active { color: var(--accent); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 18px; border-radius: var(--radius-sm); border: none; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #3d9aff; }
.btn-ghost { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--border); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-success { background: #16653a; color: #fff; }
.btn-success:hover { background: #1a7a45; }
.btn-danger { background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-icon { padding: 6px; background: none; border: none; color: var(--text2); cursor: pointer; border-radius: var(--radius-sm); }
.btn-icon:hover { color: var(--text); background: var(--bg3); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.badge-fresh { background: rgba(74,222,128,.15); color: var(--fresh-c); }
.badge-frozen { background: rgba(129,140,248,.15); color: var(--frozen-c); }
.badge-canned { background: rgba(245,158,11,.15); color: var(--canned-c); }
.badge-dry { background: rgba(167,139,107,.15); color: var(--dry-c); }
.badge-cooled { background: rgba(56,189,248,.15); color: #38bdf8; }
.badge-category { background: rgba(45,140,240,.12); color: var(--accent); }
.badge-slot-fruehstueck { background: rgba(251,191,36,.15); color: var(--breakfast-c); }
.badge-slot-abendessen { background: rgba(249,115,22,.15); color: var(--dinner-c); }
.badge-slot-snacks { background: rgba(163,230,53,.15); color: var(--snack-c); }
.badge-rough { background: rgba(239,68,68,.12); color: var(--danger); }
.badge-allergen { background: rgba(239,68,68,.1); color: var(--danger); border: 1px solid rgba(239,68,68,.25); }

/* Stat Cards */
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-label { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* Progress Bar */
.progress-bar { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width .4s; }

/* Recipe Cards */
.recipe-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; cursor: pointer; transition: border-color .15s; }
.recipe-card:hover { border-color: var(--accent); }
.recipe-card-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.recipe-card-meta { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.recipe-card-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.recipe-card-desc { font-size: 13px; color: var(--text2); margin-top: 8px; }

/* Meal Plan */
.day-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.day-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.day-card-title { font-size: 16px; font-weight: 700; }
.day-card-date { font-size: 12px; color: var(--text2); }
.meal-slot { padding: 10px 0; border-bottom: 1px solid var(--border); }
.meal-slot:last-child { border-bottom: none; }
.meal-slot-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.meal-slot-label.fruehstueck { color: var(--breakfast-c); }
.meal-slot-label.abendessen { color: var(--dinner-c); }
.meal-slot-label.snacks { color: var(--snack-c); }
.meal-slot-content { display: flex; align-items: center; justify-content: space-between; }
.meal-slot-empty { color: var(--text2); font-size: 13px; font-style: italic; }
.meal-slot-recipe { font-size: 14px; font-weight: 500; }
.meal-slot-add {
  padding: 6px 12px; background: var(--bg3); border: 1px dashed var(--border);
  border-radius: var(--radius-sm); color: var(--text2); font-size: 12px;
  cursor: pointer; transition: all .15s; display: inline-flex; align-items: center; gap: 4px;
}
.meal-slot-add:hover { border-color: var(--accent); color: var(--accent); background: rgba(45,140,240,.08); }

/* Shopping List */
.shopping-group { margin-bottom: 24px; }
.shopping-group-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text2); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.shopping-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(30,58,95,.5); font-size: 14px; }
.shopping-item:last-child { border-bottom: none; }
.shopping-item.checked { opacity: .45; }
.shopping-item.checked .shopping-name { text-decoration: line-through; }
.shopping-check { width: 20px; height: 20px; border-radius: 4px; border: 2px solid var(--border); flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; background: none; }
.shopping-item.checked .shopping-check { background: var(--accent); border-color: var(--accent); }
.shopping-name { flex: 1; }
.shopping-amount { color: var(--text2); font-size: 13px; white-space: nowrap; }

/* Crew */
.crew-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.crew-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: #fff; flex-shrink: 0; }
.crew-name { font-size: 15px; font-weight: 600; }
.crew-detail { font-size: 12px; color: var(--text2); margin-top: 2px; }
.crew-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }

/* Trip Cards */
.trip-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; cursor: pointer; transition: border-color .15s; }
.trip-card:hover { border-color: var(--accent); }
.trip-card.active-trip { border-color: var(--accent); }
.trip-card-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.trip-card-meta { font-size: 13px; color: var(--text2); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); max-width: 600px; width: 100%; max-height: 80vh; overflow-y: auto; padding: 28px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { background: var(--bg3); border: none; color: var(--text2); cursor: pointer; padding: 4px 10px; border-radius: 6px; font-size: 16px; }
.modal-close:hover { color: var(--text); }

/* Forms */
input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
label { font-size: 13px; font-weight: 500; display: block; margin-bottom: 4px; }
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* Checkbox/Toggle */
.checkbox-list { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px; cursor: pointer; transition: all .15s;
}
.checkbox-item.selected { background: rgba(45,140,240,.15); border-color: var(--accent); color: var(--accent); }
.toggle { width: 40px; height: 22px; border-radius: 11px; background: var(--bg3); border: none; cursor: pointer; position: relative; transition: background .2s; flex-shrink: 0; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text2); transition: all .2s; }
.toggle.on { background: var(--accent); }
.toggle.on::after { left: 21px; background: #fff; }

/* Tabs */
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn { padding: 8px 16px; background: none; border: none; color: var(--text2); font-size: 13px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s; }
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }

/* Misc */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text2); margin-bottom: 14px; }
.notice { background: rgba(45,140,240,.1); border: 1px solid rgba(45,140,240,.25); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; color: var(--text2); margin-bottom: 16px; }
.notice-warning { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.25); }
.notice-danger { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.25); }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text2); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 13px; }
.inline-flex { display: flex; align-items: center; gap: 8px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text2); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.gap-8 { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }

/* Settings */
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.settings-row:last-child { border-bottom: none; }
.settings-label { font-weight: 500; }
.settings-desc { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* Recipe Detail */
.recipe-detail-header { margin-bottom: 20px; }
.recipe-detail-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.recipe-detail-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.recipe-detail-meta { display: flex; gap: 16px; font-size: 13px; color: var(--text2); }
.recipe-ingredients { margin-bottom: 24px; }
.ingredient-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(30,58,95,.5); font-size: 14px; }
.ingredient-row:last-child { border-bottom: none; }
.ingredient-amount { color: var(--text2); white-space: nowrap; }
.recipe-steps { list-style: none; }
.recipe-steps li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; line-height: 1.6; }
.recipe-steps li:last-child { border-bottom: none; }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--bg3); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--accent); margin-top: 1px; }

/* Portion Scaler */
.portion-scaler { display: inline-flex; align-items: center; gap: 8px; background: var(--bg3); border-radius: var(--radius-sm); padding: 4px; }
.portion-scaler button { width: 28px; height: 28px; border-radius: 50%; background: var(--bg2); border: 1px solid var(--border); color: var(--text); cursor: pointer; font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.portion-scaler button:hover { border-color: var(--accent); color: var(--accent); }
.portion-scaler .portion-value { font-size: 14px; font-weight: 700; min-width: 20px; text-align: center; }

/* Search */
.search-input {
  width: 100%; padding: 10px 14px 10px 36px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px;
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-wrapper { position: relative; margin-bottom: 16px; }
.search-wrapper svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text2); }

/* Picker Modal */
.picker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-height: 50vh; overflow-y: auto; }
.picker-item { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; cursor: pointer; transition: all .15s; }
.picker-item:hover { border-color: var(--accent); }
.picker-item-title { font-size: 13px; font-weight: 600; }
.picker-item-meta { font-size: 11px; color: var(--text2); margin-top: 2px; }

/* Onboarding */
.onboarding-overlay { position: fixed; inset: 0; background: var(--bg); z-index: 200; display: flex; align-items: center; justify-content: center; }
.onboarding-card { max-width: 480px; width: 90%; text-align: center; padding: 40px 32px; }
.onboarding-card h1 { font-size: 28px; margin-bottom: 8px; }
.onboarding-card .subtitle { color: var(--text2); font-size: 14px; margin-bottom: 32px; }

/* Desktop */
@media (min-width: 1025px) {
  .topbar { padding: 0 40px; }
  .content { max-width: 1100px; padding: 32px 40px; }
  .modal { max-width: 900px; }
  .page-header h2 { font-size: 24px; }
  .picker-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* Tablet */
@media (min-width: 701px) and (max-width: 1024px) {
  .sidebar { display: none; }
  .mobile-nav { display: block; }
  .content { max-width: 860px; padding: 24px 24px calc(80px + env(safe-area-inset-bottom)) 24px; }
  .main { padding-top: env(safe-area-inset-top); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* Mobile */
@media (max-width: 700px) {
  .sidebar { display: none; }
  .mobile-nav { display: block; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .content { padding: 16px 16px calc(80px + env(safe-area-inset-bottom)) 16px; }
  .main { padding-top: env(safe-area-inset-top); }
  .page-header h2 { font-size: 18px; }
  .modal { border-radius: var(--radius) var(--radius) 0 0; max-height: 92vh; }
  .modal-overlay { align-items: flex-end; }
  .picker-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .recipe-detail-meta { flex-wrap: wrap; gap: 8px; }
}
