:root {
  --bg-main: #0f141c;
  --bg-surface: #171d27;
  --bg-card: #1f2735;
  --bg-hover: #263143;
  --border-color: #2b3648;
  --border-light: #37445a;
  
  --text-primary: #f0f4f8;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.2);
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Custom modern dark scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.hidden {
  display: none !important;
}

/* =========================================================
   MAINTENANCE SCREEN (UNDER CONSTRUCTIONS)
   ========================================================= */
.maintenance-screen {
  position: fixed;
  inset: 0;
  background: #000000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 0;
  overflow: hidden;
  text-align: center;
}

.maintenance-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.maintenance-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
  border: none;
  display: block;
}

/* =========================================================
   AUTH MODAL / SCREEN
   ========================================================= */
.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 440px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.auth-logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(0, 168, 255, 0.55));
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  color: #fff;
}

.logo-text h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-text span {
  font-size: 12px;
  color: var(--text-muted);
}

.auth-content h3 {
  font-size: 20px;
  margin-bottom: 6px;
}

.auth-desc {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 20px;
}

.auth-alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-alert.error {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: #fca5a5;
}

.auth-alert.info {
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  color: #93c5fd;
}

.auth-step-pane {
  display: flex;
  flex-direction: column;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.form-group input:focus {
  border-color: var(--accent);
  background: #17202c;
  box-shadow: 0 0 0 2px rgba(0, 168, 255, 0.25);
}

.auth-code-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
}

.auth-code-wrapper input#setup-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
  max-width: 130px;
}

.btn-resend {
  padding: 10px 14px;
  font-size: 12px;
  white-space: nowrap;
  flex: 1;
}

.auth-code-status {
  display: block;
  font-size: 11px;
  line-height: 1.4;
  margin-top: 4px;
  color: var(--text-muted);
}

.auth-code-status.success {
  color: #10b981;
}

.auth-code-status.error {
  color: #f87171;
}

/* Common Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  text-decoration: none;
  user-select: none;
  padding: 9px 18px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.45);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.3);
}

.btn-primary:disabled {
  background: #1e293b;
  border-color: #334155;
  color: #64748b;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-block {
  width: 100%;
  padding: 11px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: #1b2432;
  color: var(--text-primary);
  border-color: var(--border-light);
}

.form-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 4px;
  text-align: center;
}

/* =========================================================
   MAIN LAYOUT & TOP BAR
   ========================================================= */
.main-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  gap: 20px;
  z-index: 10;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 120px;
}

.btn-sidebar-toggle {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-sidebar-toggle svg {
  display: block;
}

.brand-logo-img {
  height: 34px;
  width: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 8px rgba(0, 168, 255, 0.45));
  transition: transform 0.2s ease, filter 0.2s ease;
  cursor: pointer;
}

.brand-logo-img:hover {
  transform: scale(1.04);
  filter: drop-shadow(0 0 14px rgba(0, 168, 255, 0.75));
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  overflow: visible;
}

.filter-item {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-control-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--bg-card);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'><path d='M1 1L5 5L9 1' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 7px 28px 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.filter-control-wrap .filter-select {
  padding-right: 28px;
}

.form-select:focus,
.form-select:hover {
  border-color: var(--accent);
  background-color: #17202c;
  box-shadow: 0 0 0 1px rgba(0, 168, 255, 0.25);
}

.filter-date-range-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.form-date-input {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  color-scheme: dark;
}

.form-date-input:focus,
.form-date-input:hover {
  border-color: var(--accent);
  background-color: #17202c;
  box-shadow: 0 0 0 1px rgba(0, 168, 255, 0.25);
}

.filter-date-separator {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
  user-select: none;
}

.filter-clear-btn {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  background: #1c2635;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  z-index: 3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.filter-clear-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  transform: translateY(-50%) scale(1.08);
}

.search-item {
  min-width: 230px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-input-wrapper input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 7px 28px 7px 30px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.search-input-wrapper input:focus,
.search-input-wrapper input:hover {
  border-color: var(--accent);
  background: #17202c;
  box-shadow: 0 0 0 1px rgba(0, 168, 255, 0.25);
}

.search-icon {
  position: absolute;
  left: 9px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input-wrapper .filter-clear-btn {
  right: 7px;
  z-index: 4;
}

/* Clear All Filters Button */
.btn-clear-all-filters {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1c2635;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  padding: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.btn-clear-all-filters:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* Refresh Button */
.btn-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-refresh:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.btn-refresh.auto-importing {
  color: #4ade80 !important;
  border-color: rgba(74, 222, 128, 0.4);
}

.btn-refresh.auto-importing .refresh-icon {
  stroke: #4ade80;
  animation: spin 1s linear infinite;
}

.btn-refresh.loading .refresh-icon {
  animation: spin 1s linear infinite;
}

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


/* =========================================================
   LAYOUT BODY (SIDEBAR + CONTENT)
   ========================================================= */
.layout-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 12px;
  transition: width 0.2s ease, min-width 0.2s ease, padding 0.2s ease;
  box-sizing: border-box;
}

/* Collapsed Sidebar State */
.sidebar.collapsed {
  width: 64px;
  min-width: 64px;
  padding: 16px 8px;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
  border-left: none !important;
  position: relative;
}

.sidebar.collapsed .nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar.collapsed .nav-item span {
  display: none !important;
}

.sidebar.collapsed .sidebar .btn-refresh,
.sidebar.collapsed .btn-refresh {
  width: 44px;
  height: 40px;
  padding: 0;
  margin-left: auto;
  margin-right: auto;
  justify-content: center;
  border-radius: 8px;
}

.sidebar.collapsed .btn-refresh span {
  display: none !important;
}

.sidebar.collapsed .btn-refresh svg {
  margin: 0;
}

.sidebar.collapsed .sidebar-footer {
  padding-top: 10px;
  align-items: center;
}

.sidebar.collapsed .sidebar-user-block {
  align-items: center;
}

.sidebar.collapsed .user-card-wrap {
  justify-content: center;
}

.sidebar.collapsed .user-info {
  display: none !important;
}

.sidebar.collapsed .btn-logout {
  display: none !important;
}

.sidebar.collapsed .user-avatar {
  margin: 0 auto;
  cursor: pointer;
}

/* Hide entire "Войти как" section when collapsed */
.sidebar.collapsed #impersonate-section,
.sidebar.collapsed .impersonate-section {
  display: none !important;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-item svg {
  flex-shrink: 0;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}

.sidebar .btn-refresh {
  width: 100%;
  justify-content: center;
  padding: 9px 14px;
  margin-top: auto;
  margin-bottom: 12px;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  width: 100%;
  box-sizing: border-box;
}

.sidebar-user-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.user-card-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: #334155;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  font-size: 13px;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-id {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.btn-logout:hover {
  color: var(--danger);
}

/* Impersonate section */
.impersonate-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-sizing: border-box;
  transition: border-color 0.2s, background-color 0.2s;
}

.impersonate-section.is-impersonating {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.08);
}

.impersonate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.impersonate-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.impersonate-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.impersonate-select {
  width: 100%;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.impersonate-select:focus {
  border-color: var(--accent);
}

/* Settings Readonly Banner */
.settings-readonly-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  color: #fbbf24;
  font-size: 13px;
  line-height: 1.5;
}

.settings-grid-container.settings-locked input:not([type="button"]):not([type="submit"]),
.settings-grid-container.settings-locked select,
.settings-grid-container.settings-locked button {
  cursor: not-allowed !important;
}

.settings-grid-container.settings-locked .btn-remove-geo,
.settings-grid-container.settings-locked #btn-add-geo-row,
.settings-grid-container.settings-locked #btn-add-alert-geo-row,
.settings-grid-container.settings-locked #btn-save-alerts,
.settings-grid-container.settings-locked #btn-test-crm-token,
.settings-grid-container.settings-locked #btn-test-crm-token2,
.settings-grid-container.settings-locked #btn-toggle-crm-token,
.settings-grid-container.settings-locked #btn-toggle-crm-token2 {
  opacity: 0.45 !important;
  pointer-events: none !important;
}

.accounts-table.accounts-locked input {
  cursor: not-allowed !important;
  opacity: 0.85;
}

.accounts-table.accounts-locked .btn-remove-account {
  display: none !important;
}

/* =========================================================
   CONTENT AREA & KPI CARDS
   ========================================================= */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px;
  gap: 16px;
}

.summary-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  flex: 1 1 180px;
  max-width: 250px;
  min-width: 140px;
}

/* Single stat cards (Conversions, Leads) */
.kpi-stat-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-sans);
  text-align: left;
}

.kpi-value {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  font-family: var(--font-mono);
  white-space: nowrap;
  line-height: 1.15;
  letter-spacing: 0.5px;
  text-align: right;
  margin-top: auto;
}

.kpi-value.sub {
  font-size: 12px;
  color: var(--accent);
}

.kpi-value.crm-text {
  color: #4ade80;
}

.kpi-value.lost-text {
  color: #fb923c;
}

/* Combined 3-row KPI cards (Spent/Income/Profit, Clicks/CRM/Lost, CPC/EPC/Profit) */
.kpi-clicks-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 12px;
  min-width: 140px;
}

.kpi-fees-card {
  /* Inherits 3-row space-between layout from .kpi-clicks-card */
}

.kpi-clicks-row {
  display: flex;
  align-items: baseline;
}

.kpi-clicks-row.top,
.kpi-clicks-row.mid {
  justify-content: space-between;
}

/* If mid row doesn't have a label (like in CLICKS card where only CRM clicks is shown) */
.kpi-clicks-row.mid:has(> :only-child) {
  justify-content: flex-end;
}

.kpi-clicks-row.mid {
  margin-top: 1px;
}

.kpi-clicks-row.bot {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  margin-top: 4px;
}

.kpi-clicks-row.top.has-center,
.kpi-clicks-row.mid.has-center {
  display: grid;
  grid-template-columns: 62px 76px 1fr;
  align-items: baseline;
}

.kpi-clicks-row.top.has-center > :nth-child(1),
.kpi-clicks-row.mid.has-center > :nth-child(1) {
  width: 62px;
  white-space: nowrap;
  overflow: hidden;
  text-align: left;
}

.kpi-clicks-row.top.has-center > :nth-child(2),
.kpi-clicks-row.mid.has-center > :nth-child(2) {
  width: 76px;
  text-align: right;
  margin: 0;
  padding: 0;
}

.kpi-clicks-row.top.has-center > :nth-child(3),
.kpi-clicks-row.mid.has-center > :nth-child(3) {
  text-align: right;
  margin-left: auto;
}

.kpi-approve-pct,
.kpi-cr-pct {
  display: inline-block;
  width: 76px;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  font-family: var(--font-mono);
  line-height: 1.15;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  box-sizing: border-box;
}



/* Standardized values and typography */
.kpi-val-primary,
.kpi-val-crm,
.kpi-val-spent,
.kpi-val-income,
.kpi-profit-val,
.kpi-lost-val {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1.15;
  letter-spacing: 0.5px;
  text-align: right;
}

.kpi-val-primary {
  color: #ffffff;
}

.kpi-val-crm {
  color: #ffffff;
}

.kpi-val-spent {
  color: #38bdf8; /* sky blue like in Taboola column */
}

.kpi-val-income {
  color: #4ade80; /* green like in CRM column */
}

.kpi-label-lost {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-align: left;
  font-family: var(--font-sans);
}

.kpi-lost-pct {
  font-size: 16px;
  font-weight: 700;
  color: #f59e0b;
  font-family: var(--font-mono);
  line-height: 1.15;
  text-align: center;
  padding: 0 4px;
}

.kpi-lost-val {
  color: #f59e0b;
}

.kpi-label-profit {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-align: left;
  font-family: var(--font-sans);
}

.kpi-roi-val {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1.15;
  text-align: center;
  padding: 0 4px;
}

/* Profit positive (green) */
.kpi-clicks-row.bot.profit-positive .kpi-roi-val,
.kpi-clicks-row.bot.profit-positive .kpi-profit-val {
  color: #4ade80;
}

/* Profit negative (red) */
.kpi-clicks-row.bot.profit-negative .kpi-roi-val,
.kpi-clicks-row.bot.profit-negative .kpi-profit-val {
  color: #ef4444;
}

/* Profit zero / neutral */
.kpi-clicks-row.bot.profit-neutral .kpi-roi-val,
.kpi-clicks-row.bot.profit-neutral .kpi-profit-val {
  color: #94a3b8;
}




.th-sort-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.th-sort-select {
  background: #1c2432;
  border: 1px solid var(--border-color);
  color: #93c5fd;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  text-transform: none;
}

.th-sort-select:hover,
.th-sort-select:focus {
  border-color: var(--accent);
}

.th-sort-select option {
  background: #171d27;
  color: var(--text-primary);
}

.active-period-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-tag {
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  font-size: 12px;
}

.status-tag.realtime {
  border-color: #3b82f6;
  color: #60a5fa;
}

.status-tag.report {
  border-color: #10b981;
  color: #34d399;
}

.active-period-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.count-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.btn-local-refresh {
  width: 26px;
  height: 26px;
  min-width: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-local-refresh:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
}

.btn-local-refresh.loading {
  pointer-events: none;
}

.btn-local-refresh.loading .local-refresh-icon {
  stroke: var(--accent);
  animation: spin 0.8s linear infinite;
}

/* Grouping Dimensions Control */
.grouping-section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

.grouping-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.grouping-pills {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.grouping-pill {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.grouping-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.grouping-pill.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Real-time Monitoring Play/Pause Square Icon Button */
.btn-realtime-monitor {
  width: 28px;
  height: 28px;
  min-width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-realtime-monitor:hover {
  color: #fff;
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.15);
}

.btn-realtime-monitor.running {
  background: rgba(34, 197, 94, 0.18);
  border-color: #22c55e;
  color: #4ade80;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.35);
  animation: pulse-monitor 2s infinite ease-in-out;
}

.btn-realtime-monitor.running:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #f87171;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.35);
}

@keyframes pulse-monitor {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.btn-realtime-monitor:disabled,
.btn-realtime-monitor.disabled {
  opacity: 0.45;
  cursor: not-allowed !important;
  border-color: var(--border-color) !important;
  background: var(--bg-card) !important;
  color: var(--text-muted) !important;
  box-shadow: none !important;
  animation: none !important;
}

/* Group Thumb Placeholder for 16:9 aspect ratio */
.group-thumb-placeholder {
  width: 64px;
  height: 36px;
  background: #192231;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  user-select: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.group-thumb-placeholder:hover {
  border-color: var(--accent);
  background: #1e293b;
  color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
  transform: scale(1.04);
}

.group-thumb-placeholder svg {
  stroke: #60a5fa;
  flex-shrink: 0;
}

.col-thumb.col-thumb-drilldown {
  cursor: pointer;
}

.col-thumb.col-thumb-drilldown:hover .thumb-wrapper {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
  transform: scale(1.04);
}

/* =========================================================
   TABLE & CELLS
   ========================================================= */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.table-responsive {
  overflow-x: auto;
}

.creatives-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.creatives-table thead th {
  background: #131922;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.creatives-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.15s;
}

.creatives-table tbody tr:hover {
  background-color: var(--bg-hover);
}

.creatives-table td {
  padding: 6px 12px;
  vertical-align: middle;
}

/* Column 1: Thumbnail (16:9 format, compact height) */
.col-thumb {
  width: 76px;
  min-width: 76px;
  text-align: center;
}

.thumb-wrapper {
  position: relative;
  width: 64px;
  height: 36px; /* 16:9 aspect ratio */
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.thumb-wrapper:hover .thumb-img {
  transform: scale(1.08);
}

.thumb-retry-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: #60a5fa;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease, background 0.15s, color 0.15s;
  z-index: 1;
}

.thumb-wrapper:hover .thumb-retry-badge {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: rotate(180deg) scale(1.1);
}

.thumb-spinner {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

.thumb-spinner .spinner-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  animation: thumbSpin 0.8s linear infinite;
}

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

/* Column 2: Account & Info (2 text lines total) */
.col-info {
  min-width: 320px;
  position: relative;
}

.info-cell-compact {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  line-height: 1.3;
  position: relative;
  min-height: 38px;
}

.cell-last-update {
  position: absolute;
  right: 4px;
  bottom: 0px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  pointer-events: none;
  line-height: 1;
  opacity: 0.85;
}


.account-name-line {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
}

.account-title-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

/* Dynamic Teaser Label Badges (champion | at_risk | kill) - Clean icon without background */
.teaser-label-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0 2px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  flex-shrink: 0;
  cursor: help;
  user-select: none;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.teaser-label-badge:hover {
  transform: scale(1.2);
}

.teaser-label-badge .label-icon {
  font-size: 14px;
  line-height: 1;
  display: inline-block;
}

.info-second-line {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.group-creative-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Unified Icon Badges (all identical size and line color, text in tooltip hint) */
.badges-left,
.badges-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.badge-icon {
  width: 22px;
  height: 20px;
  min-width: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.28);
  color: #93c5fd;
  cursor: help;
  transition: all 0.15s ease;
  padding: 0;
}

.badge-icon:hover {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

.badge-icon svg {
  display: block;
}

.badge-icon .flag-icon {
  width: 15px;
  height: 11px;
  border-radius: 2px;
  display: block;
  object-fit: cover;
}

/* Delivery Status Badges */
.badge-icon.status.running {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
  color: #22c55e;
}
.badge-icon.status.running:hover {
  background: rgba(34, 197, 94, 0.25);
  border-color: rgba(34, 197, 94, 0.6);
}

.badge-icon.status.paused {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: #f59e0b;
}
.badge-icon.status.paused:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.6);
}

.badge-icon.status.stopped {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.35);
  color: #f43f5e;
}
.badge-icon.status.stopped:hover {
  background: rgba(244, 63, 94, 0.25);
  border-color: rgba(244, 63, 94, 0.6);
}

.badge-icon.status.pending {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}
.badge-icon.status.pending:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.6);
}

.badge-icon.status.rejected {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
}
.badge-icon.status.rejected:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
}

/* Learning Status Badges (Taboola SmartBid ML) */
.badge-icon.learning.complete {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
}
.badge-icon.learning.complete:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.6);
}

.badge-icon.learning.learning {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.35);
  color: #0ea5e9;
}
.badge-icon.learning.learning:hover {
  background: rgba(14, 165, 233, 0.25);
  border-color: rgba(14, 165, 233, 0.6);
}

.badge-icon.learning.limited {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: #f59e0b;
}
.badge-icon.learning.limited:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.6);
}

.badge-icon.learning.expedited {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.35);
  color: #a855f7;
}
.badge-icon.learning.expedited:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: rgba(168, 85, 247, 0.6);
}

.badge-icon.learning.empty {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.25);
  color: #94a3b8;
}
.badge-icon.learning.empty:hover {
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(148, 163, 184, 0.4);
}

/* Lightbox Modal for Full Image */
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(6px);
}

.image-modal-container {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  z-index: 1;
}

.image-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
  background: #131922;
}

.image-modal-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.image-modal-close:hover {
  color: #fff;
}

.image-modal-body {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #090d13;
  max-height: 65vh;
  overflow: hidden;
}

.image-modal-body img {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 6px;
  object-fit: contain;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.image-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  background: #131922;
  gap: 12px;
}

.image-modal-desc {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-modal-link {
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.image-modal-link:hover {
  text-decoration: underline;
}

/* Accounts View Styles */
.view-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.view-header {
  margin-bottom: 2px;
}

.view-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.view-header p {
  font-size: 13px;
  color: var(--text-secondary);
}

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

.accounts-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.accounts-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  text-align: left;
}

.accounts-table th {
  background: #131922;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-color);
  box-sizing: border-box;
}

.accounts-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  box-sizing: border-box;
}

.account-real-name {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}

.account-alias-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.account-alias-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #1c2432;
}

/* Proportional text columns */
.col-account-name,
.col-account-name-td {
  width: 36%;
}

.col-account-alias,
.col-account-alias-td {
  width: 32%;
}

.col-account-id,
.col-account-id-td {
  width: 32%;
}

/* Compact fixed tool columns with identical size (Комиссия, Комиссия 2, Действия) */
.col-account-commission,
.col-account-commission-td,
.col-account-commission2,
.col-account-commission2-td,
.col-account-actions,
.accounts-actions-td {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  text-align: center;
  white-space: nowrap;
}

.account-commission-input,
.account-commission2-input {
  width: 100%;
  max-width: 80px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  padding: 7px 4px;
  margin: 0 auto;
  display: block;
  box-sizing: border-box;
}

.accounts-actions-td {
  text-align: center;
  vertical-align: middle;
}

.accounts-actions-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.btn-test-taboola {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #60a5fa;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-test-taboola:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.24);
  border-color: #3b82f6;
  color: #93c5fd;
  transform: translateY(-1px);
}

.btn-test-taboola:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.btn-test-taboola.success {
  background: rgba(34, 197, 94, 0.18) !important;
  border-color: #22c55e !important;
  color: #4ade80 !important;
}

.btn-test-taboola.error {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: #ef4444 !important;
  color: #f87171 !important;
}

.btn-remove-account {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-remove-account:hover:not(:disabled):not(.disabled) {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
  transform: translateY(-1px);
}

.btn-remove-account:disabled,
.btn-remove-account.disabled {
  opacity: 0.25;
  cursor: not-allowed;
  border-color: #334155;
  color: #64748b;
  transform: none !important;
  background: transparent !important;
}

.account-realtime-allowed-cb {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #3b82f6;
  margin: 0;
  transition: opacity 0.2s;
}

.account-realtime-allowed-cb:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.realtime-accounts-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-realtime-accounts-toggle {
  height: 28px;
  padding: 0 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-realtime-accounts-toggle:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.08);
}

.btn-realtime-accounts-toggle.open {
  border-color: var(--accent);
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.12);
}

.btn-realtime-accounts-toggle .dropdown-chevron {
  transition: transform 0.2s ease;
}

.btn-realtime-accounts-toggle.open .dropdown-chevron {
  transform: rotate(180deg);
}

.btn-realtime-accounts-toggle:disabled,
.btn-realtime-accounts-toggle.disabled {
  opacity: 0.45;
  cursor: not-allowed !important;
  border-color: var(--border-color) !important;
  background: var(--bg-card) !important;
  color: var(--text-muted) !important;
}

.realtime-accounts-dropdown.disabled {
  cursor: not-allowed !important;
}

.realtime-accounts-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1000;
  min-width: 220px;
  max-width: 320px;
  background: #182234;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeInDown 0.15s ease-out;
}

.realtime-accounts-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.realtime-accounts-list {
  padding: 4px 0;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.realtime-account-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.realtime-account-item:hover {
  background: rgba(59, 130, 246, 0.15);
}

.realtime-account-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #3b82f6;
  margin: 0;
  flex-shrink: 0;
}

.realtime-account-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Account ID Cell & Gear Button */
.account-id-cell-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.account-id-cell-wrap .readonly-account-id {
  flex: 1;
  background: #121822;
  color: #94a3b8;
  cursor: default;
  user-select: all;
  border-color: rgba(255, 255, 255, 0.08);
}

.account-id-cell-wrap .readonly-account-id:focus {
  border-color: rgba(255, 255, 255, 0.15);
  background: #121822;
  box-shadow: none;
}

.btn-open-taboola-modal {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #60a5fa;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-open-taboola-modal:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.24);
  border-color: #3b82f6;
  color: #93c5fd;
  transform: translateY(-1px);
}

.btn-open-taboola-modal:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.1);
  color: #64748b;
  background: rgba(255, 255, 255, 0.03);
  transform: none;
}

/* Custom Modal Styles (Taboola Parameters Modal) */
.custom-modal {
  position: fixed;
  inset: 0;
  z-index: 3100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.custom-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(6px);
}

.custom-modal-container {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.2s ease-out;
  overflow: hidden;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.custom-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border-color);
  background: #141a24;
}

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

.custom-modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.custom-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-top: -2px;
  transition: color 0.15s;
}

.custom-modal-close:hover {
  color: #fff;
}

.custom-modal-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.required-star {
  color: #f87171;
}

.modal-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  transition: border-color 0.2s;
}

.modal-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #1c2432;
}

.modal-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.input-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-password-wrap .modal-input {
  padding-right: 38px;
}

.btn-toggle-secret {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-secret:hover {
  color: var(--text-primary);
}

.modal-status-box {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-status-box.info {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.modal-status-box.success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.modal-status-box.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.custom-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--border-color);
  background: #141a24;
  gap: 12px;
}

.modal-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Taboola Tools Modal */
.taboola-tools-modal-container {
  max-width: 800px;
  width: 100%;
}

.taboola-tools-body {
  display: flex;
  min-height: 380px;
  max-height: 70vh;
  padding: 0;
  overflow: hidden;
}

.taboola-tools-sidebar {
  width: 220px;
  background: #101622;
  border-right: 1px solid var(--border-color);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.taboola-tools-tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.15s ease;
}

.taboola-tools-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.taboola-tools-tab-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  font-weight: 600;
}

.taboola-tools-content-area {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg-surface);
}

.taboola-tool-header {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.taboola-tool-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.taboola-tool-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
}

.taboola-tools-console-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #090d16;
  overflow: hidden;
  min-height: 280px;
}

.taboola-tools-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #0f1523;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
}

.taboola-tools-console-output {
  flex: 1;
  padding: 12px 14px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #e2e8f0;
  background: #090d16;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 4px;
  text-align: left;
}

.taboola-tools-console-output .log-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  padding: 2px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-family: inherit;
  text-align: left;
}

.taboola-tools-console-output .log-time {
  color: #64748b;
  font-size: 11px;
  font-family: inherit;
  white-space: nowrap;
  user-select: none;
}

.taboola-tools-console-output .log-msg {
  color: #4ade80;
  font-family: inherit;
  word-break: break-word;
}

.taboola-tools-console-output .log-placeholder {
  color: #475569;
  font-style: italic;
  padding: 4px 0;
  text-align: left;
}

.btn-save-alias {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.btn-save-alias:hover {
  background: var(--accent-hover);
}

.btn-save-alias.saved {
  background: #10b981;
}

/* Column 3, 4, 5: Metric Blocks (Profit, Clicks, Leads) */
.creatives-table th.col-profit,
.creatives-table td.col-profit {
  width: 213px;
  white-space: nowrap;
  padding-left: 20px;
  padding-right: 20px;
}

.creatives-table th.col-clicks,
.creatives-table td.col-clicks {
  width: 169px;
  white-space: nowrap;
  padding-left: 36px;
  padding-right: 20px;
}

.creatives-table th.col-leads,
.creatives-table td.col-leads {
  width: 150px;
  white-space: nowrap;
  padding-left: 36px;
  padding-right: 24px;
}

.creatives-table th.col-scoring,
.creatives-table td.col-scoring {
  width: 175px;
  white-space: nowrap;
  padding-left: 24px;
  padding-right: 20px;
}

.col-profit .metrics-compact,
.col-profit .th-sort-wrapper {
  width: 181px;
  max-width: 181px;
}

.col-clicks .metrics-compact,
.col-clicks .th-sort-wrapper {
  width: 138px;
  max-width: 138px;
}

.col-leads .metrics-compact,
.col-leads .th-sort-wrapper {
  width: 125px;
  max-width: 125px;
}

.col-scoring .metrics-compact,
.col-scoring .th-sort-wrapper {
  width: 155px;
  max-width: 155px;
}

.scoring-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.scoring-badge.learning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.scoring-badge.critical_stop {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

.scoring-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.scoring-badge.active.has-warning {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

.scoring-prob-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
}

.scoring-prob-val.high {
  color: #34d399;
}

.scoring-prob-val.mid {
  color: #f59e0b;
}

.scoring-prob-val.low {
  color: #f87171;
}

.scoring-sub-hint {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.metrics-compact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  line-height: 1.3;
}

.metric-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.m-label {
  color: var(--text-muted);
  font-size: 11px;
}

.m-arrow {
  color: var(--text-muted);
  font-size: 12px;
  opacity: 0.7;
  user-select: none;
}

.m-cpc {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  color: #38bdf8;
  cursor: help;
  user-select: none;
  white-space: nowrap;
}

.m-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 12px;
}

.m-value.spent-val {
  color: #38bdf8;
}

.m-value.crm-income-val {
  color: #4ade80;
}

.m-value.profit-pos {
  color: #4ade80;
}

.m-value.profit-neg {
  color: #ef4444;
}

.m-value.profit-neu {
  color: #94a3b8;
}

.m-value.lost-val {
  color: #f59e0b;
}

.m-value.sub-rate {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* States */
.table-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  gap: 12px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Settings View Styles */
.settings-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 16px;
  width: 100%;
  align-items: start;
}

.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 24px;
  width: 100%;
  box-sizing: border-box;
}

.settings-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.settings-section-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.settings-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-timezone-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.settings-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  outline: none;
  min-width: 280px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.settings-select:hover,
.settings-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.settings-select option {
  background: #171d27;
  color: var(--text-primary);
}

.timezone-current-time-badge {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 8px 14px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.settings-inline-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.settings-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.settings-import-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.settings-import-grid .settings-label {
  min-width: 135px;
  flex-shrink: 0;
}

.settings-field-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-field-row-aligned {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-label-aligned {
  width: 235px;
  min-width: 235px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-label-aligned .settings-label {
  margin-bottom: 0;
  white-space: nowrap;
}

.settings-field-row-inline {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.settings-input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  outline: none;
  flex: 1;
  max-width: 350px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.settings-input-sm {
  width: 90px;
  flex: none;
}

.settings-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.token-input-action-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 350px;
}

.token-input-action-wrap .input-password-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.token-input-action-wrap .input-password-wrap .settings-input {
  width: 100%;
  max-width: 100%;
  padding-right: 36px;
}

.btn-test-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  min-width: 78px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-hover, #232d3f);
  border: 1px solid var(--border-color, #334155);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-test-token:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-test-token:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-test-token.testing {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-test-token.success {
  background: rgba(16, 185, 129, 0.18) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
}

.btn-test-token.error {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}

.settings-inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
}

.settings-inline-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.settings-checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  background: transparent;
  border: none;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s ease;
}

.settings-checkbox-item:hover {
  background: transparent;
  opacity: 0.85;
}

.settings-checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.checkbox-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.checkbox-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}


/* =========================================================
   TOOLTIP
   ========================================================= */
.creative-tooltip {
  position: fixed;
  background: #1a222f;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px 14px;
  width: 280px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 2000;
  pointer-events: none;
  font-size: 12px;
  transition: opacity 0.15s ease-out;
}

.tooltip-title {
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  margin-bottom: 6px;
}

.tooltip-desc {
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
}

/* =========================================================
   IMPORT VIEW PANE & DRAG-AND-DROP STYLES
   ========================================================= */
.import-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 12px;
}

.import-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.import-section-title svg {
  color: var(--accent);
}

.import-date-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.date-preset-buttons {
  display: inline-flex;
  background: #111722;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
}

.btn-date-preset {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-date-preset:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-date-preset.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 168, 255, 0.3);
}

.import-custom-date-wrap {
  display: flex;
  align-items: center;
}

.import-custom-date-wrap input[type="date"] {
  background: #111722;
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.import-custom-date-wrap input[type="date"]:focus {
  border-color: var(--accent);
}

.import-date-selected-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  margin-left: auto;
}

.import-date-selected-badge strong {
  color: #38bdf8;
  font-family: var(--font-mono);
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed #2a384c;
  border-radius: 10px;
  background: #101622;
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.drop-zone:hover {
  border-color: var(--accent);
  background: #131c2b;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: #14243b;
  box-shadow: 0 0 20px rgba(0, 168, 255, 0.2);
  transform: scale(1.005);
}

.file-input-hidden {
  display: none;
}

.drop-zone-icon {
  color: #64748b;
  margin-bottom: 8px;
  transition: color 0.2s, transform 0.2s;
}

.drop-zone:hover .drop-zone-icon,
.drop-zone.drag-over .drop-zone-icon {
  color: var(--accent);
  transform: translateY(-2px);
}

.drop-zone-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.drop-zone-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 0;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  font-weight: 500;
}

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

/* Files List */
.files-list-container {
  margin-top: 14px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.files-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.files-list-title {
  font-size: 12px;
  color: var(--text-secondary);
}

.files-list-title strong {
  color: var(--text-primary);
  margin-left: 4px;
}

.files-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #121824;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 12px;
  gap: 12px;
  transition: border-color 0.15s;
}

.file-item:hover {
  border-color: #334155;
}

.file-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.file-item-icon {
  color: #94a3b8;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.file-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}

.file-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.file-badge {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  line-height: 1.2;
}

.file-badge.realtime {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.file-badge.campaigns {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.file-item-size {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  min-width: 50px;
  text-align: right;
}

.file-item-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-item-remove-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
}

/* Actions Bar */
.import-actions-bar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-lg {
  padding: 11px 22px;
  font-size: 14px;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--border-color);
}

.import-status-text {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Result Card */
.import-result-card {
  background: #111a28;
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 10px;
  padding: 20px;
  margin-top: 16px;
  animation: fadeIn 0.3s ease;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.result-icon.success {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  flex-shrink: 0;
}

.result-info {
  flex: 1;
}

.result-info h4 {
  font-size: 15px;
  color: #fff;
  margin-bottom: 2px;
}

.result-info p {
  font-size: 12px;
  color: var(--text-secondary);
}

.result-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  background: #0b1018;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.result-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.result-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.4px;
  text-align: center;
}

.result-stat-val {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  text-align: center;
}

.result-stat-val.highlight {
  color: #38bdf8;
}

.result-files-section {
  margin-top: 16px;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.result-files-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.result-files-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.result-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0b1018;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  gap: 12px;
  font-size: 12px;
}

.result-file-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.result-file-status-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}

.result-file-status-icon.success {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.result-file-status-icon.fail {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.result-file-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-file-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.result-file-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}

.result-file-badge.success {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.result-file-badge.fail {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* =========================================================
   TOOLS VIEW
   ========================================================= */
.tools-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 24px;
  max-width: 800px;
}

.danger-card {
  border-left: 4px solid var(--danger);
}

.tools-card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.tools-card-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tools-card-icon-wrap.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

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

.tools-section-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tools-range-form {
  background: #0f1520;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tools-section-block {
  margin-bottom: 24px;
}

.tools-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.tools-section-header svg {
  color: var(--accent);
}

.tools-range-form-single-row {
  background: #0f1520;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.tools-range-form-single-row .form-group-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tools-range-form-single-row .form-date-input {
  min-width: 140px;
}

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-group-inline label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.tools-action-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border: 1px solid #ef4444;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #dc2626;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.btn-danger:disabled {
  background: #331e22;
  border-color: #4a272e;
  color: #885c63;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.tools-status-msg {
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 6px;
  line-height: 1.4;
}

.tools-status-msg.success {
  background: var(--success-bg);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.tools-status-msg.error {
  background: var(--danger-bg);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Metrics & Bayesian Settings */
.settings-metrics-global {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 500px;
}

.settings-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 500px;
  gap: 16px;
}

.settings-metric-row .settings-field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.settings-metric-row .settings-input-unit-wrap {
  width: 140px;
  flex-shrink: 0;
}

.settings-label-with-tip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

/* Tooltip Popup Styles for Settings Parameters */
.settings-info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  color: var(--text-muted, #64748b);
  vertical-align: middle;
  outline: none;
  transition: color 0.15s ease;
  line-height: 1;
}

.settings-info-tip:hover,
.settings-info-tip:focus,
.settings-info-tip.active {
  color: #60a5fa;
}

.settings-info-tip .info-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2;
  pointer-events: none;
  display: block;
}

.settings-info-tip .settings-tip-popup {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: -10px;
  width: 320px;
  background: #182232;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #cbd5e1;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
  white-space: normal;
  font-weight: normal;
  text-align: left;
}

.settings-info-tip .settings-tip-popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 16px;
  border-width: 6px;
  border-style: solid;
  border-color: #182232 transparent transparent transparent;
}

.settings-info-tip:hover .settings-tip-popup,
.settings-info-tip:focus .settings-tip-popup,
.settings-info-tip:focus-within .settings-tip-popup,
.settings-info-tip.active .settings-tip-popup {
  visibility: visible;
  opacity: 1;
}

.settings-info-tip.tip-align-right .settings-tip-popup {
  left: auto;
  right: -10px;
}

.settings-info-tip.tip-align-right .settings-tip-popup::after {
  left: auto;
  right: 16px;
}

/* Downward Tooltip Popup (e.g. for Table Headers) */
.settings-info-tip.tip-down .settings-tip-popup,
.settings-geo-table th .settings-info-tip .settings-tip-popup {
  bottom: auto;
  top: calc(100% + 8px);
}

.settings-info-tip.tip-down .settings-tip-popup::after,
.settings-geo-table th .settings-info-tip .settings-tip-popup::after {
  top: auto;
  bottom: 100%;
  border-color: transparent transparent #182232 transparent;
}

.tip-title {
  display: block;
  font-weight: 700;
  font-size: 12.5px;
  color: #fff;
  margin-bottom: 6px;
}

.tip-section {
  display: block;
  margin-top: 5px;
}

.tip-section b {
  color: #93c5fd;
  font-weight: 600;
}

.tip-status-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}

.tip-status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
}

.tip-status-item .badge-icon {
  width: 18px;
  height: 16px;
  min-width: 18px;
  cursor: default;
  transform: none !important;
}

.settings-metrics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .system-grid-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .settings-grid-container {
    grid-template-columns: 1fr;
  }
  .settings-metrics-row {
    grid-template-columns: 1fr;
  }
  .settings-metric-row,
  .settings-metrics-global,
  .settings-geo-section {
    max-width: 100%;
  }
}

.settings-field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.settings-field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.settings-input-unit-wrap {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}

.settings-input-num {
  width: 100%;
  padding-right: 55px !important;
}

.settings-unit {
  position: absolute;
  right: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  pointer-events: none;
}

.settings-hint {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Geo Settings Table */
.settings-geo-section {
  border-top: 1px solid var(--border-color);
  padding-top: 18px;
  max-width: 500px;
}

.settings-geo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.settings-subsection-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-geo-table-wrap {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  overflow: visible;
}

.settings-geo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.settings-geo-table th {
  background: #17202c;
  color: var(--text-secondary);
  padding: 8px 6px;
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.settings-geo-table td {
  padding: 6px 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

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

.settings-th-content {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.settings-geo-input {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
}

.settings-geo-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 168, 255, 0.2);
}

.settings-geo-input-upper {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.btn-remove-geo {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.btn-remove-geo:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
}

.settings-geo-footer-hint {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Telegram Alerts UI Styles */
.settings-card-header-flex {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.settings-alert-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.settings-alerts-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 235px;
  width: 235px;
}

.settings-alert-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
}

.settings-alert-col-action {
  width: 72px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.btn-alert-test-inline {
  width: 72px;
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 6px;
  box-sizing: border-box;
}

.settings-hint-inline {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 6px;
  font-weight: normal;
}

.alert-status-text {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.3s;
}

.alert-status-text.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-status-text.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.system-card .settings-label {
  width: 440px;
  min-width: 440px;
  flex-shrink: 0;
}

/* Taboola Settings Grid */
.settings-taboola-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.settings-taboola-grid .settings-label {
  width: 275px;
  min-width: 275px;
  flex-shrink: 0;
}

.settings-taboola-grid .settings-field-row {
  display: flex;
  align-items: center;
}

.settings-taboola-grid .alert-input-compact-wrap {
  width: 80px !important;
  height: 28px !important;
}

.settings-taboola-grid .alert-input-compact {
  width: 80px !important;
  min-width: 0 !important;
  max-width: 80px !important;
  height: 28px !important;
  padding: 4px 28px 4px 8px !important;
  font-size: 13px;
  text-align: center;
  box-sizing: border-box;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.settings-taboola-grid select.alert-input-compact {
  width: 80px !important;
  min-width: 0 !important;
  max-width: 80px !important;
  height: 28px !important;
  padding: 4px 6px !important;
  font-size: 13px;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
  box-sizing: border-box;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.settings-taboola-grid .alert-unit-compact {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-secondary);
  pointer-events: none;
}

/* Compact alert inputs */
.alert-input-compact-wrap {
  width: 80px !important;
  display: inline-flex;
  align-items: center;
  position: relative;
  box-sizing: border-box;
}

.alert-input-compact {
  width: 80px !important;
  min-width: 0 !important;
  max-width: 80px !important;
  height: 28px !important;
  padding: 4px 28px 4px 8px !important;
  text-align: center;
  font-size: 13px;
  -moz-appearance: textfield;
  box-sizing: border-box;
  border-radius: 6px;
}

select.alert-input-compact {
  width: 80px !important;
  min-width: 0 !important;
  max-width: 80px !important;
  height: 28px !important;
  padding: 4px 6px !important;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
}

.alert-input-compact::-webkit-outer-spin-button,
.alert-input-compact::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.alert-unit-compact {
  position: absolute;
  right: 7px;
  font-size: 12px;
  color: var(--text-secondary);
  pointer-events: none;
}

.settings-alert-geo-table td {
  padding: 6px 8px !important;
}

.alert-table-geo-code {
  width: 50px !important;
  text-align: center;
  padding: 5px 4px !important;
}

.alert-table-geo-cpc {
  width: 82px !important;
  padding: 5px 8px !important;
  font-variant-numeric: tabular-nums;
}

.btn-add-geo-icon {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
}

.btn-add-geo-icon:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ============================================================
   USER ROLE BADGES & SYSTEM VIEW
   ============================================================ */
.user-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-role-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  user-select: none;
}

.user-role-badge.role-admin {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.user-role-badge.role-user {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.system-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(690px, 1fr));
  gap: 16px;
  width: 100%;
  align-items: start;
}

.system-view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.badge-admin {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  letter-spacing: 0.5px;
}

.card-header-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 16px;
}

.btn-icon-user-add {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
}

.system-add-panel {
  background: var(--bg-hover, #1e2638);
  border: 1px solid var(--border-color, #2d3748);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
  box-sizing: border-box;
}

.system-add-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: flex-end;
}

.system-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.system-form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.system-form-group .settings-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.system-form-group .settings-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.system-form-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 2px;
  min-width: 0;
}

.system-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-surface);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.system-table-wrap::-webkit-scrollbar {
  height: 5px;
}

.system-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.system-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 3px;
}

.system-table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

.system-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
  table-layout: fixed;
}

.system-users-table th {
  background: #131922;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.system-users-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.system-users-table tr:hover td {
  background: var(--bg-hover);
}

.system-users-table .settings-input {
  width: 100%;
  box-sizing: border-box;
}

.system-users-table .settings-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.03);
}

.table-role-select {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  width: 100%;
  max-width: 90px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.table-role-select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.table-role-select:focus {
  border-color: var(--accent);
}

.pwd-status-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwd-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 0;
  width: 82px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  white-space: nowrap;
  box-sizing: border-box;
}

.pwd-badge.set {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.pwd-badge.unset {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.btn-pwd-edit {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-pwd-edit:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent);
  color: #60a5fa;
  transform: translateY(-1px);
}

.btn-pwd-reset {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-pwd-reset:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #f87171;
  transform: translateY(-1px);
}

.btn-user-delete {
  background: none;
  border: 1px solid transparent;
  color: #ef4444;
  border-radius: 6px;
  cursor: pointer;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-user-delete:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-user-delete:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.system-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.system-info-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
}

.system-info-box .info-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.system-info-box .info-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.token-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.token-count-badge.two {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
}

.crm-sync-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

.sync-error-text {
  color: #ef4444 !important;
  font-weight: 600;
}

/* =========================================================
   HELP VIEW PANE (USER GUIDE)
   ========================================================= */
.help-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 980px;
}

.help-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 24px 28px;
  position: relative;
}

.help-card.intro-card {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(15, 23, 42, 0.9));
  border-color: rgba(59, 130, 246, 0.25);
}

.help-card-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  margin-bottom: 12px;
}

.help-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.help-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.help-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.help-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #101622;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px 16px;
}

.help-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.15);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.help-feature-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.help-feature-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.help-steps-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 16px;
}

.help-step-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.help-step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 168, 255, 0.35);
}

.help-step-content {
  flex: 1;
}

.help-step-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.help-step-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.help-step-sublist {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.6;
}

.help-step-sublist li {
  margin-bottom: 4px;
}

.help-step-sublist code {
  background: #111827;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  color: #38bdf8;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.help-callout {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.45;
}

.help-callout.info {
  background: rgba(59, 130, 246, 0.1);
  border-left: 3px solid #3b82f6;
  color: #93c5fd;
}

.help-tips-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.help-tip-item {
  background: #101622;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.help-tip-item b {
  color: var(--text-primary);
}

/* ============================================================= */
/* BACKUP & RESTORE PANEL STYLES                                */
/* ============================================================= */

.backup-system-card {
  margin-top: 4px;
}

.backup-folder-badge {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
}

.backup-settings-box {
  background: var(--bg-hover, #182234);
  border: 1px solid var(--border-color, #2b354f);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.backup-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.backup-settings-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
}

.backup-settings-subtitle code {
  color: #38bdf8;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
}

.backup-controls-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.backup-inline-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.settings-label-inline {
  font-size: 12px;
  color: var(--text-secondary, #94a3b8);
  white-space: nowrap;
}

.backup-checkbox-toggle,
.backup-checkbox-images {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-primary, #e2e8f0);
  cursor: pointer;
  user-select: none;
}

.backup-checkbox-images {
  color: #cbd5e1;
}

.backup-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 11px;
  min-height: 22px;
}

.backup-info-text {
  color: var(--text-secondary, #94a3b8);
  font-size: 11px;
}

.backup-list-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.backup-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.backup-list-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
}

.backup-list-title code {
  color: #38bdf8;
  font-family: var(--font-mono, monospace);
}

.backup-table-wrap {
  overflow-x: hidden !important;
  width: 100%;
}

.backup-table {
  width: 100% !important;
  table-layout: auto !important;
}

.backup-table th,
.backup-table td {
  vertical-align: middle;
  padding: 8px 10px;
}

.backup-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
}

.backup-badge-img-yes {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.backup-badge-img-no {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.backup-img-sym {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.backup-img-sym.yes {
  color: #10b981;
}

.backup-img-sym.no {
  color: #64748b;
}

.backup-badge-auto {
  font-size: 9px;
  margin-left: 4px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  text-transform: uppercase;
}

.backup-actions-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.btn-backup-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1.2;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
  font-weight: 500;
}

.btn-backup-download {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.btn-backup-download:hover {
  background: rgba(56, 189, 248, 0.22);
  color: #7dd3fc;
}

.btn-backup-restore {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.btn-backup-restore:hover {
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
}

.btn-backup-delete {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-backup-delete:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

/* Backup Restore Confirmation Modal */
.backup-restore-warning-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 6px;
  padding: 12px 14px;
  color: #fca5a5;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.backup-restore-target-info {
  background: var(--bg-hover, #182234);
  border: 1px solid var(--border-color, #2b354f);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.backup-target-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 3px 0;
}

.backup-target-label {
  color: var(--text-secondary, #94a3b8);
}

.backup-target-value {
  font-family: var(--font-mono, monospace);
  color: var(--text-primary, #e2e8f0);
  font-weight: 500;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-restore-note {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 14px;
}

.backup-restore-note code {
  color: #38bdf8;
  font-family: var(--font-mono, monospace);
}

.backup-restore-progress-box {
  display: flex;
  align-items: center;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 6px;
  padding: 10px 14px;
  color: #38bdf8;
  font-size: 13px;
  margin-top: 10px;
}

/* =========================================================
   REPORTS VIEW & DAILY REPORT TABLE
   ========================================================= */
.reports-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  margin: -20px;
  height: calc(100% + 40px);
  min-height: calc(100% + 40px);
  overflow: hidden;
}

.reports-layout.hidden {
  display: none !important;
}

.reports-sidebar {
  width: 210px;
  min-width: 210px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
  overflow-y: auto;
}

.reports-sidebar-header {
  padding: 0 4px 8px 4px;
  border-bottom: 1px solid var(--border-color);
}

.reports-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.reports-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reports-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.15s ease;
}

.reports-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.reports-nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-left: 3px solid var(--accent);
  font-weight: 600;
}

.reports-main-content {
  flex: 1;
  min-width: 0;
  padding: 16px 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.report-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1;
}

.report-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 2px;
  flex-shrink: 0;
}

.report-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.report-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-control-group label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.report-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.report-select:focus {
  border-color: var(--accent);
}

.report-refresh-btn,
.report-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  height: 34px;
}

/* Report Accounts Multi-select Dropdown */
.report-accounts-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-report-accounts-toggle {
  height: 34px;
  padding: 0 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-report-accounts-toggle:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.08);
}

.btn-report-accounts-toggle.open {
  border-color: var(--accent);
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.12);
}

.btn-report-accounts-toggle .dropdown-chevron {
  transition: transform 0.2s ease;
}

.btn-report-accounts-toggle.open .dropdown-chevron {
  transform: rotate(180deg);
}

.report-accounts-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1000;
  min-width: 240px;
  max-width: 340px;
  background: #182234;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeInDown 0.15s ease-out;
}

.report-accounts-menu-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.report-accounts-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.report-action-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.3;
  transition: all 0.15s ease;
  user-select: none;
}

.report-action-btn:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.report-action-btn:active {
  transform: translateY(1px);
}

.report-action-btn.report-action-clear {
  color: var(--text-muted);
}

.report-action-btn.report-action-clear:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.report-action-divider {
  color: var(--text-muted);
  opacity: 0.3;
  font-size: 11px;
}

.report-accounts-list {
  padding: 4px 0;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.report-account-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.report-account-item:hover {
  background: rgba(59, 130, 246, 0.15);
}

.report-account-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.report-account-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-accounts-empty {
  padding: 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Report Table */
.report-table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.report-table-container .table-responsive {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  max-height: calc(100vh - 160px);
}

.report-daily-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  text-align: left;
}

.report-daily-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #131922;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-color);
  box-shadow: inset 0 -1px 0 var(--border-color);
  white-space: nowrap;
}

.report-daily-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.15s;
}

.report-daily-table tbody tr:hover {
  background-color: var(--bg-hover);
}

.report-daily-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.report-daily-table .th-day,
.report-daily-table .td-day {
  width: 48px;
  min-width: 40px;
  max-width: 54px;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.report-daily-table .report-row-fees-push .td-day {
  text-align: left;
  padding-left: 10px;
  max-width: none;
  width: auto;
}

.report-daily-table .report-row-total .td-day {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.report-daily-table .td-day {
  font-weight: 500;
  color: var(--text-primary);
  font-family: var(--font-mono, monospace);
}

.report-daily-table .text-right {
  text-align: right;
  font-family: var(--font-mono, monospace);
}

.report-row-future {
  opacity: 0.4;
}

.report-row-future:hover {
  background-color: transparent;
}

.report-row-fees-push {
  background: rgba(255, 255, 255, 0.02);
  border-top: 2px solid var(--border-color);
  font-weight: 600;
}

.report-row-fees-push:hover {
  background: rgba(255, 255, 255, 0.05);
}

.report-row-total {
  background: #141c2b !important;
  border-top: 2px solid var(--border-light);
  border-bottom: 2px solid var(--border-light);
  font-weight: 700;
}

.report-row-total:hover {
  background: #182235 !important;
}

.report-row-total td {
  color: var(--text-primary);
  font-size: 13.5px;
}

.report-daily-table .td-bold {
  font-weight: 700;
}

.report-daily-table .profit-positive {
  color: var(--success) !important;
}

.report-daily-table .profit-negative {
  color: var(--danger) !important;
}

.report-daily-table .profit-neutral,
.report-daily-table .val-zero {
  color: var(--text-muted);
}




