/* NRB Partners cabinet v2 — approved design (Main / Promo / Payouts mockups, 25.10.2026).
 * Dark only. Contrast: muted #9AA3B2 on #1C1F26 ≈ 6.4:1, #B8C4D6 on #1A2433 ≈ 9:1, #0B1220 on #4DB2FF ≈ 8:1. */
:root {
  --bg: #14161B; --card: #1C1F26; --raised: #23262E; --raised2: #2A2E37; --bar: #2E3B4E;
  --text: #F2F4F7; --muted: #9AA3B2; --soft: #B8C4D6; --accent: #4DB2FF; --accent-hover: #8ACBFF; --on-accent: #0B1220;
  --money: #4BD08B; --money-bg: #183324; --warn: #FFB547; --error: #FF8A8A; --error-bg: #3A1E22; --info-bg: #1A2433;
  --r-card: 22px; --r-tile: 16px; --r-btn: 14px;
  /* Telegram safe areas (set by app.js from safeAreaInset / contentSafeAreaInset; 0 elsewhere). In full screen the
   * content inset is the band of Telegram's own Close / ⋯ buttons under the status bar. */
  --safe-top: calc(var(--tg-safe-top, 0px) + var(--tg-content-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--tg-safe-left, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--tg-safe-right, 0px));
  --glass: rgba(30, 33, 41, .86); --hairline: rgba(255, 255, 255, .07); --accent-soft: rgba(77, 178, 255, .16); --mine: #1F3A57;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: Manrope, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 15px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.shell { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  padding: var(--safe-top) var(--safe-right) calc(104px + var(--safe-bottom)) var(--safe-left); }
html.is-chat .shell { padding-bottom: 0; }
html.is-chat .top { display: none; }
/* full screen: content scrolling under the status bar and Telegram's buttons is veiled */
html.tg-fullscreen body::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: var(--safe-top); z-index: 8; pointer-events: none;
  background: var(--bg); }
.main { display: flex; flex-direction: column; gap: 12px; padding: 0 16px 12px; outline: none; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; gap: 12px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 36px; height: 36px; flex: none; border-radius: 12px; background: var(--accent); display: flex; align-items: center;
  justify-content: center; font-weight: 800; font-size: 13px; color: var(--on-accent); }
.who-text { display: flex; flex-direction: column; min-width: 0; }
.who-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-role { font-size: 12px; color: var(--muted); }
.pill { height: 36px; min-width: 44px; padding: 0 14px; border-radius: 18px; border: 0; background: var(--raised); font-weight: 600; font-size: 13px; }

/* screen headings (Promo / Payouts) */
.head { display: flex; flex-direction: column; gap: 4px; padding: 6px 0 0; }
.head h1 { margin: 0; font-size: 22px; font-weight: 800; }
.head p { margin: 0; font-size: 13px; color: var(--muted); }
.fresh { font-size: 12px; color: var(--muted); margin: -4px 0 0; }

/* cards */
.card { padding: 16px 18px; border-radius: var(--r-card); background: var(--card); display: flex; flex-direction: column; gap: 10px; }
.card h2 { margin: 0; font-size: 14px; font-weight: 700; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row.base { align-items: baseline; }
.muted { color: var(--muted); font-size: 12px; margin: 0; }
.soft { color: var(--soft); }
.balance { padding: 18px; gap: 14px; }
.balance .label { font-size: 13px; color: var(--muted); }
.amount { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
.trend { padding: 6px 10px; border-radius: 10px; background: var(--money-bg); color: var(--money); font-size: 12px; font-weight: 700; white-space: nowrap; }
.trend.down { background: var(--raised2); color: var(--warn); }
.btn { min-height: 48px; padding: 0 16px; border-radius: var(--r-btn); border: 0; background: var(--accent); color: var(--on-accent);
  font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn.secondary { background: var(--raised); color: var(--text); font-weight: 600; }
.btn.secondary:hover { background: var(--raised2); }
.btn.small { min-height: 40px; border-radius: 12px; font-size: 13px; font-weight: 700; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.payout-note { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--raised); color: var(--soft); font-size: 14px; font-weight: 600; text-align: center; cursor: default; user-select: none; }
.track { height: 8px; border-radius: 4px; background: var(--raised2); overflow: hidden; }
.track > span { display: block; height: 8px; background: var(--accent); width: 0; }

/* period switch */
.segment { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: var(--card); }
.segment button { flex: 1; min-height: 34px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; }
.segment button[aria-pressed="true"] { background: var(--raised2); color: var(--text); font-weight: 700; }
.datebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.datebar input { min-height: 36px; padding: 0 10px; border-radius: 10px; border: 0; background: var(--card); color: var(--text); }

/* chart */
.chart { height: 130px; display: flex; align-items: flex-end; gap: 10px; }
.chart.dense { gap: 3px; }
.chart .col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.chart .bar { width: 100%; border-radius: 6px 6px 2px 2px; background: var(--bar); height: 2px; }
.chart.dense .bar { border-radius: 3px 3px 1px 1px; }
.chart .bar.active { background: var(--accent); }
.chart .bar.future { background: transparent; }
.chart .lbl { font-size: 11px; color: var(--muted); min-height: 14px; white-space: nowrap; }
.sum { font-size: 18px; font-weight: 800; }
.split { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13px; }
.split dt { color: var(--muted); }
.split dd { margin: 0; font-weight: 700; text-align: end; }

/* funnel tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { padding: 12px 8px; border-radius: var(--r-tile); background: var(--card); display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.tile strong { font-size: 17px; font-weight: 800; }
.tile span { font-size: 11px; color: var(--muted); text-align: center; }
.tiles.three .tile { align-items: flex-start; padding: 12px; }
.tiles.three .tile span { order: -1; text-align: start; }
.tiles.three .tile strong { font-size: 16px; }
.money { color: var(--money); }

/* products */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 34px; padding: 0 14px; border-radius: 17px; border: 0; background: var(--raised); color: var(--text); font-weight: 600; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.product { padding: 14px; border-radius: 20px; background: var(--card); display: flex; flex-direction: column; gap: 12px; }
.product-top { display: flex; align-items: center; gap: 12px; }
.badge { position: relative; overflow: hidden; width: 48px; height: 48px; flex: none; border-radius: 14px; background: var(--accent); display: flex;
  align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: var(--on-accent); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.badge.md { width: 52px; height: 52px; border-radius: 16px; font-size: 14px; }
/* real bot avatar over the initials; removed on error so the initials stay */
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s ease; background: var(--raised); }
.avatar-img.on { opacity: 1; }
.product-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.product-text strong { font-size: 15px; }
.product-text span { font-size: 12px; color: var(--muted); }
.rate { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.rate strong { font-size: 15px; font-weight: 800; color: var(--money); white-space: nowrap; }
.rate span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pair { display: flex; gap: 8px; }
.pair > * { flex: 1; }

/* accruals */
.list { display: flex; flex-direction: column; gap: 8px; }
.acc { border-radius: var(--r-tile); background: var(--card); }
.acc summary { list-style: none; padding: 12px 14px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.acc summary::-webkit-details-marker { display: none; }
.acc-text { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.acc-text strong { font-size: 14px; overflow-wrap: anywhere; }
.acc-text span { font-size: 12px; color: var(--muted); }
.acc-sum { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 48%; flex: none; }
.acc-sum strong { font-size: 15px; font-weight: 800; white-space: nowrap; }
.acc-more { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--soft); }
.status { padding: 3px 8px; border-radius: 8px; font-size: 11px; font-weight: 700; text-align: end; }
.status.hold { background: var(--raised2); color: var(--warn); }
.status.ok { background: var(--money-bg); color: var(--money); }
.status.paid { background: var(--info-bg); color: var(--accent); }
.status.no { background: var(--error-bg); color: var(--error); }
.status.neutral { background: var(--raised2); color: var(--soft); }
.info { padding: 14px; border-radius: var(--r-tile); background: var(--info-bg); display: flex; flex-direction: column; gap: 6px; }
.info strong { font-size: 13px; }
.info p { margin: 0; font-size: 12px; color: var(--soft); line-height: 1.5; }
.method { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--raised2); }
.method:first-of-type { border-top: 0; }
.method div { display: flex; flex-direction: column; gap: 2px; }
.method span { font-size: 12px; color: var(--muted); }
.soon { padding: 3px 8px; border-radius: 8px; background: var(--raised2); color: var(--warn); font-size: 11px; font-weight: 700; }

/* help */
.faq details { border-top: 1px solid var(--raised2); padding: 10px 0; }
.faq details:first-of-type { border-top: 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { margin: 8px 0 0; color: var(--soft); font-size: 14px; line-height: 1.5; }
.levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.level { padding: 12px; border-radius: var(--r-tile); background: var(--raised); display: flex; flex-direction: column; gap: 2px; }
.level.on { background: var(--info-bg); }
.level b { font-size: 22px; font-weight: 800; }
.level span { font-size: 11px; color: var(--muted); }
.level em { font-style: normal; font-size: 13px; font-weight: 700; color: var(--accent); }
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.facts span { padding: 8px 12px; border-radius: 12px; background: var(--raised); font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select { min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--raised2); background: var(--raised); color: var(--text); width: 100%; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.toggle { min-width: 64px; min-height: 36px; border-radius: 18px; border: 0; background: var(--raised2); color: var(--muted); font-weight: 700; font-size: 13px; }
.toggle[aria-pressed="true"] { background: var(--money-bg); color: var(--money); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; padding: 12px; border-radius: 12px; background: var(--raised);
  word-break: break-all; user-select: all; }
.code.big { font-size: 20px; letter-spacing: 2px; text-align: center; }
.post { white-space: pre-wrap; font-size: 13px; padding: 12px; border-radius: 12px; background: var(--raised); color: var(--soft); }
.media { width: 100%; border-radius: 12px; background: var(--raised); display: block; max-height: 320px; object-fit: contain; }

/* tab bar: floating glass bar, line icons, accent pill on the active tab */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; pointer-events: none;
  padding: 18px calc(12px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(12px + var(--safe-left));
  background: linear-gradient(to top, rgba(20, 22, 27, .96) 35%, rgba(20, 22, 27, 0)); }
.tabbar-in { pointer-events: auto; max-width: 480px; margin: 0 auto; height: 66px; padding: 6px; border-radius: 24px; display: flex; gap: 2px;
  background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--hairline); box-shadow: 0 12px 32px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .04); }
.tab { flex: 1 1 0; min-width: 0; min-height: 54px; padding: 0 2px; border: 0; border-radius: 18px; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 700; letter-spacing: .1px;
  transition: color .2s ease; touch-action: manipulation; }
.tab-ic { width: 54px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; transition: background .2s ease, transform .15s ease; }
.tab .ic { width: 23px; height: 23px; }
.tab-lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab:hover { color: var(--soft); }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"] .tab-ic { background: var(--accent-soft); }
.tab[aria-current="page"] .ic { stroke-width: 2.1; }
.tab:active .tab-ic { transform: scale(.92); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .tabbar-in { background: #1E2129; } }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(5, 7, 10, .6); }
.sheet-panel { position: relative; width: 100%; max-width: 520px; max-height: min(88vh, calc(100vh - var(--safe-top) - 12px)); overflow: auto; background: var(--bg);
  border-radius: 24px 24px 0 0; padding: 18px 16px calc(20px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 12px; }
.sheet-panel h2 { margin: 0; font-size: 20px; font-weight: 800; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.x { width: 40px; height: 40px; border-radius: 20px; border: 0; background: var(--raised); font-size: 18px; }

/* states */
.notice { margin: 24px 16px; padding: 18px; border-radius: var(--r-card); background: var(--card); color: var(--soft); display: flex; flex-direction: column; gap: 12px; }
.notice h1 { margin: 0; font-size: 20px; color: var(--text); }
.skeleton { height: 120px; border-radius: var(--r-card); background: linear-gradient(90deg, var(--card), var(--raised), var(--card)); background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-bottom)); transform: translate(-50%, 20px); opacity: 0;
  padding: 10px 16px; border-radius: 12px; background: var(--raised2); color: var(--text); font-weight: 600; font-size: 13px;
  transition: opacity .2s, transform .2s; pointer-events: none; z-index: 20; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
[dir="rtl"] .rate, [dir="rtl"] .acc-sum { align-items: flex-start; }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } .toast { transition: none; } }
@media (max-width: 360px) { .amount { font-size: 28px; } .tiles { gap: 6px; } .tile strong { font-size: 15px; } .chart { gap: 6px; } }
.sheet-panel .card h2 { font-size: 14px; font-weight: 700; }

/* icons */
.ic { width: 22px; height: 22px; flex: none; display: block; }
.ic.sm { width: 16px; height: 16px; }

/* home: what to promote, with bot avatars */
.strip .row h2 { margin: 0; }
.link-btn { display: inline-flex; align-items: center; gap: 2px; min-height: 32px; padding: 0 4px 0 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--accent); font-weight: 700; font-size: 13px; }
.strip-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.strip-item { min-width: 0; min-height: 44px; padding: 4px 0; border: 0; background: transparent; color: var(--text); display: flex; flex-direction: column;
  align-items: center; gap: 6px; border-radius: 14px; }
.strip-name { max-width: 100%; font-size: 12px; font-weight: 700; line-height: 1.25; text-align: center; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.strip-rate { margin-top: -2px; font-size: 11px; font-weight: 700; color: var(--money); }
[dir="rtl"] .ic.sm { transform: scaleX(-1); }

/* help: support */
.support-card { gap: 14px; background: linear-gradient(135deg, #1D2A3B 0%, var(--card) 70%); border: 1px solid rgba(77, 178, 255, .14); }
.support-top { display: flex; align-items: center; gap: 12px; }
.support-ic { width: 44px; height: 44px; flex: none; border-radius: 22px; background: var(--accent-soft); color: var(--accent); display: flex;
  align-items: center; justify-content: center; }
.support-ic.lg { width: 64px; height: 64px; border-radius: 32px; }
.support-ic.lg .ic { width: 30px; height: 30px; }
.support-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.support-text h2 { margin: 0; font-size: 16px; }

/* support chat */
.chat-head { position: sticky; top: var(--safe-top); z-index: 4; display: flex; align-items: center; gap: 12px; margin: 0 -16px; padding: 10px 16px 12px;
  background: rgba(20, 22, 27, .96); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border-bottom: 1px solid var(--hairline); }
.icon-btn { width: 44px; height: 44px; flex: none; border: 0; border-radius: 22px; background: var(--raised); color: var(--text); display: flex;
  align-items: center; justify-content: center; }
[dir="rtl"] .icon-btn .ic { transform: scaleX(-1); }
.chat-title { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-title h1 { margin: 0; font-size: 19px; font-weight: 800; }
.chat-title p { margin: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat { display: flex; flex-direction: column; gap: 6px; padding: 8px 0 calc(92px + var(--safe-bottom)); min-height: 55vh; }
.chat-skel { height: 160px; }
.chat-empty { margin: 44px auto 0; max-width: 300px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--soft); }
.chat-empty p { margin: 0; line-height: 1.5; }
.chat-day { align-self: center; margin: 10px 0 4px; }
.chat-day span { display: inline-block; padding: 4px 12px; border-radius: 12px; background: var(--card); color: var(--muted); font-size: 12px; font-weight: 600; }
.msg { max-width: 84%; padding: 8px 12px 6px; border-radius: 18px; display: flex; flex-direction: column; gap: 3px; }
.msg.mine { align-self: flex-end; background: var(--mine); border-end-end-radius: 6px; }
.msg.team { align-self: flex-start; background: var(--card); border-end-start-radius: 6px; box-shadow: inset 0 0 0 1px var(--hairline); }
.msg-who { font-size: 12px; font-weight: 800; color: var(--accent); }
.msg-text { margin: 0; font-size: 15px; line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-time { align-self: flex-end; font-size: 11px; color: var(--muted); }
.msg.mine .msg-time { color: #9DBBDA; }
.chat-note { align-self: center; max-width: 90%; margin: 10px 0 0; padding: 10px 14px; border-radius: 14px; background: var(--raised); color: var(--soft);
  font-size: 13px; text-align: center; }
.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; max-width: 520px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px;
  padding: 10px calc(12px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(12px + var(--safe-left));
  background: rgba(20, 22, 27, .94); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border-top: 1px solid var(--hairline); }
.composer textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 140px; resize: none; padding: 11px 16px; border-radius: 22px;
  border: 1px solid var(--raised2); background: var(--card); color: var(--text); font-size: 16px; line-height: 1.3; outline: none; }
.composer textarea:focus { border-color: rgba(77, 178, 255, .55); }
.composer textarea::placeholder { color: var(--muted); }
.send { width: 44px; height: 44px; flex: none; border: 0; border-radius: 22px; background: var(--accent); color: var(--on-accent); display: flex;
  align-items: center; justify-content: center; transition: transform .15s ease, opacity .2s; }
.send:active { transform: scale(.92); }
.composer.busy .send { opacity: .55; }
[dir="rtl"] .send .ic { transform: scaleX(-1); }
@media (prefers-reduced-motion: reduce) { .avatar-img, .tab, .tab-ic, .send { transition: none; } }
