/* Suber — Lorrrem: тёплая бумага, графит, один акцент Limon. Стекло — только навигация и листы. */
:root {
  color-scheme: light;
  --bg: #F4F4F1;
  --card: #FCFCFA;
  --field: #EAEAE5;
  --ink: #141414;
  --subtle: #3A3A37;
  --muted: #7A7A75;
  --line: #D3D3CE;
  --line-soft: #E4E4DF;
  --accent: #C6F04E;
  --on-accent: #141414;
  --accent-band: rgba(198, 240, 78, .28);
  --hero-bg: #141414;
  --hero-text: #F4F4F1;
  --hero-muted: #A8A8A2;
  --warn: #D9451C;
  --warn-bg: rgba(255, 90, 44, .12);
  --ok: #63801B;

  --glass: rgba(252, 252, 250, .62);
  --glass-strong: rgba(252, 252, 250, .86);
  --glass-border: rgba(255, 255, 255, .75);
  --glass-edge: rgba(20, 20, 20, .08);
  --glass-shadow: 0 10px 40px rgba(20, 20, 20, .12), 0 1px 2px rgba(20, 20, 20, .06);
  --scrim: rgba(14, 14, 14, .28);

  --c-work: #C6F04E;
  --c-tel: #1B44E8;
  --c-media: #FF5A2C;
  --c-bank: #3A3A37;
  --c-web: #A9BFA0;
  --c-charity: #FF4D8D;
  --c-other: #A8A8A2;

  --mono: "JetBrains Mono", "SFMono-Regular", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
  --r-card: 20px;
  --r-field: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E0E0E; --card: #191917; --field: #242421; --ink: #EDEDED; --subtle: #B7B7B1; --muted: #8A8A85;
    --line: #34342F; --line-soft: #262623; --accent-band: rgba(198, 240, 78, .16);
    --hero-bg: #1E1E1B; --hero-text: #EDEDED; --hero-muted: #8A8A85;
    --warn: #FF7A52; --warn-bg: rgba(255, 90, 44, .16); --ok: #A9D62F;
    --glass: rgba(34, 34, 31, .58); --glass-strong: rgba(30, 30, 28, .9); --glass-border: rgba(255, 255, 255, .1);
    --glass-edge: rgba(0, 0, 0, .4); --glass-shadow: 0 10px 40px rgba(0, 0, 0, .5); --scrim: rgba(0, 0, 0, .5);
    --c-tel: #5B7BFF; --c-bank: #B7B7B1; --c-web: #7F9477; --c-other: #7A7A75;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E0E0E; --card: #191917; --field: #242421; --ink: #EDEDED; --subtle: #B7B7B1; --muted: #8A8A85;
  --line: #34342F; --line-soft: #262623; --accent-band: rgba(198, 240, 78, .16);
  --hero-bg: #1E1E1B; --hero-text: #EDEDED; --hero-muted: #8A8A85;
  --warn: #FF7A52; --warn-bg: rgba(255, 90, 44, .16); --ok: #A9D62F;
  --glass: rgba(34, 34, 31, .58); --glass-strong: rgba(30, 30, 28, .9); --glass-border: rgba(255, 255, 255, .1);
  --glass-edge: rgba(0, 0, 0, .4); --glass-shadow: 0 10px 40px rgba(0, 0, 0, .5); --scrim: rgba(0, 0, 0, .5);
  --c-tel: #5B7BFF; --c-bank: #B7B7B1; --c-web: #7F9477; --c-other: #7A7A75;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--mono); font-size: 14px; line-height: 20px;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }

/* ---------- стекло ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-border);
}

/* ---------- каркас ---------- */
.app { min-height: 100dvh; }
main {
  padding: calc(16px + var(--safe-t)) 16px calc(112px + var(--safe-b));
  max-width: 1120px; margin: 0 auto; display: grid; gap: 24px; outline: none;
}
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.page-head h1 { font-size: 30px; line-height: 36px; font-weight: 800; letter-spacing: -.02em; }
.kicker { font-size: 11px; line-height: 16px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.head-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; padding: 0;
  color: var(--ink);
}
.icon-btn.plus { color: var(--ink); background: var(--accent); border-color: transparent; }
.icon-btn svg, .nav svg, .btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Нижняя панель — плавающая стеклянная капсула */
.nav {
  position: fixed; z-index: 20; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b));
  height: 68px; border-radius: 34px; padding: 6px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
  max-width: 520px; margin: 0 auto;
}
.nav a {
  display: grid; place-items: center; align-content: center; gap: 2px; text-decoration: none;
  border-radius: 28px; color: var(--subtle); font-size: 10px; line-height: 12px; letter-spacing: .02em;
  transition: background .2s, color .2s;
}
.nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.nav .nav-add, .nav .nav-brand, .nav .nav-foot { display: none; }

/* Десктоп: стеклянная боковая панель */
@media (min-width: 960px) {
  .nav {
    top: 16px; bottom: 16px; left: 16px; right: auto; width: 248px; height: auto; max-width: none; margin: 0;
    border-radius: 28px; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  }
  .nav .nav-brand { display: block; padding: 4px 12px 16px; }
  .nav .nav-brand b { display: block; font-size: 18px; line-height: 24px; }
  .nav a { display: flex; justify-content: flex-start; gap: 12px; padding: 12px 14px; font-size: 14px; line-height: 20px; border-radius: 16px; }
  .nav a:hover:not([aria-current="page"]) { background: var(--accent-band); }
  .nav .nav-add { display: flex; justify-content: center; margin-top: 12px; }
  .nav .nav-foot { display: block; margin-top: auto; padding: 12px; color: var(--muted); font-size: 12px; line-height: 16px; }
  main { padding: 32px 32px 48px calc(248px + 56px); max-width: calc(1120px + 248px + 56px); }
  .head-actions .plus { display: none; }
}

/* ---------- базовые блоки ---------- */
.card { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-card); padding: 20px; }
.section { display: grid; gap: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: 16px; line-height: 24px; font-weight: 700; }
.section-head .link { font-size: 12px; color: var(--muted); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 16px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid-2 { display: grid; gap: 24px; }
@media (min-width: 960px) { .grid-2 { grid-template-columns: 1.1fr .9fr; align-items: start; } }

.btn {
  height: 48px; padding: 0 20px; border-radius: 24px; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: var(--bg); font-weight: 700; letter-spacing: .01em; text-decoration: none; white-space: nowrap;
}
.btn.accent { background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--warn); color: #fff; }
.btn.sm { height: 36px; padding: 0 14px; font-size: 12px; border-radius: 18px; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px;
  border: 1px solid var(--line); font-size: 11px; line-height: 16px; letter-spacing: .04em; white-space: nowrap; color: var(--subtle);
}
.chip.warn { border-color: transparent; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.chip.accent { border-color: transparent; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.chip.soft { border-color: transparent; background: var(--field); }

/* Сегменты */
.seg { display: flex; padding: 4px; border-radius: 22px; background: var(--field); gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg button {
  flex: 1; height: 36px; border: 0; background: transparent; border-radius: 18px; padding: 0 14px; white-space: nowrap;
  color: var(--subtle); font-size: 13px;
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(20,20,20,.12); }

/* ---------- обзор ---------- */
.hero { background: var(--hero-bg); color: var(--hero-text); border-radius: 28px; padding: 24px; display: grid; gap: 20px; }
.hero .kicker { color: var(--hero-muted); }
.hero-num { font-size: clamp(40px, 11vw, 64px); line-height: 1; font-weight: 800; letter-spacing: -.04em; color: var(--accent); }
.hero-num small { font-size: .45em; letter-spacing: 0; margin-left: 6px; color: var(--hero-text); }
.hero-sub { font-size: 12px; color: var(--hero-muted); margin-top: 8px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; border-top: 1px solid rgba(237,237,237,.14); padding-top: 16px; }
.hero-stats b { display: block; font-size: 16px; line-height: 24px; }
.hero-stats span { font-size: 11px; line-height: 14px; color: var(--hero-muted); }
@media (max-width: 420px) { .hero-stats { grid-template-columns: 1fr 1fr; } .hero-stats > :last-child { grid-column: 1 / -1; } }

.topup { display: grid; gap: 16px; }
.topup.urgent { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: linear-gradient(var(--accent-band), var(--accent-band)), var(--card); }
.topup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.topup-head h2 { font-size: 18px; line-height: 24px; font-weight: 800; }
.acc-list { display: grid; gap: 8px; }
.acc-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-radius: 16px; background: var(--field); }
.acc-row b { font-size: 14px; }
.acc-row .need { font-size: 16px; font-weight: 800; text-align: right; }
.acc-row .rub { grid-column: 2; text-align: right; font-weight: 700; font-size: 14px; }
.acc-row .rub-note { grid-column: 1 / -1; font-size: 11px; line-height: 14px; color: var(--muted); text-align: right; }
.acc-row .detail { grid-column: 1 / -1; font-size: 12px; line-height: 16px; color: var(--muted); }
.acc-row.covered .need { color: var(--ok); font-size: 13px; }

/* ---------- списки ---------- */
.list { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r-card); overflow: hidden; }
.list-group-head { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px 8px; font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.row {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center;
  width: 100%; padding: 12px 16px; background: none; border: 0; border-top: 1px solid var(--line-soft); text-align: left;
}
.list > .row:first-child, .list-group-head + .row { border-top: 0; }
.row:hover { background: var(--accent-band); }
.row.paused { opacity: .5; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px;
  color: #141414; background: var(--cat, var(--c-other));
}
.avatar.dark-text { color: #141414; }
.avatar.light-text { color: #F4F4F1; }
.row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 12px; line-height: 16px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .r { text-align: right; }
.row .r b { display: block; font-weight: 700; }
.row .r span { font-size: 12px; color: var(--muted); }
.row .r .warn { color: var(--warn); font-weight: 600; }

.search { position: relative; }
.search #q { padding-left: 44px; }
.search svg { position: absolute; z-index: 1; left: 14px; top: 14px; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.managers { display: flex; gap: 8px; flex-wrap: wrap; }
.managers a {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 20px; text-decoration: none; font-size: 13px;
}
.managers a svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* ---------- календарь ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-head h2 { font-size: 20px; line-height: 28px; font-weight: 800; }
.cal-nav { display: flex; gap: 8px; }
.cal-nav .icon-btn { width: 40px; height: 40px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .wd { font-size: 11px; color: var(--muted); text-align: center; padding: 4px 0; letter-spacing: .08em; }
.day {
  min-height: 64px; border-radius: 14px; border: 1px solid transparent; background: var(--card);
  padding: 6px; display: flex; flex-direction: column; gap: 4px; text-align: left; overflow: hidden;
}
.day.out { background: transparent; }
.day .dn { font-size: 12px; line-height: 16px; color: var(--muted); }
.day.today .dn { background: var(--accent); color: var(--on-accent); border-radius: 8px; padding: 0 6px; align-self: flex-start; font-weight: 700; }
.day[aria-pressed="true"] { border-color: var(--ink); }
.day.has { cursor: pointer; }
.dots { display: flex; flex-wrap: wrap; gap: 3px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--cat); display: block; }
.dots i.transfer { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.day .dsum { font-size: 10px; line-height: 12px; font-weight: 700; margin-top: auto; }
.day .names { display: none; }
@media (min-width: 960px) {
  .day { min-height: 112px; padding: 8px; }
  .day .dots { display: none; }
  .day .names { display: grid; gap: 2px; }
  .day .names span { font-size: 11px; line-height: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 8px; position: relative; }
  .day .names span::before { content: ""; position: absolute; left: 0; top: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--cat); }
  .cal-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
}
.cal-summary { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- статистика ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kpi { display: grid; gap: 4px; align-content: start; }
.kpi b { font-size: 22px; line-height: 28px; font-weight: 800; letter-spacing: -.02em; }
.kpi .small { color: var(--muted); }
@media (max-width: 640px) { .kpis { grid-template-columns: 1fr; } }
.donut-wrap { display: grid; gap: 20px; align-items: center; }
@media (min-width: 640px) { .donut-wrap { grid-template-columns: 220px 1fr; } }
.donut { width: 100%; max-width: 220px; margin: 0 auto; display: block; }
.donut text { fill: var(--ink); font-family: var(--mono); }
.legend { display: grid; gap: 10px; }
.leg { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; }
.leg i { width: 12px; height: 12px; border-radius: 4px; background: var(--cat); }
.leg .bar { grid-column: 2 / -1; height: 6px; border-radius: 3px; background: var(--field); overflow: hidden; }
.leg .bar span { display: block; height: 100%; background: var(--cat); border-radius: 3px; }
.leg .v { text-align: right; font-weight: 700; }
.leg .v small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }

/* ---------- формы ---------- */
.field { display: grid; gap: 6px; }
.field > label, .field > .lbl { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.input, .field input:not([type="checkbox"]):not([type="file"]), .field select, .field textarea {
  width: 100%; height: 48px; border-radius: var(--r-field); border: 1px solid transparent; background: var(--field); padding: 0 14px; font-size: 15px;
  -webkit-appearance: none; appearance: none;
}
.field textarea { height: auto; min-height: 120px; padding: 12px 14px; line-height: 20px; resize: vertical; }
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237A7A75' stroke-width='1.8'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); outline: none; }
.row-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-fields.amount { grid-template-columns: 1fr 104px; }
.row-fields.period { grid-template-columns: 88px 1fr; }
.check { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); }
.form { display: grid; gap: 16px; }
.hint { font-size: 12px; line-height: 16px; color: var(--muted); }
.found { padding: 12px 14px; border-radius: 14px; background: var(--accent-band); font-size: 13px; }

.drop {
  display: grid; place-items: center; gap: 8px; text-align: center; padding: 28px 16px; border-radius: 20px;
  border: 1.5px dashed var(--line); color: var(--muted); cursor: pointer;
}
.drop svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.shot-preview { max-height: 220px; border-radius: 16px; display: block; margin: 0 auto; }
.progress { height: 6px; border-radius: 3px; background: var(--field); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- лист (bottom sheet / модальное окно) ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade .2s; }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow: auto; overscroll-behavior: contain;
  border-radius: 28px 28px 0 0; padding: 8px 20px calc(24px + var(--safe-b));
  background: var(--glass-strong); border-bottom: 0;
  animation: up .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; position: sticky; top: -8px; padding-top: 8px; background: transparent; }
.sheet-head h2 { font-size: 20px; line-height: 28px; font-weight: 800; }
.sheet-head .icon-btn { width: 40px; height: 40px; background: var(--field); border: 0; box-shadow: none; }
.sheet-body { display: grid; gap: 16px; }
@media (min-width: 720px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: 560px; max-height: 86dvh; border-radius: 28px; padding: 20px 24px 24px; border-bottom: 1px solid var(--glass-border); animation: pop .22s ease-out; }
  .sheet .grab { display: none; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { transform: translate(-50%, -48%); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet, .scrim { animation: none; } }

.detail-amount { font-size: 36px; line-height: 40px; font-weight: 800; letter-spacing: -.03em; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }
.cancel-box { display: grid; gap: 12px; padding: 16px; border-radius: 20px; background: var(--field); }
.cancel-box b { font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn { flex: 1; }

.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--safe-b));
  padding: 12px 18px; border-radius: 20px; font-size: 13px; max-width: calc(100% - 32px);
}
@media (min-width: 960px) { .toast { bottom: 24px; } }

.empty { text-align: center; padding: 32px 16px; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.settings-list { display: grid; gap: 12px; }
.setting { display: grid; gap: 12px; }
.setting h3 { font-size: 14px; line-height: 20px; font-weight: 700; }
.rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ---------- профиль ---------- */
.nav .nav-user { display: none; }
.profile-btn { text-decoration: none; }
.me-initials { font-weight: 800; font-size: 14px; }
.auth-list { display: grid; gap: 8px; }
.auth-list .btn { justify-content: flex-start; gap: 12px; padding-left: 8px; height: 56px; border-radius: 28px; }
.auth-list .avatar { width: 40px; height: 40px; }
.profile-card { display: grid; gap: 4px; text-decoration: none; color: inherit; }
.profile-card:hover { border-color: var(--line); }
.profile-card h3::after { content: " →"; color: var(--muted); }
@media (min-width: 960px) {
  .nav .nav-user { display: flex; margin-top: auto; }
  .nav .nav-foot { margin-top: 0; }
  .head-actions .profile-btn { display: none; }
}
