:root {
  --bg: #f4f6f8; --card: #fff; --ink: #1f2933; --muted: #6b7785;
  --brand: #16a34a; --brand-dark: #15803d; --accent: #0ea5e9; --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,.08); --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); padding-bottom: 60px; }
header { text-align: center; padding: 22px 16px 6px; }
header h1 { margin: 0; font-size: 1.5rem; }
.ai-status { margin: 6px 0 0; font-size: .8rem; color: var(--muted); }
.ai-status.ok { color: var(--brand); } .ai-status.off { color: #d97706; }

.tabs { display: flex; gap: 6px; justify-content: center; padding: 10px; position: sticky; top: 0; background: var(--bg); z-index: 5; flex-wrap: wrap; }
.tab { border: 1px solid var(--border); background: var(--card); color: var(--muted); padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: .88rem; transition: all .15s; }
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

main { max-width: 780px; margin: 0 auto; padding: 8px 16px; }
.panel { display: none; } .panel.active { display: block; animation: fade .2s; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
h2 { font-size: 1.12rem; margin: 18px 0 4px; }
.hint { color: var(--muted); font-size: .84rem; margin: 0 0 12px; }
.empty { text-align: center; color: var(--muted); padding: 26px; }
.msg { margin-left: 8px; font-size: .84rem; } .msg.ok { color: var(--brand); } .msg.err { color: #dc2626; }

input, button { font-family: inherit; }
input { padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; font-size: 1rem; background: var(--card); color: var(--ink); }
input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
button { border: none; border-radius: 10px; padding: 9px 16px; font-size: .92rem; cursor: pointer; background: #e2e8f0; color: var(--ink); transition: background .15s; }
button:hover { background: #cbd5e1; }
button.primary { background: var(--brand); color: #fff; } button.primary:hover { background: var(--brand-dark); }
button.mini { background: transparent; color: var(--accent); padding: 4px 8px; font-size: .82rem; }
.row { display: flex; gap: 8px; } .row input { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-bottom: 12px; }
label.f, .grid label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: 4px; }

/* ---------- ден (Днес / детайл) ---------- */
.day-detail-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-top: 8px; }
.dd-head { display: flex; justify-content: space-between; align-items: center; }
.dd-head h3 { margin: 0; font-size: 1.15rem; }
.dt-switch { display: inline-flex; gap: 6px; margin: 10px 0; }
.dt { background: #eef2f5; color: var(--muted); border-radius: 999px; padding: 6px 12px; font-size: .82rem; }
.dt.on { background: var(--brand); color: #fff; }
.dt:nth-child(2).on { background: #64748b; }
.eaten-line { font-size: .85rem; color: var(--muted); margin: 6px 0 10px; }
.eaten-line b { color: var(--brand-dark); }

/* MFP бюджет ленти */
.budget { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.b-row { font-size: .8rem; }
.b-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.b-nums { color: var(--muted); } .b-nums em { font-style: normal; color: var(--brand-dark); margin-left: 4px; } .b-nums em.neg { color: #dc2626; }
.track { height: 8px; border-radius: 999px; background: #eef2f5; overflow: hidden; }
.fill { height: 100%; border-radius: 999px; transition: width .3s; }
.fill.cal { background: #f59e0b; } .fill.p { background: #3b82f6; } .fill.c { background: #22c55e; } .fill.f { background: #ec4899; }
.fill.over { background: #dc2626 !important; }

.meals { border-top: 1px solid var(--border); margin-top: 6px; }
.meal { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.meal:last-child { border-bottom: none; }
.meal.done { opacity: .62; }
.meal .left { flex: 1; }
.meal-name { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.recipe-name { font-size: .96rem; } .recipe-name .serv { color: var(--muted); font-size: .82rem; }
.meal-target { font-size: .74rem; color: #94a3b8; margin-top: 2px; }
.meal-macros { font-size: .76rem; color: var(--muted); white-space: nowrap; text-align: right; }
.meal-macros b { color: var(--ink); font-size: .92rem; }
.eat { position: relative; width: 28px; height: 28px; flex: none; cursor: pointer; }
.eat input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.eat span { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--border); color: transparent; font-weight: 700; }
.eat input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.day-note { margin-top: 10px; font-size: .82rem; color: #475569; background: #f8fafc; border-radius: 8px; padding: 8px 10px; }

/* ---------- слотове по хранения ---------- */
.meals { border: none; margin-top: 6px; }
.meal-slot { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: #fcfdfe; }
.meal-slot.filled { background: var(--card); }
.meal-slot.done { opacity: .62; }
.ms-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.ms-name { font-weight: 600; font-size: .95rem; }
.ms-target { font-size: .72rem; color: #94a3b8; white-space: nowrap; }
.ms-add { width: 100%; background: #f0fdf4; color: var(--brand-dark); border: 1px dashed var(--brand); border-radius: 10px; padding: 9px; font-size: .9rem; }
.ms-add:hover { background: #dcfce7; }
.ms-body { display: flex; align-items: center; gap: 10px; }
.ms-recipe { flex: 1; }
.ms-title { font-size: .96rem; } .ms-title .serv { color: var(--muted); font-size: .82rem; }
.ms-macros { font-size: .78rem; color: var(--muted); } .ms-macros b { color: var(--ink); }
.ms-act { display: flex; flex-direction: column; gap: 2px; }
.ms-ing { margin-top: 8px; background: #f8fafc; border-radius: 8px; padding: 6px 10px; }
.ms-ing summary { cursor: pointer; font-size: .84rem; color: var(--brand-dark); }
.ms-ing ul { list-style: none; padding: 6px 0 0; margin: 0; }
.ms-ing li { display: flex; justify-content: space-between; padding: 3px 0; font-size: .86rem; border-bottom: 1px dashed var(--border); }
.ms-ing li em { color: var(--muted); font-style: normal; }
.ms-note { font-size: .78rem; color: #475569; margin-top: 6px; }
.ms-cook { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.ms-cook-head { font-size: .84rem; color: var(--brand-dark); font-weight: 600; margin-bottom: 4px; }
.ms-cook-body { font-size: .86rem; color: var(--ink); }
.ms-cook-body ol { margin: 4px 0 0 18px; padding: 0; }
.ms-cook-body li { padding: 3px 0; line-height: 1.4; }
.scale { margin-top: 6px; background: #eff6ff; color: #1d4ed8; }

/* ---------- picker (избор на рецепта) ---------- */
.picker { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 60; }
.picker.hidden { display: none; }
.picker-box { background: var(--card); width: 100%; max-width: 560px; max-height: 80vh; border-radius: 18px 18px 0 0; padding: 16px; display: flex; flex-direction: column; }
@media (min-width: 600px) { .picker { align-items: center; } .picker-box { border-radius: 18px; } }
.picker-head { display: flex; justify-content: space-between; align-items: center; }
.picker-head h3 { margin: 0; font-size: 1.05rem; }
.picker-close { background: transparent; font-size: 1.1rem; padding: 4px 8px; }
#picker-search { margin: 10px 0; }
.picker-list { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.pick-item { display: flex; align-items: center; gap: 10px; background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 8px; text-align: left; }
.pick-item:hover { background: #ecfdf5; border-color: var(--brand); }
.pick-thumb { width: 52px; height: 52px; border-radius: 8px; background-size: cover; background-position: center; background-color: #eef2f5; flex: none; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.pick-info { display: flex; flex-direction: column; gap: 2px; }
.pick-info b { font-size: .92rem; } .pick-info small { color: var(--muted); font-size: .76rem; }

textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; font-size: .95rem; font-family: inherit; resize: vertical; margin-bottom: 8px; }
textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* по-голяма снимка в избора — избор „по ястие" */
.pick-thumb { width: 64px; height: 64px; }
.g-open { cursor: pointer; }
.g-card h3.g-open:hover { color: var(--brand-dark); }

/* ---------- детайл на ястие (модал) ---------- */
.rmodal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 70; }
.rmodal.hidden { display: none; }
.rmodal-box { position: relative; background: var(--card); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; border-radius: 18px 18px 0 0; }
@media (min-width: 600px) { .rmodal { align-items: center; } .rmodal-box { border-radius: 18px; } }
.rmodal-close { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(255,255,255,.9); width: 34px; height: 34px; border-radius: 50%; font-size: 1rem; }
#rmodal-content { padding-bottom: 20px; }
.rm-photo { width: 100%; height: 220px; background-size: cover; background-position: center; background-color: #eef2f5; border-radius: 18px 18px 0 0; }
.rm-photo.ph { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 3rem; gap: 10px; }
.rm-addphoto { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rm-addphoto button { font-size: .9rem; margin: 0 !important; }
.rm-photo-actions { display: flex; gap: 8px; padding: 10px 16px 0; flex-wrap: wrap; }
.rm-photo-actions .mini { background: #eff6ff; color: #1d4ed8; padding: 6px 10px; }
.rm-title { margin: 10px 16px 6px; font-size: 1.25rem; }
#rmodal-content .macros { padding: 0 16px; }
.rm-serv { font-size: .78rem; color: var(--muted); align-self: center; }
.rm-h { margin: 16px 16px 6px; font-size: 1rem; }
.rm-ing { list-style: none; margin: 0; padding: 0 16px; }
.rm-ing li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: .95rem; }
.rm-ing li em { color: var(--muted); font-style: normal; }
.rm-steps { margin: 0; padding: 0 16px 0 34px; }
.rm-steps li { padding: 6px 0; font-size: .95rem; line-height: 1.4; }
.rm-empty { color: var(--muted); padding: 0 16px; font-size: .9rem; }
#rmodal-content .primary, #rmodal-content .mini { margin-left: 16px; }

/* ---------- календар ---------- */
.cal-controls { margin-bottom: 8px; }
.gen-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.gen-box summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); }
.gen-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.gen-grid label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: 4px; }
.weekdays { margin: 8px 0; } .wd-label { font-size: .8rem; color: var(--muted); display: block; margin-bottom: 6px; }
#weekday-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.wd { width: 38px; padding: 7px 0; text-align: center; background: #eef2f5; color: var(--muted); border-radius: 8px; font-size: .82rem; }
.wd.on { background: var(--brand); color: #fff; }
.cal-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.week-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0 8px; }
.week-nav button { background: var(--card); border: 1px solid var(--border); width: 38px; height: 38px; border-radius: 50%; font-size: 1.2rem; }
.week-nav span { font-weight: 600; min-width: 160px; text-align: center; }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.strip-day { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 8px 2px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; position: relative; }
.strip-day.today { border-color: var(--accent); }
.strip-day.sel { background: var(--brand); border-color: var(--brand); }
.strip-day.sel * { color: #fff !important; }
.sd-wd { font-size: .66rem; color: var(--muted); text-transform: uppercase; }
.sd-num { font-size: 1.05rem; font-weight: 600; }
.sd-dot { width: 7px; height: 7px; border-radius: 50%; background: transparent; }
.sd-dot.tr { background: var(--brand); } .sd-dot.rs { background: #94a3b8; }
.sd-cal { font-size: .68rem; color: var(--muted); }
.sd-ring { width: 80%; height: 4px; background: #eef2f5; border-radius: 999px; overflow: hidden; margin-top: 2px; }
.sd-ring span { display: block; height: 100%; background: var(--brand); }

/* ---------- списък за пазаруване ---------- */
.shop-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-top: 14px; }
.shop-card h3 { margin: 0 0 8px; }
.shop-group { margin-top: 10px; }
.shop-group h4 { margin: 6px 0; font-size: .92rem; color: var(--brand-dark); }
.shop-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: .92rem; }
.shop-item input { width: 18px; height: 18px; }
.shop-item em { margin-left: auto; color: var(--muted); font-style: normal; font-size: .85rem; }

/* ---------- добавяне рецепта + галерия ---------- */
.add-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 12px; }
.add-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.add-label { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.drop { display: flex; align-items: center; justify-content: center; border: 2px dashed var(--border); border-radius: 12px; padding: 22px 12px; text-align: center; color: var(--muted); cursor: pointer; font-size: .88rem; transition: all .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: #f0fdf4; color: var(--brand-dark); }
.manual { margin: 14px 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.manual summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.sel-count { font-size: .8rem; color: var(--muted); font-weight: normal; }

/* категории */
.cat-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.cat-filter button { background: var(--card); border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 7px 14px; font-size: .85rem; }
.cat-filter button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.gallery-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.cat-badge { font-size: .68rem; border-radius: 999px; padding: 2px 8px; }
.cat-breakfast { background: #fef3c7; color: #92400e; }
.cat-main { background: #dcfce7; color: #166534; }
.cat-snack { background: #ede9fe; color: #5b21b6; }
.cat-none { background: #fee2e2; color: #991b1b; }
.rm-cat { padding: 8px 16px 0; font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rm-catbtn { background: #eef2f5; color: var(--muted); border-radius: 999px; padding: 5px 11px; font-size: .82rem; }
.rm-catbtn.on { background: var(--brand); color: #fff; }
.rm-actions { display: flex; gap: 8px; padding: 8px 16px 0; flex-wrap: wrap; }
.rm-actions .mini { background: #ecfdf5; color: var(--brand-dark); }
.rm-note { margin: 8px 16px 0; font-size: .84rem; color: #475569; background: #f8fafc; border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; }

/* редактор на рецепта */
.ed-form { padding: 8px 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.ed-l { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); }
.ed-l input, .ed-l select, .ed-l textarea { font-size: 1rem; }
.ed-macros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ed-macros label { display: flex; flex-direction: column; font-size: .72rem; color: var(--muted); gap: 3px; }
.ed-macros input { text-align: center; padding: 7px 4px; }
.ed-ing { display: flex; gap: 6px; margin-bottom: 6px; }
.ed-ing .ed-item { flex: 2; } .ed-ing .ed-amt { flex: 1; }
.ed-del { background: transparent; color: #dc2626; padding: 2px 8px; }
.ed-btns { display: flex; gap: 8px; align-items: center; margin-top: 8px; }

/* списък със замени */
.subs-list { padding: 0 16px 16px; }
.subs-item { border-bottom: 1px dashed var(--border); padding: 10px 0; }
.subs-title { font-weight: 600; color: var(--accent); cursor: pointer; }
.subs-note { font-size: .86rem; color: #475569; margin-top: 3px; white-space: pre-wrap; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px,1fr)); gap: 14px; margin-top: 10px; }
.g-card { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: opacity .15s, transform .1s; }
.g-card:hover { transform: translateY(-2px); } .g-card.dim { opacity: .55; }
.thumb { width: 100%; height: 125px; background-size: cover; background-position: center; background-color: #eef2f5; }
.thumb.placeholder { display: flex; align-items: center; justify-content: center; font-size: 2.3rem; }
.g-body { padding: 12px 14px; } .g-body h3 { margin: 0 0 8px; font-size: .96rem; line-height: 1.25; }
.g-tags { margin: 6px 0; min-height: 14px; }
.macros { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { background: #f1f5f9; border-radius: 999px; padding: 4px 9px; font-size: .76rem; }
.chip.cal { background: #fef3c7; } .chip.p { background: #dbeafe; } .chip.c { background: #dcfce7; } .chip.f { background: #fce7f3; }
.tag { font-size: .72rem; color: var(--muted); margin-right: 6px; }
.meta { font-size: .78rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.meta a { color: var(--accent); text-decoration: none; }
.conf-low { color: #d97706; }
.del { background: transparent; color: #dc2626; padding: 4px 8px; font-size: .8rem; } .del:hover { background: #fee2e2; }
.g-check { position: absolute; top: 8px; left: 8px; z-index: 2; width: 30px; height: 30px; cursor: pointer; }
.g-check input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.g-check span { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.9); border: 2px solid var(--border); color: transparent; font-weight: 700; }
.g-check input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- таргети ---------- */
.ttype-tabs { display: flex; gap: 8px; margin: 8px 0 12px; }
.ttype { background: var(--card); border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 8px 14px; font-size: .86rem; }
.ttype.active { background: var(--brand); color: #fff; border-color: var(--brand); }
#targets-editor { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.tg-head, .tg-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr 30px; gap: 6px; align-items: center; }
.tg-head { font-size: .72rem; color: var(--muted); text-transform: uppercase; padding: 0 2px 6px; }
.tg-row { margin-bottom: 6px; }
.tg-row input { padding: 7px 8px; font-size: .9rem; }
.tg-row input[type=number] { text-align: center; }
.del-row { background: transparent; color: #dc2626; padding: 2px; }
.tg-sum { margin-top: 8px; font-size: .88rem; color: var(--muted); } .tg-sum b { color: var(--ink); }
.add-meal { margin-top: 4px; }

/* ---------- loading ---------- */
.loading { position: fixed; inset: 0; background: rgba(255,255,255,.82); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 200; }
.loading.hidden { display: none; } .loading span { color: var(--muted); font-size: .9rem; }
.spinner { width: 38px; height: 38px; border: 4px solid #d1fae5; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- админ панел ---------- */
.admin-totals { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 14px; }
.admin-totals .stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 18px; text-align: center; box-shadow: var(--shadow); flex: 1; min-width: 100px; }
.admin-totals .stat b { display: block; font-size: 1.6rem; color: var(--brand-dark); }
.admin-totals .stat span { font-size: .8rem; color: var(--muted); }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.admin-table th { text-align: left; padding: 10px 12px; color: var(--muted); font-size: .72rem; text-transform: uppercase; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table td { padding: 10px 12px; border-bottom: 1px dashed var(--border); vertical-align: top; }
.admin-table td.num { text-align: center; font-weight: 600; }
.admin-table .au-sub { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.au-row { cursor: pointer; }
.au-row:hover td { background: #f8fafc; }
.au-detail.hidden { display: none; }
.au-detail td { background: #fcfdfe; }
.au-recipes { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.aur-item { display: flex; align-items: center; gap: 10px; }
.aur-thumb { width: 44px; height: 44px; border-radius: 8px; background-size: cover; background-position: center; background-color: #eef2f5; flex: none; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.aur-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.aur-info b { font-size: .88rem; }
.aur-info small { color: var(--muted); font-size: .74rem; }
.aur-promote { background: #ecfdf5; color: var(--brand-dark); white-space: nowrap; }
.aur-done { font-size: .78rem; color: var(--brand-dark); white-space: nowrap; }

/* ---------- вход / регистрация ---------- */
/* Скрито до решение на checkAuth() — без мигане */
nav.tabs, main, .user-bar { display: none; }
.auth { display: none; }
body.authed main { display: block; }
body.authed nav.tabs { display: flex; }
body.authed .user-bar { display: flex; }
body.guest .auth { display: flex; }

.user-bar { justify-content: center; align-items: center; gap: 10px; margin-top: 8px; font-size: .85rem; color: var(--muted); }

/* онбординг */
#onboarding { display: none; }
body.onboarding #onboarding { display: flex; }
body.onboarding .user-bar { display: flex; }
.onb { align-items: flex-start; justify-content: center; padding: 16px; }
.onb-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; width: 100%; max-width: 460px; }
.onb-box h2 { margin: 0 0 4px; }
.onb-label { display: block; font-size: .85rem; font-weight: 600; margin: 16px 0 6px; }
.onb-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.onb-choice button { flex: 1; min-width: 90px; background: #eef2f5; color: var(--muted); border-radius: 10px; padding: 10px; font-size: .9rem; }
.onb-choice button.active { background: var(--brand); color: #fff; }
#onb-activity { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 1rem; background: var(--card); }
.onb-box .grid { margin-top: 8px; }
#onb-submit { margin-top: 18px; width: 100%; }
.onb-card { margin-top: 16px; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: var(--radius); padding: 16px; text-align: center; }
.onb-goal { color: var(--brand-dark); font-weight: 600; }
.onb-cal { font-size: 2rem; font-weight: 700; margin: 6px 0; }
.onb-macros { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.onb-cal small { font-size: .8rem; color: var(--muted); font-weight: normal; }
.onb-days { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: #065f46; margin-bottom: 12px; }
.onb-days b { font-size: .95rem; }
#onb-training-days { width: 100%; }
.opt { font-size: .7rem; color: var(--muted); font-weight: normal; }
#onb-continue { width: 100%; }

.shared-badge { font-size: .68rem; background: #e0e7ff; color: #3730a3; border-radius: 999px; padding: 2px 7px; }

.auth { min-height: 60vh; align-items: center; justify-content: center; padding: 20px; }
.auth-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 6px; }
.atab { flex: 1; background: #eef2f5; color: var(--muted); border-radius: 999px; padding: 9px; font-size: .9rem; }
.atab.active { background: var(--brand); color: #fff; }
.auth-box input { width: 100%; }
.auth-box .primary { margin-top: 4px; }

/* ---------- печат ---------- */
#print-area { display: none; }
@media print {
  body { background: #fff; padding: 0; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; padding: 10px 18px; color: #000; }
  #print-area h1 { font-size: 1.4rem; margin: 0; }
  #print-area .p-sub { color: #555; margin-bottom: 14px; }
  #print-area .p-day { margin-bottom: 16px; page-break-inside: avoid; }
  #print-area h2 { font-size: 1.05rem; border-bottom: 1px solid #ccc; padding-bottom: 3px; }
  #print-area table { width: 100%; border-collapse: collapse; font-size: .82rem; margin-top: 6px; }
  #print-area th, #print-area td { border: 1px solid #ddd; padding: 4px 6px; text-align: left; }
  #print-area .p-tot td { font-weight: 700; background: #f3f3f3; }
  #print-area .p-note { font-size: .8rem; color: #555; margin-top: 4px; }
  #print-area ul { margin: 4px 0 0 18px; font-size: .85rem; }
}
