/* Kalori turuncu-amber, protein mor-mavi. Açık tema taş rengi (göz almasın), koyu tema mürekkep siyahı. */

:root {
  --bg: #E7E4DD;
  --glow: rgb(255 150 70 / 0.18);
  --card: #F7F5F0;
  --card-2: #EDEAE3;
  --raised: #FFFFFF;
  --text: #16171C;
  --text-2: #62646C;
  --border: #D9D5CC;
  --kcal: #E96B17;
  --kcal-2: #F7A928;
  --kcal-soft: #F7DCC4;
  --prot: #5A48E0;
  --prot-2: #3C8CFF;
  --prot-soft: #DFDBFA;
  --on-accent: #1C1206;
  --good: #19975C;
  --warn: #D49305;
  --bad: #D9443A;
  --on-dot: #FFFFFF;
  --shadow: 0 1px 2px rgb(30 25 15 / 0.06), 0 10px 30px -14px rgb(30 25 15 / 0.22);
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

/* Koyu tema: sistem koyuysa (Ayarlar → Sistem) ya da Ayarlar → Koyu seçildiyse. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0C10;
    --glow: rgb(255 130 50 / 0.13);
    --card: #15171D;
    --card-2: #1D2027;
    --raised: #2C3039;
    --text: #F2F3F6;
    --text-2: #8D93A1;
    --border: #262A33;
    --kcal: #FF8A3D;
    --kcal-2: #FFC24D;
    --kcal-soft: #3A2516;
    --prot: #9283FF;
    --prot-2: #56B8FF;
    --prot-soft: #25214A;
    --on-accent: #1C1206;
    --good: #3DD68C;
    --warn: #F5B83D;
    --bad: #FF6B5E;
    --on-dot: #0B0C10;
    --shadow: 0 0 0 1px rgb(255 255 255 / 0.02), 0 12px 32px -16px rgb(0 0 0 / 0.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B0C10;
  --glow: rgb(255 130 50 / 0.13);
  --card: #15171D;
  --card-2: #1D2027;
  --raised: #2C3039;
  --text: #F2F3F6;
  --text-2: #8D93A1;
  --border: #262A33;
  --kcal: #FF8A3D;
  --kcal-2: #FFC24D;
  --kcal-soft: #3A2516;
  --prot: #9283FF;
  --prot-2: #56B8FF;
  --prot-soft: #25214A;
  --on-accent: #1C1206;
  --good: #3DD68C;
  --warn: #F5B83D;
  --bad: #FF6B5E;
  --on-dot: #0B0C10;
  --shadow: 0 0 0 1px rgb(255 255 255 / 0.02), 0 12px 32px -16px rgb(0 0 0 / 0.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: radial-gradient(120% 50% at 50% -12%, var(--glow), transparent 70%) no-repeat, var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--body);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 800; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; display: block; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.small { font-size: 0.84rem; }
.center { text-align: center; }
.label { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); font-weight: 700; }
.error { color: var(--bad); min-height: 1.2em; text-align: center; }

/* --- Kontroller ---------------------------------------------------------- */

input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  font: inherit;
  color: var(--text);
  background: var(--card-2);
  border: 1.5px solid transparent;
  border-radius: 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
input:focus { border-color: var(--kcal); background: var(--card); }
input::placeholder { color: var(--text-2); opacity: 0.8; }

button {
  height: 46px;
  padding: 0 16px;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: var(--card-2);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: transform 0.12s, background 0.15s, color 0.15s;
}
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.35; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--kcal); outline-offset: 2px; }
button.ink { background: linear-gradient(135deg, var(--kcal-2), var(--kcal)); color: var(--on-accent); box-shadow: 0 6px 18px -8px var(--kcal); }
button.ghost { background: transparent; color: var(--text-2); }
button.block { width: 100%; }
button.small { height: 36px; padding: 0 14px; font-size: 0.88rem; border-radius: 12px; }
button.danger { color: var(--bad); background: transparent; border: 1.5px solid var(--border); }
button.icon { width: 42px; padding: 0; background: transparent; color: var(--text-2); }
button.icon.sm { width: 30px; height: 30px; }
button.icon.sm svg { width: 16px; height: 16px; }

/* Parçalı seçici: zemin çukur, seçili parça kabarık. */
.seg { display: flex; gap: 3px; padding: 3px; background: var(--card-2); border-radius: 14px; }
.seg button { flex: 1; height: 36px; padding: 0 6px; border-radius: 11px; background: transparent; font-size: 0.86rem; font-weight: 600; color: var(--text-2); }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.seg.soft button[aria-pressed="true"] { background: var(--prot-soft); color: var(--prot); box-shadow: none; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row input { flex: 1 1 140px; }
.row input.narrow, input.narrow { flex: 0 1 92px; width: 92px; }

/* --- Açılış ve giriş ----------------------------------------------------- */

.loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 50; transition: opacity 0.35s; }
.loading img { width: 88px; height: 88px; }
.loading.fade { opacity: 0; pointer-events: none; }

#login {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(48px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}
.hero { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; margin-bottom: 22px; }
.hero-icon { width: 104px; height: 104px; filter: drop-shadow(0 16px 30px rgb(255 120 40 / 0.35)); }
.hero h1 { font-size: 3rem; font-weight: 800; letter-spacing: -0.04em; }
.hero p { color: var(--text-2); max-width: 32ch; }
.google { background: var(--card); height: 54px; box-shadow: var(--shadow); }
.g-logo { width: 20px; height: 20px; }
.hint { color: var(--text-2); font-size: 0.86rem; text-align: center; }

/* --- Kurulum ------------------------------------------------------------- */

#setup {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(32px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.setup { display: flex; flex-direction: column; gap: 18px; }
.setup-head { display: flex; flex-direction: column; gap: 6px; }
.setup-head h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.field-row input { text-align: center; font-size: 1.1rem; font-weight: 700; }
.field-row input::placeholder { font-weight: 500; opacity: 0.4; }
.setup-result { gap: 6px; min-height: 92px; justify-content: center; }
.setup-nums { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; }
.setup-nums b { font-family: var(--display); font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
.setup-nums b small { font-family: var(--body); font-size: 0.9rem; font-weight: 600; color: var(--text-2); letter-spacing: 0; }
.setup-nums .k { color: var(--kcal); }
.setup-nums .p { color: var(--prot); }
.check { display: flex; align-items: center; gap: 10px; font-size: 0.92rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--kcal); flex: none; }

/* --- Öğün planı düzenleme ------------------------------------------------ */

.plan-buttons button { flex: 1; font-size: 0.86rem; padding: 0 10px; }
dialog.wide { width: min(520px, calc(100% - 20px)); max-height: calc(100dvh - 24px); }
dialog.wide .menu { max-height: calc(100dvh - 26px); }
dialog.wide .menu > :not(.meal-rows) { flex: none; }
.meal-rows { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; flex: 1; margin: 0 -4px; padding: 0 4px; }
.meal-row { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 16px; background: var(--card-2); }
.meal-row input { height: 40px; background: var(--card); font-size: 0.92rem; }
.meal-row-top { display: flex; gap: 6px; align-items: center; }
.meal-row-top input[type="time"] { flex: 0 0 96px; padding: 0 8px; font-weight: 700; }
.meal-row-top input:not([type]) { flex: 1; font-weight: 700; }
.vals { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vals > span { flex: 1 1 70px; }
.vals label { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 0.84rem; }
.vals input { width: 76px; text-align: center; font-weight: 700; padding: 0 6px; }
.plan-total { font-size: 0.86rem; font-weight: 600; color: var(--text-2); text-align: center; }

/* --- Uygulama iskeleti --------------------------------------------------- */

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right)) calc(110px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 0 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.daynav { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; }
.day { flex: 1; min-width: 0; height: 54px; background: transparent; flex-direction: column; gap: 0; }
.day strong { font-family: var(--display); font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.day small { font-weight: 500; color: var(--text-2); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.banner { background: var(--kcal-soft); color: var(--text); font-size: 0.84rem; padding: 9px 12px; border-radius: 12px; margin-bottom: 12px; text-align: center; }

.tab, .stack { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--card); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.install-card { flex-direction: row; align-items: center; margin-bottom: 14px; }
.install-card .main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* Alt menü: yüzen hap. */
.tabs {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 10;
  width: min(400px, calc(100% - 32px));
  display: flex;
  gap: 4px;
  padding: 6px;
  background: color-mix(in srgb, var(--card) 86%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 14px 40px -12px rgb(0 0 0 / 0.35);
}
.tabs button { flex: 1; height: 54px; background: transparent; flex-direction: column; gap: 2px; font-size: 0.72rem; font-weight: 700; color: var(--text-2); border-radius: 18px; }
.tabs button[aria-current="page"] { background: var(--kcal-soft); color: var(--kcal); }
.tabs button[aria-current="page"] svg { stroke-width: 2.6; }

/* --- Bugün: halkalar ----------------------------------------------------- */

.summary { display: flex; align-items: center; gap: 18px; }
.ring-box { position: relative; flex: none; width: 136px; height: 136px; }
.rings { width: 136px; height: 136px; transform: rotate(-90deg); stroke-linecap: round; }
.rings circle { fill: none; stroke-width: 11; }
.rings .track.k { stroke: var(--kcal-soft); }
.rings .track.p { stroke: var(--prot-soft); }
.rings .arc.k { stroke: url(#grad-k); }
.rings .arc.p { stroke: url(#grad-p); }
.stop-k1 { stop-color: var(--kcal-2); }
.stop-k2 { stop-color: var(--kcal); }
.stop-p1 { stop-color: var(--prot-2); }
.stop-p2 { stop-color: var(--prot); }
@media (prefers-reduced-motion: no-preference) { .rings circle { transition: stroke-dasharray 0.5s ease; } }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.ring-center b { font-family: var(--display); font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; }
.ring-center span { font-size: 0.68rem; color: var(--text-2); font-weight: 600; margin-top: 3px; }

.legend { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stat { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.stat .label { display: flex; align-items: center; gap: 6px; }
.stat .label i { width: 8px; height: 8px; border-radius: 50%; }
.stat.k .label i { background: var(--kcal); }
.stat.p .label i { background: var(--prot); }
.stat b { font-family: var(--display); font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.stat b small { font-family: var(--body); font-size: 0.82rem; font-weight: 600; color: var(--text-2); letter-spacing: 0; }
.rest { padding-top: 12px; border-top: 1px dashed var(--border); }

.fix { background: linear-gradient(160deg, color-mix(in srgb, var(--kcal) 14%, var(--card)), var(--card) 60%); box-shadow: var(--shadow), inset 0 0 0 1.5px color-mix(in srgb, var(--kcal) 45%, transparent); }
.fix.ok { background: linear-gradient(160deg, color-mix(in srgb, var(--good) 14%, var(--card)), var(--card) 60%); box-shadow: var(--shadow), inset 0 0 0 1.5px color-mix(in srgb, var(--good) 45%, transparent); }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; font-size: 0.92rem; border-radius: 16px; background: var(--card-2); }
.opt > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opt ul { margin: 0; padding-left: 18px; }
.opt .num { color: var(--kcal); font-weight: 700; }

/* Öğünler: zaman çizelgesi. Noktanın dolgusu öğünün durumunu gösterir. */
.meal { position: relative; display: grid; grid-template-columns: 50px 1fr; gap: 12px; padding: 14px 0; }
.meal:first-child { padding-top: 2px; }
.meal::before { content: ""; position: absolute; left: 61px; top: 0; bottom: 0; width: 2px; background: var(--card-2); }
.meal:first-child::before { top: 10px; }
.meal:last-child::before { bottom: auto; height: 22px; }
.meal::after { content: ""; position: absolute; left: 55px; top: 19px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2.5px solid var(--border); box-sizing: content-box; transform: translate(-1px, -1px); }
.meal:first-child::after { top: 7px; }
.meal.full::after { background: var(--good); border-color: var(--good); }
.meal.half::after { background: linear-gradient(90deg, var(--warn) 50%, var(--card) 50%); border-color: var(--warn); }
.meal.skip::after { background: var(--bad); border-color: var(--bad); }
.time { font-size: 0.8rem; font-weight: 700; color: var(--text-2); padding-top: 4px; }
.meal-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding-left: 14px; }
.meal-body > p { margin-top: -6px; }
.meal-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.meal-top strong { font-size: 1.02rem; }
.meal.skip strong { text-decoration: line-through; color: var(--text-2); }
.meal [data-meal$=":1"][aria-pressed="true"] { background: var(--good); color: var(--on-dot); }
.meal [data-meal$=":0.5"][aria-pressed="true"] { background: var(--warn); color: var(--on-dot); }
.meal [data-meal$=":0"][aria-pressed="true"] { background: var(--bad); color: var(--on-dot); }
.hint-line { color: var(--prot); font-weight: 600; font-size: 0.86rem; }

.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.chip { display: flex; align-items: center; justify-content: space-between; gap: 6px; background: var(--card-2); border: 1.5px solid transparent; border-radius: 14px; padding: 6px 6px 6px 12px; min-width: 0; }
.chip.on { border-color: var(--kcal); background: var(--kcal-soft); }
.chip-name { font-size: 0.84rem; font-weight: 600; min-width: 0; }
.chip-name small { display: block; color: var(--text-2); font-size: 0.7rem; font-weight: 500; }
.chip-ctl { display: flex; align-items: center; gap: 4px; }
.chip-ctl button { width: 30px; height: 30px; padding: 0; border-radius: 9px; background: var(--raised); }
.chip-ctl b { min-width: 16px; text-align: center; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.9rem; }
.list li > span:last-child { display: flex; align-items: center; gap: 4px; }

/* --- Antrenman ----------------------------------------------------------- */

.sets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sets label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sets input { text-align: center; padding: 0 6px; font-size: 1.1rem; font-weight: 700; }
.rules { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 0.9rem; }
.exercise .hint-line { color: var(--good); }

/* --- İlerleme ------------------------------------------------------------ */

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { height: auto; padding: 0; background: transparent; flex-direction: column; gap: 5px; font-weight: 600; font-size: 0.72rem; color: var(--text-2); }
.wd.sel { color: var(--text); font-weight: 800; }
.dot { width: 100%; max-width: 46px; aspect-ratio: 1; border-radius: 14px; display: grid; place-items: center; font-size: 0.74rem; font-weight: 800; background: var(--card-2); color: var(--text-2); }
.dot.good { background: var(--good); color: var(--on-dot); }
.dot.warn { background: var(--warn); color: var(--on-dot); }
.dot.bad { background: var(--bad); color: var(--on-dot); }
.dot.today { outline: 2px solid var(--kcal); outline-offset: 2px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px; border-radius: 16px; background: var(--card-2); }
.stats .label { font-size: 0.64rem; letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; }
.stats b { font-family: var(--display); font-size: 1.3rem; font-weight: 800; }

.note { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 16px; background: var(--prot-soft); font-size: 0.9rem; }
.note.warn { background: var(--kcal-soft); }
.note button { height: 36px; }

.chart { width: 100%; height: auto; display: block; stroke: none; }
.chart text { font-size: 11px; font-weight: 600; fill: var(--text-2); }
.chart .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .area { fill: var(--prot); fill-opacity: 0.16; }
.chart .line { fill: none; stroke: var(--prot); stroke-width: 3; }
.chart .pt { fill: var(--prot); }
.chart .end { fill: var(--card); stroke: var(--prot); stroke-width: 3; }

/* --- Pencereler ---------------------------------------------------------- */

dialog {
  width: min(420px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.5);
}
dialog::backdrop { background: rgb(0 0 0 / 0.45); backdrop-filter: blur(4px); }
.menu { display: flex; flex-direction: column; gap: 12px; padding: 22px; }
.menu h3 { font-size: 1.3rem; text-align: center; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px; background: var(--card-2); border-radius: 16px; }
.stepper button { width: 44px; padding: 0; font-size: 1.2rem; background: var(--raised); }
.stepper b { flex: 1; text-align: center; font-size: 1.05rem; }
.steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 20;
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 30px -10px rgb(0 0 0 / 0.4);
}

/* --- Açılır bölümler ve dil seçimi --------------------------------------- */

details.card > summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2::after { content: " +"; color: var(--text-2); font-weight: 500; }
details.card[open] > summary h2::after { content: " −"; }
details.card:not([open]) { gap: 0; }

#login .lang-seg { align-self: center; width: 220px; margin-top: 8px; }

/* --- Ne yedin? ----------------------------------------------------------- */

.scan { background: linear-gradient(150deg, color-mix(in srgb, var(--prot) 16%, var(--card)), var(--card) 55%); }
.scan-row { display: flex; gap: 8px; align-items: center; }
.scan-row input { flex: 1; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--border); }
.scan-row input:focus { box-shadow: none; }
.scan-row .cam { width: 46px; flex: none; color: #fff; background: linear-gradient(135deg, var(--prot-2), var(--prot)); box-shadow: 0 6px 18px -8px var(--prot); }
.scan-result { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px dashed var(--border); }
.scan-status { display: flex; align-items: center; gap: 10px; min-width: 0; }
.scan-status > div { min-width: 0; }
.thumb { width: 54px; height: 54px; border-radius: 12px; object-fit: cover; flex: none; }
.scan-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scan-name { flex: 1 1 100%; font-weight: 700; }
.scan-item .num { flex: 1; color: var(--text-2); font-size: 0.86rem; font-weight: 600; }
.grams { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.grams input { width: 84px; height: 40px; text-align: center; padding: 0 6px; font-weight: 700; }
.row.end { justify-content: flex-end; }
.spinner { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2.5px solid var(--prot-soft); border-top-color: var(--prot); }
@media (prefers-reduced-motion: no-preference) { .spinner { animation: spin 0.8s linear infinite; } }
@keyframes spin { to { transform: rotate(360deg); } }

.portions { display: flex; gap: 6px; flex: 1 1 100%; }
.portions button { height: 32px; padding: 0 12px; font-size: 0.82rem; font-weight: 700; color: var(--text-2); border-radius: 10px; }
.portions button[aria-pressed="true"] { background: var(--prot-soft); color: var(--prot); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; vertical-align: 2px; background: var(--card-2); color: var(--text-2); }
.badge.barcode, .badge.label { background: var(--prot-soft); color: var(--prot); }
.badge.known { background: var(--kcal-soft); color: var(--kcal); }
