:root {
  --page: #f1f5f2;
  --card: #ffffff;
  --ink: #18231e;
  --muted: #7d8a83;
  --line: #e6ebe7;
  --green: #2b9c70;
  --green-soft: #e8f5ee;
  --protein: #297ce0;
  --fat: #e68a40;
  --carbs: #28a66f;
  --shadow: 0 8px 28px rgba(34, 66, 48, .045);
}
* { box-sizing: border-box; }
html { background: var(--page); }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { color: inherit; }
.app-shell { width: min(100%, 660px); margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); }
.topbar { padding: 9px 3px 18px; }
.greeting { color: #718078; font-size: 15px; font-weight: 600; letter-spacing: .015em; }
.heading-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
h1 { margin: 5px 0 0; font-size: 34px; line-height: 1.08; letter-spacing: -.045em; font-weight: 780; }
.date-caption { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.avatar-button { width: 44px; height: 44px; border: 0; border-radius: 50%; color: white; background: #20352b; font-weight: 700; font-size: 17px; }
.card { background: var(--card); border: 1px solid rgba(222, 231, 225, .9); border-radius: 25px; box-shadow: var(--shadow); }
.overview-card { padding: 24px 21px 0; overflow: hidden; }
.overview-main { display: grid; grid-template-columns: minmax(150px, .9fr) 1.1fr; align-items: center; gap: 23px; padding-bottom: 22px; }
.calorie-ring { --ring-angle: 0deg; width: min(100%, 190px); aspect-ratio: 1; border-radius: 50%; background: conic-gradient(from -90deg, #e8893d var(--ring-angle), #edf1ee 0deg); display: grid; place-items: center; margin: 0 auto; }
.ring-center { width: 80%; height: 80%; border-radius: 50%; background: white; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.ring-center strong { font-size: clamp(32px, 8vw, 42px); line-height: 1; letter-spacing: -.05em; }
.ring-center span { margin-top: 7px; color: var(--muted); font-size: 12px; }
.ring-center b { color: #68766e; font-weight: 600; }
.macro-list { display: flex; flex-direction: column; gap: 16px; }
.macro-item { min-width: 0; }
.macro-label { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; color: #77847d; font-size: 13px; }
.macro-label strong { color: var(--ink); font-size: 13px; font-weight: 700; white-space: nowrap; }
.macro-track { height: 7px; border-radius: 10px; background: #edf0ee; overflow: hidden; margin-top: 7px; }
.macro-track[hidden], .macro-foot[hidden] { display: none !important; }
.macro-track i { display: block; width: 0; height: 100%; border-radius: inherit; transition: width .3s ease; }
.protein .macro-track i { background: var(--protein); }
.fat .macro-track i { background: var(--fat); }
.carbs .macro-track i { background: var(--carbs); }
.macro-foot { display: flex; justify-content: space-between; margin-top: 4px; color: #a0aaa4; font-size: 10px; }
.remaining-strip { min-height: 51px; margin: 0 -21px; padding: 12px 15px; display: flex; justify-content: center; align-items: center; gap: 9px; background: #f7faf8; color: #27885f; font-weight: 650; font-size: 13px; text-align: center; }
.flame { font-size: 18px; line-height: 1; }
.quick-card { margin-top: 20px; padding: 22px 21px 17px; }
.section-kicker { color: #88958e; font-size: 11px; line-height: 1.2; letter-spacing: .16em; font-weight: 750; }
.quick-title-row { display: flex; align-items: center; justify-content: space-between; }
h2 { margin: 5px 0 16px; font-size: 23px; letter-spacing: -.035em; line-height: 1.15; }
.quick-title-row h2 { margin-bottom: 16px; }
.apple-mark { color: var(--green); font-size: 30px; transform: rotate(180deg); }
.meal-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; border-radius: 15px; background: #f3f6f4; padding: 4px; margin-bottom: 14px; }
.meal-tab { border: 0; background: transparent; border-radius: 12px; padding: 10px 3px; color: #78857e; font-size: 12px; font-weight: 600; cursor: pointer; }
.meal-tab.active { background: white; color: #26372e; box-shadow: 0 2px 8px rgba(20, 45, 31, .08); }
textarea, .search-field, .goals-form input, .amount-row input { display: block; width: 100%; border: 1px solid #dce5df; outline: none; background: #fbfcfb; color: var(--ink); border-radius: 17px; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 94px; padding: 16px; font-size: 14px; line-height: 1.5; }
textarea::placeholder, input::placeholder { color: #a1ada6; }
textarea:focus, .search-field:focus, .goals-form input:focus, .amount-row input:focus { border-color: #7dc8a4; box-shadow: 0 0 0 3px rgba(43, 156, 112, .1); }
.quick-suggestions { position: relative; z-index: 2; max-height: 228px; overflow-y: auto; margin-top: 7px; border: 1px solid #e1e9e3; border-radius: 15px; background: white; box-shadow: 0 8px 20px rgba(34, 66, 48, .08); }
.quick-suggestions.hidden { display: none; }
.quick-suggestion { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; border: 0; border-bottom: 1px solid #eff2f0; background: white; text-align: left; cursor: pointer; }
.quick-suggestion:last-child { border-bottom: 0; }
.quick-suggestion-name { display: block; color: #334138; font-size: 13px; font-weight: 650; }
.quick-suggestion-meta { display: block; margin-top: 3px; color: #8a968f; font-size: 10px; }
.quick-suggestion-kcal { color: #748178; font-size: 11px; white-space: nowrap; }
.quick-actions { display: grid; grid-template-columns: 1fr 1.15fr; gap: 12px; margin-top: 13px; }
.button { min-height: 52px; padding: 0 16px; border: 0; border-radius: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; cursor: pointer; font-weight: 700; font-size: 14px; }
.button:active { transform: translateY(1px); }
.button-soft { color: #287d5b; background: var(--green-soft); }
.button-primary { background: #36b47e; color: white; box-shadow: 0 5px 12px rgba(47, 167, 115, .14); }
.button-primary span { font-size: 19px; line-height: 1; }
.search-icon { font-size: 23px; line-height: 0; }
.popular-block { margin-top: 17px; }
.popular-title { margin-bottom: 9px; color: #76837c; font-size: 13px; }
.popular-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
.popular-chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 9px 13px; border: 1px solid #dfe7e2; border-radius: 999px; background: white; color: #536158; font-size: 12px; cursor: pointer; }
.hint-text { margin: 13px 0 0; color: #8d9992; font-size: 11px; line-height: 1.45; }
.diary-section { margin-top: 28px; }
.section-heading, .calendar-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 11px; }
.section-heading h2, .calendar-heading h2 { margin: 5px 0 0; }
.record-count { border: 1px solid #dce5df; padding: 9px 12px; border-radius: 999px; color: #76837c; font-size: 12px; white-space: nowrap; }
.diary-card { overflow: hidden; }
.meal-group + .meal-group { border-top: 1px solid #edf0ee; }
.meal-group-title { min-height: 46px; padding: 12px 16px 9px; display: flex; justify-content: space-between; align-items: center; color: #445149; font-size: 13px; font-weight: 700; background: #fbfcfb; }
.meal-group-total { color: #8b9790; font-size: 11px; font-weight: 500; }
.diary-entry { min-height: 62px; padding: 10px 15px; display: grid; grid-template-columns: minmax(0, 1fr) auto 28px; align-items: center; gap: 10px; }
.diary-entry + .diary-entry { border-top: 1px solid #f1f3f1; }
.entry-name { font-size: 14px; font-weight: 650; }
.entry-detail { margin-top: 3px; color: #8a968f; font-size: 11px; }
.entry-kcal { color: #27352d; font-size: 13px; font-weight: 700; white-space: nowrap; }
.delete-entry { width: 28px; height: 32px; border: 0; background: transparent; color: #9aa69f; font-size: 17px; cursor: pointer; }
.empty-state { padding: 28px 18px; color: #87938c; text-align: center; font-size: 13px; line-height: 1.5; }
.calendar-section { margin-top: 22px; padding: 21px 19px 17px; }
.month-controls { display: flex; gap: 6px; }
.month-controls button { width: 35px; height: 35px; border: 1px solid #e4ebe6; border-radius: 50%; background: white; color: #5d6b63; font-size: 23px; line-height: 1; cursor: pointer; }
.calendar-month { margin: 4px 0 13px; color: #324139; font-size: 14px; font-weight: 700; text-transform: capitalize; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; }
.calendar-weekdays { margin-bottom: 5px; color: #9aa69f; font-size: 10px; font-weight: 700; }
.calendar-grid { row-gap: 4px; }
.calendar-day { position: relative; min-width: 0; min-height: 46px; padding: 5px 1px 4px; border: 0; border-radius: 12px; background: transparent; color: #56645c; cursor: pointer; }
.calendar-day:disabled { cursor: default; }
.calendar-day .day-number { display: block; font-size: 12px; line-height: 17px; }
.calendar-day .day-kcal { display: block; max-width: 100%; overflow: hidden; color: #819087; font-size: 8px; line-height: 12px; text-overflow: ellipsis; }
.calendar-day.selected { background: #e7f5ed; color: #207a55; font-weight: 750; }
.calendar-day.today .day-number { text-decoration: underline; text-underline-offset: 3px; }
.calendar-day.has-food::after { content: ""; position: absolute; bottom: 2px; left: calc(50% - 2px); width: 4px; height: 4px; border-radius: 50%; background: #34a977; }
.calendar-day.outside { visibility: hidden; }
.calendar-note { margin: 11px 0 0; color: #8b9790; font-size: 11px; line-height: 1.45; }
.app-footer { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 18px; color: #8c9991; font-size: 11px; }
.saved-dot { width: 7px; height: 7px; border-radius: 50%; background: #43b47f; }
.overlay { position: fixed; z-index: 10; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 18px 0 0; background: rgba(19, 31, 25, .42); }
.overlay.hidden { display: none; }
.dialog { width: min(100%, 660px); max-height: 92dvh; overflow: auto; padding: 23px 20px calc(22px + env(safe-area-inset-bottom)); border-radius: 25px 25px 0 0; background: var(--page); box-shadow: 0 -8px 38px rgba(0,0,0,.12); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-heading h2 { margin: 5px 0 14px; }
.close-button { width: 35px; height: 35px; border: 0; border-radius: 50%; background: #e6ece8; color: #617067; font-size: 23px; line-height: 1; cursor: pointer; }
.search-field { padding: 13px 15px; font-size: 14px; }
.category-list { display: flex; gap: 7px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.category-list::-webkit-scrollbar { display: none; }
.category-filter { flex: 0 0 auto; padding: 8px 11px; border: 1px solid #dce5df; border-radius: 999px; background: white; color: #66746c; font-size: 11px; cursor: pointer; }
.category-filter.active { border-color: #49b283; background: #e7f5ed; color: #287d5b; }
.food-results { max-height: 43dvh; overflow-y: auto; margin-top: 7px; border-radius: 15px; background: white; }
.food-result { width: 100%; padding: 13px 14px; border: 0; border-bottom: 1px solid #eff2f0; background: white; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; cursor: pointer; }
.food-result:last-child { border-bottom: 0; }
.food-result-name { display: block; font-size: 13px; font-weight: 650; }
.food-result-category { display: block; margin-top: 3px; color: #8a968f; font-size: 10px; }
.food-result-kcal { white-space: nowrap; color: #728077; font-size: 11px; }
.no-results { padding: 22px 15px; text-align: center; color: #839087; font-size: 12px; }
.text-button { width: 100%; padding: 14px 8px 3px; border: 0; background: none; color: #27875f; font-size: 13px; font-weight: 700; cursor: pointer; }
.portion-dialog { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.portion-food-name { margin: -4px 0 13px; color: #75827a; font-size: 13px; }
.portion-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.portion-option { min-height: 69px; border: 1px solid #dfe8e2; border-radius: 15px; background: white; color: #45534a; cursor: pointer; }
.portion-option strong { display: block; font-size: 12px; }
.portion-option span { display: block; margin-top: 5px; color: #8a968f; font-size: 11px; }
.portion-option.selected { border-color: #42ad7b; background: #e9f6ef; box-shadow: inset 0 0 0 1px #42ad7b; }
.side-box { margin-top: 17px; padding: 14px; border: 1px solid #e1e9e3; border-radius: 17px; background: #f8fbf9; }
.side-box.hidden { display: none; }
.side-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.side-heading strong { color: #334138; font-size: 13px; }
.side-heading span { color: #98a39c; font-size: 10px; }
.side-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.side-option { min-height: 48px; padding: 8px 10px; border: 1px solid #e0e8e2; border-radius: 12px; background: white; text-align: left; cursor: pointer; }
.side-option strong { display: block; color: #526057; font-size: 11px; }
.side-option span { display: block; margin-top: 3px; color: #8d9992; font-size: 10px; }
.side-option.selected { border-color: #42ad7b; background: #e9f6ef; box-shadow: inset 0 0 0 1px #42ad7b; }
.side-size-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 8px; width: 100%; margin-top: 10px; }
.side-size-options.hidden { display: none; }
#sideSizeOptions .side-size-option { appearance: none; -webkit-appearance: none; display: flex; width: 100%; min-width: 0; min-height: 64px; padding: 9px 5px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid #dfe8e2; border-radius: 13px; background: white; color: #45534a; text-align: center; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s, transform .15s; }
#sideSizeOptions .side-size-option strong { display: block; color: #39483f; font-size: 12px; line-height: 1.2; font-weight: 700; }
#sideSizeOptions .side-size-option span { display: block; margin: 0; color: #87948c; font-size: 10px; line-height: 1.2; }
#sideSizeOptions .side-size-option.selected { border-color: #42ad7b; background: #e9f6ef; box-shadow: inset 0 0 0 1px #42ad7b; }
#sideSizeOptions .side-size-option:focus-visible { outline: 3px solid rgba(43, 156, 112, .18); outline-offset: 2px; }
#sideSizeOptions .side-size-option:active { transform: translateY(1px); }
.custom-amount-label { display: block; margin: 17px 0 7px; color: #718077; font-size: 12px; }
.amount-row { display: flex; align-items: center; gap: 10px; }
.amount-row input { padding: 12px 14px; font-size: 15px; }
.amount-row span { width: 32px; color: #69766e; font-size: 13px; }
.nutrition-preview { min-height: 38px; padding: 11px 2px; color: #66746c; font-size: 12px; line-height: 1.5; white-space: pre-line; }
.full-button { width: 100%; }
.goals-form { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.macro-goal-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; grid-column: 1 / -1; }
.macro-goal-fields.hidden { display: none; }
.goal-toggle { display: flex; align-items: center; gap: 9px; color: #435148 !important; font-size: 12px !important; }
.goals-form input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }
.goals-form label { color: #69766e; font-size: 11px; }
.goals-form .wide-field { grid-column: 1 / -1; }
.goals-form input { margin-top: 6px; padding: 11px 12px; font-size: 14px; }
.goals-form .full-button { grid-column: 1 / -1; margin-top: 3px; }
.backup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.backup-actions .button { min-height: 48px; padding: 0 8px; font-size: 11px; text-align: center; }
.import-button { position: relative; overflow: hidden; }
.import-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); max-width: calc(100% - 36px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 12px 16px; border-radius: 14px; background: #20352b; color: white; font-size: 13px; text-align: center; box-shadow: 0 8px 25px rgba(0,0,0,.18); transition: opacity .2s, transform .2s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 390px) {
  .app-shell { padding-left: 14px; padding-right: 14px; }
  .overview-card { padding-left: 15px; padding-right: 15px; }
  .remaining-strip { margin-left: -15px; margin-right: -15px; }
  .overview-main { grid-template-columns: minmax(130px, .9fr) 1.1fr; gap: 13px; }
  .macro-list { gap: 13px; }
  .quick-card { padding-left: 15px; padding-right: 15px; }
  .meal-tab { font-size: 11px; }
  .button { padding-left: 10px; padding-right: 10px; }
}
