/* Jídelníček – tmavý vzhled podle návrhu C */
:root {
  --bg: #121412; --deep: #0B0C0B; --surface: #1D201D; --line: #2E322E; --line2: #3A3E38;
  --fg: #F2F0EA; --muted: #A7A79E; --faint: #6B6E66;
  --kcal: #F2F0EA; --protein: #7FC79E; --fat: #E8C468; --sugar: #C9A7F0; --over: #F08A7E; --warn: #F0A36E;
  --display: 'Space Grotesk', Inter, -apple-system, system-ui, sans-serif;
  --body: Inter, -apple-system, system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; }
body { overscroll-behavior-y: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--protein); outline-offset: 2px; }
[hidden] { display: none !important; }

.screen { min-height: 100%; display: flex; flex-direction: column; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 92px) max(16px, env(safe-area-inset-left, 0px));
  max-width: 560px; margin: 0 auto; }
.top { display: flex; align-items: center; gap: 10px; }
.top .grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.top h1 { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -0.4px; }
.sub { font-size: 13px; color: var(--muted); }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: transparent; display: flex; align-items: center; justify-content: center; flex: none; text-decoration: none; color: var(--fg); }
.icon-btn svg { width: 20px; height: 20px; }

.card { background: var(--surface); border-radius: 20px; }
.rings { display: flex; align-items: center; gap: 16px; padding: 14px; }
.rings .side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ring-row { display: flex; align-items: center; gap: 10px; }
.ring-row .v { font-size: 17px; font-weight: 700; line-height: 1.1; white-space: nowrap; }
.ring-row .v small { font-size: 12px; font-weight: 400; color: var(--muted); }
.ring-row .l { font-size: 12px; color: var(--muted); }

.meals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.meal { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 5px 12px 5px 8px; border-radius: 16px; background: var(--surface); text-decoration: none; color: var(--fg); }
.meal .t { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.meal .n { font-size: 15px; font-weight: 600; }
.meal .d { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 4px 0 -4px; }
.list { background: var(--surface); border-radius: 20px; padding: 2px 12px 2px 16px; display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; background: none; border: 0; padding: 8px 0; color: var(--fg); }
.row .n { font-size: 15px; font-weight: 500; }
.row .n span { color: var(--muted); font-weight: 400; }
.row .d { font-size: 12px; color: var(--muted); }
.round { width: 36px; height: 36px; border-radius: 18px; background: var(--line); border: 0; display: flex; align-items: center; justify-content: center; flex: none; color: var(--fg); }
.round.ghost { background: transparent; border: 1px solid var(--line2); color: var(--muted); }
.round svg { width: 18px; height: 18px; }
.empty { color: var(--muted); font-size: 14px; padding: 14px 0; }

.bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 12px) max(16px, env(safe-area-inset-left, 0px)); background: linear-gradient(to top, var(--bg) 70%, transparent); z-index: 5; }
.bar-inner { max-width: 528px; margin: 0 auto; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 6px 0 16px; border-radius: 28px; background: var(--surface); border: 1px solid var(--line); }
.bar-inner.accent { border-color: var(--protein); }
.bar-inner .ph { flex: 1 1 auto; color: var(--muted); text-decoration: none; font-size: 15px; height: 100%; display: flex; align-items: center; }
.scan-btn { width: 44px; height: 44px; border-radius: 22px; background: var(--protein); color: #121412; display: flex; align-items: center; justify-content: center; flex: none; border: 0; text-decoration: none; }
.scan-btn svg { width: 20px; height: 20px; }

.search { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 6px 0 16px; border-radius: 26px; background: var(--surface); border: 1px solid var(--protein); }
.search input { flex: 1 1 auto; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; }

.btn { height: 52px; border-radius: 26px; background: var(--protein); color: #121412; font-weight: 600; font-size: 16px; border: 0; width: 100%; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.btn.ghost { background: transparent; border: 1px solid var(--line2); color: var(--fg); font-weight: 500; font-size: 14px; height: 48px; }
.btn.danger { background: transparent; border: 1px solid #5a3a36; color: var(--over); font-weight: 500; font-size: 14px; height: 48px; }
.btn[disabled] { opacity: 0.5; }

/* sheet */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92%; overflow-y: auto; background: var(--surface); border-radius: 26px 26px 0 0; padding: 10px max(20px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 20px) max(20px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 16px; }
.grip { align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--line2); }
.sheet h2 { margin: 0; font-family: var(--display); font-size: 22px; font-weight: 700; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.status.ok { color: var(--protein); } .status.no { color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line2); background: transparent; font-size: 14px; white-space: nowrap; color: var(--fg); }
.chip[aria-pressed="true"] { background: var(--fg); color: #121412; border-color: var(--fg); font-weight: 600; }
.stepper { display: flex; align-items: center; justify-content: space-between; }
.stepper button { width: 56px; height: 56px; border-radius: 28px; border: 1px solid var(--line2); background: transparent; font-size: 26px; }
.stepper .val { display: flex; flex-direction: column; align-items: center; }
.stepper input { width: 150px; text-align: center; font-family: var(--display); font-size: 46px; font-weight: 700; border: 0; background: transparent; outline: none; padding: 0; }
.stepper .u { font-size: 14px; color: var(--muted); }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quick button { height: 40px; border-radius: 12px; border: 0; background: var(--bg); font-size: 15px; }
.quick button[aria-pressed="true"] { background: #2E3A33; color: #CFE8D9; font-weight: 600; }
.preview { background: var(--bg); border-radius: 14px; padding: 12px 14px; font-size: 14px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.preview b { color: var(--fg); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

/* toast */
.toast { position: fixed; left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); max-width: 528px; margin: 0 auto; display: flex; align-items: center; gap: 10px; background: var(--fg); color: #121412; border-radius: 14px; padding: 6px 6px 6px 14px; z-index: 30; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.toast .m { flex: 1 1 auto; font-size: 14px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button { background: none; border: 0; font-size: 14px; font-weight: 600; padding: 10px 8px; color: #121412; }
.toast.err { background: #3A2422; color: #F7CFC9; }
.toast.err button { color: #F7CFC9; }

/* calendar */
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; background: var(--surface); border-radius: 12px; padding: 4px; }
.seg a { height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; text-decoration: none; color: var(--muted); }
.seg a[aria-current="page"] { background: var(--fg); color: #121412; font-weight: 600; }
.nav { display: flex; justify-content: space-between; align-items: center; }
.nav .title { font-size: 15px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); align-items: center; }
.legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dots { display: flex; gap: 5px; }
.dots .dot { width: 10px; height: 10px; }
.dots .dot.off { border: 1.5px solid #5A5D56; }
.day-row { display: flex; align-items: center; gap: 12px; min-height: 48px; border-top: 1px solid var(--line); text-decoration: none; color: var(--fg); }
.day-row:first-child { border-top: 0; }
.day-row .dn { width: 64px; display: flex; flex-direction: column; }
.day-row .dn b { font-size: 14px; } .day-row .dn small { font-size: 11px; color: var(--muted); }
.day-row .k { flex: 1 1 auto; font-size: 14px; font-variant-numeric: tabular-nums; }
.month { padding: 12px 8px; display: flex; flex-direction: column; gap: 8px; }
.grid7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; }
.grid7.head { font-size: 11px; color: var(--muted); }
.grid7.days { row-gap: 8px; }
.mday { display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--fg); }
.mday .dots .dot { width: 5px; height: 5px; }
.mday .dots { gap: 3px; height: 5px; }
.stats { padding: 6px 16px; display: flex; flex-direction: column; }
.stats div { display: flex; justify-content: space-between; align-items: center; min-height: 42px; border-top: 1px solid var(--line); font-size: 14px; }
.stats div:first-child { border-top: 0; }
.stats b { font-variant-numeric: tabular-nums; }

/* scanner */
.scanner { position: fixed; inset: 0; background: #000; z-index: 15; display: flex; flex-direction: column; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: relative; margin: auto; width: min(290px, 80vw); height: 170px; border-radius: 18px; box-shadow: 0 0 0 2000px rgba(0,0,0,0.45); }
.scanner .frame::after { content: ""; position: absolute; left: 20px; right: 20px; top: 50%; height: 2px; background: var(--protein); opacity: 0.8; }
.scanner .corner { position: absolute; width: 34px; height: 34px; border: 4px solid var(--protein); }
.scanner .tl { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-radius: 18px 0 0 0; }
.scanner .tr { right: -2px; top: -2px; border-left: 0; border-bottom: 0; border-radius: 0 18px 0 0; }
.scanner .bl { left: -2px; bottom: -2px; border-right: 0; border-top: 0; border-radius: 0 0 0 18px; }
.scanner .br { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-radius: 0 0 18px 0; }
.scanner .head { position: relative; display: flex; justify-content: space-between; align-items: center; padding: calc(env(safe-area-inset-top, 0px) + 16px) 20px 0; }
.scanner .head .icon-btn { background: rgba(0,0,0,0.5); border: 0; }
.scanner .foot { position: relative; padding: 0 20px calc(env(safe-area-inset-bottom, 0px) + 36px); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.scanner .foot button { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 13px; }

/* login */
.login { min-height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 24px max(24px, env(safe-area-inset-right, 0px)) 24px max(24px, env(safe-area-inset-left, 0px)); max-width: 420px; margin: 0 auto; }
.login h1 { font-family: var(--display); margin: 0; font-size: 30px; }
.login input { height: 52px; border-radius: 14px; border: 1px solid var(--line2); background: var(--surface); padding: 0 16px; font-size: 16px; }
.err { color: var(--over); font-size: 14px; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; border-top: 1px solid var(--line); }
.field:first-child { border-top: 0; }
.field input { width: 84px; height: 40px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg); text-align: right; padding: 0 10px; }
.spinner { margin: 40px auto; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--protein); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
