:root {
  --ink: #EEF2EC; --muted: #BCC8C0; --dim: #98A69E;
  --glass: rgba(8,20,15,0.45); --glass-2: rgba(8,20,15,0.35); --inset: rgba(255,255,255,0.07);
  --line: rgba(255,255,255,0.11); --divider: rgba(255,255,255,0.07);
  --green: #4FD18F; --green-ink: #0B1A13; --green-text: #6FE0A6; --green-soft: rgba(90,210,150,0.14);
  --blue-text: #9CC4F5; --blue-soft: rgba(120,170,240,0.15); --blue-ink: #C9DDF7;
  --orange-text: #FFA474; --orange-soft: rgba(255,140,80,0.16);
  --yellow-text: #F5C65B; --yellow-soft: rgba(245,198,91,0.16);
  --violet-text: #C7B8FF; --violet-soft: rgba(150,120,255,0.2);
  --radius: 16px;
  --bg:
    radial-gradient(circle at 12% 8%, rgba(79,209,143,0.30) 0, rgba(79,209,143,0) 42%),
    radial-gradient(circle at 95% 38%, rgba(255,140,80,0.24) 0, rgba(255,140,80,0) 40%),
    radial-gradient(circle at 20% 92%, rgba(130,110,255,0.30) 0, rgba(130,110,255,0) 48%),
    radial-gradient(rgba(255,255,255,0.09) 1px, rgba(255,255,255,0) 1.5px) 0 0 / 18px 18px,
    linear-gradient(160deg, #0B2C1E 0%, #102826 40%, #1F1740 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Manrope', system-ui, -apple-system, sans-serif; color: var(--ink);
  background: var(--bg); background-color: #13201F; background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  color-scheme: dark;
}
a { color: var(--green-text); text-decoration: none; }
a:hover { color: #9AF0C2; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--dim); }
option { color: #0B1A13; background: #EEF2EC; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; }
body.wide #app { max-width: 1400px; }

.top { padding: calc(env(safe-area-inset-top) + 18px) 20px 12px; display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); }
h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
h1.sm { font-size: 22px; }
h2 { margin: 0; font-size: 17px; font-weight: 800; }
.label { margin: 0; font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.content { flex: 1; padding: 4px 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.page-bottom-pad { height: calc(env(safe-area-inset-bottom) + 84px); flex: none; }

.card { background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.list > * + * { border-top: 1px solid var(--divider); }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 52px; }

.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(14px); display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--ink); padding: 0; }
.btn { min-height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(14px); font-size: 14px; font-weight: 700; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; text-align: center; }
.btn.primary { background: var(--green); color: var(--green-ink); border-color: var(--green); font-weight: 800; }
.btn.primary:hover { color: var(--green-ink); filter: brightness(1.06); }
.btn.big { min-height: 52px; font-size: 15px; }
.btn.ghost { background: transparent; border-style: dashed; border-color: rgba(255,255,255,0.25); }
.btn.danger { color: var(--orange-text); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.bar { position: sticky; bottom: 0; padding: 12px 20px calc(env(safe-area-inset-bottom) + 14px); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); z-index: 5; }
.bar.with-nav { bottom: calc(env(safe-area-inset-bottom) + 66px); padding-bottom: 12px; }

.chip { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--glass); color: var(--ink); font-size: 13px; font-weight: 700; white-space: nowrap; flex: none; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--green-ink); font-weight: 800; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

.tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.tag.green { color: var(--green-text); background: var(--green-soft); }
.tag.blue { color: var(--blue-text); background: var(--blue-soft); }
.tag.orange { color: var(--orange-text); background: var(--orange-soft); }
.tag.yellow { color: var(--yellow-text); background: var(--yellow-soft); }
.tag.violet { color: var(--violet-text); background: var(--violet-soft); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; }
.day b { font-size: 16px; font-weight: 800; }
.day span { font-size: 12px; font-weight: 700; }
.day.on { background: var(--green); border-color: var(--green); color: var(--green-ink); }
.day.today:not(.on) { border-color: var(--green); }
.day.sm { min-height: 44px; font-size: 14px; font-weight: 700; }
.day.blue.on { background: var(--blue-soft); border-color: var(--blue-text); color: var(--ink); }

.meal { display: flex; gap: 12px; align-items: center; padding: 12px 14px; color: var(--ink); min-height: 64px; width: 100%; text-align: left; }
.meal:hover { color: var(--ink); }
.meal .slot { width: 58px; flex: none; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.meal .name { font-size: 15px; font-weight: 700; line-height: 1.25; }
.meal.skip { border: 1px dashed rgba(255,255,255,0.22); border-radius: var(--radius); background: transparent; backdrop-filter: none; }
.meal.empty .name { color: var(--yellow-text); }
.chev { color: var(--dim); flex: none; }

.progress { height: 8px; border-radius: 4px; background: rgba(255,255,255,0.12); overflow: hidden; }
.progress > div { height: 8px; background: var(--green); border-radius: 4px; }
.progress.over > div { background: var(--orange-text); }

.seg { display: flex; background: var(--inset); border-radius: 12px; padding: 3px; gap: 2px; flex: none; }
.seg button { min-height: 44px; min-width: 52px; padding: 0 8px; border-radius: 10px; border: none; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.seg button.have { background: var(--green-soft); color: var(--green-text); font-weight: 800; }
.seg button.low { background: var(--yellow-soft); color: var(--yellow-text); font-weight: 800; }
.seg button.out { background: var(--orange-soft); color: var(--orange-text); font-weight: 800; }

.search { display: flex; align-items: center; gap: 10px; padding: 0 6px 0 14px; min-height: 48px; }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 15px; min-height: 44px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 700; color: var(--muted); }
.input, select.input, textarea.input { min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--inset); padding: 10px 12px; font-size: 15px; width: 100%; }
textarea.input { min-height: 140px; line-height: 1.5; resize: vertical; }

.check { width: 24px; height: 24px; border-radius: 8px; border: 2px solid rgba(255,255,255,0.35); flex: none; display: flex; align-items: center; justify-content: center; }
.check.on { background: var(--green); border-color: var(--green); }
.struck { text-decoration: line-through; color: var(--dim); }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--inset); font-size: 20px; font-weight: 700; }
.stepper b { font-size: 18px; min-width: 24px; text-align: center; }

.cov { display: grid; grid-template-columns: 58px repeat(4, minmax(0, 1fr)); gap: 6px; align-items: center; }
.cov-cell { min-height: 46px; border-radius: 12px; border: 1px dashed rgba(255,255,255,0.22); background: transparent; color: var(--dim); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0; }
.cov-cell.on { border: 1px solid rgba(79,209,143,0.55); background: rgba(79,209,143,0.22); color: var(--green-text); }
.cov-cell.box { border: 1px solid rgba(120,170,240,0.5); background: var(--blue-soft); color: var(--blue-text); }

.switch { width: 46px; height: 28px; border-radius: 14px; background: rgba(255,255,255,0.18); display: flex; align-items: center; padding: 3px; flex: none; transition: background .15s; }
.switch i { width: 22px; height: 22px; border-radius: 11px; background: var(--ink); transition: transform .15s; }
.switch.on { background: var(--green); }
.switch.on i { background: var(--green-ink); transform: translateX(18px); }

.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; background: var(--inset); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.tabs button { min-height: 48px; border-radius: 10px; border: none; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; }
.tabs button b { font-size: 13px; }
.tabs button span { font-size: 11px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: var(--green); color: var(--green-ink); }
.tabs button.on span { color: var(--green-ink); font-weight: 700; }

.pick { display: flex; gap: 12px; align-items: center; padding: 12px 14px; min-height: 72px; width: 100%; text-align: left; color: var(--ink); }
.pick .dot { width: 36px; height: 36px; border-radius: 18px; border: 1.5px solid rgba(255,255,255,0.35); display: flex; align-items: center; justify-content: center; flex: none; }
.pick.on .dot { background: var(--green); border-color: var(--green); }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; background: rgba(8,20,15,0.72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px); }
.nav > div { width: 100%; max-width: 520px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; justify-content: center; color: var(--muted); font-size: 11px; font-weight: 600; }
.nav a.on { color: var(--green-text); font-weight: 800; }
.nav a .badge { position: absolute; }

.info { display: flex; gap: 10px; align-items: flex-start; background: var(--blue-soft); border-radius: 14px; padding: 12px 14px; font-size: 13px; color: var(--blue-ink); line-height: 1.45; }
.info.green { background: var(--green-soft); color: #DDF5E8; }
.info.yellow { background: var(--yellow-soft); color: #FBE7B8; }
.empty-state { text-align: center; padding: 28px 16px; display: flex; flex-direction: column; gap: 6px; align-items: center; }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; max-height: 86vh; overflow-y: auto; background: #12231D; border: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 18px 20px calc(env(safe-area-inset-bottom) + 20px); display: flex; flex-direction: column; gap: 12px; }

.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 14px); transform: translateX(-50%); background: var(--ink); color: var(--green-ink); font-weight: 700; font-size: 14px; padding: 12px 18px; border-radius: 14px; z-index: 30; max-width: 90vw; box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.loading { flex: 1; display: flex; align-items: center; justify-content: center; padding: 80px 20px; color: var(--muted); text-align: center; }

/* Desktop week grid */
.wk-phone { display: flex; flex-direction: column; gap: 12px; }
.wk-grid-wrap { display: none; }
@media (min-width: 960px) {
  body.wide .wk-phone { display: none; }
  body.wide .wk-grid-wrap { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
  .wk-grid { flex: 999 1 760px; min-width: 0; overflow-x: auto; }
  .wk-grid table { width: 100%; min-width: 900px; border-collapse: collapse; table-layout: fixed; }
  .wk-grid th, .wk-grid td { border-left: 1px solid var(--divider); border-bottom: 1px solid var(--divider); padding: 8px; vertical-align: top; text-align: left; }
  .wk-grid th:first-child, .wk-grid td:first-child { border-left: none; width: 92px; }
  .wk-grid thead th { font-size: 12px; color: var(--muted); }
  .wk-grid thead th b { display: block; font-size: 16px; color: var(--ink); }
  .wk-cell { display: flex; flex-direction: column; gap: 6px; min-height: 76px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid var(--divider); padding: 8px 10px; width: 100%; text-align: left; color: var(--ink); font-size: 13px; font-weight: 700; line-height: 1.3; }
  .wk-cell.skip { background: transparent; border-style: dashed; color: var(--dim); font-weight: 600; }
  .wk-side { flex: 1 1 280px; display: flex; flex-direction: column; gap: 14px; }
  .nav { top: 0; bottom: auto; border-top: none; border-bottom: 1px solid var(--line); padding: 6px 8px; }
  .nav > div { max-width: 640px; }
  .nav a { flex-direction: row; gap: 8px; font-size: 14px; min-height: 48px; }
  body.has-nav #app { padding-top: 62px; }
  .page-bottom-pad { height: 24px; }
  .bar.with-nav { bottom: 0; padding-bottom: calc(env(safe-area-inset-bottom) + 14px); }
  .toast { top: 72px; }
}
