
:root{
  --bg: #f7f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #7c3aed;
  --brand-2: #a78bfa;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0,0,0,0.08);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: linear-gradient(180deg, #faf8ff 0%, #f1f5f9 100%);
  color:var(--text);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
.container{
  max-width: 1024px;
  margin: 0 auto;
  padding: 16px;
}
.header{
  display:flex; gap:16px; align-items:center; justify-content:space-between;
  margin-top: 6px;
}
.brand{ display:flex; gap:12px; align-items:center; }
.logo{
  width:42px; height:42px; border-radius:12px;
  background: radial-gradient(120% 120% at 20% 10%, var(--brand) 0%, var(--brand-2) 70%, #c4b5fd 100%);
  box-shadow: var(--shadow);
}
.h1{ font-size: 22px; font-weight: 800; letter-spacing: 0.3px; }
.header-right{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.kpi{ display:flex; gap:8px; flex-wrap:wrap; }
.kpi .chip{
  background:white; border:1px dashed #e5e7eb; border-radius: 999px; padding:6px 10px; font-size:12px; color:var(--muted);
  cursor:pointer;
}
.topnav{
  display:flex; gap:10px; align-items:center; flex-wrap:wrap;
}
.topnav a, .topnav button{
  text-decoration:none; border:none; background:transparent; color:#4c1d95; font-weight:700; cursor:pointer;
  padding:8px 10px; border-radius:999px;
}
.topnav a.active{ background:white; box-shadow: var(--shadow); }

.card{
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-top: 14px;
}
.section-title{ display:flex; align-items:center; justify-content:space-between; }
.tabs{
  display:flex; gap:8px; overflow:auto; padding:4px; margin: 12px 0 16px;
  background: rgba(124,58,237,0.06);
  border-radius: 999px;
}
.tab-btn{
  flex:0 0 auto; padding:10px 14px; border-radius: 999px; border:none; cursor:pointer;
  background: transparent; color: var(--brand); font-weight: 700;
}
.tab-btn.active{ background: white; box-shadow: var(--shadow); color: var(--text); }

.search-row{
  display:flex; gap:10px; align-items:center; margin: 8px 0 12px;
}
.search-input{
  flex:1; padding:12px 14px; border:1px solid #e5e7eb; border-radius: 14px; background:white;
  outline:none;
}
.group{ margin: 14px 0; }
.group h3{ margin:0 0 8px; font-size: 15px; color:#374151; font-weight: 800; letter-spacing: 0.2px }
.item{
  display:flex; gap:10px; align-items:center; justify-content:space-between;
  border:1px solid #eef2f7; background:white; border-radius:14px; padding:10px 12px; margin:8px 0;
}
.item .meta{font-size:12px; color:var(--muted)}
.add-btn{ border:none; border-radius:10px; padding:8px 12px; cursor:pointer; font-weight:700; background: var(--brand); color:white; }
.badge{font-size:12px; padding:4px 8px; border-radius:999px; background:#ede9fe; color:#5b21b6;}

#list-panel{ display:block; }

.meal-targets{
  display:flex; gap:8px; flex-wrap:wrap; margin-top: -4px; margin-bottom: 8px;
}
.meal-targets .chip{ background:white; border:1px solid #e5e7eb; border-radius:999px; padding:6px 10px; font-size:12px; color:#374151; }

.footer-note{ font-size:12px; color:var(--muted); text-align:center; margin-top:14px }

/* Modal */
.modal-backdrop{
  position:fixed; inset:0; background:rgba(0,0,0,0.4); display:none; align-items:center; justify-content:center; z-index:50;
}
.modal{
  width: min(680px, 92vw); max-height: 86vh; overflow:auto; background:white; border-radius: 16px; box-shadow: var(--shadow);
  padding: 16px;
}
.modal-header{ display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.modal-header h3{ margin:0 }
.close-btn{ background:transparent; border:none; font-size:22px; cursor:pointer; }

.list-today .entry{
  display:flex; align-items:flex-start; justify-content:space-between; gap:8px;
  padding:10px 0; border-bottom:1px dashed #eef2f7;
}
.actions{ display:flex; gap:8px; flex-wrap:wrap; }
.ghost{ background:#f9fafb; color:#374151; border:1px solid #e5e7eb; }
.primary{ background: var(--brand); color:white; }
.warn{ background: var(--warn); color:white; }
.share-output{ width:100%; min-height:120px; padding:12px; border:1px solid #e5e7eb; border-radius: 12px }

/* Settings form */
.settings-grid{ display:grid; grid-template-columns: 1fr; gap:12px; }
@media(min-width:720px){ .settings-grid{ grid-template-columns: repeat(2, 1fr); } }
.form-row{ display:flex; gap:8px; align-items:center; }
.form-row label{ width: 160px; font-size: 13px; color:#374151; }
.form-row input{ flex:1; padding:10px 12px; border:1px solid #e5e7eb; border-radius:12px; }
