/* Дизайн-система мини-приложения: iOS 26 «Liquid Glass».
   Токены → основа → навигация → списки → карточки → элементы управления → листы и диалоги → анимации. */

:root {
  --tint: #007aff; --tint-2: #5ac8fa;
  --green: #34c759; --red: #ff3b30; --orange: #ff9500; --yellow: #ffcc00; --indigo: #5856d6;
  --purple: #af52de; --pink: #ff2d55; --teal: #30b0c7; --mint: #00c7be; --brown: #a2845e; --gray: #8e8e93;

  --label: #0b0b0f; --label-2: rgba(60, 60, 67, .62); --label-3: rgba(60, 60, 67, .32);
  --sep: rgba(60, 60, 67, .14); --fill: rgba(120, 120, 128, .12); --fill-2: rgba(120, 120, 128, .2);
  --solid: #ffffff; --solid-2: #f2f2f7;

  --wall:
    radial-gradient(65% 40% at 0% 0%, rgba(0, 122, 255, .22), transparent 70%),
    radial-gradient(55% 35% at 100% 8%, rgba(175, 82, 222, .16), transparent 70%),
    radial-gradient(60% 40% at 100% 70%, rgba(255, 45, 85, .10), transparent 70%),
    radial-gradient(70% 45% at 0% 100%, rgba(48, 176, 199, .20), transparent 70%),
    linear-gradient(180deg, #f3f5fb 0%, #eceff7 100%);

  --glass: rgba(255, 255, 255, .58);
  --glass-hi: rgba(255, 255, 255, .78);
  --glass-edge: rgba(255, 255, 255, .75);
  --glass-rim: rgba(255, 255, 255, .95);
  --glass-shadow: 0 8px 28px rgba(31, 45, 99, .10), 0 1px 2px rgba(31, 45, 99, .08);
  --glass-shadow-lg: 0 18px 50px rgba(31, 45, 99, .18), 0 2px 6px rgba(31, 45, 99, .08);
  --blur: blur(28px) saturate(185%);
  --bar: rgba(247, 248, 252, .62);

  --r-xl: 28px; --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  --spring: cubic-bezier(.32, .72, 0, 1);
  --bounce: cubic-bezier(.34, 1.56, .64, 1);
  --sat: max(env(safe-area-inset-top, 0px), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --sab: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --tabbar-h: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --tint: #0a84ff; --tint-2: #64d2ff;
  --green: #30d158; --red: #ff453a; --orange: #ff9f0a; --yellow: #ffd60a; --indigo: #5e5ce6;
  --purple: #bf5af2; --pink: #ff375f; --teal: #40c8e0; --mint: #63e6e2; --brown: #ac8e68; --gray: #98989d;
  --label: #f5f5f7; --label-2: rgba(235, 235, 245, .62); --label-3: rgba(235, 235, 245, .3);
  --sep: rgba(84, 84, 88, .5); --fill: rgba(120, 120, 128, .24); --fill-2: rgba(120, 120, 128, .34);
  --solid: #1c1c1e; --solid-2: #000000;
  --wall:
    radial-gradient(65% 40% at 0% 0%, rgba(10, 132, 255, .30), transparent 70%),
    radial-gradient(55% 35% at 100% 8%, rgba(191, 90, 242, .22), transparent 70%),
    radial-gradient(60% 40% at 100% 70%, rgba(255, 55, 95, .12), transparent 70%),
    radial-gradient(70% 45% at 0% 100%, rgba(64, 200, 224, .18), transparent 70%),
    linear-gradient(180deg, #07080d 0%, #030306 100%);
  --glass: rgba(44, 46, 58, .5);
  --glass-hi: rgba(58, 60, 74, .72);
  --glass-edge: rgba(255, 255, 255, .13);
  --glass-rim: rgba(255, 255, 255, .22);
  --glass-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .4);
  --glass-shadow-lg: 0 20px 60px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .4);
  --bar: rgba(18, 19, 26, .6);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- основа */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--wall) fixed; color: var(--label); }
body {
  font: 17px/1.29 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  letter-spacing: -.015em; -webkit-font-smoothing: antialiased; -webkit-user-select: none; user-select: none;
  overscroll-behavior: none; text-rendering: optimizeLegibility;
}
input, textarea, select, button { font: inherit; color: inherit; letter-spacing: inherit; }
input, textarea { -webkit-user-select: text; user-select: text; }
button { border: 0; background: none; padding: 0; margin: 0; cursor: pointer; }
a { color: var(--tint); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--green); } .neg { color: var(--red); } .warn { color: var(--orange); } .muted { color: var(--label-2); }
.hide { display: none !important; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i.sm { width: 17px; height: 17px; } .i.lg { width: 28px; height: 28px; }

/* общая стеклянная поверхность */
.glass, .group, .card, .metric, .hero, .chip, .searchbar, .tabbar, .fab, .nbtn.round, .seg, .toast, .tile-btn {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--glass-shadow), inset 0 0 0 .5px var(--glass-edge), inset 0 1px 0 var(--glass-rim);
}

/* ---------------------------------------------------------------- экраны и навигация */
#app { position: fixed; inset: 0; }
.stack { position: absolute; inset: 0; }
.screen {
  position: absolute; inset: 0; overflow: hidden; background: var(--wall);
  box-shadow: -10px 0 30px rgba(0, 0, 0, .06);
  will-change: transform; transition: transform .5s var(--spring), opacity .5s var(--spring), filter .5s var(--spring);
}
.screen.under { transform: translateX(-28%); filter: brightness(.94); }
.screen.enter { transform: translateX(100%); }
.screen.leave { transform: translateX(100%); }
.screen.fade-in { opacity: 0; transform: scale(.985); }
.scroll {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: calc(var(--sat) + 52px) 16px calc(var(--sab) + var(--tabbar-h) + 34px); overscroll-behavior-y: contain;
}
.screen.notabs .scroll { padding-bottom: calc(var(--sab) + 28px); }

.navbar {
  position: absolute; left: 0; right: 0; top: 0; z-index: 20; height: calc(var(--sat) + 48px); padding-top: var(--sat);
  display: flex; align-items: center; gap: 8px; padding-left: 8px; padding-right: 8px;
  transition: background .25s, box-shadow .25s, -webkit-backdrop-filter .25s;
}
.navbar.solid {
  background: var(--bar); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: 0 .5px 0 var(--sep);
}
.navbar .ttl {
  position: absolute; left: 70px; right: 70px; text-align: center; font-weight: 600; font-size: 17px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transform: translateY(6px);
  transition: opacity .2s, transform .3s var(--spring); pointer-events: none;
}
.navbar.solid .ttl, .navbar.always .ttl { opacity: 1; transform: none; }
.navbar .sp { flex: 1; }
.nbtn {
  height: 38px; min-width: 38px; padding: 0 10px; border-radius: 999px; display: inline-flex; align-items: center;
  justify-content: center; gap: 4px; color: var(--tint); font-size: 17px; transition: transform .25s var(--spring), opacity .15s;
  position: relative; z-index: 1;
}
.nbtn.round { padding: 0; width: 38px; color: var(--label); }
.nbtn.round.tint { color: var(--tint); }
.nbtn:active { transform: scale(.9); opacity: .7; }
.nbtn.bold { font-weight: 600; }
.nbtn .i { width: 21px; height: 21px; }

.large-title { font: 700 34px/1.12 -apple-system, "SF Pro Display", system-ui, sans-serif; letter-spacing: -.025em;
  margin: 6px 4px 14px; word-break: break-word; }
.large-title.long { font-size: 28px; line-height: 1.14; }
.large-title .subt { display: block; font-size: 15px; font-weight: 500; letter-spacing: -.01em; color: var(--label-2); margin-top: 4px; }

/* плавающая панель вкладок */
.tabbar {
  position: fixed; z-index: 40; left: 14px; right: 72px; bottom: calc(var(--sab) + 12px); height: var(--tabbar-h);
  border-radius: 999px; display: flex; align-items: stretch; padding: 5px;
  background: var(--glass-hi); box-shadow: var(--glass-shadow-lg), inset 0 0 0 .5px var(--glass-edge), inset 0 1px 0 var(--glass-rim);
  transition: transform .45s var(--spring), opacity .3s;
}
.tabbar.hidden, .fab.hidden { transform: translateY(140%); opacity: 0; pointer-events: none; }
.tabbar .bubble {
  position: absolute; top: 5px; bottom: 5px; left: 5px; border-radius: 999px; background: var(--fill);
  transition: transform .5s var(--bounce), width .4s var(--spring); pointer-events: none;
  box-shadow: inset 0 0 0 .5px var(--glass-edge);
}
.tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0; color: var(--label-2); position: relative; z-index: 1;
  transition: color .2s, transform .3s var(--spring);
}
.tabbar button .i { width: 25px; height: 25px; stroke-width: 1.8; }
.tabbar button.on { color: var(--tint); }
.tabbar button:active { transform: scale(.9); }
.tabbar .badge-dot { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--red); color: #fff; font-size: 11px; line-height: 16px; padding: 0 4px; font-weight: 700; }
.fab {
  position: fixed; z-index: 40; right: 14px; bottom: calc(var(--sab) + 12px); width: var(--tabbar-h); height: var(--tabbar-h);
  border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff;
  background: radial-gradient(120% 120% at 30% 20%, color-mix(in srgb, var(--tint) 75%, #fff), var(--tint) 55%, color-mix(in srgb, var(--tint) 80%, #000));
  box-shadow: 0 14px 30px color-mix(in srgb, var(--tint) 45%, transparent), inset 0 1px 0 rgba(255,255,255,.55), inset 0 0 0 .5px rgba(255,255,255,.3);
  transition: transform .4s var(--spring), opacity .3s;
}
.fab .i { width: 28px; height: 28px; stroke-width: 2.4; }
.fab:active { transform: scale(.88); }

/* ---------------------------------------------------------------- группы и строки */
.section { margin: 0 0 22px; }
.gh { display: flex; align-items: baseline; justify-content: space-between; padding: 0 16px 7px; font-size: 13px;
  text-transform: uppercase; letter-spacing: .02em; color: var(--label-2); font-weight: 500; }
.gh.big { text-transform: none; font-size: 21px; font-weight: 700; letter-spacing: -.02em; color: var(--label); padding: 2px 4px 9px; }
.gh .link { color: var(--tint); font-size: 15px; text-transform: none; letter-spacing: -.01em; font-weight: 400; }
.gf { padding: 7px 16px 0; font-size: 13px; color: var(--label-2); line-height: 1.38; }
.fgroup + .gf { margin-top: -14px; margin-bottom: 22px; }
.gf + .gh { margin-top: 4px; }
.group { border-radius: var(--r-lg); overflow: hidden; }
.row {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 9px 16px; width: 100%;
  text-align: left; background: transparent; transition: background .15s;
}
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: .5px; background: var(--sep); }
.row.icon + .row::before, .row + .row.icon::before { left: 58px; }
.row.thumbrow + .row::before, .row + .row.thumbrow::before { left: 76px; }
button.row:active, .row.tap:active { background: var(--fill); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-size: 17px; line-height: 1.24; overflow-wrap: anywhere; }
.row .t b { font-weight: 600; }
.row .s { font-size: 14px; color: var(--label-2); margin-top: 2px; line-height: 1.3; overflow-wrap: anywhere; }
.row .v { color: var(--label-2); text-align: right; font-size: 16px; flex: none; max-width: 52%; overflow-wrap: anywhere; }
.row .v.strong { color: var(--label); font-weight: 600; }
.row .chev { color: var(--label-3); width: 17px; height: 17px; stroke-width: 2.6; margin-right: -4px; }
.row.danger .t { color: var(--red); }
.row.accent .t { color: var(--tint); }
.row.center { justify-content: center; } .row.center .t { text-align: center; }
.tile { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; flex: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 1px 2px rgba(0,0,0,.08); font-size: 17px; }
.tile .i { width: 19px; height: 19px; stroke-width: 2.1; }
.c-blue { background: linear-gradient(180deg, #3b9bff, #0a6cff); } .c-green { background: linear-gradient(180deg, #4cd964, #26b14a); }
.c-red { background: linear-gradient(180deg, #ff6259, #ef2c22); } .c-orange { background: linear-gradient(180deg, #ffad33, #ff8a00); }
.c-yellow { background: linear-gradient(180deg, #ffd84d, #f5b800); } .c-indigo { background: linear-gradient(180deg, #7a78f0, #4744cf); }
.c-purple { background: linear-gradient(180deg, #c97bee, #9b40d4); } .c-pink { background: linear-gradient(180deg, #ff5c80, #f02853); }
.c-teal { background: linear-gradient(180deg, #4fc9dd, #1d9db3); } .c-mint { background: linear-gradient(180deg, #4ee0d8, #00b5ac); }
.c-gray { background: linear-gradient(180deg, #a5a5ab, #7c7c82); } .c-brown { background: linear-gradient(180deg, #bc9d77, #957250); }
.thumb { width: 50px; height: 50px; border-radius: 13px; flex: none; overflow: hidden; display: flex; align-items: center;
  justify-content: center; font-size: 25px; background: var(--fill); box-shadow: inset 0 0 0 .5px var(--glass-edge); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* бейджи статусов */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12.5px;
  font-weight: 600; letter-spacing: -.005em; white-space: nowrap; vertical-align: middle;
  background: color-mix(in srgb, var(--bc, var(--gray)) 16%, transparent); color: var(--bc, var(--gray)); }
.badge.solid { background: var(--bc, var(--gray)); color: #fff; }
.b-blue { --bc: var(--tint); } .b-green { --bc: var(--green); } .b-red { --bc: var(--red); } .b-orange { --bc: var(--orange); }
.b-indigo { --bc: var(--indigo); } .b-purple { --bc: var(--purple); } .b-teal { --bc: var(--teal); } .b-gray { --bc: var(--gray); }
.b-pink { --bc: var(--pink); } .b-yellow { --bc: #c99a00; } .b-mint { --bc: var(--mint); }
.code { font: 600 13px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0; color: var(--label-2); }

/* ---------------------------------------------------------------- карточки и показатели */
.card { border-radius: var(--r-lg); padding: 16px; }
.hero { border-radius: var(--r-xl); padding: 20px 20px 18px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: -40% -20% auto auto; width: 70%; height: 140%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tint) 22%, transparent), transparent); }
.hero .lbl { font-size: 14px; color: var(--label-2); font-weight: 500; }
.hero .big { font: 700 38px/1.1 -apple-system, "SF Pro Display", system-ui; letter-spacing: -.03em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.hero .sub { font-size: 14px; color: var(--label-2); }
.hero .chips2 { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; position: relative; z-index: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metric { border-radius: var(--r-md); padding: 13px 14px 12px; min-width: 0; position: relative; }
.metric.tap:active { transform: scale(.97); }
.metric { transition: transform .3s var(--spring); }
.metric .lbl { font-size: 13px; color: var(--label-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.metric .val { font: 700 22px/1.15 -apple-system, "SF Pro Display", system-ui; letter-spacing: -.02em; margin-top: 6px;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric .val.sm { font-size: 18px; }
.metric .hint { font-size: 12.5px; color: var(--label-2); margin-top: 3px; }
.metric .ic { position: absolute; right: 12px; top: 12px; opacity: .9; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv .k { color: var(--label-2); } .kv .v { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* плитки разделов */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; }
.tile-btn { border-radius: 20px; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; transition: transform .3s var(--spring); padding: 6px; }
.tile-btn:active { transform: scale(.92); }
.tile-btn .tile { width: 42px; height: 42px; border-radius: 12px; }
.tile-btn .tile .i { width: 24px; height: 24px; }
.tile-btn span { font-size: 11.5px; font-weight: 500; text-align: center; line-height: 1.15; color: var(--label); }
.tile-cap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tile-cap span { font-size: 12px; color: var(--label); text-align: center; line-height: 1.15; font-weight: 500; }

/* ---------------------------------------------------------------- элементы управления */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; border-radius: 999px;
  font-size: 17px; font-weight: 600; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint) 88%, #fff), var(--tint) 60%, color-mix(in srgb, var(--tint) 88%, #000));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--tint) 34%, transparent), inset 0 1px 0 rgba(255,255,255,.45), inset 0 0 0 .5px rgba(255,255,255,.2);
  transition: transform .3s var(--spring), opacity .2s, filter .2s;
}
.btn:active { transform: scale(.97); filter: brightness(.95); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.glass2 { color: var(--tint); background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--glass-shadow), inset 0 0 0 .5px var(--glass-edge), inset 0 1px 0 var(--glass-rim); }
.btn.red { --tint: var(--red); } .btn.green { --tint: var(--green); } .btn.orange { --tint: var(--orange); }
.btn.glass2.red { color: var(--red); }
.btn.small { height: 36px; width: auto; padding: 0 16px; font-size: 15px; }
.btn .spin { animation: spin 1s linear infinite; }
.btns { display: flex; gap: 10px; } .btns > * { flex: 1; }
.actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 22px; }
.actions .act { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px 10px; border-radius: 18px;
  font-size: 12px; font-weight: 600; color: var(--tint); transition: transform .3s var(--spring); text-align: center; line-height: 1.15;
  overflow-wrap: anywhere; min-width: 0; }
.actions .act .i { width: 25px; height: 25px; }
.actions .act:active { transform: scale(.92); }
.actions .act.red { color: var(--red); } .actions .act.green { color: var(--green); } .actions .act.orange { color: var(--orange); }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: -6px -16px 6px; padding: 6px 16px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 14px; border-radius: 999px; font-size: 15px; font-weight: 500; display: inline-flex;
  align-items: center; gap: 6px; white-space: nowrap; transition: transform .25s var(--spring), background .2s, color .2s; }
.chip:active { transform: scale(.94); }
.chip.on { color: #fff; background: var(--tint); box-shadow: 0 6px 16px color-mix(in srgb, var(--tint) 34%, transparent), inset 0 1px 0 rgba(255,255,255,.35); }
.chip .n { font-size: 13px; opacity: .7; font-variant-numeric: tabular-nums; }

.searchbar { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 14px; margin-bottom: 14px; }
.searchbar .i { color: var(--label-2); width: 19px; height: 19px; }
.searchbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 17px; height: 40px; }
.searchbar input::placeholder { color: var(--label-2); }
.searchbar .clr { color: var(--label-3); display: none; } .searchbar.has .clr { display: flex; }

.seg { position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); padding: 3px; border-radius: 999px; margin-bottom: 16px; }
.seg .thumbbg { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--n)); border-radius: 999px;
  background: var(--glass-hi); box-shadow: 0 3px 10px rgba(0,0,0,.12), inset 0 0 0 .5px var(--glass-edge), inset 0 1px 0 var(--glass-rim);
  transition: transform .45s var(--bounce); }
:root[data-theme="dark"] .seg .thumbbg { background: rgba(120,120,128,.45); }
.seg button { position: relative; z-index: 1; height: 32px; font-size: 14px; font-weight: 500; border-radius: 999px; padding: 0 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.switch { width: 51px; height: 31px; border-radius: 999px; background: var(--fill-2); position: relative; flex: none; transition: background .25s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .35s var(--bounce); }
.switch.on { background: var(--green); } .switch.on::after { transform: translateX(20px); }

.check-ic { color: var(--tint); }

/* поля формы */
.field { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 6px 16px; position: relative; }
.field + .field::before, .row + .field::before, .field + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: .5px; background: var(--sep); }
.field label { flex: none; max-width: 45%; font-size: 17px; }
.field label .req { color: var(--red); }
.field input, .field select, .field .val {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; text-align: right; font-size: 17px; height: 38px;
  color: var(--label); -webkit-appearance: none; appearance: none;
}
.field .val { display: flex; align-items: center; justify-content: flex-end; gap: 6px; color: var(--label-2); text-align: right; overflow-wrap: anywhere; height: auto; min-height: 38px; }
.field .val.set { color: var(--label); }
.field input::placeholder { color: var(--label-3); }
.field.col { flex-direction: column; align-items: stretch; gap: 4px; padding-top: 11px; padding-bottom: 10px; }
.field.col label { max-width: none; font-size: 13px; color: var(--label-2); text-transform: uppercase; letter-spacing: .02em; font-weight: 500; }
.field.col textarea { border: 0; outline: 0; background: transparent; resize: none; min-height: 44px; font-size: 17px; line-height: 1.35; padding: 0; }
.field .unit { color: var(--label-2); flex: none; }
.field.err label { color: var(--red); }
.field .suffix-btn { color: var(--tint); font-size: 15px; flex: none; }
.field input[type="date"] { min-width: 120px; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 16px 12px; }
.photos .ph { width: 72px; height: 72px; border-radius: 14px; overflow: hidden; position: relative; background: var(--fill); flex: none; }
.photos .ph img, .photos .ph video { width: 100%; height: 100%; object-fit: cover; }
.photos .ph .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; }
.photos .ph .x .i { width: 13px; height: 13px; stroke-width: 3; }
.photos .add { width: 72px; height: 72px; border-radius: 14px; border: 1.5px dashed var(--label-3); color: var(--tint); display: flex; align-items: center; justify-content: center; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-radius: var(--r-lg); overflow: hidden; }
.gallery .g { aspect-ratio: 1; background: var(--fill); position: relative; overflow: hidden; }
.gallery .g img, .gallery .g video { width: 100%; height: 100%; object-fit: cover; }
.gallery .g .vid { position: absolute; right: 6px; bottom: 6px; color: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.cover { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--r-xl); overflow: hidden; margin-bottom: 14px; background: var(--fill);
  box-shadow: var(--glass-shadow); position: relative; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .cnt { position: absolute; right: 12px; bottom: 12px; }

/* пустые состояния и загрузка */
.empty { text-align: center; padding: 48px 24px 32px; color: var(--label-2); }
.empty .i { width: 54px; height: 54px; stroke-width: 1.4; color: var(--label-3); margin-bottom: 10px; }
.empty b { display: block; color: var(--label); font-size: 20px; margin-bottom: 6px; letter-spacing: -.02em; }
.skel { border-radius: var(--r-md); background: linear-gradient(90deg, var(--fill) 25%, var(--fill-2) 50%, var(--fill) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; margin-bottom: 10px; }
.loading-more { text-align: center; padding: 14px; color: var(--label-2); font-size: 15px; }

/* полоска-индикатор (прогресс, доли) */
.bar { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--tint); transition: width .6s var(--spring); }

/* ---------------------------------------------------------------- листы, диалоги, уведомления */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.28); opacity: 0; transition: opacity .35s; z-index: 50; }
.backdrop.show { opacity: 1; }
:root[data-theme="dark"] .backdrop { background: rgba(0,0,0,.5); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: calc(100% - var(--sat) - 28px); display: flex; flex-direction: column;
  border-radius: 30px 30px 0 0; background: color-mix(in srgb, var(--solid-2) 82%, transparent);
  -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%);
  box-shadow: 0 -10px 40px rgba(0,0,0,.18), inset 0 1px 0 var(--glass-rim), inset 0 0 0 .5px var(--glass-edge);
  transform: translateY(105%); transition: transform .5s var(--spring); padding-bottom: var(--sab);
}
:root[data-theme="dark"] .sheet { background: color-mix(in srgb, #1c1c1e 88%, transparent); }
.sheet.show { transform: none; }
.sheet.drag { transition: none; }
.sheet .grab { width: 36px; height: 5px; border-radius: 3px; background: var(--label-3); margin: 7px auto 0; flex: none; }
.sheet header { display: flex; align-items: center; min-height: 50px; padding: 0 8px; flex: none; position: relative; }
.sheet header h3 { position: absolute; left: 80px; right: 80px; margin: 0; text-align: center; font-size: 17px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet header .sp { flex: 1; }
.sheet .sbody { overflow-y: auto; padding: 4px 16px 18px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet .sbody .group, .sheet .sbody .card { background: var(--solid); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; }
:root[data-theme="dark"] .sheet .sbody .group, :root[data-theme="dark"] .sheet .sbody .card { background: #2c2c2e; }
.sheet .sbody .searchbar { background: var(--fill); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }

.alertbox { position: fixed; z-index: 70; left: 50%; top: 50%; width: 284px; transform: translate(-50%, -50%) scale(1.12); opacity: 0;
  border-radius: 22px; overflow: hidden; text-align: center; transition: transform .35s var(--bounce), opacity .25s;
  background: color-mix(in srgb, var(--solid) 80%, transparent); -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%);
  box-shadow: var(--glass-shadow-lg), inset 0 0 0 .5px var(--glass-edge); }
.alertbox.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.alertbox .m { padding: 20px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.alertbox .m b { font-size: 17px; font-weight: 600; }
.alertbox .m span { font-size: 13.5px; line-height: 1.35; white-space: pre-line; }
.alertbox .bs { display: flex; border-top: .5px solid var(--sep); }
.alertbox .bs button { flex: 1; height: 46px; color: var(--tint); font-size: 17px; }
.alertbox .bs button + button { border-left: .5px solid var(--sep); font-weight: 600; }
.alertbox .bs button.red { color: var(--red); }
.alertbox .bs button:active { background: var(--fill); }

.toast { position: fixed; z-index: 90; left: 50%; top: calc(var(--sat) + 10px); transform: translate(-50%, -140%); max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; font-size: 15px; font-weight: 500;
  background: var(--glass-hi); box-shadow: var(--glass-shadow-lg), inset 0 0 0 .5px var(--glass-edge), inset 0 1px 0 var(--glass-rim);
  transition: transform .55s var(--bounce); }
.toast.show { transform: translate(-50%, 0); }
.toast.ok .i { color: var(--green); } .toast.bad .i { color: var(--red); }
.toast .i { width: 20px; height: 20px; stroke-width: 2.4; }

.viewer { position: fixed; inset: 0; z-index: 80; background: #000; display: flex; flex-direction: column; opacity: 0; transition: opacity .25s; }
.viewer.show { opacity: 1; }
.viewer .vtop { position: absolute; top: calc(var(--sat) + 8px); left: 8px; right: 8px; display: flex; justify-content: space-between; z-index: 2; color: #fff; }
.viewer .vtop .nbtn { color: #fff; background: rgba(40,40,40,.55); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.viewer .strip { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.viewer .strip::-webkit-scrollbar { display: none; }
.viewer .strip > div { flex: none; width: 100%; height: 100%; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; }
.viewer img, .viewer video { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .vcap { position: absolute; bottom: calc(var(--sab) + 16px); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.8); font-size: 14px; }

/* мелкое */
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sum-line { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; font-size: 15px; }
.sum-line.total { font-weight: 700; font-size: 17px; border-top: .5px solid var(--sep); margin-top: 6px; padding-top: 10px; }
.note { font-size: 13px; color: var(--label-2); line-height: 1.4; padding: 0 4px; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; } .gap { height: 14px; }
.center { text-align: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }
.chart { width: 100%; height: 190px; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--label-2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------------------------------------------------------------- анимации */
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
.rise { animation: rise .55s var(--spring) both; }
.pop { animation: pop .5s var(--bounce) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (min-width: 640px) {
  .scroll { padding-left: calc(50% - 300px); padding-right: calc(50% - 300px); }
  .tabbar { left: calc(50% - 300px); right: calc(50% - 300px + 72px); }
  .fab { right: calc(50% - 300px); }
  .tiles { grid-template-columns: repeat(5, 1fr); }
}

/* Чипы внутри горизонтальной прокрутки: строка обрезает всё, что выходит за её край, поэтому большие тени
   дают полосу с резкими краями. Оставляем стеклянную кромку и короткую тень, помещающуюся в отступы строки. */
.chips .chip { box-shadow: inset 0 0 0 .5px var(--glass-edge), inset 0 1px 0 var(--glass-rim), 0 1px 3px rgba(31, 45, 99, .08);
  background: var(--glass-hi); -webkit-backdrop-filter: none; backdrop-filter: none; }
.chips .chip.on { background: var(--tint); box-shadow: 0 3px 8px color-mix(in srgb, var(--tint) 30%, transparent), inset 0 1px 0 rgba(255,255,255,.35); }
