/**
 * Plan B Logistics — UI Kit CSS
 * Собраны все общие стили из admin.php, manager.php, index.php
 */

/* === CSS Custom Properties === */
:root {
  /* Dark theme (default) */
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-dark: #0f172a;
  --color-card: #1e293b;
  --color-border: #334155;
  --color-border-light: #1e293b;
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-text-dim: #64748b;
  --color-muted: #94a3b8;
  
  --color-accent: #3b82f6;
  --color-accent-bg: #1e3a5f;
  --color-accent-light: #93c5fd;
  
  --color-green: #22c55e;
  --color-green-bg: #14532d;
  --color-green-light: #86efac;
  --color-success: #22c55e;
  
  --color-red: #ef4444;
  --color-red-bg: #450a0a;
  --color-red-light: #fca5a5;
  --color-error: #ef4444;
  
  --color-yellow: #ca8a04;
  --color-yellow-bg: #1c1400;
  --color-yellow-light: #fde68a;
  --color-warning: #f59e0b;
  
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active-bg: rgba(59,130,246,0.15);
  --sidebar-active-text: #93c5fd;
  --topbar-bg: #1e293b;
  --table-header-bg: #1e293b;
  --table-row-hover: rgba(255,255,255,0.03);
  --input-bg: #0f172a;
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  
  --sidebar-width: 220px;
  --topbar-height: 52px;
  
  --shadow-sidebar: 4px 0 24px rgba(0,0,0,0.4);
  --transition-fast: 0.15s;
  --transition-normal: 0.25s cubic-bezier(.4,0,.2,1);

  /* RF-17 phase 2: accent palette */
  --color-accent-blue: #60a5fa;       --color-accent-blue-soft: #93c5fd;
  --color-accent-green: #4ade80;      --color-accent-green-soft: #86efac;
  --color-accent-warn: #f59e0b;       --color-accent-warn-soft: #fbbf24;
  --color-accent-error: #ef4444;      --color-accent-error-soft: #fca5a5;
  --color-text-subtle: #94a3b8;       --color-text-faint: #64748b;
}

/* Light theme */
[data-theme="light"] {
  /* Тёплая кремово-бежевая тема */
  --color-bg: #f0ece6;
  --color-surface: #f7f3ee;
  --color-surface-dark: #e8e1d8;
  --color-card: #f7f3ee;
  --color-border: #d9cfc4;
  --color-border-light: #e8e1d8;
  --color-text: #2e2820;
  --color-text-muted: #7a6e63;
  --color-text-dim: #a89e93;
  --color-muted: #7a6e63;
  
  --color-accent: #4a7fd4;
  --color-accent-bg: #e8eef8;
  --color-accent-light: #2d5fa8;
  
  --color-green: #2e8a4e;
  --color-green-bg: #e6f4ec;
  --color-green-light: #1e6b3a;
  --color-success: #2e8a4e;
  
  --color-red: #c0392b;
  --color-red-bg: #faeae8;
  --color-red-light: #9b2c20;
  --color-error: #c0392b;
  
  --color-yellow: #b07d10;
  --color-yellow-bg: #fdf4dc;
  --color-yellow-light: #8c6308;
  --color-warning: #c68c12;
  
  --sidebar-bg: #e8e1d8;
  --sidebar-border: #d0c7bc;
  --sidebar-text: #5a4f46;
  --sidebar-active-bg: rgba(200,100,0,0.10);
  --sidebar-active-text: #c85a00;
  --topbar-bg: #e8e1d8;
  --table-header-bg: #e4ddd4;
  --table-row-hover: rgba(0,0,0,0.025);
  --input-bg: #f8fafc;
  
  --shadow-sidebar: 4px 0 24px rgba(0,0,0,0.15);
}

/* ================================================================
   BREAKPOINTS STANDARD
   ================================================================
   --bp-sm: 480px  — телефоны
   --bp-md: 768px  — планшеты portrait
   --bp-lg: 1024px — планшеты landscape / десктоп
   
   Использовать только эти значения в @media queries!
   ================================================================ */

/* ================================================================
   TOUCH DEVICE SUPPORT
   ================================================================ */

/* Touch устройства — увеличенные tap targets (44px минимум по Apple HIG) */
@media (pointer: coarse) {
  .btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  .sidebar-item,
  .nav-item,
  .sidebar-link,
  .nav a,
  .action-btn {
    min-height: 48px;
  }
  
  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px; /* 16px — чтобы iOS Safari не зумил */
  }
  
  /* Убираем голубую подсветку при tap на iOS */
  a,
  button,
  .btn,
  .action-btn,
  [role="button"],
  [onclick] {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Hover стили только на устройствах с мышью */
@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    filter: brightness(1.1);
  }
  
  table tr:hover td {
    background: var(--table-row-hover);
  }
  
  .sidebar-item:hover {
    background: var(--color-surface-dark);
    color: var(--color-text);
  }
  
  .nav a:hover {
    background: var(--color-accent-bg);
    border-color: var(--color-accent);
    color: var(--color-accent-light);
  }
  
  .action-btn:hover {
    background: var(--color-border);
    color: var(--color-text);
  }
}

/* === Reset & Base === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--color-bg);
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.5;
}

/* === Typography === */
h1, h2, h3, h4 {
  font-weight: 700;
  color: var(--color-text);
}

h1 { font-size: 16px; }
h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-text-dim); }
h3 { font-size: 13px; }

a { color: var(--color-accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Layout: Sidebar === */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transform: translateX(-100%);
  transition: transform var(--transition-normal);
  box-shadow: var(--shadow-sidebar);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar.pinned {
  transform: translateX(0);
  box-shadow: none;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-logo-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo img {
  height: 26px;
  width: auto;
}

.sidebar-logo-text {
  font-size: 9px;
  color: #475569;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.sidebar-logo-role {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.sidebar-item:hover {
  background: var(--color-surface-dark);
  color: var(--color-text);
  text-decoration: none;
}

.sidebar-item.active {
  background: var(--sidebar-active-bg);
  border-color: var(--color-accent);
  color: var(--sidebar-active-text);
}

.sidebar-item.logout:hover,
.sidebar-item.sidebar-logout:hover {
  background: var(--color-red-bg);
  color: var(--color-red-light);
  border-color: var(--color-red);
}

.sidebar-icon {
  font-size: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.sidebar-icon svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-label {
  white-space: nowrap;
}

.pin-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-dim);
  font-size: 14px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-btn:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.pin-btn.active {
  color: var(--color-accent);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}

.sidebar-overlay.visible {
  display: block;
}

/* Pinned mode */
body.sidebar-pinned .sidebar-overlay {
  display: none !important;
}

body.sidebar-pinned .topbar {
  left: var(--sidebar-width);
}

body.sidebar-pinned .main {
  margin-left: var(--sidebar-width);
}

/* === Layout: Topbar === */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 100;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--color-border);
  transition: left var(--transition-normal);
}

.topbar h1 {
  font-size: 14px;
  font-weight: 600;
}

.topbar img {
  height: 26px;
  width: auto;
}

.topbar .spacer {
  flex: 1;
}

.topbar-user {
  color: var(--color-text-dim);
  font-size: 12px;
}

.topbar-site-link {
  transition: opacity 0.15s;
}
.topbar-site-link:hover {
  opacity: 0.75;
}

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.hamburger:hover {
  background: var(--color-border);
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text-muted);
  border-radius: 2px;
  transition: all var(--transition-normal);
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* === Theme Toggle Button === */
.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

.theme-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-accent);
}

/* Show correct icon based on theme */
[data-theme="dark"] .icon-moon,
:root:not([data-theme]) .icon-moon {
  display: none;
}

[data-theme="light"] .icon-sun {
  display: none;
}

/* === Layout: Main === */
.main {
  padding: 24px;
  padding-top: calc(var(--topbar-height) + 24px);
  padding-right: 40px;
  max-width: 100%;
  transition: margin-left var(--transition-normal);
}

/* === Navigation === */
.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--color-text-muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.nav a:hover,
.nav a.active {
  background: var(--color-accent-bg);
  border-color: var(--color-accent);
  color: var(--color-accent-light);
}

/* === Cards === */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 {
  margin-bottom: 16px;
}

/* === Stats Grid === */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  background: var(--color-surface-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.stat .val {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
}

.stat .lbl {
  font-size: 11px;
  color: var(--color-text-dim);
  margin-top: 4px;
}

/* === Tables === */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 10px 12px;
  color: var(--color-text-dim);
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--color-border);
  background: var(--table-header-bg);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border-light);
}

tr:hover td {
  background: var(--table-row-hover);
}

/* Table column widths — removed fixed min-width for responsive layout */

/* === Badges === */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

.badge-pending {
  background: #1c1917;
  color: #78716c;
  border: 1px solid #44403c;
}

.badge-claimed {
  background: var(--color-yellow-bg);
  color: var(--color-yellow-light);
  border: 1px solid var(--color-yellow);
}

.badge-paid,
.badge-received {
  background: var(--color-accent-bg);
  color: var(--color-accent-light);
  border: 1px solid var(--color-accent);
}

.badge-sending {
  background: #2d2d1c;
  color: var(--color-yellow-light);
  border: 1px solid var(--color-yellow);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.badge-sent {
  background: #1c2d1e;
  color: var(--color-green-light);
  border: 1px solid var(--color-green);
}

.badge-completed {
  background: var(--color-green-bg);
  color: #4ade80;
  border: 1px solid var(--color-green);
}

.badge-cancelled {
  background: var(--color-red-bg);
  color: var(--color-red-light);
  border: 1px solid var(--color-red);
}

.badge-unknown {
  background: var(--color-surface-dark);
  color: var(--color-text-dim);
  border: 1px solid var(--color-border);
}

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  border: none;
  font-family: inherit;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-blue {
  background: var(--color-accent-bg);
  border: 1px solid var(--color-accent);
  color: var(--color-accent-light);
}

.btn-blue:hover {
  background: var(--color-accent);
  color: #fff;
}

.btn-green {
  background: var(--color-green-bg);
  border: 1px solid var(--color-green);
  color: var(--color-green-light);
}

.btn-green:hover {
  background: var(--color-green);
  color: #000;
}

.btn-red {
  background: var(--color-red-bg);
  border: 1px solid var(--color-red);
  color: var(--color-red-light);
}

.btn-red:hover {
  background: var(--color-red);
  color: #fff;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

/* Action buttons in tables */
.action-btn {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  min-width: 32px;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface-dark);
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background: var(--color-border);
  color: var(--color-text);
}

/* === Forms === */
form label {
  display: block;
  font-size: 11px;
  color: var(--color-text-dim);
  margin-bottom: 4px;
  margin-top: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

form input,
form select,
form textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--color-text);
  font-size: 13px;
  font-family: inherit;
}

form input:focus,
form select:focus,
form textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* Native color picker — общий form input { background, padding } прячет swatch.
   Override: фиксированный размер, прозрачный фон, нативная paint-area видна. */
form input[type="color"],
input[type="color"] {
  width: 56px;
  height: 40px;
  padding: 4px;
  background: transparent;
  cursor: pointer;
}

form input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border: none;
}

form input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

form input[type="color"]::-moz-color-swatch {
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

/* === Grid === */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* === Messages === */
.success {
  background: var(--color-green-bg);
  border: 1px solid var(--color-green);
  color: var(--color-green-light);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.error {
  background: var(--color-red-bg);
  border: 1px solid var(--color-red);
  color: var(--color-red-light);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

/* === Profile Info === */
.profile-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.info-item {
  background: var(--color-surface-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
}

.info-item .lbl {
  font-size: 10px;
  color: var(--color-text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.info-item .val {
  font-size: 13px;
  color: var(--color-text);
}

/* === Rate Block === */
.rate-block {
  background: var(--color-surface-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

/* === Modals === */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 400px;
  max-width: 90vw;
  border: 1px solid var(--color-border);
}

.modal-content h3 {
  margin: 0 0 20px;
  color: var(--color-text);
}

/* === Mobile Responsive === */
@media (max-width: 768px) {
  .topbar {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .topbar h1 { font-size: 14px; }
  .topbar .spacer { display: none; }
  
  .nav {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    gap: 4px;
    scrollbar-width: none;
  }
  
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 5px 10px; font-size: 11px; }
  
  .main { padding: 12px; padding-top: calc(var(--topbar-height) + 12px); }
  .card { padding: 14px; border-radius: var(--radius-lg); }
  .card h2 { font-size: 12px; }
  
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 12px; }
  .stat .val { font-size: 18px; }
  
  table { font-size: 12px; }
  th, td { padding: 7px 8px; }
  
  .grid2, .grid3 { grid-template-columns: 1fr; }
  
  .btn { padding: 7px 12px; font-size: 12px; }
  .btn-sm { padding: 4px 8px; font-size: 10px; }
  
  form input, form select, form textarea {
    font-size: 16px; /* 16px — iOS Safari не зумит */
    padding: 10px 12px;
  }
  
  .profile-info { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .topbar { padding: 8px 12px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .main { padding: 8px; }
  .card { padding: 12px; margin-bottom: 12px; }
}

/* === Sandbox mode === */
.sandbox-banner {
    background: #f59e0b;
    color: #000;
    text-align: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0;
}
.btn-sandbox {
    background: #f59e0b;
    color: #000;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
}
.sandbox-bar {
    background: rgba(245,158,11,0.08);
    border: 1px dashed #f59e0b;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #f59e0b;
}

/* Orders counter */
.orders-counter {
  color: var(--color-muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.orders-counter strong {
  color: var(--color-text);
}
/* =====================================================
   MOBILE RESPONSIVE ADDITIONS
   Добавляется в конец ui/assets/css/app.css
   ===================================================== */

/* === Responsive Tables === */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    margin: 0 -4px;
    padding: 0 4px;
}

.table-responsive table {
    min-width: 768px; /* unified breakpoint: was 600px */
}

/* === Card View for Orders Table on Mobile === */
@media (max-width: 768px) {
    /* Скрываем заголовки таблицы заявок */
    .orders-table thead {
        display: none;
    }
    
    /* Каждая строка — карточка */
    .orders-table tbody tr.orders-row {
        display: block;
        background: var(--color-card);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        margin-bottom: 12px;
        padding: 16px;
    }
    
    .orders-table tbody tr.orders-row.sandbox-row {
        border-left: 3px solid #f59e0b;
    }
    
    .orders-table tbody tr.orders-row[style*="background:#2d1a00"] {
        border-left: 3px solid #f59e0b;
    }
    
    /* Каждая ячейка — строка с лейблом */
    .orders-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--color-border-light);
        font-size: 13px;
    }
    
    .orders-table tbody td:last-child {
        border-bottom: none;
        padding-top: 12px;
        flex-direction: column;
        align-items: stretch;
    }
    
    /* Лейбл из data-label атрибута */
    .orders-table tbody td::before {
        content: attr(data-label);
        color: var(--color-muted);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        flex-shrink: 0;
        margin-right: 12px;
        font-weight: 500;
    }
    
    .orders-table tbody td:last-child::before {
        display: none;
    }
    
    /* Детальная строка тоже как карточка */
    .orders-table tbody tr[id^="detail_"] {
        display: none;
        background: var(--color-surface-dark);
        border-radius: var(--radius-lg);
        margin-top: -8px;
        margin-bottom: 12px;
        border: 1px solid var(--color-border);
    }
    
    .orders-table tbody tr[id^="detail_"][style*="table-row"] {
        display: block !important;
    }
    
    .orders-table tbody tr[id^="detail_"] td {
        display: block;
        border: none;
    }
    
    .orders-table tbody tr[id^="detail_"] td::before {
        display: none;
    }
}

/* === Mobile Topbar === */
/* Применяется: телефоны ≤768px + touch-устройства ≤1023px (iPad landscape) */
@media (max-width: 768px), (pointer: coarse) and (max-width: 1023px) {
    .topbar,
    #admin-topbar {
        padding: 0 12px !important;
        height: 52px !important;
        gap: 8px !important;
    }
    
    /* Скрываем имя пользователя */
    .topbar-username,
    .topbar span[style*="font-size:12px"],
    #admin-topbar > span[style*="font-size:12px"] {
        display: none !important;
    }
    
    /* Скрываем текст "Административная панель" */
    .topbar-title-text,
    #admin-topbar > div[style*="flex:1"] + span,
    #admin-topbar div[style*="font-size:14px"] span {
        display: none;
    }
    
    /* Оставляем только лого */
    #admin-topbar > div[style*="display:flex"] span[style*="font-size:14px"] {
        display: none;
    }
    
    /* Компактный логотип */
    .topbar img,
    #admin-topbar img {
        height: 24px !important;
    }
    
    /* Контент сдвигается */
    .main {
        margin-left: 0 !important;
        padding: 12px !important;
        padding-top: calc(var(--topbar-height) + 12px) !important;
    }
    
    body.sidebar-pinned .main {
        margin-left: 0 !important;
    }
    
    body.sidebar-pinned #admin-topbar,
    body.sidebar-pinned .topbar {
        left: 0 !important;
    }
}

/* === Sidebar Overlay on Mobile === */
/* Применяется: телефоны ≤768px + touch-устройства ≤1023px (iPad landscape) */
@media (max-width: 768px), (pointer: coarse) and (max-width: 1023px) {
    .sidebar,
    .admin-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -280px !important;
        height: 100vh !important;
        width: 260px !important;
        z-index: 200 !important;
        transition: left 0.3s ease !important;
        transform: none !important;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3) !important;
    }
    
    .sidebar.open,
    .admin-sidebar.open {
        left: 0 !important;
        transform: none !important;
    }
    
    .sidebar.pinned,
    .admin-sidebar.pinned {
        left: -280px !important;
        transform: none !important;
    }
    
    .sidebar.pinned.open,
    .admin-sidebar.pinned.open {
        left: 0 !important;
    }
    
    /* Затемнение фона */
    .sidebar-overlay,
    #admin-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 199;
    }
    
    .sidebar-overlay.visible,
    .sidebar-overlay.active,
    #admin-overlay.visible {
        display: block;
    }
    
    /* На мобильном pinned не работает */
    body.sidebar-pinned .sidebar-overlay,
    body.sidebar-pinned #admin-overlay {
        display: block;
    }
}

/* === body.is-mobile CSS hook (устанавливается sidebar.js при isMobile=true) ===
   Дублирует поведение для случаев, когда media query не срабатывает корректно
   (например, при подключении/отключении мыши без ресайза) */
body.is-mobile .main {
    margin-left: 0 !important;
}
body.is-mobile .sidebar,
body.is-mobile .admin-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: -280px !important;
    height: 100vh !important;
    width: 260px !important;
    z-index: 200 !important;
    transition: left 0.3s ease !important;
    transform: none !important;
}
body.is-mobile .sidebar.open,
body.is-mobile .admin-sidebar.open {
    left: 0 !important;
}
body.is-mobile .sidebar.pinned,
body.is-mobile .admin-sidebar.pinned {
    left: -280px !important;
}
body.is-mobile .sidebar.pinned.open,
body.is-mobile .admin-sidebar.pinned.open {
    left: 0 !important;
}
body.is-mobile .sidebar-overlay,
body.is-mobile #admin-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
}
body.is-mobile .sidebar-overlay.visible,
body.is-mobile .sidebar-overlay.active,
body.is-mobile #admin-overlay.visible {
    display: block;
}
body.is-mobile.sidebar-pinned .sidebar-overlay,
body.is-mobile.sidebar-pinned #admin-overlay {
    display: block;
}
body.is-mobile.sidebar-pinned .topbar {
    left: 0 !important;
}

/* === Adaptive Stats Grid === */
@media (max-width: 768px) {
    .stats,
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    
    .stat,
    .stats-card {
        padding: 14px !important;
    }
    
    .stat .val,
    .stats-value {
        font-size: 20px !important;
    }
    
    .stat .lbl {
        font-size: 10px !important;
    }
}

@media (max-width: 480px) {
    .stats,
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}

/* === Action Buttons on Mobile === */
@media (max-width: 768px) {
    /* Скрываем текст, оставляем только иконки */
    .action-btn .btn-text {
        display: none;
    }
    
    .action-btn {
        padding: 8px !important;
        min-width: 36px !important;
        justify-content: center;
    }
    
    /* Кнопка выхода — компактная */
    .topbar .btn-red,
    #admin-topbar .btn-red {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }
    
    /* Кнопки фильтров заявок */
    .card > div[style*="display:flex"] {
        flex-wrap: wrap !important;
    }
    
    .card > div[style*="display:flex"] .btn-sm {
        padding: 4px 8px !important;
        font-size: 10px !important;
    }
}

/* === Mobile Forms === */
@media (max-width: 768px) {
    .grid2,
    .grid3 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    form input,
    form select,
    form textarea {
        font-size: 16px !important; /* предотвращает зум на iOS */
        padding: 12px !important;
    }
    
    .btn {
        padding: 10px 16px !important;
        font-size: 13px !important;
    }
    
    .btn-sm {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }
}

/* === Cards on Mobile === */
@media (max-width: 768px) {
    .card {
        padding: 14px !important;
        border-radius: var(--radius-lg) !important;
        margin-bottom: 12px !important;
    }
    
    .card h2 {
        font-size: 12px !important;
        margin-bottom: 12px !important;
    }
}

/* === Profile Info on Mobile === */
@media (max-width: 768px) {
    .profile-info {
        grid-template-columns: 1fr !important;
    }
    
    .info-item {
        padding: 10px !important;
    }
}

/* === Filters row on mobile === */
@media (max-width: 768px) {
    .card > div[style*="display:flex"][style*="justify-content:space-between"] {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: stretch !important;
    }
    
    .card > div[style*="display:flex"][style*="justify-content:space-between"] > div[style*="display:flex"] {
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
    }
}

/* === Orders table actions on mobile === */
@media (max-width: 768px) {
    .orders-table td[onclick="event.stopPropagation()"] > div {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .orders-table td[onclick="event.stopPropagation()"] form {
        width: 100%;
    }
    
    .orders-table td[onclick="event.stopPropagation()"] select {
        flex: 1;
        min-width: 0;
    }
    
    .tx-field {
        margin-top: 8px !important;
    }
    
    .tx-field input[name="tx_hash"] {
        width: 100% !important;
        margin-bottom: 8px;
    }
}

/* === Detail row grid on mobile === */
@media (max-width: 768px) {
    .orders-table tr[id^="detail_"] td > div[style*="grid"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
}

/* === Badge sizes on mobile === */
@media (max-width: 768px) {
    .badge {
        font-size: 9px !important;
        padding: 2px 6px !important;
    }
}

/* === Nav scrollable on mobile === */
@media (max-width: 768px) {
    .nav {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    
    .nav::-webkit-scrollbar {
        display: none;
    }
    
    .nav a {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* === Modal on mobile === */
@media (max-width: 768px) {
    .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        padding: 20px !important;
        margin: 10px;
    }
}

/* === Fix for table colgroup on mobile === */
@media (max-width: 768px) {
    .orders-table colgroup {
        display: none;
    }
}

/* === MOBILE FIX: Override min-width on mobile === */
@media (max-width: 768px) {
    /* Remove min-width constraints on mobile */
    .orders-table th,
    .orders-table td {
        min-width: 0 !important;
        width: auto !important;
    }
    
    /* Force table to not be a table on mobile */
    .orders-table,
    .orders-table tbody {
        display: block !important;
        width: 100% !important;
    }
    
    /* Make sure table-responsive doesn't interfere */
    .table-responsive {
        overflow-x: visible !important;
    }
    
    /* Stats grid fix - ensure 2 columns */
    .stats {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
}

@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr !important;
    }
}

/* === FINAL FIX: Force 2 columns on stats for tablets === */
@media (max-width: 768px) {
    .stats {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    
    .stat {
        min-width: 0 !important;
        padding: 12px !important;
    }
}

/* Очень маленькие экраны — 1 колонка */
@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr !important;
    }
}

/* === Logo visibility in light theme === */
[data-theme="light"] .topbar img,
[data-theme="light"] .sidebar-logo img {
    filter: brightness(0) saturate(100%); /* Делает белый SVG чёрным */
}

/* Light theme sidebar */
[data-theme="light"] .sidebar-nav {
  border-right: 1px solid var(--color-border);
  box-shadow: none;
}

[data-theme="light"] .sidebar-item {
  color: var(--sidebar-text);
}

[data-theme="light"] .sidebar-item:hover {
  background: rgba(0,0,0,0.04);
  color: #1e293b;
}

[data-theme="light"] .sidebar-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

[data-theme="light"] .sidebar-logo {
  border-bottom: 1px solid var(--color-border);
}

[data-theme="light"] .topbar {
  border-bottom: 1px solid var(--color-border);
  box-shadow: none;
}

/* Логотип — в светлой теме инвертируем белый в тёмный */
[data-theme="light"] .topbar img,
[data-theme="light"] .sidebar-logo img {
  filter: brightness(0) saturate(100%);
}

/* === Wallet === */
.wallet-grid {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1024px) {
    .wallet-grid {
        grid-template-columns: 1fr;
    }
}

.wallet-card {
    background: var(--color-card);
    border-radius: 16px;
    padding: 28px;
    border: 1px solid var(--color-border);
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.wallet-card-center {
    text-align: center;
}

.wallet-label {
    font-size: 13px;
    color: var(--color-muted);
    margin-bottom: 8px;
}

.wallet-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--color-text);
    margin-bottom: 16px;
}

.wallet-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.wallet-address {
    font-family: monospace;
    font-size: 13px;
    word-break: break-all;
    color: var(--color-text);
    background: var(--color-surface-dark);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--color-border);
}

.wallet-btn {
    padding: 8px 18px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text);
    transition: all 0.2s;
}

.wallet-btn:hover {
    border-color: var(--color-accent);
}

.wallet-btn-sm {
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-dark);
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text);
    transition: all 0.2s;
}

.wallet-btn-sm:hover {
    border-color: var(--color-accent);
}

.wallet-btn-refresh {
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-dark);
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text);
}

.wallet-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-sizing: border-box;
    font-size: 13px;
    background: var(--color-surface-dark);
    color: var(--color-text);
}

.wallet-input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.wallet-input-mono {
    font-family: monospace;
}

.wallet-input-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--color-muted);
}

.wallet-input-group {
    margin-bottom: 14px;
}

.wallet-input-group:last-child {
    margin-bottom: 0;
}

.wallet-select {
    background: var(--color-surface-dark);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
}

.wallet-search {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-dark);
    color: var(--color-text);
    font-size: 13px;
    box-sizing: border-box;
    margin-bottom: 14px;
}

.wallet-search:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* Balance cards — семантические цвета остаются тёмными */
.wallet-balances {
    display: flex;
    gap: 16px;
}

.balance-usdt {
    flex: 1;
    background: #052e16;
    border: 1px solid #166534;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.balance-usdt .balance-label {
    font-size: 12px;
    color: #16a34a;
    font-weight: 600;
    margin-bottom: 8px;
}

.balance-trx {
    flex: 1;
    background: #172554;
    border: 1px solid #1d4ed8;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.balance-trx .balance-label {
    font-size: 12px;
    color: #60a5fa;
    font-weight: 600;
    margin-bottom: 8px;
}

.balance-netts {
    flex: 1;
    background: #1a1a2e;
    border: 1px solid #7c3aed;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.balance-netts .balance-label {
    font-size: 12px;
    color: #a78bfa;
    font-weight: 600;
    margin-bottom: 8px;
}

.balance-value {
    font-size: 28px;
    font-weight: 700;
    color: #f1f5f9;
}

/* QR buttons — семантические цвета */
.wallet-qr-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.wallet-qr-btn-usdt {
    flex: 1;
    padding: 12px;
    border: 2px solid #16a34a;
    border-radius: 10px;
    background: #052e16;
    cursor: pointer;
    font-weight: 600;
    color: #16a34a;
}

.wallet-qr-btn-trx {
    flex: 1;
    padding: 12px;
    border: 2px solid #2563eb;
    border-radius: 10px;
    background: #172554;
    cursor: pointer;
    font-weight: 600;
    color: #60a5fa;
}

.wallet-qr-container {
    display: none;
    text-align: center;
}

.wallet-qr-code {
    display: inline-block;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    margin-bottom: 12px;
}

.wallet-qr-label {
    font-size: 12px;
    color: var(--color-muted);
}

/* Send USDT form */
.wallet-send-btn {
    width: 100%;
    padding: 12px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.wallet-send-btn:hover {
    background: #15803d;
}

.wallet-send-btn:disabled {
    background: #64748b;
    cursor: not-allowed;
}

.wallet-error {
    display: none;
    color: #f87171;
    font-size: 13px;
    margin-bottom: 14px;
    padding: 10px;
    background: #450a0a;
    border-radius: 8px;
    border: 1px solid #7f1d1d;
}

.wallet-success {
    display: none;
    color: #4ade80;
    font-size: 13px;
    margin-bottom: 14px;
    padding: 10px;
    background: #052e16;
    border-radius: 8px;
    border: 1px solid #166534;
}

/* Transaction history */
.wallet-history-empty {
    text-align: center;
    color: var(--color-muted);
    padding: 20px;
}

.wallet-history-loading {
    text-align: center;
    color: var(--color-muted);
    padding: 20px;
}

.wallet-tx-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.wallet-tx-row:last-child {
    border-bottom: none;
}

.wallet-tx-info {
    flex: 1;
    min-width: 0;
}

.wallet-tx-address {
    font-size: 13px;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wallet-tx-date {
    font-size: 11px;
    color: var(--color-muted);
    margin-top: 2px;
}

.wallet-tx-order {
    margin-top: 4px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.wallet-tx-payment-code {
    background: var(--color-surface);
    border: 1px solid #f59e0b;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 10px;
    color: #f59e0b;
    font-family: monospace;
    text-decoration: none;
}

.wallet-tx-payment-code:hover {
    text-decoration: none;
    border-color: #fbbf24;
}

.wallet-tx-order-num {
    font-size: 10px;
    color: var(--color-muted);
    text-decoration: none;
}

.wallet-tx-client {
    font-size: 10px;
    color: var(--color-muted);
    text-decoration: none;
}

.wallet-tx-amount {
    font-weight: 700;
    font-size: 15px;
    margin-left: 16px;
    white-space: nowrap;
}

.wallet-tx-amount a {
    text-decoration: none;
}

.wallet-tx-amount.incoming {
    color: #4ade80;
}

.wallet-tx-amount.incoming a {
    color: #4ade80;
}

.wallet-tx-amount.outgoing {
    color: #f87171;
}

.wallet-tx-amount.outgoing a {
    color: #f87171;
}

/* Pagination */
.wallet-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.wallet-pagination-btn {
    padding: 6px 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-dark);
    color: var(--color-muted);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.wallet-pagination-btn:hover:not(:disabled) {
    border-color: var(--color-accent);
    color: var(--color-text);
}

.wallet-pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.wallet-pagination-info {
    font-size: 12px;
    color: var(--color-muted);
}

/* === Mobile Wallet === */
@media (max-width: 768px) {
    .wallet-grid {
        grid-template-columns: 1fr;
    }
    
    .wallet-balances {
        flex-direction: column;
        gap: 12px;
    }
    
    .wallet-qr-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .balance-value {
        font-size: 24px;
    }
    
    .wallet-card {
        padding: 20px;
    }
}

/* === Admin Tables & Forms (dynamic theming) === */
.admin-select {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
}

.btn-danger-sm {
    background: var(--color-error);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}

/* Warning row highlight — payment_claimed */
[data-theme="dark"] .row-warning {
    background: rgba(45, 26, 0, 0.8) !important;
}

/* Inactive/muted indicator dot */
/* Toggle switch track (off state) */
/* Hamburger hover bg */
/* Hamburger span bars */
/* Pin button hover */
/* Sort button active/hover */
/* Upload zone dashed border */
/* Step connector and inactive step */
/* === LIGHT THEME FIX: Status Badges (adaptive) === */
.badge-pending {
  background: rgba(245,158,11,0.15) !important;
  color: #d97706 !important;
  border: 1px solid rgba(245,158,11,0.3) !important;
}

.badge-claimed {
  background: rgba(59,130,246,0.15) !important;
  color: #2563eb !important;
  border: 1px solid rgba(59,130,246,0.3) !important;
}

.badge-received,
.badge-paid {
  background: rgba(34,197,94,0.15) !important;
  color: #16a34a !important;
  border: 1px solid rgba(34,197,94,0.3) !important;
}

.badge-completed {
  background: rgba(34,197,94,0.15) !important;
  color: #16a34a !important;
  border: 1px solid rgba(34,197,94,0.3) !important;
}

.badge-cancelled {
  background: rgba(239,68,68,0.15) !important;
  color: #dc2626 !important;
  border: 1px solid rgba(239,68,68,0.3) !important;
}

.badge-sending {
  background: #2d2d1c;
  color: var(--color-yellow-light);
  border: 1px solid var(--color-yellow);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.badge-sent {
  background: rgba(34,197,94,0.15) !important;
  color: #16a34a !important;
  border: 1px solid rgba(34,197,94,0.3) !important;
}

/* Dark theme — более насыщенные */
[data-theme="dark"] .badge-pending {
  background: rgba(120,53,15,0.5) !important;
  color: #fde68a !important;
}

[data-theme="dark"] .badge-claimed {
  background: rgba(30,58,138,0.5) !important;
  color: #93c5fd !important;
}

[data-theme="dark"] .badge-completed,
[data-theme="dark"] .badge-received,
[data-theme="dark"] .badge-paid,
[data-theme="dark"] .badge-sent {
  background: rgba(5,46,22,0.7) !important;
  color: #86efac !important;
}

[data-theme="dark"] .badge-cancelled {
  background: rgba(69,10,10,0.7) !important;
  color: #fca5a5 !important;
}

/* === Кнопки Блок/Разблок (adaptive) === */
.btn-block {
  background: var(--color-surface);
  border: 1px solid var(--color-error);
  color: var(--color-error);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.btn-unblock {
  background: var(--color-surface);
  border: 1px solid var(--color-success);
  color: var(--color-success);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.btn-block:hover {
  background: var(--color-error);
  color: #fff;
}

.btn-unblock:hover {
  background: var(--color-success);
  color: #fff;
}

/* === Badge Авто/Ручной === */
/* === Badge Активен/Неактивен === */
.badge-active {
  background: rgba(34,197,94,0.15);
  color: #16a34a;
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
}

.badge-inactive {
  background: var(--color-surface);
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
}

/* === Alert Warning (payment_claimed) === */
.alert-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

[data-theme="dark"] .alert-warning {
  background: #78350f;
  border-color: #ca8a04;
}

.alert-warning-count {
  background: #ca8a04;
  color: #000;
  font-size: 20px;
  font-weight: 800;
  border-radius: 8px;
  padding: 6px 14px;
}

.alert-warning-title {
  font-size: 14px;
  font-weight: 700;
  color: #d97706;
}

.alert-warning-desc {
  font-size: 12px;
  color: #92400e;
  margin-top: 2px;
}

[data-theme="dark"] .alert-warning-title {
  color: #fde68a;
}

[data-theme="dark"] .alert-warning-desc {
  color: #d97706;
}

.alert-warning-btn {
  background: #ca8a04;
  color: #000;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
}

/* === Alert Info (Sandbox) === */
.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 10px;
  padding: 14px 18px;
  color: var(--color-text);
}

[data-theme="dark"] .alert-info {
  background: rgba(30, 58, 138, 0.3);
  border-color: #3b82f6;
}

/* === TX Fee Badge (wallet) === */
[data-theme="dark"] .tx-fee-badge {
  background: rgba(120, 53, 15, 0.5);
  color: #fde68a;
}

/* === Sandbox Warning (adaptive) === */
.alert-warning-sandbox {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

[data-theme="dark"] .alert-warning-sandbox {
  background: #1a1a0a;
  border-color: #854d0e;
}

.alert-warning-sandbox-title {
  font-size: 14px;
  color: #d97706;
  font-weight: 600;
  margin-bottom: 4px;
}

.alert-warning-sandbox-desc {
  font-size: 13px;
  color: #92400e;
}

[data-theme="dark"] .alert-warning-sandbox-title {
  color: #fcd34d;
}

[data-theme="dark"] .alert-warning-sandbox-desc {
  color: #a3a38a;
}

/* ================================================================
   UNIVERSAL FORM COMPONENTS
   ================================================================ */

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--color-red);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 16px; /* 16px — iOS не зумит */
  font-family: inherit;
  background: var(--input-bg, var(--color-bg));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 8px);
  color: var(--color-text);
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-dim);
}

.form-hint {
  font-size: 12px;
  color: var(--color-text-dim);
  margin-top: 5px;
}

/* ================================================================
   PAGE HEADER
   ================================================================ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

/* ================================================================
   ALERT BANNERS
   ================================================================ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md, 8px);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.alert-error {
  background: var(--color-red-bg, #450a0a);
  border: 1px solid var(--color-red, #ef4444);
  color: var(--color-red-light, #fca5a5);
}

.alert-success {
  background: var(--color-green-bg, #14532d);
  border: 1px solid var(--color-green, #22c55e);
  color: var(--color-green-light, #86efac);
}

/* ================================================================
   FORM ACTIONS ROW
   ================================================================ */

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 24px;
}

/* ================================================================
   AMOUNT ROW (двусторонний калькулятор)
   ================================================================ */

.amount-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.amount-col { flex: 1; }

.amount-currency {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.amount-arrow {
  display: flex;
  align-items: center;
  padding-top: 26px;
  color: var(--color-text-dim);
  font-size: 18px;
  flex-shrink: 0;
}

/* ================================================================
   CALC CARD (расчёт суммы)
   ================================================================ */

.calc-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 8px);
  padding: 16px;
  margin-top: 16px;
}

.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 14px;
}

.calc-row + .calc-row {
  border-top: 1px solid var(--color-border);
}

.calc-label { color: var(--color-text-muted); }

.calc-value {
  font-weight: 600;
  color: var(--color-text);
}

.calc-value.highlight {
  color: var(--color-accent);
  font-size: 17px;
}

/* ================================================================
   MOBILE RESPONSIVE — @media (max-width: 768px)
   ================================================================ */

@media (max-width: 768px) {

  /* Page header */
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-title { font-size: 18px; }

  /* Card */
  .card { padding: 16px; }

  /* Buttons — full width on mobile */
  .form-actions { flex-direction: column; }
  .form-actions .btn,
  .form-actions a.btn,
  .form-actions button { width: 100%; justify-content: center; text-align: center; }

  /* Amount row — stack vertically */
  .amount-row { flex-direction: column; gap: 8px; }
  .amount-col { width: 100%; }
  .amount-arrow { padding-top: 0; align-self: center; transform: rotate(90deg); }

  /* Form inputs larger touch target */
  .form-input, .form-select, .form-textarea { padding: 13px 14px; }

  /* Tables → cards */
  .table-mobile thead { display: none; }
  .table-mobile tbody tr {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 12px;
  }
  .table-mobile td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border: none !important;
    font-size: 13px;
    gap: 8px;
  }
  .table-mobile td::before {
    content: attr(data-label);
    font-size: 11px;
    color: var(--color-text-muted);
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Calc card */
  .calc-row { font-size: 13px; }
  .calc-value.highlight { font-size: 15px; }

  /* Stats grid */
  .stats { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 480px) {
  .page-title { font-size: 16px; }
  .form-input, .form-select { font-size: 15px; }
}

/* ================================================================
   ADDITIONAL COMPONENTS FOR REFACTORING (2024-03)
   ================================================================ */

/* === Back Link === */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-text-dim);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 16px;
}

.back-link:hover {
  color: var(--color-text-muted);
  text-decoration: none;
}

/* === Info Block (labeled data) === */
.info-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.info-label {
  font-size: 11px;
  color: var(--color-text-dim);
  margin-bottom: 2px;
}

.info-value {
  font-size: 14px;
  color: var(--color-text);
}

.info-value-lg {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
}

.info-value-mono {
  font-family: monospace;
  font-size: 13px;
  word-break: break-all;
  background: var(--color-surface-dark);
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--color-text);
}

/* === Section Title (card h2) === */
.section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 16px;
}

/* === Grid Layouts === */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

@media (max-width: 768px) {
  .grid-2col, .grid-auto {
    grid-template-columns: 1fr;
  }
}

/* === Text Colors === */
.text-green { color: var(--color-green); }
.text-red { color: var(--color-red); }
.text-muted { color: var(--color-text-dim); }
.text-accent { color: var(--color-accent); }

/* === Font Utilities === */
.font-mono { font-family: monospace; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

/* === Spacing === */
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }

.pt-16 { padding-top: 16px; }
/* === Border utilities === */
.border-top { border-top: 1px solid var(--color-border); }

/* === Modal === */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: var(--color-surface);
  border-radius: 12px;
  padding: 32px;
  width: 400px;
  max-width: 90vw;
  border: 1px solid var(--color-border);
}

.modal-title {
  margin: 0 0 20px;
  color: var(--color-text);
  font-size: 16px;
  font-weight: 700;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.modal-actions .btn { flex: 1; }
.modal-actions .btn-submit { flex: 2; }

/* === Filter Form === */
@media (max-width: 768px) {
}

/* === Orders List (mobile view) === */
.orders-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 8px;
  background: var(--color-surface-dark);
  margin-bottom: 8px;
  text-decoration: none;
  transition: background 0.15s;
}

.orders-list a:hover {
  background: var(--color-border);
  text-decoration: none;
}

/* === Empty State === */
.empty-state {
  color: var(--color-text-dim);
  font-size: 14px;
  padding: 20px 0;
  text-align: center;
}

/* === Pagination === */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 20px 0 0;
}

.pagination .btn {
  min-width: 36px;
  text-align: center;
}

/* === Btn outline === */
.btn-outline {
  background: var(--color-surface-dark);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.btn-outline:hover {
  background: var(--color-border);
  color: var(--color-text);
}

/* === Full width button === */
.btn-full { width: 100%; }

/* === Flex utilities === */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

/* === Text align === */
.text-center { text-align: center; }
.text-right { text-align: right; }

/* === Width === */
.w-full { width: 100%; }

/* === Table header standard === */
.table-header {
  text-align: left;
  padding: 10px 12px;
  color: var(--color-text-dim);
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--color-border);
  background: var(--table-header-bg);
}

/* === Detail row (expandable) === */
.detail-row {
  display: none;
  background: var(--color-surface-dark);
}

.detail-row.open {
  display: table-row;
}

/* === Btn with icon === */
.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* === Hide text on mobile (for icon buttons) === */
@media (max-width: 768px) {
  .hide-mobile { display: none; }
}

/* === Action row (status change + delete) === */
/* === Rate recalc section === */
/* === Client detail page === */
.client-header {
  display: flex;
  align-items: center;
  gap: 16px;
}
.client-header h2 {
  margin-bottom: 0;
}
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}
.info-label {
  color: var(--color-text-dim);
  width: 150px;
}
.text-dim {
  color: var(--color-text-dim);
}

/* === Clickable table rows === */
.row-clickable {
  cursor: pointer;
  transition: background 0.15s;
}
.row-clickable:hover td {
  background: var(--bg-hover);
}

/* === KYC status colors === */
/* === Clients table === */
.clients-table {
  width: 100%;
}
@media (max-width: 768px) {
  .client-grid {
    grid-template-columns: 1fr;
  }
  .info-label {
    width: 120px;
  }
}

/* === Requisites Block (widget step4_pay) === */
.requisites-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
}

.requisites-row:last-child {
  border-bottom: none;
}

.requisites-row .label {
  color: var(--color-muted);
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.requisites-row .value {
  font-size: 13px;
  text-align: right;
  word-break: break-all;
  color: var(--color-text);
}

/* === Upload Area fixes === */
.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 120px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg, 10px);
  padding: 20px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  background: var(--color-surface-dark);
  box-sizing: border-box;
}

.upload-area:hover {
  border-color: var(--color-accent);
  background: rgba(59, 130, 246, 0.05);
}

.upload-area.has-file {
  border-color: var(--color-green);
  background: rgba(34, 197, 94, 0.05);
}

.upload-area .icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.upload-area .text {
  font-size: 13px;
  color: var(--color-muted);
  line-height: 1.5;
}

.upload-area .filename {
  margin-top: 8px;
  font-size: 12px;
  color: var(--color-green);
  font-weight: 500;
}

/* === Sandbox button spacing === */
.btn-sandbox {
  background: #f59e0b;
  color: #000;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  width: 100%;
  margin-bottom: 12px;
}

.btn-sandbox:hover {
  background: #d97706;
}

/* === Btn Success (widget) === */
.btn-success {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: var(--color-green);
  color: #fff;
  border: none;
  border-radius: var(--radius-md, 8px);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-success:hover:not(:disabled) {
  background: #16a34a;
}

.btn-success:disabled {
  background: var(--color-border);
  color: var(--color-muted);
  cursor: not-allowed;
}

/* === Btn Secondary (widget) === */
.btn-secondary {
  display: inline-block;
  padding: 12px 20px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 8px);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--color-border);
  text-decoration: none;
}


/* === WIDGET INLINE STYLE REPLACEMENT === */

/* Hidden elements (JS-controlled toggle) */
/* OCR overlay - fullscreen */
.ocr-overlay {
  display: none; /* JS-controlled */
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.75);
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ocr-overlay.active { display: flex; }

/* Close button (fullscreen mode) */
/* Section separators */
/* Text sizes */
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-md { font-size: 13px; }
.text-lg { font-size: 14px; }
.text-xl { font-size: 16px; }
.text-2xl { font-size: 18px; }
.text-3xl { font-size: 22px; }
.text-4xl { font-size: 28px; }
/* Font weights */
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Text colors */
.text-muted { color: var(--color-muted); }
.text-success { color: var(--color-success, #22c55e); }
.text-error { color: var(--color-error, #ef4444); }
/* Line heights */
/* Spacing utilities (widget-specific) */
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
/* Widget card styles */
/* Welcome text */
/* Form error messages */
/* Order cards in mini-cabinet */
/* Rate box */
/* Fee row */
/* Wallet hint */
.wallet-hint {
  font-size: 12px;
  color: #e74c3c;
  margin-top: 5px;
  display: none; /* JS-controlled */
}

/* OCR buttons */
/* OCR warning box */
/* SMS code input */
.sms-code-input {
  letter-spacing: 4px;
  font-size: 22px;
  text-align: center;
}

/* Contract scroll area */
/* Payment section */
/* Copy button */
/* QR image */
.qr-image {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  display: block;
  margin: 0 auto;
}

/* Upload proof */
.proof-filename {
  font-size: 12px;
  color: var(--color-success, #22c55e);
  margin-top: 6px;
  text-align: center;
}

/* Disabled button style */
/* Final status screen */
/* Inline link primary color */
/* Resend SMS link */
.resend-link {
  color: var(--color-accent);
  text-decoration: none;
}

/* Word break utility */
.break-all { word-break: break-all; }

/* Display block utility */
.d-block { display: block; }
/* Text align right */
.text-right { text-align: right; }


/* Additional margin utilities */
.mt-4 { margin-top: 4px; }
/* KYC Warning Banner */
.kyc-warning {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: var(--color-warning-bg, rgba(255, 180, 0, 0.12));
    border: 1px solid var(--color-warning-border, rgba(255, 180, 0, 0.4));
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text);
}
.kyc-warning-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.kyc-warning-text { flex: 1; }

/* Form row 2 columns */
.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* === OCR Two-page support === */
.ocr-section { margin-bottom: 12px; }
.ocr-section-label { font-size: 11px; color: var(--color-muted); margin-bottom: 6px; }
.ocr-hint { font-size: 12px; color: var(--color-muted); text-align: center; margin-bottom: 12px; padding: 8px; background: var(--color-surface); border-radius: var(--radius-md, 8px); }
.ocr-status-text { text-align: center; margin-bottom: 16px; font-size: 13px; color: var(--color-muted); }
.ocr-file-input { display: none; }

/* === Order Actions Column Buttons === */
.order-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}
.order-actions .btn {
  width: 100%;
  justify-content: center;
}
.btn-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
}
.btn-recalc {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.btn-recalc:hover {
  background: var(--color-accent-bg);
  border-color: var(--color-accent);
}
.btn-delete {
  background: rgba(255, 80, 80, 0.15);
  border: 1px solid rgba(255, 80, 80, 0.4);
  color: #ff5050;
}
.btn-delete:hover {
  background: rgba(255, 80, 80, 0.25);
  border-color: #ff5050;
}
.tx-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 4px);
  color: var(--color-accent);
  text-decoration: none;
  transition: all 0.15s ease;
}
.tx-link-btn:hover {
  background: var(--color-accent-bg);
  border-color: var(--color-accent);
}

/* === Mobile optimizations for orders table === */

/* Bulk panel - hidden by default, respect hidden attribute */
.bulk-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 4px);
}
.bulk-panel[hidden] {
  display: none !important;
}

/* Status filters - horizontal scroll on mobile */
/* Rate diff styling */
.rate-diff {
  color: var(--color-text-muted);
  font-size: 0.9em;
}

/* Mobile: hide separate Тек.курс column, show combined rate */
@media (max-width: 768px) {
  td[data-label="Тек.курс"],
  th:has(+ th:contains("Тек.курс")) {
    display: none;
  }
  /* For card view on mobile - hide the row */
  .orders-table tr td[data-label="Тек.курс"] {
    display: none !important;
  }
}

/* Mobile rate display - visible only on mobile */
.rate-diff.mobile-rate {
  display: none;
}
@media (max-width: 768px) {
  .rate-diff.mobile-rate {
    display: inline;
  }
}

/* === Bank Selector for Deeplink QR === */
/* Sberbank - green */
/* Tinkoff - yellow/black */
/* Alfa-Bank - red */
/* Other banks - neutral */
/* QR wrapper with loader */
.qr-wrapper {
  position: relative;
  display: inline-block;
}

.qr-img {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Mobile responsive */
@media (max-width: 480px) {
}

/* === IMAGE LIGHTBOX === */
.image-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.9);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.image-lightbox.open { display: flex; }
.image-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  cursor: grab;
  transition: transform 0.2s ease;
}
.image-lightbox img:active { cursor: grabbing; }
.image-lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  cursor: pointer;
  font-size: 28px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.image-lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* KYC thumbnails */
.kyc-doc-thumb {
  display: block;
  cursor: zoom-in;
}
.kyc-doc-thumb img {
  max-width: 200px;
  max-height: 150px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  transition: transform 0.2s, box-shadow 0.2s;
}
.kyc-doc-thumb:hover img {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* === PASSPORT SCANS IN USER CARD === */
.passport-scans {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}
.passport-scans-label {
  font-size: 0.875rem;
  color: var(--color-text-dim);
  margin-bottom: 0.75rem;
}
.passport-scans-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  
}
.kyc-doc-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  cursor: zoom-in;
}
.kyc-doc-thumb img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  transition: transform 0.2s, box-shadow 0.2s;
}
.kyc-doc-thumb:hover img {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.thumb-label {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  margin-top: 0.5rem;
}

/* === PASSPORT SCANS RESPONSIVE (override) === */
.passport-scans-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.kyc-doc-thumb img {
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: 4/3;
  object-fit: cover;
}
@media (max-width: 480px) {
  .passport-scans-grid {
    grid-template-columns: 1fr;
  }
}

/* === Section Headers (без эмодзи) === */
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-header h2 {
  margin: 0;
  text-transform: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.section-icon {
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* === Status indicators (без эмодзи) === */
.status-yes {
  color: var(--color-green);
  font-weight: 500;
}

.status-no {
  color: var(--color-text-muted);
}

.status-pending {
  color: var(--color-yellow);
}

/* === Icon classes for inline SVG === */
.icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }
/* === Button icon alignment === */
.btn .icon {
  margin-right: 6px;
}

.btn-sm .icon {
  margin-right: 4px;
  width: 14px;
  height: 14px;
}

/* === Info table (client details) === */
.info-table {
  width: 100%;
  border-collapse: collapse;
}

.info-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.info-table tr:last-child td {
  border-bottom: none;
}

.info-table .label {
  width: 160px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.info-table .value {
  color: var(--color-text);
  font-size: 14px;
}

/* === Document grid === */
.docs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--color-surface-dark);
  border-radius: var(--radius-md);
}

.doc-row .doc-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doc-row .doc-name {
  font-weight: 500;
  color: var(--color-text);
}

.doc-row .doc-date {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ================================================================
   AUTH PAGES — root login.php
   ================================================================ */

/* Centered auth body */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Auth card box */
.box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

/* Auth logo */
.logo {
  text-align: center;
  margin-bottom: 28px;
}
.logo img {
  width: 52px;
  height: 52px;
  display: block;
  margin: 0 auto 12px;
}
.logo h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}
.logo p {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* Labels inside auth box (reset generic form label cascade) */
.box label {
  display: block;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 6px;
  margin-top: 16px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
}
.box label .opt {
  font-size: 11px;
  color: var(--color-text-dim);
  margin-left: 4px;
}

/* Inputs inside auth box */
.box input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--color-text);
  font-size: 15px;
  font-family: inherit;
}
.box input:focus {
  outline: none;
  border-color: var(--color-accent);
}
.box input::placeholder {
  color: var(--color-text-dim);
}

/* Auth primary button (full-width) */
.box .btn {
  width: 100%;
  margin-top: 24px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  background: var(--color-accent);
  color: #fff;
  transition: all var(--transition-fast);
  display: block;
  text-align: center;
  text-decoration: none;
}
.box .btn:hover {
  background: #2563eb;
  text-decoration: none;
}
.box .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.box .btn.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  margin-top: 12px;
}
.box .btn.btn-secondary:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
  background: transparent;
}

/* Ghost button */
.btn-ghost {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-family: inherit;
}
.btn-ghost:hover {
  color: var(--color-text);
}

/* Auth footer links row */
.links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}
.links a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 13px;
}
.links a:hover {
  color: var(--color-accent-light);
}
.links .sep {
  color: var(--color-border);
}

/* Switch account type hint */
.switch {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--color-text-muted);
}
.switch a {
  color: var(--color-accent-light);
  text-decoration: none;
}
.switch a:hover {
  color: #60a5fa;
  text-decoration: underline;
}

/* Referral notice */
.ref-notice {
  background: var(--color-accent-bg);
  border: 1px solid var(--color-accent);
  color: var(--color-accent-light);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}

/* Phone display in auth box */
.box .phone-display {
  background: var(--input-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 15px;
  color: var(--color-text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.box .phone-display .check {
  color: var(--color-green);
  font-size: 18px;
}

/* SMS code input */
.sms-code {
  letter-spacing: 8px;
  font-size: 22px;
  text-align: center;
  font-weight: 600;
}

/* Set password prompt */
.set-password-box {
  text-align: center;
  padding: 8px 0 16px;
}
.set-password-box .icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.set-password-box p {
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}

/* Password strength bar */
.password-strength-bar {
  height: 4px;
  border-radius: 2px;
  margin-top: 8px;
  background: var(--color-border);
  overflow: hidden;
}
.password-strength-bar .fill {
  height: 100%;
  width: 0;
  transition: width 0.3s, background 0.3s;
}

/* Password requirements checklist */
.password-requirements {
  margin-top: 10px;
  font-size: 11px;
  color: var(--color-text-dim);
  line-height: 1.6;
}
.password-requirements .req {
  display: block;
  transition: color 0.2s;
}
.password-requirements .req.met {
  color: var(--color-green);
}

/* Password match indicator */
.password-match {
  font-size: 12px;
  margin-top: 6px;
  min-height: 18px;
}
.password-match.error {
  color: var(--color-red);
}
.password-match.success {
  color: var(--color-green);
}

@media (max-width: 480px) {
  .box {
    margin: 0;
    padding: 28px 20px;
  }
  .auth-body {
    padding: 12px;
  }
}

/* ================================================================
   AUTH PAGES — Cabinet modules (login, reset_password, forgot)
   ================================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: 20px;
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}
.login-logo img {
  height: 40px;
}
.login-logo-text {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
  text-align: center;
}
.login-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 24px;
  text-align: center;
}

.login-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  background: var(--color-surface-dark);
  border-radius: var(--radius-md);
  padding: 4px;
}
.login-tab {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--color-text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.login-tab:hover {
  color: var(--color-text);
  text-decoration: none;
}
.login-tab.active {
  background: var(--color-accent);
  color: #fff;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Reset form label cascade inside cabinet auth pages */
.login-card label,
.login-card .form-label {
  text-transform: none;
  letter-spacing: normal;
  margin-top: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
}

/* Primary action button */
.btn-primary {
  width: 100%;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
  font-family: inherit;
}
.btn-primary:hover {
  background: #2563eb;
}

.login-hint {
  font-size: 12px;
  color: var(--color-text-dim);
  text-align: center;
  margin-top: 16px;
}
.login-hint a {
  color: var(--color-accent);
  text-decoration: none;
}
.login-hint a:hover {
  text-decoration: underline;
}

.forgot-link {
  font-size: 13px;
  color: var(--color-accent);
  text-decoration: none;
  text-align: right;
  display: block;
  margin-top: -8px;
}
.forgot-link:hover {
  text-decoration: underline;
}

/* Phone display inside cabinet auth card */
.login-card .phone-display {
  background: var(--color-surface-dark);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 15px;
  color: var(--color-text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.password-rules {
  font-size: 12px;
  color: var(--color-text-dim);
  margin-top: 4px;
}

@media (max-width: 480px) {
  .login-card {
    padding: 28px 20px;
  }
  .login-title {
    font-size: 20px;
  }
}

/* ================================================================
   KYC PAGES
   ================================================================ */

.kyc-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* KYC step progress bar */
.kyc-steps {
  display: flex;
  margin-bottom: 32px;
}
.kyc-step {
  flex: 1;
  text-align: center;
  position: relative;
}
.kyc-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 16px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}
.kyc-step.done:not(:last-child)::after {
  background: var(--color-green);
}
.kyc-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}
.kyc-step.done .kyc-step-num {
  background: var(--color-green);
  color: #000;
}
.kyc-step.active .kyc-step-num {
  background: var(--color-accent);
  color: #fff;
}
.kyc-step.inactive .kyc-step-num {
  background: var(--color-border);
  color: var(--color-text-dim);
}
.kyc-step-label {
  font-size: 11px;
  color: var(--color-text-dim);
  margin-top: 6px;
  display: block;
}
.kyc-step.active .kyc-step-label {
  color: var(--color-accent-light);
}
.kyc-step.done .kyc-step-label {
  color: var(--color-green-light);
}
.kyc-step-check {
  width: 14px;
  height: 14px;
}

/* KYC card */
.kyc-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 16px;
}
.kyc-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--color-text);
}
.kyc-card p {
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
}

/* KYC alerts */
.kyc-error {
  background: var(--color-red-bg);
  border: 1px solid var(--color-red);
  color: var(--color-red-light);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
}
.kyc-success {
  background: var(--color-green-bg);
  border: 1px solid var(--color-green);
  color: var(--color-green-light);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
}
.kyc-warning {
  background: var(--color-yellow-bg);
  border: 1px solid var(--color-warning);
  color: var(--color-text);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
}

/* KYC buttons */
.kyc-btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  border: none;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.15s;
}
.kyc-btn-blue {
  background: var(--color-accent);
  color: #fff;
}
.kyc-btn-blue:hover {
  background: #2563eb;
}
.kyc-btn-blue:disabled {
  background: var(--color-border);
  color: var(--color-text-dim);
  cursor: not-allowed;
}
.kyc-btn-green {
  background: var(--color-green);
  color: #000;
}
.kyc-btn-green:hover {
  background: #16a34a;
  color: #fff;
}
.kyc-btn-full {
  width: 100%;
  text-align: center;
}

/* KYC contract preview */
.kyc-contract-preview {
  background: var(--color-surface-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 16px 0;
  font-size: 12px;
  line-height: 1.8;
  color: var(--color-text-muted);
  max-height: 450px;
  overflow-y: auto;
}
.kyc-contract-preview h4 {
  color: var(--color-text);
  font-size: 14px;
  margin-bottom: 8px;
}
.kyc-contract-preview p {
  margin-bottom: 10px;
}
.kyc-contract-preview strong {
  color: var(--color-text);
}

/* KYC agreement checkbox */
.kyc-agree-block {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--color-surface-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
}
.kyc-agree-block input[type=checkbox] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--color-accent);
  flex-shrink: 0;
}
.kyc-agree-block label {
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 1.5;
  text-transform: none;
  letter-spacing: normal;
  margin: 0;
  font-weight: normal;
}

/* KYC form fields */
.kyc-label {
  display: block;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 5px;
  margin-top: 14px;
  font-weight: 500;
}
.kyc-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--color-text);
  font-size: 14px;
  font-family: inherit;
}
.kyc-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* KYC SMS info */
.kyc-sms-info {
  background: var(--color-surface-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 13px;
}
.kyc-sms-info a {
  color: var(--color-accent);
  text-decoration: none;
}
.kyc-sms-info a:hover {
  text-decoration: underline;
}

/* KYC phone change block (JS-toggled) */
.kyc-phone-change-block {
  display: none;
  background: var(--color-surface-dark);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 14px;
}

/* KYC SMS code input */
.kyc-code-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.kyc-code-input {
  width: 140px;
  text-align: center;
  font-size: 20px;
  letter-spacing: 6px;
  padding: 10px;
  background: var(--input-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
}
.kyc-code-input:focus {
  outline: none;
  border-color: var(--color-accent);
}
.kyc-resend-link {
  background: none;
  border: none;
  color: var(--color-accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.kyc-resend-link:hover {
  color: #2563eb;
}

/* KYC notice block */
.kyc-notice {
  background: var(--color-surface-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 12px;
}
.kyc-notice strong {
  color: var(--color-text);
}

/* KYC OCR warning */
.kyc-ocr-warning {
  margin-top: 16px;
  background: var(--color-surface-dark);
  border-left: 3px solid var(--color-warning);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 14px 16px;
}
.kyc-ocr-warning-title {
  color: #fcd34d;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.kyc-ocr-warning-text {
  color: #fbbf24;
  font-size: 13px;
  line-height: 1.5;
}

/* KYC upload blocks */
.kyc-upload-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.kyc-upload-block.done {
  border-color: var(--color-green);
}
.kyc-upload-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}
.kyc-upload-hint-text {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}
.kyc-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  background: var(--color-surface-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  font-family: inherit;
}
.kyc-upload-btn:hover {
  border-color: var(--color-accent);
  background: rgba(59,130,246,0.08);
}
.kyc-upload-btn.done {
  border-color: var(--color-green);
  background: var(--color-green-bg);
}

/* QR Bridge */
.qr-bridge-section {
  text-align: center;
  padding: 20px 0;
}
.qr-bridge-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.qr-bridge-hint {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}
.qr-bridge-code {
  display: inline-block;
  padding: 16px;
  background: #fff;
  border-radius: var(--radius-md);
}
.qr-image {
  width: 200px;
  height: 200px;
}
.qr-bridge-status {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}
.qr-bridge-status span {
  padding: 8px 16px;
  background: var(--color-surface-dark);
  border-radius: var(--radius-sm);
}
.qr-bridge-status span.done {
  background: var(--color-green-bg);
  color: var(--color-green);
}

/* Form hint error */
.form-hint-error {
  color: var(--color-red);
  font-size: 13px;
  margin-top: 12px;
}

/* KYC done page specifics */
.kyc-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  color: var(--color-green);
}
.kyc-info-block {
  background: var(--color-surface-dark);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 14px;
  color: var(--color-text-muted);
  text-align: left;
}
.kyc-info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}
.kyc-info-row:last-child {
  border-bottom: none;
}
.kyc-info-label {
  color: var(--color-text-dim);
}
.kyc-info-value {
  color: var(--color-text);
  font-weight: 500;
}

@media (max-width: 768px) {
  .kyc-card h2 {
    font-size: 18px;
  }
  .kyc-contract-preview {
    max-height: 350px;
  }
}

/* Touch устройства (дополнительные tap-target правила) */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .nav-item, .sidebar-link { min-height: 48px; }
  input, select, textarea { font-size: 16px; }
  /* iOS Safari: предотвратить auto-zoom */
  form input, form select, form textarea,
  .form-input, .form-select, .form-textarea { font-size: 16px; }
  /* iOS: убрать подсветку при tap */
  button, .btn, .action-btn, [role=button], [onclick] {
    -webkit-tap-highlight-color: transparent;
  }
}

/* Hover только для мыши (pointer: fine) */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { opacity: 0.9; }
}

/* ================================================================
   MANAGER CARD — Issue #221 (унификация UI)
   ================================================================ */

/* Верхняя панель с кнопкой "назад" */
.page-actions-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

/* Уменьшенный размер текста для val (например, email) */
.val-sm {
  font-size: 12px;
}

/* Список прав менеджера */
.manager-perm-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Строка одного права */
.manager-perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  background: var(--color-bg, #0f172a);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

/* Название права */
.manager-perm-label {
  font-weight: 600;
  color: var(--color-text);
  font-size: 13px;
}

/* Описание права */
.manager-perm-desc {
  font-size: 11px;
  color: var(--color-text-dim);
  margin-top: 2px;
}

/* Блок лимита свободной выплаты */
.manager-limit-box {
  margin-top: 16px;
  padding: 12px;
  background: var(--color-bg, #0f172a);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

/* Форма лимита */
.manager-limit-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

/* Поле ввода лимита */
.manager-limit-field {
  flex: 1;
  min-width: 220px;
}

/* Строка с кнопками (Действия) */
.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Form без margin (инлайн-форма рядом с кнопками) */
.form-bare {
  margin: 0;
}

/* Ячейки таблицы лога выплат */
.td-date {
  font-size: 12px;
  color: var(--color-text-dim);
  white-space: nowrap;
}

.td-nowrap {
  white-space: nowrap;
}

.td-mono-sm {
  font-family: monospace;
  font-size: 11px;
}

.td-truncate {
  font-size: 12px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.td-error-hint {
  font-size: 10px;
  color: var(--color-text-dim);
  margin-top: 2px;
  max-width: 200px;
}

.td-tx-link {
  font-family: monospace;
  font-size: 11px;
}


/* ===== RF-17: semantic utility classes (used with dynamic PHP conditions) ===== */
.u-fs-11 { font-size: 11px; }
.u-fw-600 { font-weight: 600; }
.u-cursor-pointer { cursor: pointer; }
.u-opacity-50 { opacity: 0.5; }
.sidebar-item-sandbox-on { background: #854d0e; border-color: #f59e0b; }

/* === RF-17 phase 2: semantic utility dictionary === */

/* spacing */
.u-mt-0{margin-top:0}.u-mt-2{margin-top:2px}.u-mt-4{margin-top:4px}.u-mt-8{margin-top:8px}
.u-mt-12{margin-top:12px}.u-mt-16{margin-top:16px}.u-mt-20{margin-top:20px}.u-mt-24{margin-top:24px}
.u-mb-0{margin-bottom:0}.u-mb-4{margin-bottom:4px}.u-mb-8{margin-bottom:8px}
.u-mb-12{margin-bottom:12px}.u-mb-16{margin-bottom:16px}.u-mb-20{margin-bottom:20px}.u-mb-24{margin-bottom:24px}
.u-gap-4{gap:4px}.u-gap-8{gap:8px}.u-gap-12{gap:12px}.u-gap-16{gap:16px}
.u-pt-8{padding-top:8px}.u-pt-12{padding-top:12px}.u-pt-16{padding-top:16px}
.u-px-8{padding-left:8px;padding-right:8px}.u-px-12{padding-left:12px;padding-right:12px}
.u-py-8{padding-top:8px;padding-bottom:8px}.u-py-12{padding-top:12px;padding-bottom:12px}

/* typography */
.u-fs-10{font-size:10px}.u-fs-12{font-size:12px}.u-fs-13{font-size:13px}.u-fs-14{font-size:14px}
.u-fs-15{font-size:15px}.u-fs-16{font-size:16px}.u-fs-20{font-size:20px}.u-fs-22{font-size:22px}
.u-fs-24{font-size:24px}.u-fs-28{font-size:28px}.u-fs-40{font-size:40px}.u-fs-48{font-size:48px}
.u-fw-500{font-weight:500}.u-fw-700{font-weight:700}
.u-tt-upper{text-transform:uppercase}.u-ls-05{letter-spacing:.5px}

/* colors */
.u-text{color:var(--color-text)}
.u-text-muted{color:var(--color-text-muted)}
.u-text-dim{color:var(--color-text-dim)}
.u-text-subtle{color:var(--color-text-subtle)}
.u-text-faint{color:var(--color-text-faint)}
.u-text-accent-blue{color:var(--color-accent-blue)}
.u-text-accent-blue-soft{color:var(--color-accent-blue-soft)}
.u-text-accent-green{color:var(--color-accent-green)}
.u-text-accent-green-soft{color:var(--color-accent-green-soft)}
.u-text-warn{color:var(--color-accent-warn)}
.u-text-warn-soft{color:var(--color-accent-warn-soft)}
.u-text-error{color:var(--color-accent-error)}
.u-text-error-soft{color:var(--color-accent-error-soft)}

/* layout */
.u-flex{display:flex}
.u-flex-center{display:flex;align-items:center}
.u-flex-between{display:flex;align-items:center;justify-content:space-between}
.u-flex-wrap{flex-wrap:wrap}
.u-flex-col{display:flex;flex-direction:column}
.u-flex-1{flex:1}
.u-flex-start{display:flex;align-items:flex-start}
/* consent-row: checkbox + multiline label layout.
   Override specificity over generic "form label { display:block; margin-top:12px; ... }"
   and "form input { width:100% }" which break flex layout. */
form .consent-row,
.consent-row{display:flex !important;align-items:flex-start;gap:8px;margin:16px 0;width:100%}
form .consent-row > input[type=checkbox],
.consent-row > input[type=checkbox]{width:18px !important;height:18px;flex:0 0 18px;margin:2px 0 0 0 !important;padding:0}
form .consent-row > label,
.consent-row > label{flex:1 1 auto;min-width:0;margin:0 !important;padding:0;line-height:1.5;text-transform:none;font-size:11px;letter-spacing:normal}
.u-inline{display:inline}.u-block{display:block}.u-hidden{display:none !important}
.u-grid-2{display:grid;grid-template-columns:1fr 1fr}
.u-grid-4{display:grid;grid-template-columns:repeat(4,1fr)}
.u-scroll-x{overflow-x:auto}

/* components */
.card-sub{background:var(--color-surface-dark);border:1px solid var(--color-border);border-radius:8px;padding:16px}
.input-dark{width:100%;padding:8px 12px;background:var(--color-surface-dark);border:1.5px solid var(--color-border);border-radius:6px;color:var(--color-text);font-size:13px}
.section-divider{margin-top:16px;padding-top:12px;border-top:1px solid var(--color-border)}

/* ================================================================
   PHASE 3 (#230): additional utility + component classes
   Заменили блок u-s-<hash> из RF-17.
   ================================================================ */

/* --- spacing --- */
.u-mt-2{margin-top:2px}
.u-mt-6{margin-top:6px}.u-mt-10{margin-top:10px}.u-mt-14{margin-top:14px}.u-mt-28{margin-top:28px}
.u-mb-2{margin-bottom:2px}.u-mb-6{margin-bottom:6px}.u-mb-10{margin-bottom:10px}
.u-ml-8{margin-left:8px}.u-mr-8{margin-right:8px}
.u-m-0{margin:0}
.u-m-0-0-12{margin:0 0 12px}
.u-m-16-0{margin:16px 0}
.u-m-8-0-10{margin:8px 0 10px}
.u-p-12-0-16{padding:12px 0 16px}
.u-p-16{padding:16px}
.u-p-20{padding:20px}
.u-p-30{padding:30px}
.u-py-2{padding-top:2px;padding-bottom:2px}
.u-py-4{padding-top:4px;padding-bottom:4px}
.u-py-6{padding-top:6px;padding-bottom:6px}
.u-py-10{padding-top:10px;padding-bottom:10px}
.u-py-24{padding-top:24px;padding-bottom:24px}
.u-py-30{padding-top:30px;padding-bottom:30px}
.u-px-6{padding-left:6px;padding-right:6px}
.u-px-24{padding-left:24px;padding-right:24px}
.u-pt-4{padding-top:4px}
.u-pt-10{padding-top:10px}
.u-pt-28{padding-top:28px}
.u-pb-4{padding-bottom:4px}
.u-gap-6{gap:6px}
.u-gap-10{gap:10px}
.u-gap-32{gap:32px}

/* --- typography --- */
.u-fs-9{font-size:9px}
.u-lh-15{line-height:1.5}
.u-lh-16{line-height:1.6}
.u-lh-18{line-height:1.8}
.u-ls-08{letter-spacing:.8px}
.u-ls-1{letter-spacing:1px}
.u-ls-4{letter-spacing:4px}
.u-text-center{text-align:center}
.u-text-right{text-align:right}
.u-text-underline{text-decoration:underline}
.u-text-slate{color:#64748b}
.u-text-slate-dark{color:#475569}
.u-text-black{color:#000}
.u-text-white{color:#fff}
.u-text-muted-var{color:var(--color-muted)}
.u-mono{font-family:monospace}
.u-nowrap{white-space:nowrap}
.u-break-all{word-break:break-all}
.u-nodec{text-decoration:none}

/* --- sizing --- */
.u-w-auto{width:auto}
.u-w-90{width:90px}
.u-w-120{width:120px}
.u-w-140{width:140px}
.u-w-160{width:160px}
.u-h-26{height:26px}
.u-full{width:100%}
.u-mw-160{max-width:160px}
.u-mw-240{max-width:240px}
.u-mw-300{max-width:300px}
.u-mw-320{max-width:320px}
.u-mw-400{max-width:400px}
.u-mw-480{max-width:480px}
.u-min-w-80{min-width:80px}
.u-min-w-200{min-width:200px}
.u-min-h-18{min-height:18px}
.u-min-h-screen{min-height:100vh}

/* --- layout extras --- */
.u-flex-0-auto{flex:0 0 auto}
.u-items-end{align-items:flex-end}
.u-items-start{align-items:flex-start}
.u-items-stretch{align-items:stretch}
.u-justify-center{justify-content:center}
.u-justify-between{justify-content:space-between}
.u-inline-block{display:inline-block}
.u-grid-140-1fr{display:grid;grid-template-columns:140px 1fr}
.u-list-flex{list-style:none;display:flex;gap:12px;flex-wrap:wrap}
.u-cursor-default{cursor:default}
.u-trans-transform{transition:transform .2s}

/* --- colors / backgrounds --- */
.u-bg-surface-dark{background:var(--color-surface-dark)}
.u-bg-accent-blue{background:#3b82f6}
.u-bg-deep{background:#070d18}
.u-radius-4{border-radius:4px}
.u-border-danger{border-color:#dc2626;color:#dc2626}

/* --- component shortcuts --- */
.modal-backdrop{display:none;position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:100;align-items:center;justify-content:center}
.modal-dialog{background:var(--color-surface);border:1px solid var(--color-border);border-radius:12px;padding:24px;width:400px;max-width:95vw}

.card-sub{background:var(--color-surface-dark);border:1px solid var(--color-border);border-radius:8px;padding:16px}
.card-sub-r10{background:var(--color-surface-dark);border:1px solid var(--color-border);border-radius:10px;padding:16px}
.card-sub-sm{background:var(--color-surface-dark);border:1px solid var(--color-border);border-radius:8px;padding:12px}
.card-accent{background:var(--color-surface-dark);border:1px solid var(--color-border);border-radius:12px;padding:16px}
.card-accent-green{background:var(--color-surface-dark);border:1px solid #22c55e;border-radius:12px;padding:16px}

.input-dark{width:100%;padding:8px 12px;background:var(--color-surface-dark);border:1.5px solid var(--color-border);border-radius:6px;color:var(--color-text);font-size:14px;outline:none}
.input-dark-sm{background:var(--color-surface);border:1px solid var(--color-border);color:var(--color-text);padding:6px 10px;border-radius:6px;font-size:13px}
.input-dark-full{width:100%;padding:10px;background:var(--color-surface-dark);border:1px solid var(--color-border);border-radius:6px;color:var(--color-text)}
.input-slate{background:#1e293b;border:1px solid #334155;border-radius:6px;padding:4px 8px;color:#e2e8f0;font-size:12px}
.input-code{background:var(--color-surface-dark);border:1px solid var(--color-border);border-radius:8px;padding:10px 14px;color:#93c5fd;font-family:monospace;font-size:13px;flex:1;min-width:200px}

.pill-dark{background:var(--color-surface-dark);border:1px solid var(--color-border);border-radius:8px;padding:8px 12px;color:var(--color-text);font-size:13px}
.chip-neutral{background:var(--color-surface);border:1px solid var(--color-border);color:var(--color-text);padding:5px 10px;border-radius:20px;font-size:12px;display:inline-flex;align-items:center;gap:6px}
.chip-warn{background:var(--color-surface-dark);border:1px solid var(--color-border);border-radius:6px;padding:8px 12px;color:#fbbf24}
.chip-border-muted{background:var(--color-border);color:var(--color-text-muted);padding:4px 10px;border-radius:20px;font-size:13px}

.alert-warn{background:#1c1400;border:1px solid #ca8a04;border-radius:8px;padding:16px;margin-bottom:16px}
.alert-warn-soft{background:#1c1400;border:1px solid #ca8a04;border-radius:10px;padding:12px 16px;margin-bottom:16px;color:#fde68a}
.alert-stone{background:#1c1917;border:1px solid #44403c;color:#a8a29e;padding:12px;border-radius:8px;font-size:13px}

.banner-warn{background:#f59e0b;color:#000;text-align:center;padding:8px 16px;font-size:13px;font-weight:600;position:fixed;top:0;left:0;right:0;z-index:1001}
.badge-warn-sm{background:#f59e0b;color:#000;padding:2px 6px;border-radius:4px;font-size:10px;margin-left:4px}

.section-divider-light{border-top:1px solid var(--color-border-light)}

.btn-ghost-success{background:var(--color-surface);border:1px solid #22c55e;color:#86efac;padding:8px 16px;border-radius:8px;cursor:pointer;font-size:13px;font-weight:600}
.btn-ghost-blue{background:var(--color-surface);border:1px solid #3b82f6;color:#93c5fd;padding:8px 16px;border-radius:8px;cursor:pointer;font-size:13px;font-weight:600}
.btn-ghost-muted{background:var(--color-surface);border:1px solid var(--color-text-dim);color:var(--color-text-muted);padding:6px 12px;border-radius:6px;cursor:pointer;font-size:13px}
.btn-icon{background:none;border:none;color:var(--color-text-muted);cursor:pointer;padding:0;font-size:14px;line-height:1}
.btn-danger-xs{background:transparent;border:1px solid #dc2626;color:#dc2626;padding:2px 8px;font-size:11px;cursor:pointer;border-radius:4px}

.toggle-wrap{position:relative;display:inline-block;width:52px;height:26px}
.toggle-input{opacity:0;width:0;height:0}
.toggle-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background:var(--color-border);border-radius:26px;transition:.3s}
.toggle-slider-knob{position:absolute;content:'';height:20px;width:20px;left:3px;bottom:3px;background:white;border-radius:50%;transition:.3s}

.dot-dim{width:12px;height:12px;border-radius:50%;background:var(--color-text-dim)}
.dot-success{width:12px;height:12px;border-radius:50%;background:#22c55e;box-shadow:0 0 8px #22c55e}

.qr-frame{border:4px solid #fff;border-radius:8px;width:200px;height:200px}
.u-qr-number{position:absolute;top:4px;right:5px;color:#fff;font-size:11px;font-weight:700;text-shadow:0 1px 3px #0008}

.u-widget-iframe{width:420px;height:600px;border:none;border-radius:12px}
.iframe-wrap-480{background:var(--color-surface-dark);border:1px solid var(--color-border);border-radius:10px;overflow:hidden;height:480px}
.u-chart-240{position:relative;height:240px}

.u-icon-40{width:40px;height:40px;display:block;margin:0 auto 12px}
.u-icon-48{width:48px;height:48px;display:block;margin:0 auto 10px}
.u-icon-52{width:52px;height:52px;display:block;margin:0 auto 12px}

.u-checkbox-18{width:18px;height:18px;accent-color:#3b82f6;cursor:pointer;flex-shrink:0}

.u-color-btn{width:46px;height:36px;padding:2px 4px;border:1.5px solid var(--color-border);border-radius:6px;background:var(--color-surface);cursor:pointer;flex-shrink:0}

.page-error{background:#0f172a;color:#fff;font-family:sans-serif;text-align:center;padding:40px}

/* ============================================================
   KYC unified flow (issue #320) — партиал ui/components/kyc_form.php
   Классы u-kyc-* — structural utility. .kyc-form-field — компонент поля.
   ============================================================ */

.u-kyc-flow { display:flex; flex-direction:column; gap:16px; }

.u-kyc-warning {
  background:var(--color-card);
  border:1px solid var(--color-border);
  border-left:3px solid var(--color-yellow, #f59e0b);
  padding:12px 14px;
  border-radius:var(--radius-md, 8px);
  font-size:13px;
  color:var(--color-text-muted, #9ca3af);
}
.u-kyc-warning-text { line-height:1.45; }

.u-kyc-step {
  padding:16px;
  background:var(--color-card);
  border:1px solid var(--color-border);
  border-radius:var(--radius-md, 8px);
}
.u-kyc-step-title {
  font-size:15px;
  font-weight:600;
  margin-bottom:10px;
  color:var(--color-text);
}
.u-kyc-step-hint {
  font-size:12px;
  color:var(--color-text-dim, #6b7280);
  margin-top:8px;
}

.u-kyc-photo-block { margin-bottom:10px; }
.u-kyc-photo-label {
  font-size:13px;
  font-weight:500;
  margin-bottom:6px;
  color:var(--color-text);
}
.u-kyc-photo-row { display:flex; gap:8px; }
.u-kyc-photo-status {
  margin-top:8px;
  font-size:12px;
  color:var(--color-text-muted, #9ca3af);
  text-align:center;
}
.u-kyc-photo-status.is-ok { color:var(--color-green, #10b981); }

.u-kyc-upload-btn {
  flex:1 1 50%;
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:12px 16px;
  background:var(--color-accent, #3b82f6);
  color:#fff;
  border-radius:var(--radius-md, 8px);
  font-size:14px;
  font-weight:500;
  cursor:pointer;
  border:none;
  text-align:center;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  overflow:hidden;
}
.u-kyc-upload-btn > span,
.u-kyc-upload-btn > span * {
  pointer-events:none;
}
.u-kyc-upload-btn-secondary {
  background:var(--color-surface);
  color:var(--color-text);
  border:1px solid var(--color-border);
}
/*
 * iOS Safari fix (#520): техника sr-only (clip-rect + 1×1) на iOS
 * не делегирует тап с <label> на скрытый <input type=file> внутри
 * флекс-контейнера. Растягиваем input по всему <label> с opacity:0,
 * чтобы тап в любой точке кнопки попал прямо в input. На десктопе
 * и Android поведение остаётся прежним.
 */
.u-kyc-file-input {
  position:absolute;
  inset:0;
  width:100%; height:100%;
  margin:0; padding:0;
  opacity:0;
  cursor:pointer;
  border:0;
  font-size:0;
  z-index:1;
}

.u-kyc-qr-bridge { text-align:center; padding:12px 0; }
.u-kyc-qr-title { font-size:16px; font-weight:600; margin-bottom:6px; }
.u-kyc-qr-hint {
  font-size:13px;
  color:var(--color-text-muted, #9ca3af);
  margin-bottom:14px;
}
.u-kyc-qr-frame {
  display:inline-block;
  padding:14px;
  background:#fff;
  border-radius:var(--radius-md, 8px);
}
.u-kyc-qr-image { width:200px; height:200px; display:block; }
.u-kyc-qr-status {
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:13px;
}
.u-kyc-qr-status span {
  padding:6px 12px;
  background:var(--color-surface);
  border-radius:var(--radius-sm, 4px);
}
.u-kyc-qr-status span.is-ok {
  background:var(--color-green-bg, rgba(16,185,129,0.12));
  color:var(--color-green, #10b981);
}

.u-kyc-notice {
  padding:10px 12px;
  border-radius:var(--radius-md, 8px);
  background:var(--color-surface);
  color:var(--color-text);
  font-size:13px;
}
.u-kyc-notice-error {
  background:rgba(239,68,68,0.12);
  color:var(--color-red, #ef4444);
  border:1px solid rgba(239,68,68,0.3);
}

.u-kyc-country-banner {
  padding:10px 12px;
  background:rgba(59,130,246,0.1);
  border:1px solid rgba(59,130,246,0.3);
  color:var(--color-accent, #3b82f6);
  border-radius:var(--radius-md, 8px);
  font-size:13px;
  margin-bottom:12px;
}

.u-kyc-form {
  padding:16px;
  background:var(--color-card);
  border:1px solid var(--color-border);
  border-radius:var(--radius-md, 8px);
}
.u-kyc-fields {
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
}
@media (min-width:640px){
  .u-kyc-fields { grid-template-columns:1fr 1fr; }
  .kyc-form-field[data-kyc-field="full_name"],
  .kyc-form-field[data-kyc-field="registration_address"],
  .kyc-form-field[data-kyc-field="passport_issued_by"],
  .kyc-form-field[data-kyc-field="birth_place"],
  .kyc-form-field[data-kyc-field="identification_number"] {
    grid-column:1 / -1;
  }
}

.kyc-form-field { display:flex; flex-direction:column; gap:4px; }
.kyc-form-field-label {
  font-size:13px;
  font-weight:500;
  color:var(--color-text);
}
.kyc-form-field-star { color:var(--color-red, #ef4444); }
.kyc-form-field-input {
  padding:10px 12px;
  background:var(--color-surface);
  border:1px solid var(--color-border);
  border-radius:var(--radius-sm, 4px);
  color:var(--color-text);
  font-size:14px;
  width:100%;
  box-sizing:border-box;
}
.kyc-form-field-input:focus {
  outline:none;
  border-color:var(--color-accent);
}
.kyc-form-field-input.is-invalid {
  border-color:var(--color-red, #ef4444);
}
.kyc-form-field-error {
  font-size:12px;
  color:var(--color-red, #ef4444);
  margin-top:2px;
}

.u-kyc-form-errors {
  margin-top:12px;
  padding:10px 12px;
  background:rgba(239,68,68,0.1);
  border:1px solid rgba(239,68,68,0.3);
  color:var(--color-red, #ef4444);
  border-radius:var(--radius-md, 8px);
  font-size:13px;
}

.u-kyc-submit {
  margin-top:16px;
  width:100%;
  padding:12px 16px;
  background:var(--color-accent, #3b82f6);
  color:#fff;
  border:none;
  border-radius:var(--radius-md, 8px);
  font-size:15px;
  font-weight:600;
  cursor:pointer;
}
.u-kyc-submit:disabled {
  opacity:0.5;
  cursor:not-allowed;
}

.u-kyc-overlay {
  position:fixed;
  inset:0;
  background:rgba(10,13,20,0.92);
  z-index:9999;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:20px;
}
.u-kyc-overlay-inner {
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:16px;
}
.u-kyc-overlay-text {
  color:var(--color-text, #e5e7eb);
  font-size:15px;
  font-weight:500;
}
.u-kyc-overlay-progress {
  color:var(--color-text-muted, #9ca3af);
  font-size:13px;
  margin-top:8px;
  min-height:18px;
}
.u-kyc-spinner {
  width:48px; height:48px;
  border-radius:50%;
  border:4px solid var(--color-border, #2a3444);
  border-top-color:var(--color-accent, #3b82f6);
  animation:u-kyc-spin 0.9s linear infinite;
}
@keyframes u-kyc-spin { to { transform:rotate(360deg); } }

/* #347 — KYC retry-overlay (low_quality / exhausted / not_a_document) */
.u-kyc-retry-overlay { background:rgba(10,13,20,0.94); }
.u-kyc-retry-card {
  max-width:420px;
  width:calc(100% - 32px);
  padding:24px 20px;
  background:var(--color-surface, #111827);
  border:1px solid var(--color-border, #2a3444);
  border-radius:12px;
  text-align:center;
  gap:12px;
}
.u-kyc-retry-icon { color:#f87171; }
.u-kyc-retry-icon-svg { width:44px; height:44px; }
.u-kyc-retry-title {
  font-size:18px; font-weight:600;
  color:var(--color-text, #e5e7eb);
}
.u-kyc-retry-message {
  font-size:14px; line-height:1.45;
  color:var(--color-text, #e5e7eb);
}
.u-kyc-retry-hint {
  font-size:13px; line-height:1.4;
  color:var(--color-text-muted, #9ca3af);
  background:rgba(255,255,255,0.03);
  border-radius:8px;
  padding:8px 12px;
}
.u-kyc-retry-counter {
  font-size:12px;
  color:var(--color-text-muted, #9ca3af);
  letter-spacing:0.02em;
}
.u-kyc-retry-btn {
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 18px;
  border:none; border-radius:8px;
  background:var(--color-accent, #3b82f6);
  color:#fff; font-size:14px; font-weight:600;
  cursor:pointer;
  margin-top:4px;
}
.u-kyc-retry-btn:hover { filter:brightness(1.08); }
.u-kyc-retry-btn-icon { width:18px; height:18px; }
.u-kyc-retry-support {
  display:inline-flex; align-items:center; gap:8px;
  font-size:14px;
  color:var(--color-text, #e5e7eb);
  background:rgba(59,130,246,0.08);
  border:1px solid rgba(59,130,246,0.3);
  border-radius:8px;
  padding:10px 14px;
}
.u-kyc-retry-support-icon { width:18px; height:18px; color:var(--color-accent, #3b82f6); }
.u-kyc-retry-support-link {
  color:var(--color-accent, #3b82f6);
  font-weight:600;
  text-decoration:none;
}
.u-kyc-retry-support-link:hover { text-decoration:underline; }
