/* «Глубина»: one hue in many shades, from mist to night. Light: pale blue sky, a deep navy
   main card, airy tonal tiles. Dark: deep night with a soft glow of the hue at the top,
   translucent panels, a white pill button. Big light type, lots of air. */

:root {
  --h: 216; /* the hue: change this one number to recolour (palettes.md) */
  --sky: linear-gradient(180deg, hsl(var(--h) 60% 94%) 0%, hsl(var(--h) 52% 85%) 100%);
  --text: hsl(var(--h) 55% 12%);
  --muted: hsl(var(--h) 18% 42%);
  --surface: hsla(var(--h), 70%, 98%, 0.72);
  --solid: hsl(var(--h) 60% 97%);
  --mid: hsl(var(--h) 68% 79%);
  --on-mid: hsl(var(--h) 60% 14%);
  --deep: linear-gradient(160deg, hsl(var(--h) 55% 30%) 0%, hsl(var(--h) 62% 16%) 70%);
  --on-deep: #ffffff;
  --cta: hsl(var(--h) 62% 16%);
  --on-cta: #ffffff;
  --accent: hsl(var(--h) 88% 54%);
  --on-accent: #ffffff;
  --line: hsla(var(--h), 40%, 40%, 0.14);
  --well: hsla(var(--h), 40%, 40%, 0.1);
  --rim: rgba(255, 255, 255, 0.7);
  --danger: #d6463b;
  --fade: hsl(var(--h) 52% 86%);
  --chrome: #e7eef9;
  --radius: 28px;
  --font: Onest, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
}
[data-scheme="dark"] {
  --sky: radial-gradient(120% 55% at 50% -5%, hsl(var(--h) 70% 30%) 0%, hsl(var(--h) 65% 12%) 55%, hsl(var(--h) 60% 5%) 100%);
  --text: #f2f6fd;
  --muted: hsl(var(--h) 22% 70%);
  --surface: hsla(var(--h), 60%, 70%, 0.08);
  --solid: hsl(var(--h) 45% 11%);
  --mid: hsla(var(--h), 70%, 70%, 0.16);
  --on-mid: #f2f6fd;
  --deep: linear-gradient(160deg, hsla(var(--h), 70%, 65%, 0.22) 0%, hsla(var(--h), 70%, 50%, 0.08) 100%);
  --on-deep: #ffffff;
  --cta: #ffffff;
  --on-cta: hsl(var(--h) 60% 10%);
  --accent: hsl(var(--h) 92% 60%);
  --line: rgba(255, 255, 255, 0.1);
  --well: rgba(255, 255, 255, 0.07);
  --rim: rgba(255, 255, 255, 0.14);
  --danger: #ff7b70;
  --fade: hsl(var(--h) 60% 5%);
  --chrome: #071022;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); background: var(--chrome);
  font: 400 16px/1.4 var(--font); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--sky); }
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }
.i--fill { fill: currentColor; stroke: none; }

/* One recipe for the panels: translucent, a light rim on top, a little blur. */
.card, .list, .tile, .timeline, .options, .media, .search, .segmented, .chip, .day, .notice, .icon-btn, .qty {
  background: var(--surface);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 var(--rim), inset 0 0 0 1px var(--line);
}

.screen { min-height: var(--tg-viewport-stable-height, 100vh); display: flex; flex-direction: column; }
.screen[hidden] { display: none; }
.page { flex: 1; display: flex; flex-direction: column; gap: 14px;
  padding: 6px 18px calc(104px + var(--safe-bottom)); }
.screen:not(:has(.tabbar)) .page { padding-bottom: calc(28px + var(--safe-bottom)); }

/* Header: a big light title */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-top) + 14px) 18px 12px; }
.topbar__text { flex: 1; min-width: 0; }
.topbar__title { font-size: 30px; font-weight: 500; letter-spacing: -0.035em; line-height: 1.1; }
.topbar__sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.icon-btn { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none;
  transition: transform .3s var(--ease); }
.icon-btn:active { transform: scale(.9); }
.icon-btn--filled { width: 40px; height: 40px; background: var(--accent); color: var(--on-accent); box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none; }
.icon-btn--filled .i { width: 19px; height: 19px; stroke-width: 2.2; }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--mid); color: var(--on-mid); font-weight: 600; }

/* Cards; the main one is the deep end of the hue */
.card { border-radius: var(--radius); padding: 20px; }
.card--accent { background: var(--deep); color: var(--on-deep);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 24px 40px -24px hsla(var(--h), 70%, 20%, .6); }
.hero__label { font-size: 14px; opacity: .75; }
.hero__value { font-size: 46px; font-weight: 600; letter-spacing: -0.045em; line-height: 1.05; margin: 8px 0 18px;
  font-variant-numeric: tabular-nums; }
.hero__value small { font-size: 26px; font-weight: 400; opacity: .55; }
.hero__hint { font-size: 14px; opacity: .75; margin-top: 12px; }
.progress { height: 6px; border-radius: 3px; background: var(--well); overflow: hidden; }
.card--accent .progress { background: rgba(255, 255, 255, .18); }
.progress > span { display: block; height: 100%; border-radius: inherit; background: currentColor; }

.section-title { font-size: 22px; font-weight: 500; letter-spacing: -0.03em; padding: 12px 2px 0; margin-bottom: -2px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 6px; border-radius: var(--radius); }
.row { display: flex; align-items: center; gap: 14px; padding: 10px; min-height: 64px; border-radius: 22px;
  transition: background .2s; }
.row:active { background: var(--well); }
.row__icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--mid); color: var(--on-mid); }
.row__icon .i { width: 20px; height: 20px; }
.row__body { flex: 1; min-width: 0; }
.row__title { font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.row__sub { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__end { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.price { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.chev { width: 20px; height: 20px; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line); background: var(--well); }

/* Segmented control, chips */
.segmented { display: flex; padding: 4px; border-radius: 999px; }
.segmented > * { flex: 1; height: 40px; border-radius: 999px; font-size: 15px; color: var(--muted);
  transition: background .3s var(--ease), color .3s; }
.segmented > .is-active { background: var(--cta); color: var(--on-cta); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.chip { height: 38px; padding: 0 18px; border-radius: 999px; white-space: nowrap; font-size: 14px; transition: background .3s; }
.chip.is-active { background: var(--cta); color: var(--on-cta); box-shadow: none; }

/* Fields */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; color: var(--muted); padding-left: 4px; }
.input { width: 100%; min-height: 50px; padding: 13px 18px; border: 0; border-radius: 18px; background: var(--well);
  font-size: 16px; outline: none; resize: none; transition: box-shadow .2s; }
.input::placeholder { color: var(--muted); }
.input:focus { box-shadow: inset 0 0 0 1.5px var(--accent); }
.search { display: flex; align-items: center; gap: 10px; padding: 0 18px; border-radius: 999px; color: var(--muted); }
.search .input { background: none; padding: 0; min-height: 52px; color: var(--text); box-shadow: none; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; }
.switch { appearance: none; -webkit-appearance: none; margin: 0; flex: none; position: relative; cursor: pointer;
  width: 54px; height: 32px; border-radius: 16px; background: var(--well); box-shadow: inset 0 0 0 1px var(--line);
  transition: background .3s var(--ease); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .3s var(--ease); }
.switch:checked { background: var(--accent); box-shadow: none; }
.switch:checked::after { transform: translateX(22px); }

/* Buttons: a pill, often with a round arrow beside it */
.actions { display: flex; flex-direction: column; gap: 10px; }
.actions__row { display: flex; gap: 10px; }
.actions__row > .btn { flex: 1; min-width: 0; padding: 0 12px; }
.btn { height: 54px; padding: 0 24px; border-radius: 999px; font-size: 16px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  transition: transform .3s var(--ease), opacity .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; }
.btn--primary { background: var(--cta); color: var(--on-cta); }
.btn--secondary { background: var(--surface); box-shadow: inset 0 1px 0 var(--rim), inset 0 0 0 1px var(--line);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.btn--ghost { color: var(--muted); }
.btn--danger { color: var(--danger); }
.btn--block { width: 100%; }

/* Empty state */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 24px; }
.empty__icon { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 8px;
  background: var(--mid); color: var(--on-mid); }
.empty__icon .i { width: 34px; height: 34px; stroke-width: 1.5; }
.empty__title { font-size: 24px; font-weight: 500; letter-spacing: -0.03em; }
.empty__text { color: var(--muted); font-size: 15px; max-width: 280px; margin-bottom: 10px; }

/* Bottom navigation: a floating deep capsule */
.tabbar { position: fixed; z-index: 5; left: 18px; right: 18px; bottom: calc(12px + var(--safe-bottom)); display: flex;
  padding: 6px; border-radius: 999px; background: hsl(var(--h) 60% 13%); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 18px 30px -18px hsla(var(--h), 70%, 15%, .7); }
.tab { flex: 1; height: 54px; border-radius: 999px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; font-size: 11px; color: rgba(255, 255, 255, .55); transition: background .3s, color .3s; }
.tab.is-active { background: rgba(255, 255, 255, .14); color: #fff; }
.tab .i { width: 22px; height: 22px; }

/* Tiles: plain ones are glass, the accent one is the mid tone */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile--wide { grid-column: 1 / -1; }
.tile--accent { background: var(--mid); color: var(--on-mid); }
.tile__label { font-size: 14px; color: var(--muted); }
.tile--accent .tile__label, .tile--accent .tile__sub { color: inherit; opacity: .75; }
.tile__value { font-size: 36px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile__value small { font-size: 18px; font-weight: 400; opacity: .6; }
.tile__sub { font-size: 13px; color: var(--muted); }

/* Ring: --value is 0–100, a thick tonal arc */
.ring { position: relative; width: 92px; height: 92px; margin: 6px auto 0; display: grid; place-items: center; }
.ring::before { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--cta) calc(var(--value, 0) * 1%), var(--well) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px)); }
.tile--accent .ring::before { background: conic-gradient(currentColor calc(var(--value, 0) * 1%), hsla(var(--h), 60%, 98%, .45) 0); }
.ring > span { position: relative; font-size: 19px; font-weight: 600; letter-spacing: -0.03em; }

/* Bars: --value is 0–100; a stacked look, the chosen one solid */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 124px; padding-top: 8px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bar::before { content: ""; width: 100%; max-width: 30px; height: calc(var(--value, 0) * 0.8%); border-radius: 10px;
  background: var(--mid); }
.bar.is-active::before { background: var(--cta); }
.bar > span { font-size: 11px; color: var(--muted); }

/* Days */
.days { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.day { flex: 1 0 48px; height: 70px; border-radius: 22px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; font-size: 19px; font-weight: 500; transition: background .3s var(--ease); }
.day small { font-size: 12px; color: var(--muted); }
.day.is-active { background: var(--cta); color: var(--on-cta); box-shadow: none; }
.day.is-active small { color: inherit; opacity: .7; }
.day:disabled { opacity: .35; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 20px; border-radius: var(--radius); }
.step { position: relative; padding: 0 0 20px 32px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--muted); }
.step::after { content: ""; position: absolute; left: 7px; top: 25px; bottom: 3px; width: 2px; border-radius: 1px; background: var(--line); }
.step:last-child::after { display: none; }
.step.is-done::before { background: var(--cta); box-shadow: none; }
.step.is-done::after { background: var(--cta); opacity: .5; }
.step.is-now::before { background: var(--accent); box-shadow: 0 0 0 5px hsla(var(--h), 90%, 60%, .2); }
.step__time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.step__title { font-weight: 500; }
.step:not(.is-done):not(.is-now) .step__title { color: var(--muted); }
.step__text { font-size: 14px; color: var(--muted); }

/* Picture cards: rounded photos, the cover with its text over the picture */
.media { position: relative; display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden;
  min-width: 0; padding: 6px; }
.media__img { display: grid; place-items: center; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 22px;
  background: var(--mid); color: var(--on-mid); }
.media__img .i { width: 40px; height: 40px; stroke-width: 1.3; }
.media__body { padding: 10px 10px 8px; }
.media__title { font-weight: 500; }
.media__sub { font-size: 14px; color: var(--muted); }
.media__tag { position: absolute; top: 14px; right: 14px; font-size: 12px; font-weight: 500; padding: 5px 11px;
  border-radius: 999px; background: hsla(var(--h), 60%, 98%, .82); color: hsl(var(--h) 60% 14%);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.media--cover { padding: 0; color: #fff; }
.media--cover .media__img { aspect-ratio: 4 / 5; border-radius: 0; background: var(--deep); color: rgba(255, 255, 255, .8); }
.media--cover .media__body { position: absolute; inset: auto 0 0; padding: 70px 20px 20px;
  background: linear-gradient(transparent, hsla(var(--h), 60%, 8%, .7)); }
.media--cover .media__title { font-size: 26px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; }
.media--cover .media__sub { color: rgba(255, 255, 255, .8); }
.media--cover .media__tag { right: auto; left: 16px; top: 16px; }

/* Options */
.options { display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: var(--radius); }
.option { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 60px;
  padding: 10px 54px 10px 16px; border-radius: 22px; text-align: left; transition: background .3s var(--ease); }
.option:active { background: var(--well); }
.option:disabled { opacity: .4; }
.option.is-active { background: var(--cta); color: var(--on-cta); }
.option::after { content: ""; position: absolute; right: 16px; top: 50%; width: 24px; height: 24px; margin-top: -12px;
  border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--muted); }
.option.is-active::after { background: var(--accent); box-shadow: inset 0 0 0 7px var(--accent), inset 0 0 0 24px #fff; }
.option__title { font-weight: 500; }
.option__sub { font-size: 14px; opacity: .65; }

/* Notice */
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 14px 18px; border-radius: 22px; font-size: 15px; }
.notice > .i { color: var(--accent); }
.notice--danger > .i { color: var(--danger); }

/* Stepper */
.qty { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; }
.qty > button { width: 34px; height: 34px; border-radius: 50%; font-size: 19px; transition: background .2s; }
.qty > button:active { background: var(--well); }
.qty > output { min-width: 22px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Dock: the action as a big pill, a round arrow beside it is welcome */
.dock { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 14px;
  padding: 24px 18px calc(14px + var(--safe-bottom));
  background: linear-gradient(transparent, var(--fade) 45%); }
.dock > .btn { flex: 1; }
.dock__info { display: flex; flex-direction: column; padding-left: 4px; }
.dock__label { font-size: 12px; color: var(--muted); }
.dock__value { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.screen:has(.dock) .page { padding-bottom: calc(110px + var(--safe-bottom)); }

/* Greeting and a picture drawn for the app: .art__tint, .art__fill, .art__line in its SVG */
.intro { display: flex; flex-direction: column; gap: 8px; padding: 12px 2px 6px; }
.intro__title { font-size: 40px; font-weight: 500; letter-spacing: -0.045em; line-height: 1.05; }
.intro__text { color: var(--muted); font-size: 16px; max-width: 300px; }
.art { width: 112px; height: 112px; margin-bottom: 6px; }
.art svg { display: block; width: 100%; height: 100%; }
.art__tint { fill: var(--mid); }
.art__fill { fill: hsl(var(--h) 60% 98%); }
[data-scheme="dark"] .art__fill { fill: hsl(var(--h) 50% 22%); }
.art__line { fill: none; stroke: var(--text); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* A row that scrolls sideways */
.rail { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -18px; padding: 1px 18px; scroll-padding-left: 18px; }
.rail > * { flex: 0 0 62%; scroll-snap-align: start; }

/* No blur on this device: panels become solid. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --surface: var(--solid); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* app */
[hidden] { display: none !important; }
:root { --h: 270; --chrome: #f0e7f9; }
[data-scheme="dark"] { --chrome: #12071d; }

.intro { padding-top: 4px; }
.intro__title { font-size: 38px; }
.intro .art { width: 96px; height: 96px; margin-bottom: 0; }

.stars { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.stars .i { width: 15px; height: 15px; stroke-width: 1.8; color: var(--muted); }
.stars b { font-weight: 600; }

.dock__value .stars .i { width: 19px; height: 19px; color: var(--text); }

.row-btn { width: 100%; text-align: left; color: inherit; }
.row--off { opacity: .45; }
.item-art { display: flex; justify-content: center; padding: 6px 0 2px; }
.item-art .empty__icon { width: 96px; height: 96px; margin: 0; }
.item-art .empty__icon .i { width: 38px; height: 38px; }
.cat-chip { display: inline-flex; align-items: center; gap: 7px; }
.cat-chip .i { width: 17px; height: 17px; }

/* Подпись: чек Недуры с зубчатым низом и пунктирными дорожками. */
.receipt { position: relative; background: var(--solid); border-radius: var(--radius) var(--radius) 4px 4px;
  padding: 20px 20px 30px; box-shadow: inset 0 1px 0 var(--rim), inset 0 0 0 1px var(--line); }
.receipt::after { content: ""; position: absolute; left: 0; right: 0; bottom: -9px; height: 18px;
  background: linear-gradient(-45deg, transparent 8px, var(--solid) 0) 0 0 / 18px 18px repeat-x,
              linear-gradient(45deg, transparent 8px, var(--solid) 0) 9px 0 / 18px 18px repeat-x; }
.receipt__head { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px dashed var(--line); }
.receipt__mark { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--mid); color: var(--on-mid); flex: none; }
.receipt__mark .i { width: 19px; height: 19px; }
.receipt__shop { font-size: 17px; font-weight: 500; letter-spacing: -0.02em; }
.receipt__meta { font-size: 13px; color: var(--muted); }
.r-line { display: flex; align-items: baseline; gap: 8px; font-size: 15px; padding: 5px 0; }
.r-line > span:first-child { color: var(--muted); flex: none; }
.r-line > i { flex: 1; border-bottom: 1px dashed var(--line); transform: translateY(-4px); min-width: 12px; }
.r-line > span:last-child { text-align: right; font-weight: 500; }
.r-content { margin: 12px 0 0; padding: 14px 16px; border-radius: 18px; background: var(--well);
  font: 500 14px/1.45 ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 280px; overflow-y: auto; }
