:root {
  color-scheme: dark;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  background: #111313;
  color: #f0f3ed;
  --surface: #181b1a;
  --subtle: #202422;
  --line: #2d3430;
  --text: #f0f3ed;
  --muted: #9daaa0;
  --accent: #d3fa84;
  --danger: #ffc0af;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: wait; opacity: .48; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.shell { max-width: 690px; min-height: 100dvh; margin: auto; position: relative; }
.sidebar { display: contents; }
.brand { display: flex; align-items: center; gap: 10px; padding: 15px 3px 4px; margin: 0 14px; font-size: 20px; font-weight: 750; line-height: 1; letter-spacing: -.7px; width: fit-content; }
.brand-sub { display: block; color: #a4b09f; font-size: 9px; font-weight: 700; letter-spacing: .22em; margin-top: 6px; }
.brand-mark { width: 31px; height: 31px; display: grid; grid-template-columns: repeat(2, 8px); grid-template-rows: repeat(2, 8px); gap: 3px; place-content: center; border-radius: 10px; background: var(--accent); transform: rotate(-8deg); }
.brand-mark i { background: #242d18; border-radius: 1px 5px 1px 5px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(3) { border-radius: 5px 1px 5px 1px; }
.navigation { position: fixed; z-index: 4; left: 50%; width: min(690px, 100vw); transform: translateX(-50%); bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; padding: 7px 8px calc(7px + max(env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px))); border-top: 1px solid var(--line); background: #151917; }
.navigation button { border: 1px solid transparent; background: transparent; display: grid; place-items: center; gap: 4px; width: 100%; min-height: 49px; text-align: center; border-radius: 9px; color: var(--muted); padding: 5px 2px; font-size: 11px; white-space: nowrap; }
.navigation svg { width: 19px; height: 19px; }
.navigation[hidden] { display: none; }
.navigation button:hover { color: var(--text); background: var(--surface); }
.navigation button[aria-current="page"] { color: var(--accent); background: #242e21; border-color: #35442c; }
main { padding: 0 14px calc(88px + max(env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px))); }
.topbar { position: absolute; top: 21px; right: 14px; font-size: 11px; }
.environment { display: flex; align-items: center; gap: 6px; color: #d9e3d2; padding: 4px 7px; border: 1px solid var(--line); border-radius: 20px; white-space: nowrap; }
.environment span, .status i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.hero { position: relative; overflow: hidden; margin: 17px 0 14px; padding: 23px clamp(21px, 4vw, 33px); min-height: 145px; display: flex; align-items: center; border: 1px solid #384635; border-radius: 17px; background: linear-gradient(110deg, #1d2720, #26352a 74%, #314336); isolation: isolate; }
.hero::after { position: absolute; content: ""; z-index: -1; width: 460px; height: 325px; right: -24px; top: -97px; transform: rotate(-24deg); border-radius: 48%; opacity: .8; background: repeating-radial-gradient(ellipse at 68% 52%, transparent 0 10px, #b9e77d38 11px, transparent 12px 19px); mask-image: radial-gradient(ellipse at 66% 53%, black 2%, transparent 72%); }
.hero h1 { margin: 0; font-size: clamp(36px, 5vw, 57px); letter-spacing: -.061em; line-height: 1; font-weight: 740; }
.hero p { margin: 13px 0 0; color: #bfcebe; font-size: 15px; }
.hero-text { max-width: 84%; }
.ledger { border: 1px solid var(--line); border-radius: 17px; background: var(--surface); overflow: hidden; }
.controls { padding: 17px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; background: #121514; padding: 4px; border: 1px solid var(--line); border-radius: 11px; }
.tabs button, .icon-button, .plain, .primary, .danger { background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 8px 11px; font-size: 13px; white-space: nowrap; }
.tabs button { color: var(--muted); }
.tabs button[aria-pressed="true"] { background: #29312a; color: var(--text); border-color: #3a463a; }
.tabs button:hover, .plain:hover, .icon-button:hover { color: var(--accent); }
.filters { display: flex; gap: 8px; align-items: center; }
.search { display: flex; gap: 8px; align-items: center; padding: 0 10px; }
.search svg { width: 16px; height: 16px; }
.search, select, .icon-button, .plain { color: var(--muted); border: 1px solid var(--line); border-radius: 8px; background: #131614; min-height: 37px; }
.search input { width: clamp(100px, 13vw, 175px); min-height: 35px; border: 0; background: transparent; color: var(--text); }
.search input::placeholder { color: var(--muted); }
.search input:focus-visible { outline: 0; }
.search:focus-within { outline: 1px solid var(--accent); }
select { padding: 0 7px; }
.icon-button { padding: 5px 8px; }
.icon-button svg { width: 17px; height: 17px; }
.table-head, .order { display: grid; grid-template-columns: minmax(155px,1.3fr) minmax(122px,1.2fr) minmax(104px,.8fr) minmax(90px,.8fr) 24px; align-items: center; gap: 14px; padding: 0 18px; }
.table-head { min-height: 36px; background: #151817; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.order { border: 0; border-top: 1px solid var(--line); background: transparent; width: 100%; text-align: left; min-height: 67px; font-size: 13px; }
.order:hover { background: #202622; }
.order strong, .order small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.order small { color: var(--muted); margin-top: 3px; font-size: 11px; }
.order .mobile-bank { display: none; }
.identity { display: flex; gap: 11px; align-items: center; min-width: 0; }
.identity > span:last-child, .money, .bank { min-width: 0; }
.source-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; background: #2a3625; color: var(--accent); font-weight: 700; }
.source-icon.cards { background: #302939; color: #d9b8ed; }
.money strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.status { display: inline-flex; align-items: center; gap: 6px; justify-self: start; white-space: nowrap; font-size: 11px; color: #d4efaf; background: #293629; border-radius: 20px; padding: 5px 8px; }
.status.active { background: #393222; color: #f5d992; }
.status.active i { background: #e8c776; }
.status.cancelled, .status.expired { color: var(--muted); background: #292e2b; }
.status.cancelled i, .status.expired i { background: var(--muted); }
.chevron { color: #859287; }
.pagination { min-height: 52px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 17px; color: var(--muted); font-size: 13px; }
.pager { display: flex; align-items: center; gap: 5px; }
.empty, .loading, .error-state { padding: 36px 20px; color: var(--muted); text-align: center; }
.error-state strong { color: var(--text); display: block; margin-bottom: 8px; }
.sections { display: grid; gap: 15px; }
.summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat { min-width: 0; padding: 19px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; font-size: clamp(20px, 3vw, 34px); letter-spacing: -.05em; margin-top: 6px; }
.chart { padding: 20px; display: grid; gap: 7px; }
.bar { display: grid; grid-template-columns: 63px minmax(30px, 1fr) 108px; align-items: center; gap: 10px; font-size: 12px; }
.bar span:last-child { text-align: right; }
progress { appearance: none; width: 100%; height: 7px; border: none; background: #2d3730; border-radius: 10px; overflow: hidden; }
progress::-webkit-progress-bar { background: #2d3730; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.section-title { margin: 0; padding: 17px 19px; font-size: 16px; }
.section-head { display: flex; justify-content: space-between; align-items: center; padding-right: 12px; }
.simple-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 19px; border-top: 1px solid var(--line); font-size: 13px; }
.simple-row small { color: var(--muted); }
.drawer { max-width: min(100vw, 520px); width: 100%; margin: 0 0 0 auto; inset: 0 0 0 auto; height: 100dvh; max-height: 100dvh; color: var(--text); background: var(--surface); border: 0; border-left: 1px solid var(--line); padding: 23px; }
.drawer::backdrop { background: #050706b5; }
.drawer-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.drawer h2 { font-size: 25px; letter-spacing: -.04em; margin: 2px 0 5px; overflow-wrap: anywhere; }
.drawer h3 { font-size: 15px; margin: 0 0 10px; }
.drawer p, .drawer dt { color: var(--muted); font-size: 13px; }
.drawer .big-money { color: var(--text); font-size: 39px; font-weight: 750; margin: 15px 0; letter-spacing: -.06em; }
.detail-group { padding: 17px 0; border-top: 1px solid var(--line); margin: 0; }
.detail-group > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; }
.detail-group dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.primary { color: #182210; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.danger { color: var(--danger); background: #352624; border-color: #594039; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.drawer .simple-row { padding-inline: 0; }
.match-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.match-fields label { font-size: 13px; color: var(--muted); display: grid; gap: 5px; }
.match-fields input { min-width: 0; background: #131614; border: 1px solid var(--line); border-radius: 8px; padding: 8px; color: var(--text); }
.match-switch { display: flex; align-items: center; gap: 8px; min-height: 42px; font-size: 13px; }
.match-switch input { accent-color: var(--accent); width: 17px; height: 17px; }
.match-options { display: grid; gap: 6px; }
.match-option { display: grid; grid-template-columns: minmax(0, 1fr) auto 15px; align-items: center; gap: 8px; padding: 11px 8px; text-align: left; min-height: 58px; background: var(--subtle); border: 1px solid var(--line); border-radius: 9px; font-size: 12px; }
.match-option strong { display: block; font-size: 15px; }
.match-option small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); margin-top: 3px; }
.match-option svg { width: 15px; }
.settings-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 8px; align-items: end; padding: 14px 0; }
.settings-fields label { display: grid; gap: 5px; }
.settings-fields label, .settings-fields span { color: var(--muted); font-size: 13px; }
.settings-fields input { min-width: 0; background: #131614; border: 1px solid var(--line); border-radius: 8px; padding: 8px; color: var(--text); }
.simple-row .actions { margin: 0; }
.drawer button[aria-pressed="true"] { border-color: #4a6141; color: var(--accent); }
.toast { z-index: 10; position: fixed; inset: auto 16px calc(76px + max(env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px))) auto; max-width: min(330px, calc(100vw - 32px)); padding: 12px 15px; border-radius: 11px; background: #27382b; border: 1px solid #4f654c; box-shadow: 0 9px 36px #0006; }
.toast:empty { display: none; }
.drawer .toast { position: sticky; bottom: 10px; display: block; margin-top: 12px; color: var(--text); }
@media (max-width: 610px) {
  .table-head, .order { grid-template-columns: minmax(118px,1.2fr) minmax(81px,.8fr) minmax(87px,.7fr) 19px; gap: 9px; }
  .bank { display: none; }
  .order .mobile-bank { display: block; }
}
@media (max-width: 510px) {
  .hero { border-radius: 14px; min-height: 120px; margin: 14px 0 12px; padding: 18px; }
  .hero h1 { font-size: clamp(27px, 9.3vw, 43px); }
  .hero p { font-size: 12px; margin-top: 8px; }
  .hero::after { right: -160px; }
  .ledger { border-radius: 12px; }
  .controls { padding: 9px; gap: 8px; }
  .tabs { gap: 2px; }
  .tabs button { padding: 8px 9px; min-height: 36px; font-size: 12px; }
  .filters { width: 100%; gap: 5px; }
  .search { flex: 1; min-width: 0; }
  .search input { width: 100%; font-size: 16px; }
  .filters select, .filters .plain, .filters .icon-button { min-height: 42px; font-size: 12px; }
  .table-head, .order { grid-template-columns: minmax(0,1.1fr) minmax(66px,.85fr) auto 13px; gap: 6px; padding: 0 8px; }
  .order strong { font-size: 13px; }
  .order small { font-size: 10px; }
  .table-head { font-size: 10px; min-height: 31px; }
  .order { min-height: 61px; }
  .source-icon { width: 24px; height: 27px; font-size: 11px; border-radius: 6px; }
  .identity { gap: 5px; }
  .status { padding: 4px 5px; font-size: 10px; gap: 3px; }
  .status i { width: 4px; height: 4px; }
  .chevron svg { width: 13px; }
  .pagination { font-size: 11px; padding-inline: 9px; }
  .drawer { padding: 15px; padding-bottom: max(20px, env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px)); }
  .drawer[open] { display: flex; flex-direction: column; }
  .drawer > * { flex-shrink: 0; }
  .drawer button { min-height: 42px; }
  .drawer input { font-size: 16px; }
  .order-actions { position: sticky; bottom: 0; margin-top: auto; margin-bottom: 0; padding: 12px 0 0; background: var(--surface); }
  .order-actions button { min-height: 46px; flex: 1; }
}
@media (max-width: 375px) {
  .search svg { display: none; }
}
