*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #F97316;
  --brand-dark: #EA580C;
  --brand-light: #FFF7ED;
  --protein: #2563eb;
  --carb: #b45309;
  --fat: #059669;
  --text: #1C1917;
  --text-muted: #78716C;
  --border: #E7E5E4;
  --bg: #FAFAF9;
  --white: #FFFFFF;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* HEADER */
.site-header { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 800; color: var(--brand); }
.header-badges { display: flex; gap: 6px; }
.badge { background: var(--brand-light); color: var(--brand-dark); font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }

/* LAYOUT */
.app-main { max-width: 1200px; margin: 0 auto; padding: 24px 20px 0; }
.app-grid { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .app-grid { grid-template-columns: 1fr; } }

/* INPUTS */
.inputs-panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.panel-title { font-size: 16px; font-weight: 700; }

/* Unit toggle */
.unit-toggle { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.unit-btn { flex: 1; padding: 8px; border: none; background: var(--white); font-size: 13px; font-family: inherit; cursor: pointer; transition: background .12s, color .12s; color: var(--text-muted); }
.unit-btn.active { background: var(--brand); color: white; font-weight: 600; }

/* Fields */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.input-wrap { display: flex; align-items: center; border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; transition: border-color .12s; }
.input-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(249,115,22,.1); }
.inp { flex: 1; border: none; outline: none; padding: 9px 10px; font-size: 15px; font-weight: 600; font-family: inherit; color: var(--text); background: var(--white); min-width: 0; }
.inp::-webkit-inner-spin-button { opacity: 0; }
select.inp { cursor: pointer; flex: 1; }
.inp-unit { padding: 0 10px; background: var(--bg); color: var(--text-muted); font-size: 12px; font-weight: 600; white-space: nowrap; border-left: 1px solid var(--border); }
.field-hint { font-size: 11px; color: var(--text-muted); }
.optional-field { opacity: .75; }
.optional-tag { font-size: 10px; background: var(--border); color: var(--text-muted); padding: 1px 6px; border-radius: 10px; font-weight: 400; }

/* Goal grid */
.goal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
@media (max-width: 400px) { .goal-grid { grid-template-columns: 1fr 1fr; } }
.goal-btn { padding: 8px 4px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); font-size: 11px; font-family: inherit; cursor: pointer; text-align: center; transition: all .12s; color: var(--text); line-height: 1.3; }
.goal-btn small { display: block; color: var(--text-muted); font-size: 10px; }
.goal-btn.active { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }

.btn-calc { padding: 12px; background: var(--brand); color: white; border: none; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit; transition: background .12s, transform .1s; }
.btn-calc:hover { background: var(--brand-dark); }
.btn-calc:active { transform: scale(.98); }

/* RESULTS */
.results-panel { display: flex; flex-direction: column; gap: 16px; }

/* Calorie cards */
.cal-cards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .cal-cards { grid-template-columns: 1fr; } }
.cal-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center; box-shadow: var(--shadow); }
.cal-card.hero-card { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%); color: white; border-color: transparent; }
.cal-val { font-size: 32px; font-weight: 900; line-height: 1; }
.hero-card .cal-val { font-size: 40px; }
.cal-lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; color: var(--text-muted); }
.hero-card .cal-lbl { color: rgba(255,255,255,.8); }
.cal-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.hero-card .cal-hint { color: rgba(255,255,255,.7); }

/* Macros */
.macros-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.macros-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 16px; }
.macros-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.macro-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.macro-bar-wrap { width: 40px; height: 100px; background: var(--bg); border-radius: 8px; overflow: hidden; display: flex; align-items: flex-end; margin-bottom: 4px; }
.macro-bar { width: 100%; border-radius: 6px; transition: height .5s ease; }
.protein-bar { background: var(--protein); }
.carb-bar { background: var(--carb); }
.fat-bar { background: var(--fat); }
.macro-grams { font-size: 20px; font-weight: 800; }
.macro-name { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.macro-cal { font-size: 11px; color: var(--text-muted); }
.macro-legend { display: flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.protein-dot { background: var(--protein); }
.carb-dot { background: var(--carb); }
.fat-dot { background: var(--fat); }

/* Extra stats */
.extra-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.extra-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; box-shadow: var(--shadow); }
.extra-val { font-size: 20px; font-weight: 800; color: var(--brand); }
.extra-lbl { font-size: 11px; color: var(--text-muted); margin-top: 3px; font-weight: 500; }

/* Meals */
.meals-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.meals-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 12px; }
.meals-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 600px) { .meals-grid { grid-template-columns: repeat(2, 1fr); } }
.meal-card { background: var(--bg); border-radius: 8px; padding: 12px; text-align: center; }
.meal-name { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.meal-cal { font-size: 18px; font-weight: 800; color: var(--brand); }
.meal-unit { font-size: 10px; color: var(--text-muted); }

.disclaimer { font-size: 11px; color: var(--text-muted); line-height: 1.5; padding: 8px 0; }

/* Guide */
.guide-section { border-top: 1px solid var(--border); margin-top: 32px; padding: 36px 20px; background: var(--white); }
.guide-inner { max-width: 1200px; margin: 0 auto; }
.guide-inner h2 { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.guide-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 860px) { .guide-grid { grid-template-columns: 1fr 1fr; } }
.guide-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.guide-card h3 { font-size: 14px; font-weight: 700; color: var(--brand-dark); margin-bottom: 8px; }
.guide-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); text-align: center; padding: 20px; color: var(--text-muted); font-size: 13px; line-height: 1.8; background: var(--white); margin-top: 20px; }
.footer-small { font-size: 11px; color: #A8A29E; }
