/* ui-pro.css — one design layer for the PC panel (index.html) and mobile.html, loaded LAST so it refines, never rebuilds.
   Tokens · hairline 1px borders · calm hover transitions · tabular numbers · shimmer skeletons · soft view fades.
   Scoped to known components only: themes (applyRadzTheme) and Zen / PRO keep working because no colors of themed
   surfaces are forced here. */
:root {
  --ui-radius-sm: 8px;
  --ui-radius: 12px;
  --ui-radius-lg: 16px;
  --ui-line: rgba(255, 255, 255, 0.08);
  --ui-line-strong: rgba(255, 255, 255, 0.14);
  --ui-text: #f4f4f7;
  --ui-muted: #8e8e9c;
  --ui-faint: #5c5c69;
  --ui-acc: #8b7cff;
  --ui-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ui-skel-a: rgba(255, 255, 255, 0.04);
  --ui-skel-b: rgba(255, 255, 255, 0.09);
}

/* ---------- tabular numbers: sums, ELO / MMR, counters, percents, timers never "dance" on update ---------- */
.cbx, .dcx, .olv-live, .nav-badge, .oc-price, .oc-card, .stat-value, .metric-value, .metric-card, .kpi-value,
.v124-cat-badge, .order-card, [data-order-id], [data-dcx-card], table td, table th, time, .elo, .price,
.sidebar-status-row, .rch-tip, .rch-dl, #setupCountText {
  font-variant-numeric: tabular-nums;
}

/* ---------- PC sidebar: one icon system (Font Awesome, one size / weight / muted palette) ---------- */
.sidebar .nav-link .nav-link-left > i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: 0.62;
  color: currentColor;
  transition: opacity 0.15s var(--ui-ease), color 0.15s var(--ui-ease);
}
.sidebar .nav-link:hover .nav-link-left > i { opacity: 0.9; }
.sidebar .nav-link.active .nav-link-left > i { opacity: 1; color: var(--ui-acc); }
.sidebar .nav-link { transition: background-color 0.15s var(--ui-ease), color 0.15s var(--ui-ease); }

/* ---------- hairline surfaces for the shared modules (Cashbox, Discord CRM, order cards) ---------- */
.cbx-card, .cbx-tile, .dcx-card, .oc-card { border-width: 1px; }
.cbx-card, .cbx-tile, .dcx-card { border-color: var(--ui-line); }
.cbx-btn, .dcx-btn, .dcx-chip, .m-chip, .olv-trk {
  transition: background-color 0.15s var(--ui-ease), border-color 0.15s var(--ui-ease), color 0.15s var(--ui-ease), opacity 0.15s var(--ui-ease);
}
.cbx-btn:focus-visible, .dcx-btn:focus-visible, .olv-trk:focus-visible, .rch-seg button:focus-visible, .cbx-seg button:focus-visible {
  outline: 2px solid var(--ui-acc);
  outline-offset: 2px;
}

/* ---------- skeletons instead of "Загрузка…" ---------- */
.ui-skel, .sheet-loading {
  position: relative;
  border-radius: var(--ui-radius-sm);
  background: linear-gradient(90deg, var(--ui-skel-a) 25%, var(--ui-skel-b) 50%, var(--ui-skel-a) 75%);
  background-size: 200% 100%;
  animation: uiShimmer 1.3s linear infinite;
}
.ui-skel { display: block; height: 14px; }
.sheet-loading { min-height: 120px; color: transparent !important; margin: 8px 0; }
.ui-skel-stack { display: flex; flex-direction: column; gap: 10px; }
@keyframes uiShimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  .ui-skel, .sheet-loading { animation: none !important; }
}

/* =====================================================================================================================
   MOTION (driven by ui-motion.js). Views never keep a transform/filter/will-change: older layers animated
   [id^="view-"].active / .tab-page.active with fill-mode "forwards" + will-change:transform, which turns the view into
   the containing block of every position:fixed modal inside it. One-shot classes below use fill-mode "backwards".
   ===================================================================================================================== */
:root { --um-ease: cubic-bezier(0.22, 1, 0.36, 1); --um-spring: cubic-bezier(0.16, 1, 0.3, 1); }
[id^='view-'].active, .view-page.active, .tab-page.active, [id^='page-'].active, .view-section.active, .tab-pane.active {
  animation: none !important; will-change: auto !important;
}
html:not(.um-off) .view-page.um-view { animation: umViewIn 260ms var(--um-spring) backwards !important; }
html:not(.um-off) .tab-page.um-from-right { animation: umFromRight 260ms var(--um-spring) backwards !important; }
html:not(.um-off) .tab-page.um-from-left { animation: umFromLeft 260ms var(--um-spring) backwards !important; }
html:not(.um-off) .um-rise { animation: umRise 300ms var(--um-spring) backwards !important; }
html:not(.um-off) .um-msg { animation: umMsg 220ms var(--um-spring) backwards !important; }
html:not(.um-off) .um-ico-pop { animation: umIcoPop 340ms var(--um-ease) backwards !important; }
@keyframes umViewIn { from { opacity: 0; transform: translateY(14px); } }
@keyframes umFromRight { from { opacity: 0; transform: translateX(24px); } }
@keyframes umFromLeft { from { opacity: 0; transform: translateX(-24px); } }
@keyframes umRise { from { opacity: 0; transform: translateY(10px); } }
@keyframes umMsg { from { opacity: 0; translate: 0 8px; scale: 0.96; } }
@keyframes umIcoPop { 0% { transform: scale(0.86); } 55% { transform: scale(1.12); } 100% { transform: scale(1); } }
.um-veil { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }

/* ---------- surfaces (ui-motion.js marks them): entrance = one-shot keyframes on individual translate/scale, so an
   element centred with transform: translate(-50%) keeps its own transform ---------- */
html:not(.um-off) .um-ov-in { animation: umOvIn 220ms ease-out backwards !important; }
html:not(.um-off) .um-card-in { animation: umCardIn 300ms var(--um-spring) backwards !important; }
html:not(.um-off) .um-sheet-in { animation: umSheetIn 320ms var(--um-spring) backwards !important; }
html:not(.um-off) .um-sec-in { animation: umSecIn 260ms var(--um-spring) backwards !important; }
html:not(.um-off) .um-pop-in { animation: umPopIn 180ms var(--um-spring) backwards !important; }
html:not(.um-off) .um-toast-in { animation: umToastIn 360ms var(--um-spring) backwards !important; }
@keyframes umOvIn { from { opacity: 0; -webkit-backdrop-filter: blur(0px); backdrop-filter: blur(0px); } }
@keyframes umCardIn { from { opacity: 0; translate: 0 18px; scale: 0.93; } }
@keyframes umSheetIn { from { opacity: 0.4; translate: 0 44px; } }
@keyframes umSecIn { from { opacity: 0; translate: 0 6px; } }
@keyframes umPopIn { from { opacity: 0; translate: 0 -6px; scale: 0.95; } }
@keyframes umToastIn { 0% { opacity: 0; translate: 0 -14px; scale: 0.96; } 70% { translate: 0 2px; } 100% { translate: 0 0; } }

/* exit: app.js sets style.display = 'none' / drops .open synchronously; allow-discrete keeps the box rendered for
   190 ms so the fade + shrink below can play (Chrome 117+ / Safari 17.5+, older engines just hide instantly) */
html:not(.um-off) [data-motion-overlay], html:not(.um-off) [data-motion-popover], html:not(.um-off) [data-motion-toast] {
  transition: opacity 190ms ease, display 190ms allow-discrete, visibility 190ms allow-discrete !important;
  transition-behavior: allow-discrete !important;
}
html:not(.um-off) [data-motion-dialog] { transition: opacity 190ms ease, translate 190ms ease, scale 190ms ease !important; }
html:not(.um-off) [data-motion-popover] { transition-property: opacity, translate, scale, display, visibility !important; transition-duration: 160ms !important; }
[data-motion-mode='style'][style*='display: none'], [data-motion-mode='style'][style*='display:none'],
[data-motion-mode='class']:not(.open):not(.show):not(.visible), [data-motion-toast][style*='display: none'] {
  opacity: 0 !important; pointer-events: none !important;
}
[data-motion-mode='style'][style*='display: none'] [data-motion-dialog], [data-motion-mode='style'][style*='display:none'] [data-motion-dialog],
[data-motion-mode='class']:not(.open):not(.show):not(.visible) [data-motion-dialog] { opacity: 0; translate: 0 10px; scale: 0.95; }
[data-motion-overlay='sheet'][data-motion-mode][style*='display: none'] [data-motion-dialog] { translate: 0 44px; scale: 1; }
[data-motion-popover][data-motion-mode='style'][style*='display: none'], [data-motion-popover][data-motion-mode='class']:not(.open):not(.show):not(.visible) { translate: 0 -4px; scale: 0.96; }
/* removed while open: ui-motion.js leaves a decorative clone that fades out */
.um-ghost { pointer-events: none !important; animation: umGhostOut 200ms ease forwards !important; }
.um-ghost [data-motion-dialog] { animation: umCardOut 200ms ease forwards !important; }
@keyframes umGhostOut { to { opacity: 0; } }
@keyframes umCardOut { to { opacity: 0; translate: 0 10px; scale: 0.95; } }

/* ---------- content transitions right after a click: filters, sub-tabs, dialog switch, games gear / back ---------- */
html:not(.um-off) .um-fresh { animation: umFresh 220ms var(--um-spring) backwards !important; }
html:not(.um-off) .um-fresh-fwd { animation: umFreshFwd 240ms var(--um-spring) backwards !important; }
html:not(.um-off) .um-fresh-back { animation: umFreshBack 240ms var(--um-spring) backwards !important; }
@keyframes umFresh { from { opacity: 0.35; translate: 0 8px; } }
@keyframes umFreshFwd { from { opacity: 0.35; translate: 16px 0; } }
@keyframes umFreshBack { from { opacity: 0.35; translate: -16px 0; } }
/* charts (reports-charts.js SVG) draw in once per click */
html:not(.um-off) .um-chart-in { animation: umChartIn 450ms var(--um-spring) backwards !important; }
html:not(.um-off) .um-donut-in { animation: umDonutIn 450ms var(--um-spring) backwards !important; }
@keyframes umChartIn { from { clip-path: inset(0 100% 0 0); opacity: 0.4; } }
@keyframes umDonutIn { from { opacity: 0; scale: 0.82; rotate: -40deg; } }

/* ---------- ELO progress bars: smooth width + soft running highlight ---------- */
.elo-bar i, .cyber-hud-progress-fill,
div[style*='border-radius:99px'][style*='overflow:hidden'] > div[style*='width:'][style*='height:100%'] {
  position: relative; overflow: hidden; transition: width 0.55s var(--um-spring);
}
html:not(.um-off) .elo-bar i::after, html:not(.um-off) .cyber-hud-progress-fill::after,
html:not(.um-off) div[style*='border-radius:99px'][style*='overflow:hidden'] > div[style*='width:'][style*='height:100%']::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.28) 50%, transparent 100%);
  translate: -100% 0; animation: umShimmer 2.8s ease-in-out infinite;
}
@keyframes umShimmer { 0% { translate: -100% 0; } 65%, 100% { translate: 100% 0; } }

/* ---------- PC: gliding sidebar pill (accent read on the element, so theme tokens on <body> apply) ---------- */
.sidebar .nav-list.um-has-pill { position: relative; }
.um-pill {
  position: absolute; top: 0; left: 10px; right: 10px; height: 36px; z-index: 0; pointer-events: none; opacity: 0;
  border-radius: 10px; background: color-mix(in srgb, var(--accent, #8b5cf6) 13%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.um-pill::before {
  content: ''; position: absolute; left: 0; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent, #8b5cf6); box-shadow: 0 0 10px var(--accent, #8b5cf6);
}
.um-pill.um-pill-ready { transition: transform 260ms var(--um-ease), height 260ms var(--um-ease), opacity 150ms ease; }
.sidebar .nav-list.um-has-pill > .nav-link { position: relative; z-index: 1; }
.sidebar .nav-list.um-has-pill > .nav-link.active { background: transparent !important; box-shadow: none !important; }

/* ---------- mobile: floating glass dock with a sliding pill ---------- */
.bottom-nav.um-has-pill { -webkit-backdrop-filter: blur(20px) saturate(160%) !important; backdrop-filter: blur(20px) saturate(160%) !important; }
.um-navpill {
  position: absolute; top: 0; left: 0; z-index: 0; pointer-events: none; opacity: 0; border-radius: 14px;
  background: color-mix(in srgb, var(--accent, #7c6cff) 16%, transparent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.um-navpill.um-pill-ready { transition: transform 280ms var(--um-ease), width 280ms var(--um-ease), opacity 150ms ease; }
.bottom-nav.um-has-pill .nav-btn { z-index: 1; min-height: 48px; }
.bottom-nav.um-has-pill .nav-btn.active { background: transparent !important; box-shadow: none !important; }
.nav-btn .ico-svg { stroke-width: 1.75; }
.nav-btn .ico { display: inline-flex; }

/* ---------- mobile: chat screen slides in from the right and back out ---------- */
#mobChatScreen { animation: umChatIn 280ms var(--um-ease) backwards !important; }
#mobChatScreen.um-chat-out { animation: umChatOut 190ms ease-in forwards !important; pointer-events: none; }
html.um-off #mobChatScreen { animation: none !important; }
@keyframes umChatIn { from { transform: translateX(100%); } }
@keyframes umChatOut { to { transform: translateX(100%); opacity: 0.6; } }
/* bottom sheets + modal cards: native-feeling sheet, blurred veil, springy card (re-run on display none → shown) */
.radz-sheet .sheet-backdrop { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.radz-sheet .sheet-panel { transition-timing-function: var(--um-ease) !important; transition-duration: 320ms !important; }
html.um-off .um-pill, html.um-off .um-navpill, html.um-off .radz-sheet .sheet-panel, html.um-off .radz-sheet .sheet-backdrop { transition: none !important; }

/* ---------- tactile: every button / chip lifts on hover and springs on press; cards and rows light their edge.
   Individual translate/scale compose with an element's own transform (centred floating buttons stay put). ---------- */
html:not(.um-off) button, html:not(.um-off) .btn, html:not(.um-off) .tab-btn, html:not(.um-off) .m-chip, html:not(.um-off) .m-btn,
html:not(.um-off) .argon-chip-btn, html:not(.um-off) .v122-flt-btn, html:not(.um-off) .hub-pill, html:not(.um-off) .dcx-chip, html:not(.um-off) .sheet-btn {
  transition: translate 160ms var(--um-spring), scale 90ms ease-out, transform 160ms var(--um-spring), background-color 200ms ease, border-color 200ms ease,
    box-shadow 200ms ease, color 200ms ease, opacity 180ms ease, filter 160ms ease !important;
}
@media (hover: hover) and (pointer: fine) {
  html:not(.um-off) :is(button, .btn, .tab-btn, .argon-chip-btn, .v122-flt-btn, .hub-pill, .dcx-chip):hover:not(:disabled):not(.nav-btn) { translate: 0 -1px; }
}
/* one press scale (design-2027's transform: scale(.96) would stack with it) */
html:not(.um-off) :is(button, .btn, .tab-btn, .m-chip, .m-btn, .argon-chip-btn, .v122-flt-btn, .hub-pill, .dcx-chip, .sheet-btn):active:not(:disabled) {
  translate: 0 0; scale: 0.965; transform: none !important;
}
html:not(.um-off) :is(.oc-card, [data-exact-order-card], .conv-item, .chat-row, .dcx-card, tbody > tr, .game-card) {
  outline: 1px solid transparent; outline-offset: -1px; transition: outline-color 180ms ease, background-color 180ms ease;
}
@media (hover: hover) and (pointer: fine) {
  html:not(.um-off) :is(.oc-card, [data-exact-order-card], .conv-item, .dcx-card, .game-card):hover { outline-color: rgba(139, 92, 246, 0.32); }
}

/* ---------- settings toggle «Плавные анимации» ---------- */
.um-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.um-toggle-label { font-weight: 700; font-size: 13.5px; }
.um-toggle-note { margin-top: 8px; font-size: 12px; color: var(--text-muted, #8b92a8); }
#umMotionCard .um-seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--ui-line); }
#umMotionCard .um-seg button {
  min-width: 64px; min-height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted, #8b92a8);
  font: inherit; font-weight: 700; font-size: 12.5px; cursor: pointer;
}
#umMotionCard .um-seg button.active { background: color-mix(in srgb, var(--accent, #8b5cf6) 22%, transparent); color: #fff; }
.radz-sheet .um-toggle-row { margin: 4px 2px 10px; }
.radz-sheet .um-toggle-row .seg { margin: 0; flex: 0 0 auto; min-width: 150px; }

/* =====================================================================================================================
   OBSIDIAN GLASS — PC default look (body.radz-obsidian: Synthwave / Terminal never get it). Tokens first, so the
   themes that override them keep working; Zen / PRO only hides blocks, so it is unaffected.
   ===================================================================================================================== */
body.radz-obsidian {
  --ob-bg: #090a10; --bg-main: #090a10; --text-main: #f8fafc; --ob-text: #f8fafc; --text-muted: #8b92a8; --ob-muted: #8b92a8;
  --ui-line: rgba(255, 255, 255, 0.075); --ui-text: #f8fafc; --ui-muted: #8b92a8;
  --og-card: linear-gradient(180deg, rgba(23, 24, 35, 0.92) 0%, rgba(17, 18, 27, 0.92) 100%);
  --og-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 32px -12px rgba(0, 0, 0, 0.55);
  background:
    radial-gradient(900px 520px at 100% -8%, rgba(124, 58, 237, 0.09), transparent 62%),
    radial-gradient(760px 460px at 0% -10%, rgba(56, 189, 248, 0.04), transparent 60%),
    #090a10 !important;
}
/* backdrop-filter on cards adds nothing over a flat background and makes every card a containing block for fixed modals */
body.radz-obsidian .card, body.radz-obsidian .stat-card, body.radz-obsidian .metric-card, body.radz-obsidian .metric-box {
  background: var(--og-card) !important; border: 1px solid var(--ui-line) !important; border-radius: 14px !important;
  box-shadow: var(--og-shadow) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
}
body.radz-obsidian .card:hover, body.radz-obsidian .metric-box:hover { border-color: rgba(255, 255, 255, 0.12) !important; }
body.radz-obsidian .page-title { color: #f8fafc !important; }
body.radz-obsidian .btn, body.radz-obsidian .tab-btn, body.radz-obsidian .v122-flt-btn { border-radius: 10px !important; }
body.radz-obsidian .nav-badge, body.radz-obsidian .hub-pill, body.radz-obsidian .dcx-chip, body.radz-obsidian .badge { border-radius: 999px !important; }
body.radz-obsidian .btn:hover:not(:disabled), body.radz-obsidian .hub-pill:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 16px -8px rgba(0, 0, 0, 0.6); }

/* inputs: calm field + soft violet focus ring */
body.radz-obsidian input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='color']),
body.radz-obsidian select, body.radz-obsidian textarea { border-radius: 10px; }
body.radz-obsidian input:not([type='checkbox']):not([type='radio']):not([type='range']):focus,
body.radz-obsidian select:focus, body.radz-obsidian textarea:focus {
  outline: none !important; border-color: rgba(139, 92, 246, 0.6) !important; box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2) !important;
}

/* tables: hairlines, soft row hover */
body.radz-obsidian table th { color: var(--ui-muted); font-weight: 600; border-color: var(--ui-line) !important; }
body.radz-obsidian table td { border-color: var(--ui-line) !important; }
body.radz-obsidian table tbody tr { transition: background-color 0.15s var(--ui-ease); }
body.radz-obsidian table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

/* KPI cursor glow: one radial highlight at (--mx, --my), set by ui-motion.js on pointermove */
body.radz-obsidian .metric-box, body.radz-obsidian .cbx-tile { position: relative; }
body.radz-obsidian .metric-box::after, body.radz-obsidian .cbx-tile::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 0%), rgba(139, 92, 246, 0.14), transparent 70%);
  transition: opacity 0.25s var(--ui-ease);
}
body.radz-obsidian .metric-box:hover::after, body.radz-obsidian .cbx-tile:hover::after { opacity: 1; }
html.um-off body.radz-obsidian .metric-box::after, html.um-off body.radz-obsidian .cbx-tile::after { display: none; }

/* messenger (PC) */
body.radz-obsidian .msg-row.mine .msg-bubble {
  background: linear-gradient(135deg, #7c3aed 0%, #5b4ff0 55%, #4f46e5 100%) !important; color: #fff !important; border: 0 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 8px 20px -10px rgba(124, 58, 237, 0.55) !important;
}
body.radz-obsidian .msg-row.theirs .msg-bubble {
  background: #16171f !important; color: #eef0f6 !important; border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}
body.radz-obsidian #convListContainer .conv-item { transition: background-color 0.18s var(--ui-ease), box-shadow 0.18s var(--ui-ease); }
body.radz-obsidian #convListContainer .conv-item.active {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.16), rgba(124, 58, 237, 0.04)) !important;
  box-shadow: inset 3px 0 0 var(--accent, #8b5cf6) !important;
}

/* =====================================================================================================================
   OBSIDIAN GLASS — mobile (mobile.html default "obsidian" theme; AMOLED / Neon keep their own look)
   ===================================================================================================================== */
html:not([data-theme='amoled']):not([data-theme='neon']) body .app-shell {
  background:
    radial-gradient(520px 340px at 100% -6%, rgba(124, 58, 237, 0.09), transparent 62%),
    radial-gradient(420px 300px at 0% -8%, rgba(56, 189, 248, 0.04), transparent 60%);
}
.tab-page .m-card { border: 1px solid rgba(255, 255, 255, 0.075) !important; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 32px -12px rgba(0, 0, 0, 0.55) !important; }
.m-bubble.theirs { background: #16171f !important; border: 1px solid rgba(255, 255, 255, 0.08) !important; color: #eef0f6 !important; }
.m-bubble.mine { background: linear-gradient(135deg, #7c3aed 0%, #5b4ff0 55%, #4f46e5 100%) !important; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 8px 20px -10px rgba(124, 58, 237, 0.55) !important; }
.tab-page .m-btn { min-height: 40px; }
.tab-page .filter-strip .m-chip { min-height: 36px; border-radius: 999px; }
.filter-strip {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); padding-right: 18px;
}
