* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-overflow-scrolling: touch;
}

:root {
    /* Оранжевая тема по умолчанию */
    --primary: #f97316;
    --primary-dark: #ea580c;
    --primary-light: #fb923c;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-primary: #fff7ed;
    --bg-secondary: #ffedd5;
    --bg-card: rgba(255, 247, 237, 0.9);
    --bg-input: rgba(255, 247, 237, 0.95);
    --text-primary: #431407;
    --text-secondary: #7c2d12;
    --border: rgba(249, 115, 22, 0.2);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --glass-bg: rgba(255, 247, 237, 0.8);
    --glass-border: rgba(249, 115, 22, 0.3);
}

/* Оранжевая тема (по умолчанию) */
[data-theme="orange"] {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --primary-light: #fb923c;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-primary: #fff7ed;
    --bg-secondary: #ffedd5;
    --bg-card: rgba(255, 247, 237, 0.9);
    --bg-input: rgba(255, 247, 237, 0.95);
    --text-primary: #431407;
    --text-secondary: #7c2d12;
    --border: rgba(249, 115, 22, 0.2);
    --glass-bg: rgba(255, 247, 237, 0.8);
    --glass-border: rgba(249, 115, 22, 0.3);
}

[data-theme="dark"] {
    /* Готическая темная тема - темно-синяя палитра */
    --primary: #1e3a5f;
    --primary-dark: #0f1f35;
    --primary-light: #2d4f7a;
    --success: #10b981;
    --danger: #dc2626;
    --warning: #5a4a2a;
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: rgba(22, 27, 34, 0.9);
    --bg-input: rgba(22, 27, 34, 0.95);
    --text-primary: #e0e5eb;
    --text-secondary: #8b95a6;
    --border: rgba(30, 58, 95, 0.5);
    --glass-bg: rgba(22, 27, 34, 0.9);
    --glass-border: rgba(30, 58, 95, 0.6);
}

[data-theme="orange"] {
    /* Оранжевая тема */
    --primary: #f97316;
    --primary-dark: #ea580c;
    --primary-light: #fb923c;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-primary: #fff7ed;
    --bg-secondary: #ffedd5;
    --bg-card: rgba(255, 247, 237, 0.9);
    --bg-input: rgba(255, 247, 237, 0.95);
    --text-primary: #431407;
    --text-secondary: #7c2d12;
    --border: rgba(249, 115, 22, 0.2);
    --glass-bg: rgba(255, 247, 237, 0.8);
    --glass-border: rgba(249, 115, 22, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background-image: 
        radial-gradient(at 0% 0%, rgba(249, 115, 22, 0.1) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(251, 146, 60, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(249, 115, 22, 0.12) 0px, transparent 50%),
        linear-gradient(135deg, rgba(255, 247, 237, 0.98) 0%, rgba(255, 237, 213, 0.99) 100%);
}

[data-theme="dark"] body {
    background-image: 
        radial-gradient(at 0% 0%, rgba(30, 58, 95, 0.2) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(15, 31, 53, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(30, 58, 95, 0.18) 0px, transparent 50%),
        linear-gradient(135deg, rgba(13, 17, 23, 0.98) 0%, rgba(22, 27, 34, 0.99) 100%);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

[data-theme="orange"] body {
    background-image: 
        radial-gradient(at 0% 0%, rgba(249, 115, 22, 0.1) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(251, 146, 60, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(249, 115, 22, 0.12) 0px, transparent 50%),
        linear-gradient(135deg, rgba(255, 247, 237, 0.98) 0%, rgba(255, 237, 213, 0.99) 100%);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

/* Дополнительные стили для темной темы - градиенты на элементах (темно-синие) */
[data-theme="dark"] .data-card {
    background: linear-gradient(135deg, 
        rgba(22, 27, 34, 0.95) 0%, 
        rgba(15, 31, 53, 0.9) 50%,
        rgba(22, 27, 34, 0.95) 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 
                0 0 0 1px rgba(30, 58, 95, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .data-card:hover {
    background: linear-gradient(135deg, 
        rgba(15, 31, 53, 0.98) 0%, 
        rgba(30, 58, 95, 0.95) 50%,
        rgba(15, 31, 53, 0.98) 100%);
    box-shadow: 0 8px 30px rgba(30, 58, 95, 0.5), 
                0 0 0 1px rgba(30, 58, 95, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .stat-card {
    background: linear-gradient(135deg, 
        rgba(22, 27, 34, 0.95) 0%, 
        rgba(15, 31, 53, 0.9) 50%,
        rgba(22, 27, 34, 0.95) 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 
                0 0 0 1px rgba(30, 58, 95, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .statistics-metrics-bar {
    background: linear-gradient(135deg, 
        rgba(22, 27, 34, 0.98) 0%, 
        rgba(15, 31, 53, 0.95) 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 
                0 0 0 1px rgba(30, 58, 95, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Градиент для темной темы применяется к glass-container, а не к modern-nav */

[data-theme="dark"] .modal {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

[data-theme="dark"] .btn-secondary {
    background: linear-gradient(135deg, 
        rgba(22, 27, 34, 0.95) 0%, 
        rgba(15, 31, 53, 0.9) 100%);
    box-shadow: none;
}

[data-theme="dark"] .btn-secondary:hover {
    background: linear-gradient(135deg, 
        rgba(15, 31, 53, 0.98) 0%, 
        rgba(30, 58, 95, 0.95) 100%);
    box-shadow: none;
}

/* Премиальные градиенты для светлой темы - бело-оранжевые */
body:not([data-theme="dark"]) .data-card {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.98) 0%, 
        rgba(255, 250, 240, 0.95) 50%,
        rgba(255, 255, 255, 0.98) 100%);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.08), 
                0 0 0 1px rgba(251, 146, 60, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 1);
}

body:not([data-theme="dark"]) .data-card:hover {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(255, 250, 240, 0.98) 50%,
        rgba(255, 255, 255, 1) 100%);
    box-shadow: 0 8px 30px rgba(249, 115, 22, 0.12), 
                0 0 0 1px rgba(251, 146, 60, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 1);
}

body:not([data-theme="dark"]) .stat-card {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.98) 0%, 
        rgba(255, 250, 240, 0.95) 50%,
        rgba(255, 255, 255, 0.98) 100%);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.08), 
                0 0 0 1px rgba(251, 146, 60, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 1);
}

body:not([data-theme="dark"]) .stat-card:hover {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 1) 0%, 
        rgba(255, 250, 240, 0.98) 50%,
        rgba(255, 255, 255, 1) 100%);
    box-shadow: 0 8px 30px rgba(249, 115, 22, 0.12), 
                0 0 0 1px rgba(251, 146, 60, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 1);
}

body:not([data-theme="dark"]) .statistics-metrics-bar {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.98) 0%, 
        rgba(255, 250, 240, 0.95) 100%);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.08), 
                0 0 0 1px rgba(251, 146, 60, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 1);
}

body:not([data-theme="dark"]) .glass-container {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.98) 0%, 
        rgba(255, 250, 240, 0.95) 100%);
    box-shadow: 0 4px 20px rgba(249, 115, 22, 0.08), 
                0 0 0 1px rgba(251, 146, 60, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 1);
}

body:not([data-theme="dark"]) .modal {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

body:not([data-theme="dark"]) .btn-secondary {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(255, 250, 240, 0.9) 100%);
    box-shadow: none;
}

body:not([data-theme="dark"]) .btn-secondary:hover {
    background: linear-gradient(135deg, 
        rgba(255, 250, 240, 0.98) 0%, 
        rgba(255, 255, 255, 0.95) 100%);
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.15);
}

body:not([data-theme="dark"]) .tabs {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
}

body:not([data-theme="dark"]) .pagination {
    background: rgba(255, 247, 237, 0.7);
    border: 1px solid rgba(251, 146, 60, 0.2);
}

/* Стили для неавторизованного состояния - белый фон, скрыт весь контент */
body.not-authenticated {
    background: #ffffff !important;
    background-image: none !important;
    overflow: hidden !important;
    height: 100vh !important;
}

body.not-authenticated .modern-nav,
body.not-authenticated .tabs-container,
/* Скрываем контент во время проверки авторизации и когда не авторизован */
body.checking-auth .modern-nav,
body.checking-auth .tabs-container,
body.checking-auth #statistics-grid,
body.checking-auth #cards-grid,
body.checking-auth #passports-grid {
    visibility: hidden !important;
}

body.not-authenticated #card-modal,
body.not-authenticated #passport-modal {
    display: none !important;
    visibility: hidden !important;
}

body.not-authenticated #login-modal {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 10000 !important;
    background: var(--bg-primary) !important;
    backdrop-filter: none !important;
    padding: 20px !important;
}

body.not-authenticated #login-modal .modal-content {
    margin: auto !important;
    max-width: 400px !important;
    width: 100% !important;
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-xl) !important;
    position: relative !important;
    z-index: 10001 !important;
    color: var(--text-primary) !important;
}

/* Премиальные стили для модального окна логина в светлой теме */
body:not([data-theme="dark"]).not-authenticated #login-modal {
    background: linear-gradient(135deg, 
        rgba(248, 250, 252, 0.98) 0%, 
        rgba(255, 255, 255, 0.99) 100%) !important;
}

body:not([data-theme="dark"]).not-authenticated #login-modal .modal-content {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.98) 0%, 
        rgba(248, 250, 252, 0.95) 100%) !important;
    box-shadow: 0 20px 60px rgba(59, 130, 246, 0.12), 
                0 0 0 1px rgba(147, 197, 253, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

/* Премиальные стили для модального окна логина в темной теме */
[data-theme="dark"] body.not-authenticated #login-modal {
    background: linear-gradient(135deg, 
        rgba(13, 17, 23, 0.98) 0%, 
        rgba(22, 27, 34, 0.99) 100%) !important;
}

[data-theme="dark"] body.not-authenticated #login-modal .modal-content {
    background: linear-gradient(135deg, 
        rgba(22, 27, 34, 0.99) 0%, 
        rgba(15, 31, 53, 0.98) 100%) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 
                0 0 0 1px rgba(30, 58, 95, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(30, 58, 95, 0.6) !important;
}

[data-theme="dark"] body.not-authenticated #login-modal .modal-header h3 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] body.not-authenticated #login-modal .form-label {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] body.not-authenticated #login-modal .form-input {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] body.not-authenticated #login-modal .form-input:focus {
    border-color: var(--primary) !important;
    background: var(--bg-card) !important;
}

body.not-authenticated #login-modal .modal-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

body.not-authenticated #login-modal .modal-header h3 {
    margin: 0;
    flex: 1;
}

body.not-authenticated #login-modal .theme-switcher {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    margin-left: 16px;
}

/* Убеждаемся, что окно авторизации остается на месте даже при изменении классов */
#login-modal {
    transition: none !important;
    display: none !important; /* Скрыто по умолчанию */
}

/* Скрываем модальное окно во время проверки авторизации */
body.checking-auth #login-modal {
    display: none !important;
}

/* Показываем модальное окно только когда проверка завершилась и пользователь не авторизован */
body.not-authenticated #login-modal {
    display: flex !important;
}

body.authenticated {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh !important;
}

body.authenticated .tabs-container {
    visibility: visible !important;
}

body.authenticated .modern-nav,
body.authenticated .tabs-container {
    display: block !important;
}

body.authenticated #login-modal {
    display: none !important;
}

/* Modern Navigation */
.modern-nav {
    position: fixed;
    top: 0 !important;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 80px !important;
    max-height: 80px !important;
    max-width: 100%;
    z-index: 1000;
    overflow: hidden;
    border-radius: 0;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-top: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
    padding: 10px 24px !important;
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    align-content: center;
    box-shadow: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    height: 60px !important;
    max-height: 60px !important;
    min-height: 60px !important;
    box-sizing: border-box !important;
    overflow: hidden;
    line-height: 1;
}

.nav-logo-center {
    display: flex;
    justify-content: center;
    align-items: center;
    grid-column: 2;
    height: 60px !important;
    max-height: 60px !important;
    min-height: 60px !important;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
    align-self: stretch;
    padding: 0;
    margin: 0;
}

.nav-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    grid-column: 3;
}

/* Градиент для темной темы на glass-container */
[data-theme="dark"] .glass-container {
    background: linear-gradient(135deg, 
        rgba(22, 27, 34, 0.98) 0%, 
        rgba(15, 31, 53, 0.95) 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 
                0 0 0 1px rgba(30, 58, 95, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.glass-container:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

.modern-nav .glass-container:hover {
    box-shadow: none;
    transform: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    grid-column: 1;
    justify-content: flex-start;
}

.brand-logo {
    display: block;
    max-height: 137px !important;
    height: 137px !important;
    max-width: 300px;
    width: auto;
    object-fit: cover;
    object-position: center;
    flex-shrink: 0;
    vertical-align: top;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Логотип всегда оранжевый */
    filter: brightness(0) saturate(100%) invert(48%) sepia(93%) saturate(1352%) hue-rotate(1deg) brightness(98%) contrast(101%);
}

.logo-dot {
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.5);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.brand span {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.nav-logo-center .brand-logo {
    max-height: 137px !important;
    height: 137px !important;
    max-width: 300px;
    object-fit: cover;
    object-position: center;
    /* Логотип всегда оранжевый */
    filter: brightness(0) saturate(100%) invert(48%) sepia(93%) saturate(1352%) hue-rotate(1deg) brightness(98%) contrast(101%);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Traffic Toggle */
.traffic-toggle-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: 4px;
}

.geo-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  user-select: none;
  white-space: nowrap;
}

.tjs-flag {
  width: 30px;
  height: 23px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.traffic-toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.traffic-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.traffic-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(239, 68, 68, 0.3);
  transition: 0.3s;
  border-radius: 26px;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.traffic-toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.traffic-toggle input:checked + .traffic-toggle-slider {
  background-color: rgba(34, 197, 94, 0.3);
  border-color: rgba(34, 197, 94, 0.5);
}

.traffic-toggle input:checked + .traffic-toggle-slider:before {
  transform: translateX(24px);
  background-color: #ffffff;
}

.traffic-toggle input:focus + .traffic-toggle-slider {
  box-shadow: 0 0 1px rgba(59, 130, 246, 0.5);
}

.traffic-toggle:hover .traffic-toggle-slider {
  opacity: 0.9;
}

/* Dark theme adjustments */
[data-theme="dark"] .traffic-toggle-slider {
  background-color: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.4);
}

[data-theme="dark"] .traffic-toggle input:checked + .traffic-toggle-slider {
  background-color: rgba(34, 197, 94, 0.25);
  border-color: rgba(34, 197, 94, 0.4);
}


.icon-btn {
    width: 42px !important;
    height: 42px !important;
    border-radius: 50% !important;
    border: 1.5px solid #D4A574 !important;
    background: linear-gradient(135deg, #F5E6D3 0%, #E8D5B7 100%) !important;
    color: #8B6F47 !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(139, 111, 71, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
}

button.icon-btn {
    color: #8B6F47 !important;
}

.icon-btn:hover {
    background: linear-gradient(135deg, #E8D5B7 0%, #D4A574 100%) !important;
    border-color: #C19A6B !important;
    box-shadow: 0 4px 12px rgba(139, 111, 71, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.7) !important;
    transform: translateY(-2px);
}

.icon-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(139, 111, 71, 0.2), inset 0 1px 2px rgba(139, 111, 71, 0.1) !important;
    background: linear-gradient(135deg, #D4A574 0%, #C19A6B 100%) !important;
}

.icon-btn svg {
    width: 20px !important;
    height: 20px !important;
    display: flex;
    justify-content: center;
}

svg.lucide {
    color: #8B6F47 !important;
}

/* Коричневые иконки в навигации для светлой темы */
body:not([data-theme="dark"]) .icon-btn svg,
body:not([data-theme="dark"]) .icon-btn svg.lucide {
    color: #8B6F47 !important;
    stroke: #8B6F47 !important;
    stroke-width: 2;
}

body:not([data-theme="dark"]) .icon-btn:hover svg,
body:not([data-theme="dark"]) .icon-btn:hover svg.lucide {
    color: #6B5238 !important;
    stroke: #6B5238 !important;
}

svg {
    background-clip: unset;
    -webkit-background-clip: unset;
    color: rgba(140, 170, 222, 1);
}

/* Tabs */
.tabs-container {
    margin-top: 100px;
    padding: 0 20px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: visible;
    min-height: 0;
}

.tabs {
    display: flex;
    gap: 8px;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 6px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
    margin-bottom: 32px;
}

.tabs button {
    flex: 1;
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.tabs button.active {
    background: #f97316 !important;
    color: white !important;
    box-shadow: 0 1px 2px 0 rgba(249, 115, 22, 0.2) !important;
    border-radius: 16px !important;
}

.tabs button:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.05);
}

.tabs button.active svg,
.tabs button.active svg.lucide {
    color: white !important;
    stroke: white !important;
}

.tabs button.active svg path,
.tabs button.active svg rect,
.tabs button.active svg circle {
    stroke: white !important;
}

[data-theme="dark"] .tabs button.active {
    background: #f97316 !important;
    box-shadow: 0 1px 2px 0 rgba(249, 115, 22, 0.3) !important;
    border-radius: 16px !important;
    color: white !important;
}

/* Иконки активного таба в темной теме - белые */
[data-theme="dark"] .tabs button.active svg,
[data-theme="dark"] .tabs button.active svg.lucide {
    color: white !important;
    stroke: white !important;
}

[data-theme="dark"] .tabs button.active svg path,
[data-theme="dark"] .tabs button.active svg rect,
[data-theme="dark"] .tabs button.active svg circle {
    stroke: white !important;
}

[data-theme="dark"] .tabs {
    background: #1f2937 !important;
    border: 1px solid #374151 !important;
}

[data-theme="dark"] .tabs button {
    box-shadow: none;
}

/* Иконки табов в темной теме - такой же цвет как у текста */
[data-theme="dark"] .tabs button svg,
[data-theme="dark"] .tabs button svg.lucide {
    color: var(--text-secondary) !important;
    stroke: var(--text-secondary) !important;
}

[data-theme="dark"] .tabs button svg path,
[data-theme="dark"] .tabs button svg rect,
[data-theme="dark"] .tabs button svg circle {
    stroke: var(--text-secondary) !important;
}

[data-theme="dark"] .tabs button:hover svg,
[data-theme="dark"] .tabs button:hover svg.lucide {
    color: var(--text-primary) !important;
    stroke: var(--text-primary) !important;
}

[data-theme="dark"] .tabs button:hover svg path,
[data-theme="dark"] .tabs button:hover svg rect,
[data-theme="dark"] .tabs button:hover svg circle {
    stroke: var(--text-primary) !important;
}

[data-theme="dark"] .icon-btn {
    background: linear-gradient(135deg, rgba(22, 27, 34, 0.95) 0%, rgba(15, 31, 53, 0.95) 100%) !important;
    border-color: rgba(30, 58, 95, 0.6) !important;
    color: #e0e5eb !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

[data-theme="dark"] .icon-btn:hover {
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.8) 0%, rgba(22, 27, 34, 0.95) 100%) !important;
    border-color: rgba(30, 58, 95, 0.8) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
    transform: translateY(-2px);
}

[data-theme="dark"] .icon-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(0, 0, 0, 0.3) !important;
    background: linear-gradient(135deg, rgba(15, 31, 53, 0.95) 0%, rgba(22, 27, 34, 0.95) 100%) !important;
}

[data-theme="dark"] .icon-btn svg,
[data-theme="dark"] .icon-btn svg.lucide {
    color: #e0e5eb !important;
    stroke: #e0e5eb !important;
    stroke-width: 2;
}

[data-theme="dark"] .icon-btn:hover svg,
[data-theme="dark"] .icon-btn:hover svg.lucide {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

.tabs button i {
    width: 18px;
    height: 18px;
}

/* Content Area */
.tab-content {
    display: none;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(10px);
    overflow: visible;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes fadeInScale {
    from { 
        opacity: 0; 
        transform: scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: scale(1); 
    }
}

.tab-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.content-header {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
    box-sizing: border-box;
    overflow: visible; /* Изменено с hidden на visible, чтобы dropdown не обрезался */
}

/* Специальная верстка для заголовка статистики - h2 и statistics-metrics-bar в одной строке */
.statistics-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Первая строка: h2 и statistics-metrics-bar */
.statistics-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 16px;
}

.statistics-header-row h2 {
    margin: 0;
    flex-shrink: 0;
}

/* statistics-metrics-bar прижат к правому краю */
.statistics-header-row #statistics-metrics-bar {
    margin-left: auto;
    margin-right: 0;
    flex-shrink: 0;
    width: fit-content;
    max-width: none;
    min-width: auto;
}

.content-header > div {
    box-sizing: border-box;
    max-width: 100%;
    overflow: visible; /* Изменено с hidden на visible, чтобы dropdown не обрезался */
}

.header-title-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 24px;
    flex-wrap: wrap;
}

.content-header h2 {
    margin: 0;
    flex-shrink: 0;
}

.content-header h2 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cards-statistics {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-left: auto;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.stat-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.statistics-metrics-bar {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin: 0;
    height: 50px;
    min-height: 50px;
    max-height: 50px;
    box-sizing: border-box;
}

/* statistics-metrics-bar в заголовке статистики - ограниченная ширина по содержимому */
.statistics-header-row #statistics-metrics-bar {
    width: fit-content !important;
    max-width: none !important;
    min-width: auto !important;
    flex: 0 0 auto !important;
    white-space: nowrap;
    height: 50px;
    overflow: visible;
}

/* Контейнер для метрик статистики - выравнивание по ширине карточек */
.statistics-metrics-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.statistics-metrics-container .statistics-metrics-bar {
    width: 100%;
    flex: 1;
}

.turnover-divider {
    width: 1px;
    height: 24px;
    margin: 0 12px;
    flex-shrink: 0;
    background: var(--text-secondary, rgba(0, 0, 0, 0.4));
    box-sizing: border-box;
}

[data-theme="dark"] .turnover-divider {
    background: rgba(255, 255, 255, 0.35);
}

#reset-turnover-btn {
    margin-left: auto;
    padding: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-sizing: border-box;
}

#reset-turnover-btn i,
#reset-turnover-btn svg {
    color: #ffffff !important;
    width: 18px;
    height: 18px;
}

#reset-turnover-btn:hover {
    background: var(--primary-hover, var(--primary));
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#reset-turnover-btn:active {
    transform: translateY(0);
}

.metric-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
    flex: 1;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

#turnover-metrics-bar {
    gap: 12px;
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
}

#total-success-metrics-bar {
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
}

#turnover-metrics-bar .metric-item {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
}

.metric-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.metric-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}


.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* Стили для поиска карт */
.content-header-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    overflow: visible; /* Убеждаемся, что dropdown не обрезается */
}

.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 16px;
    flex-wrap: wrap;
    overflow: visible; /* Убеждаемся, что dropdown не обрезается */
    position: relative; /* Для правильного позиционирования dropdown */
}

.search-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
    overflow: visible; /* Убеждаемся, что dropdown не обрезается */
    position: relative; /* Для правильного позиционирования dropdown */
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    height: 54px; /* Фиксированная высота для выравнивания с поиском */
}

.search-type-select {
    padding: 8px 32px 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

/* Селект типа поиска - фиксированная ширина */
#cards-search-type {
    width: 170px;
    min-width: 170px;
    max-width: 170px;
    flex: 0 0 170px;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
}

/* Селект сортировки баланса - уменьшенная ширина */
#cards-balance-sort {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
    flex: 0 0 140px;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
}

.search-type-select:hover {
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.search-type-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.search-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  justify-content: flex-end;
  align-self: flex-end;
  margin-right: 24px;
  overflow: visible; /* Убеждаемся, что dropdown не обрезается */
  position: relative; /* Для правильного позиционирования dropdown */
}

.search-field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    line-height: 1.2;
    height: 16px;
    display: flex;
    align-items: center;
}

.search-field-group .search-type-select {
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    width: 100%;
    box-sizing: border-box;
}

/* Ограничиваем ширину custom-select-wrapper внутри search-field-group */
.search-field-group .custom-select-wrapper {
    width: auto;
    flex-shrink: 0;
    position: relative; /* Важно для правильного позиционирования dropdown */
    z-index: 1000; /* Убеждаемся, что dropdown будет поверх других элементов */
    overflow: visible; /* Убеждаемся, что dropdown не обрезается */
}

/* Ограничиваем ширину custom-select-button внутри search-field-group */
.search-field-group .custom-select-button {
  width: 170px;
  min-width: 170px;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    height: 36px;
    align-self: flex-end;
}

.search-input {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    width: 250px;
    min-width: 200px;
    max-width: 100%;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    outline: none;
    transition: all 0.2s;
    flex: 1;
    box-sizing: border-box;
}

.search-icon-btn {
    padding: 0 !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px;
    flex-shrink: 0;
}

.search-icon-btn i,
.search-icon-btn svg {
    width: 18px !important;
    height: 18px !important;
    display: block !important;
    flex-shrink: 0;
}

.search-icon-btn svg.lucide {
    width: 18px !important;
    height: 18px !important;
}

.search-icon-btn span {
    display: none;
}

.search-icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.search-icon-btn:disabled svg {
    opacity: 0.5;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

[data-theme="dark"] .search-type-select:not(.custom-select-wrapper > select),
[data-theme="dark"] .search-input {
    background: rgba(22, 27, 34, 0.95);
    border-color: rgba(30, 58, 95, 0.6);
}

/* Скрываем оригинальный select в темной теме, если он внутри кастомного селекта */
/* Оригинальный select полностью удаляется из DOM через JavaScript */

[data-theme="dark"] .search-type-select:not(.custom-select-wrapper > select) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238c9aaf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

[data-theme="dark"] .search-type-select:hover,
[data-theme="dark"] .search-input:hover {
    border-color: rgba(59, 130, 246, 0.5);
}

[data-theme="dark"] .search-type-select:hover {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

[data-theme="dark"] .search-type-select:focus,
[data-theme="dark"] .search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .search-type-select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Квадратная кнопка поиска с иконкой */
.btn.search-icon-btn {
    padding: 0 !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    gap: 0 !important;
    align-self: flex-end;
    flex-shrink: 0;
}

.btn svg,
.btn svg.lucide {
    color: white !important;
    stroke: white !important;
}

.btn svg path,
.btn svg rect,
.btn svg circle {
    stroke: white !important;
}

.modal-buttons .btn {
    justify-content: center;
}

.modal-buttons .btn i {
    display: none;
}

.btn:hover {
    transform: none;
    box-shadow: none;
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-secondary svg,
.btn-secondary svg.lucide {
    color: var(--text-primary) !important;
    stroke: var(--text-primary) !important;
}

.btn-secondary svg path,
.btn-secondary svg rect,
.btn-secondary svg circle {
    stroke: var(--text-primary) !important;
}

body:not([data-theme="dark"]) .btn-secondary svg,
body:not([data-theme="dark"]) .btn-secondary svg.lucide {
    color: #0f172a !important;
    stroke: #0f172a !important;
}

body:not([data-theme="dark"]) .btn-secondary svg path,
body:not([data-theme="dark"]) .btn-secondary svg rect,
body:not([data-theme="dark"]) .btn-secondary svg circle {
    stroke: #0f172a !important;
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    box-shadow: none;
}

.btn i {
    width: 18px;
    height: 18px;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    margin-bottom: 32px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    contain: layout style;
}

#passports-grid {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.data-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 14px 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-height: 80px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    contain: layout style paint;
}

/* Для паспортов - ограничиваем ширину и выравнивание */
#passports-grid .data-card {
    align-items: flex-start !important;
}

/* Обертка для основной строки карты (header + body + footer) */
.data-card > .card-main-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  flex-shrink: 0;
  min-height: 64px;
    box-sizing: border-box;
}

.data-card.fade-in {
    animation: fadeInScale 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.data-card.slide-in {
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Задержка для последовательного появления карточек */
.data-card:nth-child(1) { animation-delay: 0.05s; }
.data-card:nth-child(2) { animation-delay: 0.1s; }
.data-card:nth-child(3) { animation-delay: 0.15s; }
.data-card:nth-child(4) { animation-delay: 0.2s; }
.data-card:nth-child(5) { animation-delay: 0.25s; }
.data-card:nth-child(6) { animation-delay: 0.3s; }
.data-card:nth-child(n+7) { animation-delay: 0.35s; }

.data-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
    border-width: 1px;
}

.card-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  position: relative;
  gap: 12px;
  min-width: 60px;
  flex-shrink: 0;
  padding-right: 12px;
  border-right: 1px solid var(--border);
}

@media (min-width: 769px) {
    .card-header {
        display: flex !important;
        flex-shrink: 0 !important;
    }
}

.card-device-id {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 65px;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
    user-select: none;
}

.card-device-id:hover {
    opacity: 0.8;
}

.card-id-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
}

.card-id-column {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 2px 5px;
    border-radius: 4px;
    flex-shrink: 0;
    white-space: nowrap;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    user-select: none;
}

.card-id-column:hover {
    opacity: 0.8;
}

.card-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 0;
  position: relative;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  justify-content: center;
  align-items: center;
}

/* Отступ слева для первого поля карты (второй дочерний элемент после обертки с ID) */
.card-body > .card-field:nth-child(2) {
  margin-left: 8px;
}

.card-field-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
  justify-content: center;
  overflow: hidden;
}

.card-field-content .card-label {
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
}

.card-field-content .card-value {
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-body {
  flex: 1;
  display: grid;
  grid-template-columns: 45px minmax(140px, 260px) 60px 70px 95px 75px 90px 85px;
  gap: 4px 6px;
  align-items: center;
  padding: 0 8px;
  position: relative;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

#cards-grid .card-body {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

/* Для паспортов - 4 колонки */
#passports-grid {
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#passports-grid .card-body {
    grid-template-columns: 50px 180px 140px 140px 180px !important;
    max-width: none !important;
    overflow: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

/* Стили для трейдеров - аналогично паспортам */
#traders-grid {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

#traders-grid .card-body {
    grid-template-columns: 50px 1.5fr 1.5fr 1.5fr 1fr 1fr 1fr !important;
    max-width: none !important;
    overflow: visible !important;
    width: 100% !important;
    box-sizing: border-box !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    gap: 8px 10px !important;
    align-items: center !important;
    padding: 0 12px !important;
    position: relative !important;
}

/* Дополнительное жесткое ограничение для трейдеров */
#traders-grid .data-card {
    align-items: flex-start !important;
    max-width: 100% !important;
    overflow: hidden !important;
    width: 100% !important;
}

#traders-grid .data-card .card-main-row {
    align-items: center !important;
    gap: 20px !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
}

#traders-grid .data-card .card-body {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
    overflow: visible !important;
    align-self: center !important;
    display: grid !important;
}

/* Ограничение ширины card-footer для трейдеров */
#traders-grid .card-footer {
    width: auto !important;
    max-width: fit-content !important;
    flex-shrink: 0 !important;
    align-self: center !important;
    justify-content: flex-start !important;
    display: flex !important;
    align-items: center !important;
    height: auto !important;
}

/* Убеждаемся, что кнопки действий не растягиваются и центрированы по высоте */
#traders-grid .card-action-buttons {
    flex-shrink: 0 !important;
    width: auto !important;
    max-width: fit-content !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#traders-grid .action-btn.edit-btn,
#traders-grid .action-btn.delete-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Ограничиваем ширину полей */
#traders-grid .card-field {
    max-width: 100% !important;
    overflow: hidden !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Специфичные стили для трейдеров - используем стандартные размеры шрифтов */
/* Не переопределяем font-size, используем стандартные значения из .card-label и .card-value */
#traders-grid .card-label {
    /* Используем стандартный размер 10px, не переопределяем */
    margin-top: 0 !important;
    margin-bottom: 4px !important;
    line-height: 1.2 !important;
    height: auto !important;
}

#traders-grid .card-value {
    /* Используем стандартный размер 13px, не переопределяем */
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Дополнительное жесткое ограничение для паспортов */
#passports-grid .data-card {
    align-items: flex-start !important;
    max-width: 100% !important;
    overflow: hidden !important;
    width: 100% !important;
}

#passports-grid .data-card .card-main-row {
    align-items: center !important;
    gap: 20px !important;
    width: 100% !important;
}

#passports-grid .data-card .card-body {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
    overflow: hidden !important;
}

/* Ограничение ширины card-footer для паспортов */
#passports-grid .card-footer {
    width: auto !important;
    max-width: fit-content !important;
    flex-shrink: 0 !important;
    align-self: center !important;
    justify-content: flex-start !important;
}

/* Убеждаемся, что кнопки действий не растягиваются */
#passports-grid .card-action-buttons {
    flex-shrink: 0 !important;
    width: auto !important;
    max-width: fit-content !important;
}

/* Ограничиваем ширину полей */
#passports-grid .card-field {
    max-width: 100% !important;
    overflow: hidden !important;
}

#passports-grid .card-value {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Разделитель справа от card-body (после всех полей) */
.card-body::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 30px;
    background: var(--border);
    background-color: rgba(148, 163, 184, 0.5);
    z-index: 1;
}

/* Десктоп версия - гарантируем правильное отображение */
@media (min-width: 769px) {
    .data-card {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    #passports-grid .data-card {
        align-items: flex-start !important;
    }
    
    .data-card > .card-main-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        flex-shrink: 0 !important;
        min-height: 64px !important;
    }
    
    .card-body {
        flex: 1 1 auto !important;
        display: grid !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: none !important;
    }
    
    #cards-grid .card-body {
        grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
        gap: 0 6px !important;
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }
    
    #passports-grid .card-body {
        grid-template-columns: 50px 180px 140px 140px 180px !important;
        max-width: none !important;
        overflow: hidden !important;
        width: 100% !important;
        box-sizing: border-box !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }
    
    #passports-grid .data-card .card-main-row {
        width: 100% !important;
    }
    
    #passports-grid .data-card .card-body {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        max-width: none !important;
        width: auto !important;
        overflow: hidden !important;
    }
    
    #passports-grid .card-footer {
        width: auto !important;
        max-width: fit-content !important;
        justify-content: flex-start !important;
        flex: 0 0 auto !important;
        align-self: center !important;
    }
    
    /* Стили для трейдеров в медиа-запросе */
    #traders-grid .card-body {
        grid-template-columns: 50px 1.5fr 1.5fr 1.5fr 1fr 1fr 1fr !important;
        max-width: none !important;
        overflow: visible !important;
        width: 100% !important;
        box-sizing: border-box !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        gap: 8px 10px !important;
        align-items: center !important;
        padding: 0 12px !important;
        position: relative !important;
    }
    
    #traders-grid .data-card .card-main-row {
        width: 100% !important;
        align-items: center !important;
        display: flex !important;
        flex-direction: row !important;
    }
    
    #traders-grid .data-card .card-body {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        max-width: none !important;
        width: auto !important;
        overflow: hidden !important;
    }
    
    #traders-grid .card-footer {
        width: auto !important;
        max-width: fit-content !important;
        justify-content: flex-start !important;
        flex: 0 0 auto !important;
        align-self: center !important;
        display: flex !important;
        align-items: center !important;
    }
    
    #traders-grid .card-action-buttons {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .card-field {
        min-width: 0 !important;
        width: auto !important;
    }
    
    .card-field:not(:last-child)::after {
        display: block !important;
        visibility: visible !important;
    }
    
    /* Гарантируем, что слайдер только в footer, не в body */
    .card-body .status-toggle {
        display: none !important;
    }
    
    .card-footer {
        display: flex !important;
        flex-shrink: 0 !important;
        align-items: center !important;
        gap: 16px !important;
    }
    
    .card-footer .status-toggle {
        display: inline-block !important;
        flex-shrink: 0 !important;
    }
    
    .card-action-buttons {
        display: flex !important;
        gap: 8px !important;
        flex-shrink: 0 !important;
    }
}

/* Определение card-field уже есть выше */

/* Разделители между полями - для всех полей кроме последнего */
.card-field:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 30px;
  background: var(--border);
  background-color: rgba(148, 163, 184, 0.5);
  z-index: 2;
  display: block !important;
}

/* Убеждаемся, что разделители видны для всех полей в картах */
#cards-grid .card-field:not(:last-child)::after {
    display: block !important;
    visibility: visible !important;
}

/* Убеждаемся, что разделители видны для всех полей в паспортах */
#passports-grid .card-field:not(:last-child)::after {
    display: block !important;
    visibility: visible !important;
}

/* Специальный стиль для значения с индикатором лимита */
.limit-value {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0;
}

/* Центрирование для поля месячного лимита */
#passports-grid .card-field:last-child .card-label {
    text-align: center;
}

.card-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  margin-bottom: 4px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
  max-width: 100%;
}

.card-field:nth-child(2) .card-value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Поле "ДО ОСТЫВАНИЯ" (6-е поле после card-id-column) - текст в одну строку, по размеру содержимого */
.card-field:nth-child(6) {
  overflow: visible;
  width: auto;
  min-width: auto;
}

.card-field:nth-child(6) .card-value {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  font-size: 12px;
  width: auto;
  min-width: auto;
  max-width: none;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    min-width: auto;
    width: 168px;
    flex-shrink: 0;
    padding-left: 0;
    visibility: visible !important;
    position: relative;
    overflow: visible;
}

@media (min-width: 769px) {
    .card-footer {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 16px !important;
        flex-shrink: 0 !important;
        visibility: visible !important;
        padding-left: 0 !important;
    }
}

.card-footer > div:first-child {
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-footer .status-toggle {
    display: flex;
    align-items: center;
    margin: 0;
    vertical-align: middle;
}

/* Уменьшаем толщину иконок замков */
.card-footer i[data-lucide="lock"],
.card-footer svg[data-lucide="lock"],
i[data-lucide="lock"],
svg[data-lucide="lock"],
.lucide-lock,
.linked-requisite-status-badge i[data-lucide="lock"],
.linked-requisite-status-badge svg[data-lucide="lock"] {
  stroke-width: 1 !important;
}

.card-footer i[data-lucide="lock"] {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    width: 35px;
    height: 35px;
}

.card-action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-self: end;
    visibility: visible !important;
}

@media (min-width: 769px) {
    .card-action-buttons {
        display: flex !important;
        gap: 8px !important;
        align-items: center !important;
        visibility: visible !important;
        flex-shrink: 0 !important;
    }
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50% !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    color: #5A3F1F !important;
    transition: all 0.1s ease !important;
    visibility: visible !important;
    box-shadow: none !important;
    filter: none !important;
}

@media (min-width: 769px) {
    .action-btn {
        display: flex !important;
        visibility: visible !important;
        flex-shrink: 0 !important;
    }
}

.action-btn i {
    width: 18px;
    height: 18px;
    color: #5A3F1F !important;
    stroke-width: 2;
}

.action-btn:hover {
    background: transparent !important;
    border: none !important;
    color: #4A2F0F !important;
    box-shadow: none !important;
    filter: none !important;
    transform: translateY(-1px);
}

.action-btn:active {
    transform: translateY(1px);
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    filter: none !important;
    color: #3A1F0F !important;
}

.action-btn.edit-btn:hover {
    background: transparent !important;
    border: none !important;
    color: #4A2F0F !important;
}

.action-btn.delete-btn:hover {
    background: transparent !important;
    border: none !important;
    color: #4A2F0F !important;
}

.action-btn i svg,
.action-btn svg {
    color: #5A3F1F !important;
    stroke: #5A3F1F !important;
    stroke-width: 2;
    fill: none !important;
}

.action-btn:hover i,
.action-btn:hover i svg,
.action-btn:hover svg {
    color: #4A2F0F !important;
    stroke: #4A2F0F !important;
}

/* Ретро стиль для темной темы */
[data-theme="dark"] .action-btn {
    background: transparent !important;
    border: none !important;
    color: #c0d0e0 !important;
    box-shadow: none !important;
    filter: none !important;
}

[data-theme="dark"] .action-btn:hover {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    box-shadow: none !important;
    filter: none !important;
    transform: translateY(-1px);
}

[data-theme="dark"] .action-btn:active {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    filter: none !important;
    transform: translateY(1px);
    color: #a0b0c0 !important;
}

[data-theme="dark"] .action-btn.edit-btn:hover {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
}

[data-theme="dark"] .action-btn.delete-btn:hover {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
}

[data-theme="dark"] .action-btn i {
    color: #e0e5eb !important;
}

[data-theme="dark"] .action-btn i svg,
[data-theme="dark"] .action-btn svg {
    color: #e0e5eb !important;
    stroke: #e0e5eb !important;
    stroke-width: 2;
}

[data-theme="dark"] .action-btn:hover i,
[data-theme="dark"] .action-btn:hover i svg,
[data-theme="dark"] .action-btn:hover svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

[data-theme="dark"] .action-btn.delete-btn:hover i,
[data-theme="dark"] .action-btn.delete-btn:hover i svg,
[data-theme="dark"] .action-btn.delete-btn:hover svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

.status-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
    visibility: visible !important;
}

@media (min-width: 769px) {
    .status-toggle {
        display: inline-block !important;
        visibility: visible !important;
        flex-shrink: 0 !important;
    }
    
    .card-body .status-toggle {
        display: none !important;
    }
    
    .card-footer .status-toggle {
        display: inline-block !important;
        visibility: visible !important;
    }
}

.status-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.status-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #cbd5e1;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 28px;
}

.status-toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.status-toggle input:checked + .status-toggle-slider {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.status-toggle input:checked + .status-toggle-slider:before {
    transform: translateX(20px);
}

/* Заблокированный тумблер (карта пролита, ожидает остывания) */
.status-toggle input:disabled {
    cursor: not-allowed;
}

.status-toggle input:disabled + .status-toggle-slider {
    cursor: not-allowed;
    opacity: 0.6;
    background: #94a3b8;
    position: relative;
}

.status-toggle input:disabled + .status-toggle-slider:before {
    background: #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.status-toggle input:disabled:checked + .status-toggle-slider {
    background: #94a3b8;
}

.status-toggle input:disabled:checked + .status-toggle-slider:before {
    background: #e2e8f0;
}

/* Визуальная индикация заблокированного состояния */
/* Иконка замочка теперь отображается слева от слайдера через HTML */

.status-toggle input:disabled + .status-toggle-slider.cooldown-locked {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.status-toggle input:disabled:checked + .status-toggle-slider.cooldown-locked {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Кастомный чекбокс для выбора карточек */
.card-checkbox-wrapper {
    position: absolute;
    top: 12px;
    right: 12px;
    left: auto;
    z-index: 10;
    pointer-events: none;
    width: 20px;
    height: 20px;
    display: block !important;
    visibility: visible !important;
}

.card-checkbox-wrapper .card-checkbox-label {
    pointer-events: all !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    visibility: visible !important;
}

.card-checkbox-label {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    user-select: none !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.card-checkbox {
    position: absolute !important;
    opacity: 0 !important;
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: auto !important; /* Разрешаем клики для переключения */
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    cursor: pointer !important;
    z-index: 3 !important; /* Поверх кастомного элемента для кликов */
    top: 0 !important;
    left: 0 !important;
}

.card-checkbox-custom {
    position: relative !important;
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    background: #ffffff !important;
    border: 1px solid #d1d5db !important;
    border-radius: 4px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
    flex-shrink: 0 !important;
    pointer-events: none !important;
    box-sizing: border-box !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 1 !important; /* Под input для видимости */
}

.card-checkbox-label:hover .card-checkbox-custom {
    border-color: #f97316 !important;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.1) !important;
}

.card-checkbox:checked ~ .card-checkbox-custom,
.card-checkbox-custom.checked {
    background: #f97316 !important;
    border-color: #f97316 !important;
    box-shadow: 0 1px 2px 0 rgba(249, 115, 22, 0.2) !important;
}

.card-checkbox:checked ~ .card-checkbox-custom::after,
.card-checkbox-custom.checked::after {
    content: '' !important;
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) rotate(45deg) !important;
    width: 5px !important;
    height: 10px !important;
    border: solid white !important;
    border-width: 0 2px 2px 0 !important;
    border-radius: 1px !important;
    display: block !important;
}

.card-checkbox:focus + .card-checkbox-custom {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.card-checkbox:disabled + .card-checkbox-custom {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-secondary);
}

/* Темная тема для чекбокса */
[data-theme="dark"] .card-checkbox-custom {
    background: #1f2937 !important;
    border-color: #4b5563 !important;
}

[data-theme="dark"] .card-checkbox-label:hover .card-checkbox-custom {
    border-color: #f97316 !important;
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2) !important;
}

[data-theme="dark"] .card-checkbox:checked ~ .card-checkbox-custom,
[data-theme="dark"] .card-checkbox-custom.checked {
    background: #f97316 !important;
    border-color: #f97316 !important;
    box-shadow: 0 1px 2px 0 rgba(249, 115, 22, 0.3) !important;
}

/* Плавающая кнопка массового добавления в группу */
.bulk-group-button {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 16px 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    display: none;
    align-items: center;
    gap: 16px;
    min-width: 700px !important;
    max-width: 90vw;
    box-sizing: border-box;
}

.bulk-group-content {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    flex-wrap: nowrap !important;
}

.bulk-group-selected-count {
    font-weight: 600;
    color: #1f2937 !important;
    font-size: 14px;
    white-space: nowrap;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.bulk-group-count {
    color: #f97316 !important;
    font-weight: 700;
}

.bulk-group-label {
    font-size: 14px;
    color: #6b7280 !important;
    white-space: nowrap;
}

#bulk-group-select-wrapper {
    flex: 1;
    min-width: 180px;
}

.bulk-group-apply-btn,
.bulk-group-cancel-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.bulk-group-apply-btn {
    background: #f97316 !important;
    color: #ffffff !important;
    border: none !important;
}

.bulk-group-apply-btn:hover {
    background: #ea580c !important;
    box-shadow: 0 2px 4px rgba(249, 115, 22, 0.3) !important;
}

.bulk-group-cancel-btn {
    background: #ffffff !important;
    color: #6b7280 !important;
    border: 1px solid #e5e7eb !important;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
}

.bulk-group-cancel-btn:hover {
    background: #f9fafb !important;
    border-color: #d1d5db !important;
    color: #374151 !important;
}

.bulk-group-cancel-btn i {
    width: 18px !important;
    height: 18px !important;
    display: block !important;
    line-height: 1 !important;
}

.bulk-group-cancel-btn i svg,
.bulk-group-cancel-btn svg {
    width: 18px !important;
    height: 18px !important;
    display: block !important;
    color: inherit !important;
    stroke: currentColor !important;
    stroke-width: 2.5 !important;
    fill: none !important;
}

/* Темная тема для кнопки группировки */
[data-theme="dark"] .bulk-group-button {
    background: #1f2937 !important;
    border-color: #374151 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2) !important;
}

[data-theme="dark"] .bulk-group-apply-btn {
    background: #f97316 !important;
}

[data-theme="dark"] .bulk-group-apply-btn:hover {
    background: #ea580c !important;
}

[data-theme="dark"] .bulk-group-cancel-btn {
    background: #1f2937 !important;
    border-color: #4b5563 !important;
    color: #9ca3af !important;
}

[data-theme="dark"] .bulk-group-cancel-btn:hover {
    background: #374151 !important;
    border-color: #6b7280 !important;
    color: #d1d5db !important;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .bulk-group-button {
        left: 10px;
        right: 10px;
        transform: none;
        min-width: auto;
        width: calc(100% - 20px);
        padding: 12px 16px;
    }
    
    .bulk-group-content {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        flex-wrap: nowrap !important;
    }
    
    .bulk-group-button {
        min-width: auto !important;
    }
    
    #bulk-group-select-wrapper {
        width: 100%;
        min-width: auto;
    }
    
    .bulk-group-apply-btn {
        width: 100%;
    }
}

/* Заблокированные карты */
.blocked-indicator {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 10px 12px !important;
  background: rgba(239, 68, 68, 0.15) !important;
  border: 1px solid #ef4444 !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  color: #ef4444 !important;
  flex-shrink: 0 !important;
  gap: 4px !important;
  min-width: auto !important;
  width: fit-content !important;
  max-width: 122px !important;
  height: fit-content !important;
  box-sizing: border-box !important;
  text-align: center !important;
  margin: 0 auto !important;
  align-self: center !important;
  white-space: normal !important;
}

.blocked-timer {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
}

/* Стили для blocked-label (как cooldown-label) */
.blocked-label {
  color: #ef4444 !important;
  font-weight: 600 !important;
  font-size: 11px !important;
  display: block !important;
  line-height: 1.2 !important;
  white-space: normal !important;
  text-align: center !important;
}

/* Стили для blocked-timer в card-field (как cooldown-timer) */
.card-field .blocked-timer {
  font-family: inherit !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: #ef4444 !important;
  letter-spacing: 0 !important;
  white-space: normal !important;
  flex-shrink: 0 !important;
  display: block !important;
  line-height: 1.2 !important;
  word-wrap: break-word !important;
  font-variant-numeric: tabular-nums;
}

/* Желтая плашка для карт в остывании */
/* Желтая плашка для карт в остывании */
.cooldown-indicator {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 12px 16px !important;
  background: rgba(245, 158, 11, 0.15) !important;
  border: 1px solid #f59e0b !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  color: #f59e0b !important;
  flex-shrink: 0 !important;
  gap: 4px !important;
  min-width: auto !important;
  width: auto !important;
  max-width: none !important;
  height: fit-content !important;
  box-sizing: border-box !important;
  text-align: center !important;
  margin: 0 auto !important;
  align-self: center !important;
  white-space: nowrap !important;
}

.cooldown-label {
  color: #f59e0b !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  display: block !important;
  line-height: 1.2 !important;
}

.cooldown-indicator > span:first-child {
  color: #f59e0b !important;
  font-weight: 600 !important;
  white-space: normal !important;
}

.cooldown-timer {
  font-family: inherit !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: #f59e0b !important;
  letter-spacing: 0 !important;
  white-space: normal !important;
  flex-shrink: 0 !important;
  display: block !important;
  line-height: 1.2 !important;
  word-wrap: break-word !important;
}

[data-theme="dark"] .cooldown-indicator {
  background: rgba(217, 119, 6, 0.2) !important;
  border-color: #f59e0b !important;
  color: #f59e0b !important;
}

[data-theme="dark"] .cooldown-indicator span {
  color: #f59e0b;
}

[data-theme="dark"] .cooldown-timer {
  color: #f59e0b;
}

[data-theme="dark"] .blocked-indicator {
  background: rgba(220, 38, 38, 0.2) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}

[data-theme="dark"] .blocked-indicator .blocked-label {
  color: #ef4444 !important;
}

[data-theme="dark"] .blocked-timer {
  color: #ef4444 !important;
}

[data-theme="dark"] .card-field .blocked-timer {
  color: #ef4444 !important;
}

.data-card[data-blocked="true"] {
    opacity: 0.7;
}

.data-card[data-blocked="true"] .card-action-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Индикатор месячного лимита */
.limit-indicator {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: center;
}

.limit-progress-bar {
    width: 100%;
    max-width: 180px;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    margin: 0 auto;
}

.limit-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 0%, var(--primary) 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
    position: relative;
}

.limit-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.limit-text {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    line-height: 1.2;
    width: 100%;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    animation: fadeInScale 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.empty-state.fade-in {
    animation: fadeInScale 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.empty-state i {
    width: 64px;
    height: 64px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    opacity: 0.5;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.empty-state:hover i {
    transform: scale(1.1);
    opacity: 0.7;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.empty-state p {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    margin-bottom: 32px;
    margin-left: auto;
    margin-right: auto;
    padding: 20px;
    width: fit-content;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.pagination.hidden {
    display: none;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

.pagination-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
    overflow: hidden;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Непрозрачный фон для модальных окон в светлой теме */
body:not([data-theme="dark"]) .modal-content {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.98) 0%, 
        rgba(248, 250, 252, 0.95) 100%);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
}

/* Непрозрачный фон для модальных окон в темной теме */
[data-theme="dark"] .modal-content {
    background: linear-gradient(135deg, 
        rgba(22, 27, 34, 0.99) 0%, 
        rgba(15, 31, 53, 0.98) 100%);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: opacity 0.2s ease;
    width: auto;
    height: auto;
    flex-shrink: 0;
}

.modal-close:hover {
    opacity: 0.7;
}

.modal-close:active {
    opacity: 0.5;
}

.modal-close i {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* Floating Labels */
.form-group {
    position: relative;
    margin-bottom: 24px;
}

/* Form Row - для размещения полей в одну строку */
.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-input {
    width: 100%;
    padding: 16px 16px 16px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    background: var(--bg-card);
}

[data-theme="dark"] .form-input:focus {
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.3);
}

.form-label {
    position: absolute;
    left: 16px;
    top: 16px;
    font-size: 15px;
    color: var(--text-secondary);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    padding: 0;
    z-index: 1;
}

.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label {
    top: -10px;
    left: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: var(--bg-card);
    padding: 0 4px;
}

.form-input::placeholder {
    color: transparent;
}

/* Стили для поля ввода токена трейдера: в тёмной теме — тёмный фон */
[data-theme="dark"] #trader-token-input,
[data-theme="dark"] #trader-token-input[readonly] {
    background: #3d2e24 !important;
    color: #e8dcc8 !important;
    border-color: rgba(139, 90, 43, 0.5) !important;
}

/* В светлой/оранжевой теме токен как обычное поле (как trader-number) */
body:not([data-theme="dark"]) #trader-token-input {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
}

/* Заблокированные поля (депозит, лимит) в светлой теме — светлый коричневый */
body:not([data-theme="dark"]) .trader-readonly-field,
body:not([data-theme="dark"]) #trader-deposit-display,
body:not([data-theme="dark"]) #trader-limit-amount-display {
    background: #e8d5c4 !important;
    color: var(--text-primary) !important;
    border-color: rgba(139, 90, 43, 0.35) !important;
}

body:not([data-theme="dark"]) .trader-readonly-field .edit-btn,
body:not([data-theme="dark"]) .trader-readonly-field .edit-btn svg {
    color: var(--text-secondary) !important;
}

body:not([data-theme="dark"]) .trader-readonly-field .edit-btn:hover {
    background-color: rgba(139, 90, 43, 0.15) !important;
}

.modal-buttons,
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    width: 100%;
    justify-content: stretch;
    align-items: stretch;
}

.modal-buttons .btn,
.form-actions .btn {
    flex: 1;
    min-width: 0;
}

.btn-danger,
.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-danger:hover,
.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 12px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    height: 120px;
}

/* Скелетоны для метрик оборота (пока грузятся) */
.metric-value.skeleton {
    display: inline-block;
    min-width: 80px;
    color: transparent;
    user-select: none;
}

#usd-8000-rub.skeleton {
    min-width: 95px;
}

/* Skeleton для значений в карточках трейдеров */
.card-value.skeleton {
    display: inline-block !important;
    min-width: 100px;
    color: transparent !important;
    user-select: none;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card) 50%, var(--bg-secondary) 75%) !important;
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    height: 1.2em;
}

/* Скелетоны для статистики карт (Всего / В работе / Остывает / Заблокировано) */
.stat-value.skeleton-stat {
    display: inline-block;
    min-width: 28px;
    color: transparent;
    user-select: none;
}


/* Адаптивность для планшетов (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .modern-nav {
        width: 100%;
    }

    .glass-container {
        padding: 12px 20px;
        margin: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    .tabs-container {
        padding: 0 16px;
        max-width: 100%;
    }

    .header-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .search-container {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .search-type-select {
        flex: 1 1 calc(33.333% - 6px);
        min-width: 150px;
    }

    .search-input {
        flex: 1 1 calc(50% - 4px);
        min-width: 200px;
    }

    .search-btn {
        flex: 0 0 auto;
    }

    .action-buttons {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn {
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
    }

    .content-header {
        gap: 16px;
    }

    .modal-content {
        max-width: 90%;
        padding: 24px;
    }
}

/* Responsive - только для мобильных устройств */
@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 4px;
        width: 100%;
        padding: 0;
        margin-bottom: 24px;
    }
    
    .data-card {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100%;
        max-width: 100%;
        padding: 16px;
        gap: 0;
        min-height: auto;
        box-sizing: border-box;
    }
    
    .data-card > .card-main-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        flex-shrink: 0 !important;
        min-height: auto !important;
    }
    
    .card-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        min-width: auto;
        margin-bottom: 16px;
        padding-right: 0;
        padding-bottom: 12px;
        border-right: none !important;
        border-bottom: 1px solid var(--border);
        width: 100%;
    }
    
    .card-body {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px;
        margin-bottom: 16px;
        padding: 0;
        width: 100%;
    }
    
    .card-field {
        min-width: auto;
        width: 100%;
        padding: 12px 0;
        margin-bottom: 0;
        border-bottom: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .cooldown-indicator {
        min-width: 168px;
        width: fit-content;
        max-width: 100%;
        flex-wrap: wrap;
        white-space: normal;
    }
    
    .blocked-indicator {
        min-width: 168px;
        width: fit-content;
        max-width: 100%;
        flex-wrap: wrap;
        white-space: normal;
    }
    
    .card-field:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .card-field::after {
        display: none !important;
    }
    
    .card-label {
        font-size: 16.5px; /* 11px * 1.5 */
        margin-bottom: 4px;
        width: 100%;
    }
    
    .card-value {
        font-size: 21px; /* 14px * 1.5 */
        width: 100%;
        word-break: break-word;
    }
    
    .card-body::after {
        display: none;
    }
    
    .card-footer {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        min-width: auto;
        padding-left: 0;
        padding-top: 16px;
        border-left: none;
        border-top: 1px solid var(--border);
        width: 100%;
        flex-wrap: nowrap;
        gap: 12px;
    }
    
    .card-action-buttons {
        width: auto;
        flex-shrink: 0;
    }

    .modern-nav {
        width: 100%;
        top: 0;
        left: 0;
        right: 0;
        transform: none;
        border-radius: 0;
    }

    .glass-container {
        padding: 12px 16px;
        margin: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    .nav-actions {
        gap: 8px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
    }

    .tabs-container {
        margin-top: 80px;
        padding: 0 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 12px;
        padding: 0;
    }
    
    /* На мобильных устройствах statistics-metrics-bar переносится на новую строку */
    .statistics-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .statistics-header-row #statistics-metrics-bar {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }
    
    /* На мобильных устройствах метрики в одну колонку */
    .statistics-metrics-container {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .content-header-wrapper {
        width: 100%;
    }

    .content-header h2 {
        width: 100%;
        margin-bottom: 0;
    }

    .header-title-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
    }

    .content-header h2 {
        font-size: 22px;
        margin-bottom: 0;
        width: 100%;
        line-height: 1.3;
    }

    .cards-statistics {
        width: 100%;
        margin-left: 0;
        gap: 12px;
        flex-wrap: wrap;
    }

    .stat-item {
        flex: 1 1 auto;
        min-width: 0;
    }

    .statistics-metrics-bar {
        margin: 0;
        width: 100%;
        padding: 12px 16px;
        height: auto;
        min-height: 50px;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .metric-item {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
        min-width: 0;
        flex: 1;
        width: 100%;
        max-width: 100%;
    }
    
    .metric-label {
        font-size: 12.6px; /* 18px * 0.7 (уменьшение на 30%) */
    }
    
    .metric-value {
        font-size: 16.8px; /* 24px * 0.7 (уменьшение на 30%) */
    }

    .tabs {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tabs button {
        padding: 10px 16px;
        font-size: 13px;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .tabs button span {
        display: inline;
    }

    .tabs button i {
        width: 18px;
        height: 18px;
    }

    .header-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-container {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .search-field-group {
        width: 100%;
    }

    .search-type-select {
        width: 100%;
        flex: 1 1 100%;
    }

    /* На мобильных селекты на всю ширину */
    #cards-search-type {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        flex: 1 1 100%;
    }

    #cards-balance-sort {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        flex: 1 1 100%;
    }

    .search-icon-btn {
        width: 100%;
        min-width: 100%;
    }

    .search-input {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
    }

    .search-btn {
        width: 100%;
    }

    .action-buttons {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 14px;
        flex: 1 1 calc(50% - 4px);
        min-width: calc(50% - 4px);
        max-width: 100%;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .btn span {
        display: inline;
    }

    .btn i {
        width: 18px;
        height: 18px;
    }
    
    /* Модальные окна */
    .modal-content {
        width: calc(100% - 32px) !important;
        max-width: 100% !important;
        margin: 16px;
        padding: 20px;
        max-height: calc(100vh - 32px);
        overflow-y: auto;
    }
    
    .modal-header {
        margin-bottom: 20px;
    }
    
    .modal-header h3 {
        font-size: 20px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-row .form-group {
        margin-bottom: 20px;
    }
    
    .form-input {
        padding: 14px 16px;
        font-size: 16px; /* Предотвращает зум на iOS */
    }
    
    .form-label {
        font-size: 14px;
    }
    
    .modal-buttons,
    .form-actions {
        flex-direction: column;
        gap: 12px;
        margin-top: 24px;
    }
    
    .modal-buttons .btn,
    .form-actions .btn {
        width: 100%;
        flex: 1 1 100%;
        min-width: 100%;
    }
}

/* Mobile - дополнительные стили для очень маленьких экранов */
@media (max-width: 480px) {
  .modern-nav {
    width: 100%;
    top: 0;
    left: 0;
    right: 0;
    transform: none;
    border-radius: 0;
  }

  .glass-container {
    padding: 10px 14px;
    margin: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    height: 60px !important;
    max-height: 60px !important;
    min-height: 60px !important;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .nav-logo-center {
    height: 60px !important;
    max-height: 60px !important;
    min-height: 60px !important;
  }
  
  .nav-logo-center .brand-logo {
    max-height: 137px !important;
    height: 137px !important;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .nav-actions {
    flex: 0 0 auto;
    gap: 6px;
  }

  .brand {
    gap: 8px;
  }

  .logo-dot {
    width: 8px;
    height: 8px;
  }

  .brand span {
    font-size: 14px;
    letter-spacing: 0;
  }

  .nav-actions {
    gap: 8px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .icon-btn svg {
    width: 18px;
    height: 18px;
  }

  .tabs-container {
    margin-top: 70px;
    padding: 0 8px;
    width: 100%;
    box-sizing: border-box;
  }

  /* Улучшенная адаптивность для очень маленьких экранов */
  .content-header-wrapper {
    gap: 12px;
  }

  .header-controls {
    gap: 10px;
  }

  .search-container {
    gap: 6px;
  }

  .tabs {
    padding: 4px;
    gap: 4px;
    width: 100%;
  }

  .tabs button {
    padding: 10px 12px;
    font-size: 12px;
    flex: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .tabs button span {
    display: none;
  }
  
  .tabs button i {
    width: 16px;
    height: 16px;
  }

  .content-header {
    padding: 0;
    width: 100%;
    gap: 10px;
  }

  .header-title-section {
    gap: 10px;
  }

  .content-header h2 {
    font-size: 18px;
    margin-bottom: 0;
    line-height: 1.3;
  }

  .cards-statistics {
    gap: 8px;
    width: 100%;
  }

  .stat-item {
    flex: 1 1 100%;
  }

  .stat-label {
    font-size: 12px;
  }

  .stat-value {
    font-size: 14px;
  }

  .header-controls {
    flex-direction: column;
    gap: 12px;
  }

  .search-container {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .search-field-group {
    width: 100%;
  }

  .search-type-select {
    width: 100%;
  }

  /* На очень маленьких экранах селекты на всю ширину */
  #cards-search-type {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
  }

  #cards-balance-sort {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
  }

  .search-icon-btn {
    width: 100%;
    min-width: 100%;
  }

  .search-input {
    width: 100%;
    min-width: 100%;
  }

  .search-btn {
    width: 100%;
  }

  .action-buttons {
    width: 100%;
    gap: 8px;
    flex-direction: column;
  }

  .btn {
    padding: 12px 14px;
    font-size: 14px;
    width: 100%;
    min-width: 100%;
    flex: 1 1 100%;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  .btn span {
    display: inline;
  }
  
  .btn i {
    width: 16px;
    height: 16px;
  }

  .data-card {
    padding: 12px;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .card-header {
    padding-bottom: 10px;
    margin-bottom: 12px;
  }
  
  .card-body {
    gap: 12px;
    margin-bottom: 12px;
  }
  
  
  .card-footer {
    padding-top: 12px;
    gap: 8px;
  }
  
  /* Модальные окна для маленьких экранов */
  .modal-content {
    width: calc(100% - 16px) !important;
    margin: 8px;
    padding: 16px;
    max-height: calc(100vh - 16px);
  }
  
  .modal-header h3 {
    font-size: 18px;
  }
  
  .form-input {
    padding: 12px 14px;
    font-size: 16px; /* Предотвращает зум на iOS */
  }
  
  .form-label {
    font-size: 13px;
  }
  
  /* Стили для заблокированных полей трейдера */
  .trader-readonly-field {
    opacity: 0.9;
  }
  
  .trader-readonly-field .edit-btn {
    z-index: 10;
    position: relative;
  }
  
  .trader-readonly-field .edit-btn:hover {
    background-color: rgba(229, 231, 235, 0.15) !important;
  }
  
  .trader-readonly-field .edit-btn:active {
    background-color: rgba(229, 231, 235, 0.25) !important;
  }
  
  .statistics-metrics-bar {
    padding: 10px 12px;
    gap: 10px;
    flex: 1;
    width: 100%;
    max-width: 100%;
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
  }
  
  #turnover-metrics-bar,
  #total-success-metrics-bar {
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
  }
  
  /* На очень маленьких экранах метрики в одну колонку */
  .statistics-metrics-container {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  
  .metric-item {
    gap: 6px;
    flex: 1;
    width: 100%;
    max-width: 100%;
  }
  
  .metric-label {
    font-size: 11.55px; /* 16.5px * 0.7 (уменьшение на 30%) */
  }
  
  .metric-value {
    font-size: 14.7px; /* 21px * 0.7 (уменьшение на 30%) */
  }

  .card-header {
    padding-right: 0;
    border-right: none;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .card-body {
    padding: 0;
    margin-bottom: 12px;
    gap: 12px;
    width: 100%;
  }

  .card-field {
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }
  
  .card-field:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .card-label {
    font-size: 15px; /* 10px * 1.5 */
    margin-bottom: 4px;
  }

  .card-value {
    font-size: 21px; /* 14px * 1.5 */
    word-break: break-word;
  }

  .card-footer {
    padding-left: 0;
    padding-top: 12px;
    width: 100%;
    flex-wrap: nowrap;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
  }

  .card-action-buttons {
    width: auto;
    justify-content: flex-end;
    flex-shrink: 0;
  }

  .action-btn {
    width: 40px;
    height: 40px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* Статистика - карточки */
.stats-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 24px !important;
  margin-bottom: 32px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.stat-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (min-width: 769px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    display: grid !important;
    gap: 24px !important;
  }
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  animation: fadeInScale 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
  opacity: 0;
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}

.stat-card.fade-in {
  animation: none;
}

.stat-card.slide-in {
  animation: slideInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Задержка для последовательного появления карточек статистики */
.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0s; }
.stat-card:nth-child(3) { animation-delay: 0s; }
.stat-card:nth-child(n+4) { animation-delay: 0s; }

/* Убрали декоративную синюю полоску сверху карточек статистики */

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.stat-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.stat-card-icon i {
  width: 20px;
  height: 20px;
}

.stat-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.stat-metric {
  display: flex;
  flex-direction: column;
}

.stat-metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-metric-value.success {
  color: var(--success);
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-metric-value.warning {
  color: var(--warning);
  background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-metric-value.danger {
  color: var(--danger);
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card-footer {
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-card-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.stat-card-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-secondary);
}

.stat-card-loading i {
  width: 32px;
  height: 32px;
  animation: spin 1s linear infinite;
}

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

.stat-card-error {
  padding: 40px;
  text-align: center;
  color: var(--danger);
}

.stat-card-error i {
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
}

/* Адаптивность для статистики */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .stat-card {
    padding: 20px;
  }

  .stat-metrics {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .stat-metric-value {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .stat-card {
    padding: 16px;
  }

  .stat-card-header {
    margin-bottom: 16px;
  }

  .stat-metric-value {
    font-size: 18px;
  }
}

/* Кнопка развертывания для привязанных реквизитов */
.card-expand-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  border-radius: 6px;
  flex-shrink: 0;
}

.card-expand-btn:hover {
  background: var(--bg-secondary);
  color: var(--primary);
}

.card-expand-btn .expand-icon {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

/* Контейнер с привязанными реквизитами - отдельный блок после card-footer */
.linked-requisites-container {
  width: 100%;
  margin-top: 12px;
  padding: 12px 0 0 0;
  border-top: 1px solid var(--border);
  animation: slideDown 0.3s ease;
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: hidden;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

.linked-requisites-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.linked-requisite-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  justify-content: space-between;
}

.linked-requisite-item:hover {
  background: var(--bg-primary);
  border-color: var(--primary);
}

.linked-requisite-item.cooldown-locked {
  opacity: 0.7;
  background: var(--bg-secondary);
  border-color: var(--warning);
}

.linked-requisite-item.cooldown-locked:hover {
  background: var(--bg-secondary);
  border-color: var(--warning);
}

.linked-requisite-item[data-blocked="true"] {
  opacity: 0.7;
  border-color: rgba(239, 68, 68, 0.3);
}

.linked-requisite-item[data-blocked="true"] .linked-requisite-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.linked-requisite-cooldown .cooldown-indicator {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #f59e0b;
  flex-shrink: 0;
  gap: 8px;
  white-space: nowrap;
  height: fit-content;
  vertical-align: middle;
}

[data-theme="dark"] .linked-requisite-cooldown .cooldown-indicator {
  background: rgba(217, 119, 6, 0.2);
  border-color: rgba(217, 119, 6, 0.5);
  color: #f59e0b;
}

.linked-requisite-cooldown .cooldown-timer {
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  vertical-align: baseline;
}

.linked-requisite-item .blocked-indicator {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 6px 12px;
  background: #fee2e2;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #ef4444;
  flex-shrink: 0;
  gap: 8px;
}

[data-theme="dark"] .linked-requisite-item .blocked-indicator {
  background: #7f1d1d;
  border-color: rgba(220, 38, 38, 0.4);
  color: #dc2626;
}

.linked-requisite-item .blocked-timer {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
}

.linked-requisite-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.linked-requisite-status-badge.blocked-badge {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.linked-requisite-status-badge.blocked-badge i[data-lucide="lock"],
.linked-requisite-status-badge.blocked-badge svg[data-lucide="lock"] {
stroke-width: 1 !important;
}

[data-theme="dark"] .linked-requisite-status-badge.blocked-badge {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.4);
  color: #dc2626;
}


.linked-requisite-status-badge.cooldown-badge {
  display: inline-flex !important;
  align-items: center !important;
  padding: 6px 12px !important;
  background: rgba(245, 158, 11, 0.15) !important;
  border: 2px solid #f59e0b !important;
  border-radius: 6px !important;
  color: #f59e0b !important;
  gap: 6px !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}

[data-theme="dark"] .linked-requisite-status-badge.cooldown-badge {
  background: rgba(217, 119, 6, 0.2) !important;
  border-color: #f59e0b !important;
  color: #f59e0b !important;
}

.linked-requisite-status-badge .cooldown-label {
  color: #f59e0b !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  display: inline !important;
}

.linked-requisite-status-badge .cooldown-timer,
.linked-requisite-status-badge .blocked-timer {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  letter-spacing: 0.3px !important;
  font-variant-numeric: tabular-nums !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  color: #f59e0b !important;
  white-space: nowrap !important;
  display: inline !important;
}

.linked-requisite-type {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 100px;
  flex-shrink: 0;
}

.linked-requisite-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  flex-wrap: wrap;
}

.linked-requisite-id {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.linked-requisite-number {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  cursor: pointer;
  transition: opacity 0.2s ease;
  user-select: none;
}

.linked-requisite-number:hover {
  opacity: 0.8;
}

.linked-requisite-stats {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.linked-requisite-cooldown {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.linked-requisite-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
}

.linked-requisite-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
}

/* Базовый контейнер селекта */
.custom-select-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

/* Кнопка селекта */
.custom-select-button {
  width: 100%;
  min-width: 160px;
  height: 36px;
  padding: 8px 32px 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  text-align: left;
  position: relative;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 16px 16px !important;
}

.custom-select-button:hover {
  border-color: var(--primary);
  background-color: var(--bg-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 16px 16px !important;
}

.custom-select-button.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background-color: var(--bg-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 6 6 15'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 16px 16px !important;
}

.custom-select-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Выпадающее меню - позиционирование управляется через JS */
.custom-select-dropdown {
  display: none;
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 99999;
  max-height: 250px;
  overflow-y: auto;
  min-width: 160px;
  transform-origin: top center;
  will-change: transform, opacity;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Состояние по умолчанию (скрыто) - устанавливается через JS */
.custom-select-dropdown:not(.open) {
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
}

/* Открытое состояние */
.custom-select-dropdown.open {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Опции */
.custom-select-option {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background 0.15s ease;
}

.custom-select-option:hover {
  background: rgba(59, 130, 246, 0.1);
}

.custom-select-option.selected {
  background: var(--primary);
  color: white;
}

/* При портале в body через DropdownManager */
body > .custom-select-dropdown {
  margin-top: 0;
}

/* Выпадающий список для bulk-group открывается вверх */
#bulk-group-select-wrapper .custom-select-dropdown {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 4px;
  transform: translateY(8px);
}

#bulk-group-select-wrapper .custom-select-dropdown.open {
  transform: translateY(0);
}

.custom-select-option {
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  border-bottom: 1px solid var(--border);
}

.custom-select-option:last-child {
  border-bottom: none;
}

.custom-select-option:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
}

.custom-select-option.selected {
  background: #f97316;
  color: #ffffff;
  font-weight: 600;
}

/* Темная тема для кастомного селекта */
/* Оригинальный select полностью удаляется из DOM через JavaScript */

[data-theme="dark"] .custom-select-button {
  background-color: var(--bg-input);
  border-color: var(--border);
  color: var(--text-primary);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23e0e5eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 16px 16px !important;
}

[data-theme="dark"] .custom-select-button:hover {
  border-color: var(--primary);
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232d4f7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 16px 16px !important;
}

[data-theme="dark"] .custom-select-button:focus,
[data-theme="dark"] .custom-select-button.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.3);
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232d4f7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 16px 16px !important;
}

[data-theme="dark"] .custom-select-button.active {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232d4f7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 6 6 15'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 16px 16px !important;
}

/* Заблокированное состояние для темной темы */
[data-theme="dark"] .custom-select-button:disabled,
[data-theme="dark"] .custom-select-button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  background-color: var(--bg-input);
  border-color: var(--border);
  color: var(--text-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23e0e5eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 16px 16px !important;
}

/* Убираем hover эффекты для заблокированного состояния в темной теме */
[data-theme="dark"] .custom-select-button:disabled:hover,
[data-theme="dark"] .custom-select-button[disabled]:hover {
  border-color: var(--border);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23e0e5eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 16px 16px !important;
  box-shadow: none;
}

[data-theme="dark"] .custom-select-dropdown {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-color: var(--glass-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--glass-border), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .custom-select-option {
  color: var(--text-primary);
  border-bottom-color: var(--border);
}

[data-theme="dark"] .custom-select-option:hover {
  background: rgba(30, 58, 95, 0.3);
  color: var(--text-primary);
}

[data-theme="dark"] .custom-select-option.selected {
  background: #f97316;
  color: #ffffff;
  font-weight: 600;
}

/* Стили для скроллбара в выпадающем меню */
.custom-select-dropdown::-webkit-scrollbar {
  width: 6px;
}

.custom-select-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.custom-select-dropdown::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.custom-select-dropdown::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

[data-theme="dark"] .custom-select-dropdown::-webkit-scrollbar-thumb {
  background: rgba(30, 58, 95, 0.5);
}

[data-theme="dark"] .custom-select-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.5);
}

/* Принудительные стили для логотипа - максимальный приоритет */
/* Логотип увеличен, но не влияет на высоту контейнера */
.modern-nav .nav-logo-center .brand-logo,
.nav-logo-center .brand-logo,
.brand-logo {
  max-height: 137px !important;
  height: 137px !important;
  width: auto !important;
  max-width: 300px !important;
  object-fit: cover !important;
  object-position: center !important;
}