:root {
  color-scheme: dark;
  --bg: #090b10;
  --surface: #11151d;
  --surface-2: #171c26;
  --surface-3: #202633;
  --text: #f7f8fb;
  --muted: #858d9d;
  --line: rgba(255,255,255,.075);
  --accent: #b8ff54;
  --accent-2: #8fe832;
  --tab-active: #9a83ff;
  --blue: #77a9ff;
  --danger: #ff666f;
  --warning: #ffbd59;
  --radius: 22px;
  --safe-top: max(16px, env(safe-area-inset-top));
  --safe-bottom: max(8px, env(safe-area-inset-bottom));
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(560px 300px at 100% -5%, rgba(141,232,50,.09), transparent 70%),
    radial-gradient(500px 280px at -20% 20%, rgba(92,126,255,.08), transparent 70%),
    var(--bg);
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
#app {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: var(--safe-top) 16px calc(102px + var(--safe-bottom));
}
.hidden { display: none !important; }
.page { animation: enter .24s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } }
.topline { display: flex; justify-content: space-between; align-items: center; min-height: 46px; margin-bottom: 19px; }
.identity { display: flex; align-items: center; gap: 11px; min-width: 0; }
.avatar {
  width: 44px; height: 44px; flex: 0 0 auto; border-radius: 15px; object-fit: cover;
  display: grid; place-items: center; overflow: hidden; font-weight: 800; color: #0a0c0f;
  background: linear-gradient(140deg, var(--accent), #68caff);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.eyebrow, .label { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.name { font-size: 16px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 7px; color: #d8f8b7; font-size: 12px; font-weight: 650; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(184,255,84,.1); }
.status.off { color: var(--muted); }
.status.off::before { background: #667080; box-shadow: none; }
h1 { margin: 0; font-size: 30px; line-height: 1.08; letter-spacing: -.04em; }
.page-title { margin: 4px 0 22px; display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.page-sub { margin-top: 5px; color: var(--muted); font-size: 13px; }
.card {
  margin-bottom: 12px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255,255,255,.025), transparent 55%), var(--surface);
  box-shadow: 0 12px 32px rgba(0,0,0,.12);
}
.hero { position: relative; overflow: hidden; padding: 22px; }
.hero::after { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; right: -70px; top: -90px; background: rgba(184,255,84,.08); filter: blur(2px); }
.hero .label { margin-bottom: 7px; }
.balance { font-size: clamp(34px, 10vw, 44px); line-height: 1.1; font-weight: 820; letter-spacing: -.055em; }
.balance small { font-size: .43em; color: var(--muted); letter-spacing: 0; }
.reserved { margin-top: 10px; color: var(--muted); font-size: 13px; }
.reserved b { color: #cbd0da; }
.hero-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 20px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 12px; }
.metric { min-width: 0; padding: 15px 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.metric b { display: block; font-size: 18px; letter-spacing: -.03em; overflow: hidden; text-overflow: ellipsis; }
.metric span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .055em; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 23px 2px 10px; }
.section-title b { font-size: 14px; }
.section-title span { color: var(--muted); font-size: 12px; }
.filter-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 9px; margin-bottom: 12px; }
.filter-grid select, .filter-grid input {
  width: 100%; min-width: 0; padding: 12px; color: var(--text);
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.list-row:first-child { padding-top: 0; }
.list-row:last-child { padding-bottom: 0; border: 0; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.btn {
  min-height: 51px; padding: 0 18px; border: 0; border-radius: 17px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 760; text-decoration: none; transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { width: 100%; color: #090b10; background: var(--accent); }
.btn-secondary { width: 100%; color: var(--text); background: var(--surface-3); border: 1px solid var(--line); }
.btn-danger { color: var(--danger); background: rgba(255,102,111,.1); }
.btn-small { min-height: 38px; padding: 0 13px; border-radius: 13px; font-size: 13px; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }
.check-link {
  display: block; margin-top: 12px; color: var(--muted); font-size: 12px;
  text-align: center; overflow-wrap: anywhere; text-decoration: none;
}
.icon-btn { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: var(--surface-2); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.field { margin-bottom: 13px; }
.field > label { display: block; margin: 0 2px 7px; color: #b8bec9; font-size: 12px; font-weight: 650; }
input, select, textarea {
  width: 100%; min-height: 53px; padding: 0 15px; border: 1px solid var(--line); border-radius: 16px;
  outline: none; color: var(--text); background: #0c0f15; appearance: none; font-size: 16px;
}
textarea { min-height: 90px; resize: none; padding-top: 14px; }
input:focus, select:focus, textarea:focus { border-color: rgba(184,255,84,.45); box-shadow: 0 0 0 3px rgba(184,255,84,.07); }
.currency-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 5px; margin-bottom: 18px; border-radius: 17px; background: #0c0f15; }
.currency-switch button { min-height: 42px; border: 0; border-radius: 13px; color: var(--muted); background: transparent; font-weight: 750; }
.currency-switch button.active { color: var(--text); background: var(--surface-3); }
.amount-wrap { position: relative; margin: 10px 0 6px; }
.amount-input { height: 76px; padding-right: 80px; font-size: 31px; font-weight: 800; letter-spacing: -.04em; }
.amount-unit { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 750; }
.quote { min-height: 22px; margin: 0 2px 20px; color: var(--muted); }
.quote b { color: var(--accent); }
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.step { height: 3px; flex: 1; border-radius: 3px; background: var(--surface-3); }
.step.done { background: var(--accent); }
.choice { width: 100%; padding: 14px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 17px; text-align: left; color: var(--text); background: var(--surface-2); cursor: pointer; }
.choice.selected { border-color: rgba(184,255,84,.45); background: rgba(184,255,84,.07); }
.choice b, .choice span { display: block; }
.choice span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.deal-card { cursor: pointer; padding: 16px; }
.deal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.deal-head b { font-size: 15px; }
.deal-head > div { display: flex; align-items: center; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.deal-amounts { display: flex; justify-content: space-between; align-items: end; gap: 10px; }
.deal-amounts strong { display: block; font-size: 20px; letter-spacing: -.03em; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; background: rgba(255,255,255,.055); color: #c2c8d2; font-size: 11px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #838b98; }
.pill.good::before { background: var(--accent); }
.pill.warn::before { background: var(--warning); }
.pill.bad::before { background: var(--danger); }
.progress { height: 6px; margin: 15px 0 7px; border-radius: 9px; overflow: hidden; background: var(--surface-3); }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.detail-top { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.detail-top h1 { font-size: 24px; }
.operator { display: flex; align-items: center; gap: 11px; }
.operator .avatar { width: 38px; height: 38px; border-radius: 13px; }
.payment { padding: 13px 0; border-bottom: 1px solid var(--line); }
.payment:last-child { border: 0; }
.payment-pending { margin: 0 -8px; padding: 13px 8px; border-radius: 14px; background: rgba(255,189,89,.055); }
.payment-actions { display: flex; gap: 7px; margin-top: 10px; }
.chat { max-height: 330px; overflow-y: auto; padding: 4px 0; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 85%; padding: 10px 12px; border-radius: 15px 15px 15px 4px; background: var(--surface-3); font-size: 13px; }
.bubble.mine { align-self: flex-end; border-radius: 15px 15px 4px 15px; color: #11150c; background: #b0ee65; }
.bubble small { display: block; margin-top: 4px; opacity: .58; font-size: 10px; }
.chat-form { display: grid; grid-template-columns: 1fr 46px; gap: 8px; margin-top: 12px; }
.chat-form input { min-height: 46px; }
.chat-form button { min-height: 46px; padding: 0; border-radius: 15px; }
.ledger { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ledger:last-child { border: 0; }
.ledger-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; color: var(--accent); background: rgba(184,255,84,.08); font-weight: 800; }
.ledger.out .ledger-icon { color: var(--blue); background: rgba(119,169,255,.09); }
.ledger-sum { text-align: right; font-weight: 750; }
.requisite { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.requisite:last-child { border: 0; }
.admin-link { border-color: rgba(119,169,255,.16); background: linear-gradient(135deg, rgba(119,169,255,.1), transparent), var(--surface); }
.empty, .error-state, .blocked { text-align: center; padding: 42px 20px; }
.state-icon { width: 54px; height: 54px; margin: 0 auto 15px; border-radius: 18px; display: grid; place-items: center; color: var(--muted); background: var(--surface-2); }
.state-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.empty h2, .error-state h2, .blocked h2 { margin: 0 0 7px; font-size: 19px; }
.empty p, .error-state p, .blocked p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.skeleton { overflow: hidden; position: relative; background: var(--surface); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.045), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 13px; margin: 9px 0; border-radius: 8px; background: var(--surface-3); }
.sk-line.big { width: 70%; height: 34px; }
.overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px var(--safe-bottom); background: rgba(0,0,0,.7); backdrop-filter: blur(8px); }
.modal { width: min(100%, 500px); max-height: min(86vh, 720px); overflow-y: auto; padding: 21px; border: 1px solid var(--line); border-radius: 25px; background: var(--surface); animation: sheet .22s ease both; }
@keyframes sheet { from { opacity: 0; transform: translateY(20px); } }
.modal h2 { margin: 0 0 6px; font-size: 23px; letter-spacing: -.035em; }
.modal > p { margin: 0 0 18px; }
.success-state { padding: 17px 0 5px; text-align: center; }
.success-state h2 { margin-top: 15px; font-size: 25px; }
.success-state p { margin: 5px 0 24px; }
.success-check {
  width: 76px; height: 76px; margin: 0 auto; border-radius: 50%;
  display: grid; place-items: center; color: #0a0c0f; background: var(--accent);
  box-shadow: 0 0 0 10px rgba(184,255,84,.08), 0 16px 42px rgba(143,232,50,.18);
}
.success-check svg { width: 39px; height: 39px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.success-button { min-height: 59px; font-size: 16px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); padding: 11px 15px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: rgba(32,38,51,.96); box-shadow: 0 10px 30px rgba(0,0,0,.35); font-size: 13px; }
.error { min-height: 18px; margin: 7px 2px; color: #ff8f96; font-size: 12px; }
.tabbar {
  position: fixed; z-index: 40; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 520px); display: grid; grid-template-columns: repeat(5,1fr);
  padding: 8px 5px calc(8px + var(--safe-bottom)); border-top: 1px solid var(--line);
  background: rgba(9,11,16,.88); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
}
.tab { min-width: 0; padding: 3px 0; border: 0; color: #697180; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; cursor: pointer; }
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.tab.active { color: var(--text); }
.tab.active svg { color: var(--tab-active); transform: translateY(-1px); }
.tab.active span { font-weight: 700; }
.staff-mode {
  --accent: #59e391;
  --accent-2: #39c878;
  --tab-active: #59e391;
  background:
    radial-gradient(600px 330px at 100% -5%, rgba(89,227,145,.12), transparent 70%),
    radial-gradient(520px 300px at -20% 35%, rgba(119,169,255,.07), transparent 70%),
    var(--bg);
}
.staff-mode .tabbar { grid-template-columns: repeat(3, 1fr); }
.staff-mode .tab { font-size: 11px; }
.staff-mode .tab svg { width: 23px; height: 23px; }
.queue-card { padding: 17px; }
.queue-user { display: flex; align-items: center; gap: 11px; margin-bottom: 17px; }
.queue-user .avatar { width: 39px; height: 39px; border-radius: 13px; }
.queue-requisite { display: flex; flex-direction: column; gap: 3px; margin: 15px 0; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.035); }
.queue-requisite span { color: var(--muted); font-size: 12px; }
.queue-actions { display: grid; grid-template-columns: 1.45fr 1fr; gap: 8px; }
.queue-actions .btn { min-height: 47px; }
.staff-record { margin: -2px 0 15px; min-height: 56px; }
.staff-deal-actions { display: grid; grid-template-columns: 1.35fr 1fr; gap: 8px; margin-top: 12px; }
.deal-timeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0 2px 15px; }
.deal-timeline span { position: relative; padding-top: 11px; color: var(--muted); font-size: 9px; text-align: center; }
.deal-timeline span::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 4px; border-radius: 5px; background: var(--surface-3); }
.deal-timeline span.done { color: var(--text); }
.deal-timeline span.done::before { background: var(--accent); }
.deal-notice { margin: 0 0 12px; padding: 13px 14px; border: 1px solid rgba(119,169,255,.15); border-radius: 15px; color: #cad9f5; background: rgba(119,169,255,.07); font-size: 12px; }
.deal-notice.important { border-color: rgba(255,189,89,.2); color: #ffe0aa; background: rgba(255,189,89,.08); }
.staff-search > label { display: block; margin-bottom: 10px; font-weight: 750; }
.staff-search > div:first-of-type { display: grid; grid-template-columns: 1fr 90px; gap: 8px; }
.staff-search .btn { min-height: 53px; padding: 0 12px; }
.staff-user-card .identity { margin-bottom: 13px; }
.staff-user-card .identity .pill { margin-left: auto; }
.staff-user-card > .btn { margin-top: 15px; }
.block-reason { margin-top: 12px; padding: 11px; border-radius: 13px; color: #ffb5ba; background: rgba(255,102,111,.08); font-size: 12px; }
.custom-bank-field { animation: enter .18s ease both; }
@media (min-width: 600px) {
  #app { padding-left: 22px; padding-right: 22px; }
  .overlay { align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
