:root {
  /* Тёмные тона (фон) */
  --bg: #1a1b1e;
  --bg-dark: #121316;
  --surface: rgba(38, 40, 45, 0.7);
  --surface-solid: #26282d;
  --sidebar: rgba(30, 32, 36, 0.85);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  /* Текст */
  --text: #ffffff;
  --text-muted: #a0a4ab;
  --text-inactive: #6b6f78;
  --icon: #6b6f78;
  /* Акцентные */
  --accent: #FF6B6B;
  --green: #4CD964;
  --yellow: #FFCC00;
  --red: #FF6B6B;
  --blue: #FF6B6B;
  --font: "LINE Seed JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --header-height: 52px;
  /* Стекло и форма */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --glass-bg: rgba(38, 40, 45, 0.6);
  --glass-border: rgba(255, 255, 255, 0.06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
  --transition: 0.25s ease;
  --transition-fast: 0.15s ease;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
}

body {
  margin: 0 auto;
  max-width: 1000px;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  background-image: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(255, 107, 107, 0.06), transparent 50%);
}

.header {
  flex-shrink: 0;
  z-index: 10;
  min-height: var(--header-height);
  padding: 0;
  border-bottom: 1px solid var(--glass-border);
  background: var(--sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: stretch;
  gap: 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: box-shadow var(--transition);
}
.header-block {
  padding: 0 0.85rem;
  display: flex;
  align-items: center;
  min-height: var(--header-height);
  box-sizing: border-box;
}
.header-block-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.header-block-logo h1 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.header-token-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-inactive);
}
.header-token-indicator--ok {
  background: var(--green);
}
.header-token-indicator--fail {
  background: var(--red);
}
.header-block-nick-profit {
  flex: 1;
  min-width: 0;
  margin-left: 5.7rem;
}
.header-block-rate,
.header-block-trust {
  flex-shrink: 0;
}
.header-area {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.header-area-1 {
  flex-shrink: 0;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.header-user-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.header-nick {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-profit-line {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.header-area-label {
  color: var(--text-muted);
  white-space: nowrap;
}
.header-finance-value {
  color: var(--text);
  white-space: nowrap;
}
.header-area-trust {
  flex-shrink: 0;
}
.header-trust-lines {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  line-height: 1.15;
}
.header-trust-usd {
  font-size: 0.65rem;
}
.header-trust-rub {
  font-size: 0.85rem;
  font-weight: 600;
}
.header-area-2,
.header-area-3 {
  flex-shrink: 0;
}
.subtitle { margin: 0.25rem 0 0; color: var(--text-muted); font-size: 0.9rem; }

.header-compact {
  min-height: var(--header-height);
}

.app-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.sidebar {
  flex-shrink: 0;
  z-index: 5;
  width: 200px;
  min-width: 200px;
  background: var(--sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.02);
}
.sidebar .nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-left: 4px;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.sidebar .nav-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.85;
}
/* Первые 3 иконки (Дашборд, Профили, Сотрудники), TradeMo, Прочее — белые (инверт) */
.sidebar .nav-item:nth-child(1) .nav-icon,
.sidebar .nav-item:nth-child(2) .nav-icon,
.sidebar .nav-item:nth-child(3) .nav-icon,
.sidebar .nav-icon-trademo,
.sidebar .nav-icon-misc {
  filter: brightness(0) invert(1);
}
/* MultiMM — иконка уже белая, без фильтра */
.sidebar .nav-item.active .nav-icon {
  opacity: 1;
}
.sidebar .nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.sidebar .nav-item.active {
  color: var(--blue);
  background: rgba(255, 107, 107, 0.1);
  border-left-color: var(--blue);
  box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.08);
}

.content-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  scroll-behavior: smooth;
}
.content-area::-webkit-scrollbar {
  width: 5px;
}
.content-area::-webkit-scrollbar-track {
  background: transparent;
}
.content-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.content-area::-webkit-scrollbar-thumb:hover {
  background: var(--icon);
}

.screen {
  display: none;
  opacity: 0;
}
.screen.active {
  display: block;
  animation: screenFadeIn 0.3s ease forwards;
}
@keyframes screenFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
#screen-payouts.screen.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.page-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--text);
}

.profiles-filter-bar {
  margin-bottom: 1rem;
}
.profiles-filter-bar .profiles-filter-input {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 0.75rem;
  min-width: 220px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.profiles-filter-bar .profiles-filter-input:focus {
  outline: none;
  border-color: rgba(255, 107, 107, 0.4);
  box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.1);
}

.loading-bar {
  height: 3px;
  min-height: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border-radius: 2px;
  margin-bottom: 0.5rem;
}
.loading-bar::after {
  content: "";
  display: block;
  height: 100%;
  width: 40%;
  background: var(--blue);
  animation: loading-bar-slide 1.2s ease-in-out infinite;
}
.loading-bar.hidden {
  display: none;
}
@keyframes loading-bar-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
.btn-primary,
.btn-secondary {
  padding: 0.5rem 1.1rem;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition-fast), box-shadow var(--transition);
}
.btn-primary:hover,
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}
.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.98);
}
.btn-primary.btn-loading,
.btn-secondary.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-primary.btn-loading::after,
.btn-secondary.btn-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.form-inline input {
  flex: 1;
  min-width: 0;
}

.apps-list {
  margin-top: 0.5rem;
}
.app-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--glass-border);
  transition: background var(--transition-fast);
}
.app-row:hover {
  background: rgba(255, 255, 255, 0.02);
}
.app-row .app-name {
  font-weight: 500;
  min-width: 140px;
}
.app-row .app-package {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}
@media (max-width: 900px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.entity-card .card-footer-blocks {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-top: 1px solid var(--glass-border);
  margin-top: auto;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.entity-card .card-footer-row {
  display: flex;
  align-items: stretch;
}
.entity-card .card-footer-row--second {
  border-top: 1px solid var(--glass-border);
}
.entity-card .card-footer-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 36px;
  padding: 0.35rem 0.5rem;
  color: var(--text);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
  border-right: 1px solid var(--glass-border);
  font-size: 0.7rem;
}
.entity-card .card-footer-row .card-footer-block:last-child {
  border-right: none;
}
.entity-card .card-footer-block:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--blue);
}
.entity-card .card-footer-block-icon {
  font-weight: 600;
  font-size: 0.75rem;
}
.entity-card .card-footer-block-label {
  display: none;
}

.entity-card .field-val-clickable.reception-toggle-on {
  color: var(--green);
  text-decoration-color: var(--green);
}

.entity-card .reception-toggle-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: middle;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.entity-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: visible;
  display: flex;
  flex-direction: column;
  min-height: 160px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition-fast);
}
.entity-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.08);
}
.entity-card .card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--glass-border);
  gap: 0.35rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.entity-card .card-title {
  font-weight: 600;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}
.entity-card .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: help;
}
.entity-card .status-dot.ready { background: var(--green); }
.entity-card .status-dot.partial { background: var(--yellow); }
.entity-card .status-dot.idle { background: var(--red); }
.entity-card .status-dot.active { background: var(--green); }
.entity-card .status-dot.running { background: var(--green); }
.entity-card .status-dot.waiting_approval { background: var(--green); }
.entity-card .status-dot.error { background: var(--red); }
.entity-card .card-actions-top {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}
.entity-card .card-actions-top button,
.entity-card .card-actions-top .icon-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  padding: 0;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.entity-card .card-actions-top button:hover,
.entity-card .card-actions-top .icon-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}
.entity-card .card-actions-top .icon-btn-disabled,
.entity-card .card-actions-top .icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.entity-card .card-actions-top .icon-btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.entity-card .card-actions-top .icon-btn-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.entity-card .card-actions-top .icon-btn-delete:hover {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.15);
}
.entity-card .card-fields {
  padding: 0.4rem 1rem;
  flex: 1;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.62rem;
  line-height: 1.35;
}
.entity-card .card-fields td {
  padding: 0.05rem 0.25rem 0.05rem 0;
  vertical-align: top;
}
.entity-card .card-fields .field-key {
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 4.8rem;
  width: 4.8rem;
  flex-shrink: 0;
  padding-right: 0.35rem;
}
.entity-card .card-fields .field-val {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  min-width: 0;
}
.entity-card .card-fields .field-val.status-val--active {
  color: var(--green);
  font-weight: 600;
}
.entity-card .card-fields .field-val.status-val--idle {
  color: var(--red);
  font-weight: 600;
}
.entity-card .card-fields .field-val-clickable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--text);
}
.entity-card .card-fields .field-val-clickable:hover {
  color: var(--blue);
  text-decoration-color: var(--blue);
}
.entity-card .card-fields .automation-working {
  color: var(--green);
}
.entity-card .card-fields .field-val-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.entity-card .card-fields .field-val-loading::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.entity-card .card-fields .field-row {
  display: flex;
  gap: 0.35rem;
  min-width: 0;
}
.entity-card .card-fields .field-row .field-key {
  flex-shrink: 0;
}
.entity-card .card-bottom {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: center;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.entity-card .card-bottom .action-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}
.entity-card .card-bottom .action-link:hover {
  color: var(--blue);
}

.main {
  padding: 1.5rem 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

.card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.08);
}
.card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: var(--text);
}
.card h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--text);
}
.trademo-status {
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.trademo-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: help;
}
.trademo-status-loading .trademo-status-dot {
  display: none;
}
.trademo-status-spinner {
  display: none;
  flex-shrink: 0;
}
.trademo-status-loading .trademo-status-spinner {
  display: inline-block;
}
.trademo-status-loading .trademo-status-text {
  display: none;
}
.trademo-status-connected .trademo-status-dot {
  background: var(--green);
}
.trademo-status-connected .trademo-status-text {
  color: var(--green);
}
.trademo-status-disconnected .trademo-status-dot {
  background: var(--red);
}
.trademo-status-disconnected .trademo-status-text {
  color: var(--red);
}

/* Кастомный тултип (шпора) — крупнее, с анимацией выхода */
[data-tooltip] {
  position: relative;
  cursor: help;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  transform: translateY(4px);
  padding: 0.35rem 0.6rem;
  font-size: 0.65rem;
  font-family: var(--font);
  color: var(--text);
  background: rgba(30, 32, 36, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  white-space: pre-line;
  max-width: 320px;
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 100;
  box-shadow: var(--shadow-md);
  transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
}
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.trademo-step-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--text);
}
.trademo-step-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Блок Telegram в отдельной карточке (.trademo-telegram-card) — без верхней границы */
.trademo-telegram-block {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.trademo-telegram-card {
  margin-top: 0.5rem;
}
.trademo-telegram-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--text);
}
.trademo-telegram-status {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
}
.trademo-telegram-username {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.trademo-telegram-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.trademo-telegram-actions .btn-primary,
.trademo-telegram-actions .btn-secondary {
  margin: 0;
}
.trademo-telegram-code-wrap {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.trademo-telegram-code-hint {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.trademo-telegram-code {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}
.trademo-telegram-code code {
  background: var(--surface-solid);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, monospace;
}
.trademo-telegram-code-sub {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.trademo-telegram-bot-link {
  display: inline-block;
  color: var(--blue);
  text-decoration: none;
  font-size: 0.9rem;
}
.trademo-telegram-bot-link:hover {
  text-decoration: underline;
}

/* Collapsible sections */
.card-collapsible .card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  margin: 0 0 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  width: 100%;
  text-align: left;
}
.card-collapsible .card-header:hover {
  color: var(--blue);
}
.card-collapsible .card-header:focus {
  outline: none;
}
.card-collapsible .card-header h2 {
  margin: 0;
  flex: 1;
}
.card-collapsible .card-toggle-arrow {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}
.card-collapsible.collapsed .card-toggle-arrow {
  transform: rotate(-90deg);
}
.card-collapsible .card-body {
  overflow: hidden;
  max-height: 2000px;
  opacity: 1;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
  margin-top: 1rem;
}
.card-collapsible.collapsed .card-body {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.workers-list {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.worker-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.worker-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.08);
}
.worker-card .worker-id { font-weight: 600; }
.worker-card .status {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  cursor: help;
}
.worker-card .status.idle { background: var(--red); }
.worker-card .status.running { background: var(--green); }
.worker-card .status.waiting_approval { background: var(--green); }
.worker-card .status.error { background: var(--red); }
.worker-card .actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.worker-card button {
  padding: 0.4rem 0.85rem;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.worker-card button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
}
.worker-card .worker-profile-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  margin-left: 0.5rem;
}
.worker-card .worker-profile-select {
  min-width: 160px;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}
.device-apps-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
.device-apps-table th,
.device-apps-table td {
  padding: 0.4rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.device-apps-table .btn-add-device-app {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}
.approvals-list { display: flex; flex-direction: column; gap: 0.75rem; }
.approval-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.approval-item:hover {
  box-shadow: var(--shadow-md);
}
.approval-item .info { font-size: 0.9rem; }
.approval-item .info strong { color: var(--yellow); }
.approval-item button {
  padding: 0.4rem 0.85rem;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.approval-item button:hover {
  opacity: 0.95;
}
.approval-item button:active {
  transform: scale(0.98);
}
.approval-item button.approve { background: var(--green); color: var(--bg); }
.approval-item button.deny { background: var(--red); color: #fff; }

.tasks-list { margin-top: 0.75rem; }
.tasks-list table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tasks-list th, .tasks-list td { padding: 0.5rem; text-align: left; border-bottom: 1px solid var(--border); }
.tasks-list th { color: var(--text-muted); }

.dashboard-stats:empty { display: none; }
.dashboard-stats .stats-table { width: 100%; max-width: 400px; border-collapse: collapse; font-size: 0.9rem; }
.dashboard-stats .stats-table th,
.dashboard-stats .stats-table td { padding: 0.5rem; text-align: left; border-bottom: 1px solid var(--border); }
.dashboard-stats .stats-table th { color: var(--text-muted); }

.dashboard-top-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.dashboard-kpi {
  padding: 1rem;
  border-radius: var(--radius-md);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.dashboard-kpi:hover {
  box-shadow: var(--shadow-sm);
}
.dashboard-kpi h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.dashboard-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.dashboard-kpi-header h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.dashboard-kpi-period {
  display: flex;
  gap: 0.35rem;
  align-self: flex-start;
  margin-top: -0.15rem;
}
.dashboard-kpi-period-btn {
  padding: 0;
  font-size: 0.65rem;
  font-weight: 500;
  font-family: var(--font);
  background: none;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  text-transform: none;
}
.dashboard-kpi-period-btn:hover {
  color: var(--text);
}
.dashboard-kpi-period-btn.active {
  color: var(--blue);
}
.dashboard-kpi-value {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: break-word;
  min-height: 1.5em;
}

/* При загрузке: скрываем заголовок и значение, показываем только блок со спиннером */
.dashboard-kpi--loading .dashboard-kpi-header,
.dashboard-kpi--loading .dashboard-kpi-value,
.dashboard-kpi--loading > h3 {
  display: none !important;
}
.dashboard-kpi-loading-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  width: 100%;
}
.dashboard-kpi-loading-wrap .dashboard-kpi-spinner {
  width: 28px;
  height: 28px;
  border-width: 2px;
  border-color: var(--text-inactive);
  border-top-color: var(--blue);
}
.dashboard-stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.dashboard-stats-header h2 {
  margin: 0;
}
.dashboard-stats-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.dashboard-metric-tabs {
  display: flex;
  gap: 0.35rem;
}
.dashboard-metric-btn {
  padding: 0;
  font-size: 0.65rem;
  font-weight: 500;
  font-family: var(--font);
  background: none;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  text-transform: none;
  transition: color var(--transition-fast);
}
.dashboard-metric-btn:hover {
  color: var(--text);
}
.dashboard-metric-btn.active {
  color: var(--blue);
}
.dashboard-period-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.dashboard-period-btn {
  padding: 0;
  font-size: 0.65rem;
  font-weight: 500;
  font-family: var(--font);
  background: none;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  text-transform: none;
  transition: color var(--transition-fast);
}
.dashboard-period-btn:hover {
  color: var(--text);
}
.dashboard-period-btn.active {
  color: var(--blue);
}
.dashboard-chart {
  min-height: 240px;
  margin: 0.5rem 0;
  padding: 0.75rem 0;
  border-top: 1px solid var(--glass-border);
  width: 100%;
}
.dashboard-chart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  width: 100%;
}
.dashboard-chart-spinner {
  border-color: var(--text-inactive);
  border-top-color: var(--blue);
}
.dashboard-chart-svg {
  display: block;
  width: 100%;
  height: 220px;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.dashboard-chart.dashboard-chart--visible .dashboard-chart-svg {
  opacity: 1;
}
.dashboard-chart .dashboard-chart-inner {
  opacity: 0;
  transition: opacity 0.35s ease;
}
.dashboard-chart.dashboard-chart--visible .dashboard-chart-inner {
  opacity: 1;
}
.dashboard-chart-grid {
  stroke: rgba(255,255,255,0.06);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.dashboard-chart-line { }
.dashboard-chart-y-label,
.dashboard-chart-x-label {
  font-size: 10px;
  font-family: var(--font);
  fill: var(--text-muted);
}
.dashboard-chart-x-label {
  font-size: 9px;
}
.dashboard-chart-point {
  fill: #fff;
  stroke: var(--blue);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.dashboard-chart-tooltip-val {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  fill: var(--text);
}
.dashboard-chart-tooltip-line {
  stroke: var(--text-muted);
  stroke-width: 1;
  stroke-dasharray: 2 2;
  opacity: 0.5;
  vector-effect: non-scaling-stroke;
}

.hidden { display: none !important; }

.form-row.mode-switch { margin-top: 0.5rem; margin-bottom: 0.75rem; display: flex; gap: 1.5rem; flex-wrap: wrap; }
.form-row .radio-label { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; color: var(--text); }
.form-row .radio-label input { width: auto; margin: 0; }
.form .required { color: var(--red); }
.form select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-family: inherit;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form select:focus {
  outline: none;
  border-color: rgba(255, 107, 107, 0.4);
  box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.08);
}
.form label { display: block; margin-top: 0.75rem; margin-bottom: 0.25rem; font-size: 0.9rem; color: var(--text-muted); }
.form input, .form textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-family: inherit;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form input:focus, .form textarea:focus {
  outline: none;
  border-color: rgba(255, 107, 107, 0.4);
  box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.08);
}
.form-hint {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.form button {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--blue);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  transition: filter var(--transition-fast), transform var(--transition-fast);
}
.form button:hover { filter: brightness(1.1); }
.form button:active { transform: scale(0.98); }

.logs-panel pre {
  margin-top: 0.75rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  overflow: auto;
  max-height: 300px;
  font-size: 0.8rem;
  white-space: pre-wrap;
  border: 1px solid var(--glass-border);
}
.logs-panel select {
  padding: 0.4rem 0.6rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text);
  border-radius: var(--radius-sm);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: modalBgFade 0.2s ease;
}
@keyframes modalBgFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: modalContentIn 0.25s ease;
}
@keyframes modalContentIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.modal-content h3 { margin: 0 0 1rem; }
.modal-content pre { font-size: 0.85rem; overflow: auto; max-height: 200px; }
.modal-actions { margin-top: 1rem; display: flex; gap: 0.5rem; }
.modal-actions button {
  padding: 0.5rem 1rem;
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 0;
}
#approve-btn { background: var(--green); color: var(--bg); }
#deny-btn { background: var(--red); color: #fff; }
#modal-close { background: var(--border); color: var(--text); }

/* Модалка добавления профиля */
#add-profile-modal .add-profile-modal-content {
  max-width: min(96vw, 420px) !important;
  width: min(96vw, 420px) !important;
}
#add-profile-modal .add-profile-modal-body {
  padding: 0.25rem 0;
  min-width: 0;
  overflow-x: hidden;
}
#add-profile-modal .add-profile-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}
#add-profile-modal .add-profile-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
}
#add-profile-modal .add-profile-input {
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}
#add-profile-modal .add-profile-select-wrap {
  position: relative;
  overflow: visible;
}
#add-profile-modal .add-profile-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
#add-profile-modal .add-profile-select-trigger:hover {
  border-color: var(--border-strong);
}
#add-profile-modal .add-profile-select-trigger::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: 0.5rem;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-muted);
}
#add-profile-modal .add-profile-select-dropdown[hidden] {
  display: none !important;
}
#add-profile-modal .add-profile-select-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 2px;
  max-height: 200px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}
#add-profile-modal .add-profile-select-dropdown:has(.add-profile-select-search) {
  padding: 0.25rem 0.35rem 0 0.35rem;
}
#add-profile-modal .add-profile-select-search {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  margin: 0 0 0.25rem 0;
  font-size: 0.85rem;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
}
#add-profile-modal .add-profile-select-search::placeholder {
  color: var(--text-inactive);
}
#add-profile-modal .add-profile-select-search:focus {
  outline: none;
  border-color: var(--border-strong);
}
#add-profile-modal .add-profile-select-options {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 140px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#add-profile-modal .add-profile-select-options::-webkit-scrollbar {
  width: 5px;
}
#add-profile-modal .add-profile-select-options::-webkit-scrollbar-track {
  background: transparent;
}
#add-profile-modal .add-profile-select-options::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
#add-profile-modal .add-profile-select-options::-webkit-scrollbar-thumb:hover {
  background: var(--icon);
}
#add-profile-modal .add-profile-select-dropdown:not(:has(.add-profile-select-options)) {
  overflow-y: auto;
  overflow-x: hidden;
}
#add-profile-modal .add-profile-select-dropdown::-webkit-scrollbar {
  width: 5px;
}
#add-profile-modal .add-profile-select-dropdown::-webkit-scrollbar-track {
  background: transparent;
}
#add-profile-modal .add-profile-select-dropdown::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
#add-profile-modal .add-profile-select-dropdown::-webkit-scrollbar-thumb:hover {
  background: var(--icon);
}
#add-profile-modal .add-profile-select-option {
  padding: 0.4rem 0.6rem;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition-fast);
}
#add-profile-modal .add-profile-select-option:hover {
  background: var(--border);
}
#add-profile-modal .add-profile-fio-row {
  display: flex;
  gap: 0.5rem;
}
#add-profile-modal .add-profile-fio-row .add-profile-field {
  flex: 1;
}
#add-profile-modal .add-profile-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
#add-profile-modal .add-profile-sublabel {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
#add-profile-modal .add-profile-fio-row .add-profile-input {
  flex: 1;
}
#add-profile-modal .add-profile-submit {
  margin-top: 0.25rem;
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
}

/* Кастомные диалоги (alert/confirm/prompt) в стиле приложения */
.custom-dialog .custom-dialog-content {
  font-family: var(--font);
  color: var(--text);
  max-width: 320px;
  padding: 0.75rem 1rem;
}
/* Модалка логов профиля — горизонтальное широкое окно, скролл по таблице операций.
   Селектор с #profile-logs-modal нужен, чтобы перебить .custom-dialog .custom-dialog-content (max-width: 320px). */
#profile-logs-modal .profile-logs-modal-content,
#profile-logs-modal .modal-content.profile-logs-modal-content {
  max-width: min(96vw, 1600px) !important;
  width: min(96vw, 1600px) !important;
  max-height: 85vh;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
}
.profile-logs-modal-content .custom-dialog-title { margin-top: 0; }
#profile-logs-modal .profile-logs-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
#profile-logs-modal .profile-logs-tab {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: -1px;
}
#profile-logs-modal .profile-logs-tab:hover { color: var(--text); }
#profile-logs-modal .profile-logs-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 500;
}
#profile-logs-modal .profile-logs-modal-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#profile-requisites-modal .modal-content.profile-requisites-modal-content,
#profile-requisites-modal .profile-requisites-modal-content {
  max-width: min(96vw, 320px) !important;
  width: min(96vw, 320px) !important;
  padding: 0.5rem 0.75rem;
}
#profile-requisites-modal .profile-requisites-modal-body {
  max-height: 50vh;
  overflow-y: auto;
  font-size: 0.8125rem;
  line-height: 1.4;
  text-align: center;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#profile-requisites-modal .profile-requisites-modal-body::-webkit-scrollbar {
  width: 5px;
}
#profile-requisites-modal .profile-requisites-modal-body::-webkit-scrollbar-track {
  background: transparent;
}
#profile-requisites-modal .profile-requisites-modal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
#profile-requisites-modal .profile-requisites-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--icon);
}
#profile-requisites-modal .requisites-modal-list-view,
#profile-requisites-modal .requisites-modal-add-view {
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#profile-requisites-modal .requisites-modal-add-view {
  display: none;
  opacity: 0;
  text-align: left;
}
#profile-requisites-modal.requisites-modal--add .requisites-modal-list-view {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}
#profile-requisites-modal.requisites-modal--add .requisites-modal-add-view {
  display: block;
  opacity: 1;
  position: relative;
}
#profile-requisites-modal .requisites-back-link {
  display: inline-block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--primary);
  text-decoration: none;
}
#profile-requisites-modal .requisites-back-link:hover {
  text-decoration: underline;
}
#profile-requisites-modal .requisites-list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  display: inline-block;
  text-align: center;
  min-width: 0;
}
#profile-requisites-modal .requisites-list li {
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: baseline;
  font-weight: 400;
}
#profile-requisites-modal .requisite-row {
  cursor: pointer;
}
#profile-requisites-modal .requisite-row:hover {
  opacity: 0.9;
}
#profile-requisites-modal .requisites-id {
  color: var(--text-muted);
  font-size: 0.875em;
  min-width: 4.2rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}
#profile-requisites-modal .requisites-value {
  font-family: var(--font-mono), monospace;
  font-size: 0.95em;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text);
  white-space: nowrap;
}
#profile-requisites-modal .requisite-primary {
  font-size: 0.8em;
  color: var(--primary);
  margin-left: 0.25rem;
}
#profile-requisites-modal .requisites-balance {
  font-size: 0.85em;
  color: var(--text-muted);
  margin-left: auto;
}
#profile-requisites-modal .add-requisite-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
}
#profile-requisites-modal .btn-add-requisite {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--primary);
  background: transparent;
  border: 1px dashed var(--primary);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
#profile-requisites-modal .btn-add-requisite:hover {
  background: rgba(var(--primary-rgb, 59, 130, 246), 0.08);
  color: var(--primary);
}
#profile-requisites-modal .add-requisite-form-wrap {
  margin-top: 0;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 10px;
  border: 1px solid var(--border);
}
#profile-requisites-modal .add-requisite-form-wrap.hidden {
  display: none;
}
#profile-requisites-modal .add-requisite-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
#profile-requisites-modal .add-requisite-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
#profile-requisites-modal .add-requisite-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
}
#profile-requisites-modal .add-requisite-input {
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
#profile-requisites-modal .add-requisite-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}
#profile-requisites-modal .add-requisite-submit {
  margin-top: 0.5rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.875rem;
  align-self: center;
}
#profile-logs-modal .profile-logs-section {
  margin-bottom: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#profile-logs-modal .profile-logs-section.hidden { display: none !important; }
#profile-logs-modal .profile-logs-section h4 { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--text-muted); }
#profile-logs-modal .profile-logs-section--operations { margin-bottom: 0.5rem; flex: 1; min-height: 0; display: flex; flex-direction: column; }
#profile-logs-modal .profile-logs-section--operations h4 { font-size: 1rem; color: var(--text); flex-shrink: 0; }
#profile-logs-modal .reconciliation-log-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}
#profile-logs-modal .reconciliation-log-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
#profile-logs-modal .reconciliation-log-list li:last-child { border-bottom: none; }
#profile-logs-modal .profile-logs-operations {
  min-height: 120px;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#profile-logs-modal .profile-logs-operations::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
#profile-logs-modal .profile-logs-operations::-webkit-scrollbar-track {
  background: transparent;
}
#profile-logs-modal .profile-logs-operations::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
#profile-logs-modal .profile-logs-operations::-webkit-scrollbar-thumb:hover {
  background: var(--icon);
}
#profile-deals-modal .modal-content.profile-limits-modal-content {
  max-width: min(96vw, 1200px) !important;
  width: min(96vw, 1200px) !important;
}
#profile-deals-modal .profile-deals-modal-body { padding: 0 0 0.5rem; }
#profile-deals-modal .profile-deals-table-wrap {
  max-height: 60vh;
  overflow: auto;
  margin-top: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
#profile-deals-modal .profile-deals-table-wrap::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
#profile-deals-modal .profile-deals-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}
#profile-deals-modal .profile-deals-table-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
#profile-deals-modal .profile-deals-table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--icon);
}
#profile-deals-modal .transactions-table { margin: 0; width: 100%; font-size: 0.75rem; }
#profile-deals-modal .transactions-table th,
#profile-deals-modal .transactions-table td { padding: 0.2rem 0.4rem; vertical-align: middle; font-size: 0.75rem; }
#profile-deals-modal .transactions-table td.deal-time,
#profile-deals-modal .transactions-table td.deal-rate,
#profile-deals-modal .transactions-table td.deal-profit { white-space: nowrap; }
#profile-deals-modal .transactions-table tr.deal-summary-row th { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; padding: 0.25rem 0.4rem; border-bottom: 1px solid var(--border); }
#profile-deals-modal .transactions-table td.deal-id-copy { cursor: pointer; }
#profile-deals-modal .transactions-table td.deal-id-copy code { cursor: pointer; }
#profile-deals-modal .transactions-table td.deal-id-copy code:hover { color: #ef4444; }
#profile-deals-modal .deal-state { font-size: 0.75rem; padding: 0.1rem 0.35rem; border-radius: 4px; }
#profile-deals-modal .deal-state--confirmed { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
#profile-deals-modal .deal-state--pending { background: rgba(234, 179, 8, 0.25); color: #eab308; }
#profile-deals-modal .deal-state--expired,
#profile-deals-modal .deal-state--canceled { background: rgba(239, 68, 68, 0.15); color: var(--text-muted); }

#profile-logs-modal .profile-logs-operations .transactions-table { margin: 0; width: 100%; }
#profile-logs-modal .profile-logs-section--alfa {
  margin-bottom: 0.5rem;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#profile-logs-modal .profile-logs-section--alfa .transactions-table { font-size: 0.8rem; }
#profile-logs-modal .profile-logs-section--alfa .tx-amount-in { color: var(--green); }
#profile-logs-modal .profile-logs-section--alfa .tx-amount-out { color: var(--text-muted); }
#profile-logs-modal .profile-logs-section--emulator,
#profile-logs-modal .profile-logs-section--tm {
  margin-bottom: 0.5rem;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#profile-logs-modal .profile-logs-log-panel {
  min-height: 120px;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  background: var(--bg-dark);
  padding: 0.75rem;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
  border-radius: 6px;
}
#profile-logs-modal .profile-logs-log-panel::-webkit-scrollbar { width: 5px; height: 5px; }
#profile-logs-modal .profile-logs-log-panel::-webkit-scrollbar-track { background: transparent; }
#profile-logs-modal .profile-logs-log-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
#profile-logs-modal .profile-logs-log-panel::-webkit-scrollbar-thumb:hover { background: var(--icon); }
#profile-logs-modal .profile-logs-emulator-pre { margin: 0; font-size: inherit; white-space: pre-wrap; }
.profile-logs-section--log { margin-top: 1rem; }
.profile-logs-log {
  background: var(--bg-dark);
  padding: 0.5rem;
  font-size: 0.75rem;
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
}

/* Результат задачи — шире, чтобы таблица операций была видна целиком */
.custom-dialog .custom-dialog-content:has(.task-result-modal) {
  max-width: min(92vw, 720px);
  width: min(92vw, 720px);
  padding: 1rem 1.25rem;
}
.custom-dialog .custom-dialog-body:has(.task-result-modal) {
  max-height: 85vh;
  overflow: auto;
}
.custom-dialog .custom-dialog-title {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.custom-dialog .custom-dialog-body {
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.custom-dialog-input-wrap {
  margin: 0.5rem 0 0.75rem;
}
.custom-dialog-input-wrap.hidden { display: none; }
.custom-dialog .custom-dialog-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.custom-dialog .custom-dialog-input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  font-family: var(--font);
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text);
  border-radius: var(--radius-sm);
}
.custom-dialog .custom-dialog-input:focus {
  outline: none;
  border-color: rgba(255, 107, 107, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.1);
}
.custom-dialog .custom-dialog-actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
}
.custom-dialog .custom-dialog-actions button {
  padding: 0.4rem 0.85rem;
  font-family: var(--font);
  font-size: 0.82rem;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.custom-dialog .custom-dialog-actions button:active {
  transform: scale(0.98);
}
.custom-dialog .custom-dialog-actions .btn-primary,
.custom-dialog .custom-dialog-actions .btn-secondary {
  background: var(--border);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.custom-dialog .custom-dialog-actions button:hover {
  background: rgba(255, 255, 255, 0.95);
  color: var(--bg);
  border-color: #fff;
}

.modal-with-close {
  position: relative;
  padding-top: 2rem;
}
.modal-close-x {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.modal-close-x:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.15);
}
.form-actions-single {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: 1rem;
  gap: 0.35rem;
}
.form-actions-single .btn-primary {
  width: 100%;
}
.form-action-hint {
  margin: 0;
  font-size: 0.65rem;
  line-height: 1.3;
  color: var(--text-muted);
}
.form-action-hint--under-title {
  margin-bottom: 0.75rem;
}
#profile-limits-modal .profile-limits-modal-content {
  max-width: 480px;
}
#profile-limits-modal .profile-limits-loading {
  margin: 0.5rem 0;
}
#profile-limits-modal .profile-limits-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 0.5rem;
}
#profile-limits-modal .profile-limits-card {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary, rgba(255, 255, 255, 0.03));
}
#profile-limits-modal .profile-limits-card-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
#profile-limits-modal .profile-limits-card-value.field-val-clickable {
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text);
}
#profile-limits-modal .profile-limits-card-value.field-val-clickable:hover {
  color: var(--blue);
}

button:disabled { opacity: 0.6; cursor: not-allowed; }

/* Toast уведомления */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast-container > * {
  pointer-events: auto;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  max-width: 300px;
  animation: toast-enter 0.35s ease-out;
}
.toast.toast-exit {
  animation: toast-exit 0.25s ease-out forwards;
}
@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes toast-exit {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}
.toast-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.toast-body {
  flex: 1;
  min-width: 0;
}
.toast-title {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text);
  margin: 0 0 0.1rem;
}
.toast-message {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0;
}
.toast-progress-track {
  height: 3px;
  background: rgba(255, 107, 107, 0.2);
  margin-top: 0.4rem;
  overflow: hidden;
  border-radius: 2px;
}
.toast-progress-bar {
  height: 100%;
  width: 100%;
  background: var(--blue);
  animation: toast-progress 5s linear forwards;
  transform-origin: left;
}
@keyframes toast-progress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem;
  font-size: 1rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}
.toast-close:hover {
  color: var(--text);
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}
.loading-overlay.hidden {
  display: none;
}
.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-spinner--sm {
  width: 24px;
  height: 24px;
  border-width: 2px;
}
.loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  min-height: 2rem;
}

/* Task result modal (history transactions) */
.task-result-modal h3 { margin-top: 0; }
.task-result-modal h4 { margin: 1rem 0 0.5rem; font-size: 1rem; }
.task-result-modal p { word-break: break-word; }
.transactions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 0.5rem 0;
  table-layout: fixed;
}
.transactions-table th,
.transactions-table td {
  padding: 0.35rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.transactions-table th { color: var(--text-muted); }
.transactions-table td:nth-child(1) { width: 11%; }
.transactions-table td:nth-child(2) { width: 14%; }
.transactions-table td:nth-child(3) { width: 12%; }
.transactions-table td:nth-child(4) { width: auto; min-width: 0; }
.transactions-table .tx-amount-in { color: #22c55e; font-weight: 500; }
.transactions-table .tx-amount-out { color: #ef4444; font-weight: 500; }
.transactions-table tr.tx-row-today { background: rgba(34, 197, 94, 0.08); }
.task-result-logs {
  max-height: 200px;
  overflow: auto;
  font-size: 0.8rem;
  white-space: pre-wrap;
  margin: 0.5rem 0;
}
.tasks-table .btn-sm { padding: 0.2rem 0.5rem; font-size: 0.85rem; }

/* Выплаты (MultiMM) */
.payouts-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.payouts-api-status {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.payouts-api-status--error {
  color: var(--red);
}
.payouts-error {
  padding: 0.5rem 0.75rem;
  background: rgba(255, 107, 107, 0.1);
  color: var(--red);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  border-radius: 0;
}
.payouts-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.payouts-table-wrap .payouts-table {
  font-size: 0.75rem;
  margin: 0;
}
.payouts-table-wrap .payouts-table th,
.payouts-table-wrap .payouts-table td {
  padding: 0.25rem 0.45rem;
  vertical-align: middle;
  white-space: nowrap;
}
.payouts-updated-at { font-size: 0.8rem; margin: 0 0 0.5rem 0; }
.payout-status { font-size: 0.7rem; padding: 0.1rem 0.3rem; border-radius: 4px; }
.payout-status--ok { background: rgba(76, 217, 100, 0.2); color: var(--green); }
.payout-status--searching { background: rgba(255, 204, 0, 0.2); color: var(--yellow); }
.payout-status--error { background: rgba(255, 107, 107, 0.15); color: var(--red); }
.payout-countdown { margin-left: 0.35rem; opacity: 0.9; font-variant-numeric: tabular-nums; }
.payout-countdown--urgent { color: var(--red); }

/* ========== Мобильная адаптация ========== */
@media (max-width: 768px) {
  html {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  body {
    max-width: 100%;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .header {
    flex-wrap: wrap;
    padding: 0 0.35rem;
    padding-top: env(safe-area-inset-top, 0);
    min-height: auto;
    padding-bottom: 0.3rem;
    gap: 0 0.25rem;
  }
  .header-block {
    padding: 0 0.25rem;
    min-height: 40px;
    min-width: 0;
  }
  .header-block-logo {
    flex: 0 1 auto;
    min-width: 0;
  }
  .header-block-logo h1 {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-block-nick-profit {
    margin-left: 0;
    order: 3;
    width: 100%;
    padding: 0.2rem 0.25rem 0.3rem;
    border-top: 1px solid var(--glass-border);
    min-height: auto;
  }
  .header-block-nick-profit .header-nick,
  .header-block-nick-profit .header-profit-line {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .header-block-rate,
  .header-block-trust {
    flex-shrink: 0;
    font-size: 0.65rem;
  }
  .header-block-rate .header-finance-value,
  .header-block-trust .header-finance-value {
    font-size: 0.7rem;
    min-width: 0;
  }
  .header-trust-lines {
    flex-direction: row;
    gap: 0.25rem;
  }
  .header-trust-usd {
    font-size: 0.6rem;
  }
  .header-trust-rub {
    font-size: 0.7rem;
  }
  .header-area-2 {
    padding-right: 0.25rem;
  }
  .header-profit-line {
    font-size: 0.65rem;
  }
  .app-layout {
    flex-direction: column;
    padding-bottom: 0;
  }
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    align-items: stretch;
    padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    border-right: none;
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.03);
    z-index: 20;
  }
  .sidebar .nav-item {
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.4rem 0.25rem;
    margin-left: 0;
    border-left: none;
    border-radius: var(--radius-sm);
    border-top: 3px solid transparent;
    min-width: 0;
    flex: 1;
    font-size: 0.65rem;
  }
  .sidebar .nav-item.active {
    border-left: none;
    border-top-color: var(--blue);
  }
  .sidebar .nav-icon {
    width: 22px;
    height: 22px;
  }
  .content-area {
    flex: 1;
    padding: 0.75rem 0.75rem calc(5rem + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
  }
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .entity-card {
    min-height: 140px;
  }
  .entity-card .card-fields {
    font-size: 0.58rem;
  }
  .entity-card .card-fields .field-key {
    min-width: 3.6rem;
    width: 3.6rem;
  }
  .page-header {
    margin-bottom: 0.75rem;
    gap: 0.5rem;
  }
  .page-header h2 {
    font-size: 1.1rem;
  }
  .dashboard-top-row {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
  }
  .dashboard-stats-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .dashboard-stats-controls {
    width: 100%;
  }
  .dashboard-chart {
    min-height: 200px;
  }
  .dashboard-chart-svg {
    height: 180px;
  }
  .dashboard-chart-loading {
    min-height: 180px;
  }
  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  .profiles-filter-bar .profiles-filter-input {
    min-width: 0;
    width: 100%;
  }
  .payouts-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.75rem;
    padding: 0 0.75rem;
  }
  .payouts-table-wrap .payouts-table {
    font-size: 0.7rem;
  }
  .payouts-table-wrap .payouts-table th,
  .payouts-table-wrap .payouts-table td {
    padding: 0.35rem 0.4rem;
  }
  #trademo-when-connected {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  #trademo-when-connected .btn-primary,
  #trademo-when-connected .btn-secondary {
    flex: 1;
    min-width: 120px;
  }
  .btn-primary,
  .btn-secondary {
    min-height: 44px;
    padding: 0.6rem 1rem;
  }
  .entity-card .card-actions-top button,
  .entity-card .card-actions-top .icon-btn {
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
  }
  .toast-container {
    left: 0.5rem;
    right: 0.5rem;
    top: 0.5rem;
    max-width: none;
  }
  .toast {
    min-width: 0;
    max-width: none;
  }
  .modal-content {
    width: calc(100% - 1rem);
    max-width: none;
    margin: 0.5rem;
    max-height: calc(100vh - 1rem - 5rem);
    overflow-y: auto;
  }
  .modal-with-close .modal-close-x {
    min-width: 44px;
    min-height: 44px;
    top: 0.35rem;
    right: 0.35rem;
  }
  #profile-logs-modal .profile-logs-modal-content,
  #profile-logs-modal .modal-content.profile-logs-modal-content {
    max-width: 100% !important;
    width: 100% !important;
    max-height: 85vh;
  }
  #profile-logs-modal .profile-logs-tabs {
    flex-wrap: wrap;
  }
  #profile-logs-modal .profile-logs-tab {
    padding: 0.5rem 0.65rem;
    font-size: 0.8rem;
  }
  #profile-deals-modal .modal-content.profile-limits-modal-content {
    max-width: 100% !important;
    width: 100% !important;
  }
  #profile-deals-modal .profile-deals-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .custom-dialog .custom-dialog-content:has(.task-result-modal) {
    max-width: 100%;
    width: 100%;
  }
  .form-actions-single .btn-primary,
  .trademo-step-actions .btn-primary,
  .trademo-step-actions .btn-secondary {
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .header-block-rate .header-finance-value,
  .header-block-trust .header-finance-value {
    font-size: 0.65rem;
  }
  .content-area {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  .sidebar .nav-item {
    font-size: 0.6rem;
  }
  .sidebar .nav-icon {
    width: 20px;
    height: 20px;
  }
  .dashboard-kpi-period-btn,
  .dashboard-metric-btn,
  .dashboard-period-btn {
    font-size: 0.6rem;
  }
  .entity-card .card-fields {
    font-size: 0.6rem;
  }
  .entity-card .card-fields .field-key {
    min-width: 3.6rem;
    width: 3.6rem;
  }
  #profile-deals-modal .transactions-table,
  #profile-deals-modal .profile-deals-table-wrap .transactions-table {
    font-size: 0.65rem;
  }
  #profile-deals-modal .transactions-table th,
  #profile-deals-modal .transactions-table td {
    padding: 0.2rem 0.3rem;
  }
}
