/* spend.lbg.ru: темная тема LBG, только телефон. vh не используем: в части браузеров он врет при клавиатуре. */
@font-face {
  font-family: Inter;
  src: url('/static/fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #050911;
  --bg-2: #09121e;
  --panel: #111d2a;
  --panel-2: #172636;
  --line: rgb(170 190 210 / 16%);
  --text: #f5f8ff;
  --muted: #8b9bb2;
  --accent: #2485ff;
  --accent-tint: rgb(36 133 255 / 18%);
  --ok: #3ccf8e;
  --danger: #ef5264;
  --font: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --gap: 16px;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; overscroll-behavior: none; background: var(--bg); color: var(--text); font: 400 15px/1.45 var(--font); }
body { touch-action: manipulation; min-height: 100%; -webkit-font-smoothing: antialiased; }
body.locked { overflow: hidden; }
input, textarea, select, button { font: inherit; font-size: 16px; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
[hidden] { display: none !important; }

.bgfx { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(700px 500px at 10% -10%, rgb(36 133 255 / 16%), transparent 70%), linear-gradient(180deg, var(--bg-2), var(--bg)); }

/* шапка с фильтрами */
.top { position: sticky; top: 0; z-index: 10; padding: calc(var(--safe-top) + 12px) var(--gap) 12px;
  background: rgb(5 9 17 / 82%); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.top__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.brand { font: 800 18px/1 var(--font); letter-spacing: .02em; }
.brand span { color: var(--accent); }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); }
.icon-btn:active { background: var(--panel); }
.icon-btn svg { width: 22px; height: 22px; }

.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--panel); }
.seg button { min-width: 0; height: 36px; border-radius: 10px; color: var(--muted); font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .15s, color .15s; }
.seg button[aria-pressed='true'] { background: var(--accent); color: #fff; }

/* итог периода */
.main { padding: var(--gap) var(--gap) calc(var(--safe-bottom) + 96px); }
/* итог периода - белая плашка на темном фоне */
.sum { padding: 18px; border-radius: var(--radius); background: #fff; color: #111a2a; box-shadow: 0 10px 30px rgb(0 0 0 / 35%); }
.sum__label { color: #536580; font-size: 13px; }
.sum__value { font: 750 34px/1.15 var(--font); letter-spacing: -.01em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sum__meta { color: #536580; font-size: 13px; }
.sum__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.sum .btn--ghost { background: #eff2f8; color: #111a2a; }
.sum .btn--ghost:active { background: #dde4ee; }
.sum .btn--ghost svg { color: var(--accent); }
.btn { text-decoration: none; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 650; font-size: 15px; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn--ghost { background: rgb(255 255 255 / 9%); color: #fff; text-decoration: none; }
.btn--ghost:active { background: rgb(255 255 255 / 16%); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:active { filter: brightness(.92); }
.btn--danger { background: rgb(239 82 100 / 14%); color: var(--danger); }
.btn--danger.is-armed { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .5; }

/* список */
.day { margin-top: 22px; }
.day__head { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 600; padding: 0 4px 8px; }
.list { border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 0 6px 0 16px; min-height: 58px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row__main { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; text-align: left; }
.row__cat { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.row__amt { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.receipt { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #4b5b72; }
.receipt svg { width: 22px; height: 22px; }
.receipt.is-on { color: var(--ok); }
.receipt:active { background: var(--panel-2); }

.empty { margin-top: 40px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* главная кнопка снизу */
.fab { position: fixed; left: var(--gap); right: var(--gap); bottom: calc(var(--safe-bottom) + 14px); z-index: 20; height: 56px; border-radius: 18px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 12px 30px rgb(36 133 255 / 35%); }
.fab svg { width: 22px; height: 22px; }
.fab:active { filter: brightness(.92); }

/* плашки: выезжают снизу и занимают экран почти целиком, поля наверху, чтобы клавиатура их не закрывала */
.veil { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / 55%); opacity: 0; transition: opacity .22s; }
.veil.is-open { opacity: 1; }
.sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; top: calc(var(--safe-top) + 10px); display: flex; flex-direction: column;
  border-radius: 24px 24px 0 0; background: var(--bg-2); border: 1px solid var(--line); border-bottom: 0;
  transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.sheet.is-open { transform: none; }
.sheet__head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 6px 18px; }
.sheet__title { font: 700 18px/1.2 var(--font); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet__head-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.link-btn { height: 40px; padding: 0 12px; border-radius: 12px; color: var(--accent); font-weight: 650; }
.link-btn:disabled { opacity: .45; }
.sheet__body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 6px 18px calc(var(--safe-bottom) + 24px); }

.label { display: block; color: var(--muted); font-size: 13px; font-weight: 600; margin: 16px 0 8px; }
.label:first-child { margin-top: 4px; }
.label-row { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; }
.label-row .label { margin: 0; }
.label-row .link-btn { height: 28px; padding: 0 4px; font-size: 13px; }

.field { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 6px 0 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.field input { flex: 1; min-width: 0; height: 54px; border: 0; background: none; outline: none; padding: 0; }
.field input:focus, .field input:focus-visible { outline: none; box-shadow: none; }
.field input::placeholder { color: #56677f; }
.field--amount input { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.field .receipt { width: 46px; height: 46px; }
.field .receipt img { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; display: block; }
.clear-btn { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.clear-btn svg { width: 18px; height: 18px; }

.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

input[type=date] { -webkit-appearance: none; appearance: none; width: 100%; max-width: 100%; min-width: 0; color-scheme: dark; }
input::-webkit-date-and-time-value { text-align: left; margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { max-width: 100%; height: 38px; padding: 0 14px; border-radius: 19px; background: var(--panel); border: 1px solid var(--line);
  font-size: 14px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip--new { color: var(--accent); border-style: dashed; border-color: rgb(36 133 255 / 55%); background: none; }

.sheet__foot { margin-top: 24px; display: grid; gap: 10px; }
.error { color: var(--danger); font-size: 14px; margin-top: 12px; }

/* отчет */
.rep-total { font: 750 32px/1.15 var(--font); font-variant-numeric: tabular-nums; margin: 2px 0; overflow-wrap: anywhere; }
.rep-meta { color: var(--muted); font-size: 14px; }
.rep-split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.tile { padding: 14px; border-radius: 16px; background: var(--panel); min-width: 0; }
.tile__label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.tile__label svg { width: 16px; height: 16px; }
.tile__value { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; margin-top: 4px; overflow-wrap: anywhere; }
.tile__sub { color: var(--muted); font-size: 13px; }
.rep-cats { margin-top: 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.rep-cat__top { display: flex; justify-content: space-between; gap: 12px; }
.rep-cat__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.rep-cat__sum { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.rep-cat__bar { height: 6px; border-radius: 3px; background: var(--panel-2); margin: 6px 0 4px; overflow: hidden; }
.rep-cat__bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.rep-cat__meta { color: var(--muted); font-size: 12px; }

/* категории */
.cat-list { border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.cat-row { display: flex; align-items: center; gap: 4px; min-height: 56px; padding: 0 4px 0 16px; border-top: 1px solid var(--line); }
.cat-row:first-child { border-top: 0; }
.cat-row__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-row__n { color: var(--muted); font-size: 13px; flex: none; margin-right: 4px; }
.cat-row.is-hidden .cat-row__name { color: var(--muted); }
.cat-edit { flex: 1; min-width: 0; height: 40px; border-radius: 10px; border: 1px solid var(--accent); background: var(--bg-2); padding: 0 10px; outline: none; }
.cat-edit:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }

/* просмотр чека */
.viewer { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; flex-direction: column; opacity: 0; transition: opacity .2s; }
.viewer.is-open { opacity: 1; }
.viewer__img { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.viewer__img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer__bar { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px var(--gap) calc(var(--safe-bottom) + 14px); }

.toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 86px); z-index: 70; transform: translate(-50%, 20px); opacity: 0;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; background: #24364b; color: #fff; font-size: 14px;
  transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-err { background: #5a1e28; }

/* вход и заглушка */
.center { min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--safe-top) + 32px) 24px calc(var(--safe-bottom) + 32px); }
.center h1 { font: 800 28px/1.15 var(--font); margin: 0 0 6px; }
.center h1 span { color: var(--accent); }
.center p { color: var(--muted); margin: 0 0 28px; }
.login { display: grid; gap: 12px; }
.login .btn { margin-top: 8px; height: 54px; }
.qr { width: 220px; height: 220px; border-radius: 20px; background: #fff; padding: 10px; }
.qr img { width: 100%; height: 100%; display: block; }
.desk { align-items: center; text-align: center; }
html.full, html.full body { height: 100%; }
.hint--lead { margin: 4px 0 14px; }
.desk__url { margin-top: 18px !important; }
.cat-edit { color: var(--text); }
/* iPhone SE и подобные: «Все время» должно влезать целиком */
@media (max-width: 360px) {
  .seg button { font-size: 12px; letter-spacing: -.01em; }
}
/* страница входа не прокручивается и не пружинит: экран прибит к окну */
html.noscroll, html.noscroll body { overflow: hidden; overscroll-behavior: none; }
html.noscroll .center { position: fixed; inset: 0; overflow: hidden; }
