/* ============================================================================
   EXIMP Design System
   Based on: CI Manual (Diton colors) + Falcon UI Reference
   Font: Rajdhani (Google Fonts)
   Color: Tyrkysová #009AA6 + Oranžová #f36f32 + Lehce šedá
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@300;400;500;600;700&display=swap');

/* ============================================================================
   CSS Variables (Design Tokens)
   ============================================================================ */

:root {
  /* Primární barvy z CI */
  --primary: #009AA6;
  --primary-light: #b1dce0;
  --primary-hover: #007d87;
  --primary-rgb: 0, 154, 166;
  
  --accent: #f36f32;
  --accent-hover: #d95a1f;
  --accent-rgb: 243, 111, 50;
  
  /* Šedá paleta (lehce do šedé) */
  --gray-50: #f8f9fb;
  --gray-100: #f1f3f6;
  --gray-200: #e6e9ee;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Sémantické barvy */
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --error: #dc2626;
  --error-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;
  
  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 76px;
  --topbar-height: 64px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  
  /* Border radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  
  /* Typography */
  --font-family: 'Rajdhani', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ============================================================================
   Reset & Base
   ============================================================================ */

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

html {
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  background: var(--gray-50);
  color: var(--gray-700);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   Typography
   ============================================================================ */

h1, h2, h3, h4, h5, h6 {
  color: var(--gray-900);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
}

h1 { font-size: 32px; }
h2 { font-size: 26px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }
h5 { font-size: 16px; }
h6 { font-size: 14px; }

p { margin: 0 0 12px; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-hover);
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
}

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

/* Primary Button */
.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.2);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
  transform: translateY(-1px);
}

/* Secondary Button */
.btn, .btn-secondary {
  background: white;
  color: var(--gray-700);
  border-color: var(--gray-300);
}

.btn:hover:not(:disabled), .btn-secondary:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

/* Accent Button */
.btn-accent {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.2);
}

.btn-accent:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
  transform: translateY(-1px);
}

/* Success Button */
.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
  background: #15803d;
  transform: translateY(-1px);
}

/* Danger Button */
.btn-danger {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  transform: translateY(-1px);
}

/* Button Sizes */
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 700;
}

/* ============================================================================
   Forms
   ============================================================================ */

.input, input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
select, textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--gray-700);
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.input:disabled,
input:disabled,
select:disabled {
  background: var(--gray-100);
  color: var(--gray-400);
  cursor: not-allowed;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

/* ============================================================================
   Cards
   ============================================================================ */

.card {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* ============================================================================
   Tables
   ============================================================================ */

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

thead {
  background: var(--gray-100);
}

th {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--gray-200);
}

td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-200);
}

tbody tr:hover {
  background: var(--gray-50);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================================================
   Badges
   ============================================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: #b45309;
}

.badge-error {
  background: var(--error-light);
  color: var(--error);
}

.badge-info {
  background: var(--info-light);
  color: var(--info);
}

.badge-primary {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
}

/* ============================================================================
   Alerts
   ============================================================================ */

.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  border-left: 4px solid;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-success {
  background: var(--success-light);
  border-color: var(--success);
  color: #166534;
}

.alert-error {
  background: var(--error-light);
  border-color: var(--error);
  color: #991b1b;
}

.alert-warning {
  background: var(--warning-light);
  border-color: var(--warning);
  color: #b45309;
}

.alert-info {
  background: var(--info-light);
  border-color: var(--info);
  color: #1e40af;
}

/* ============================================================================
   Layout - App Container
   ============================================================================ */

.app {
  display: flex;
  min-height: 100vh;
  background: var(--gray-50);
}

/* ============================================================================
   Sidebar
   ============================================================================ */

.sidebar {
  width: var(--sidebar-width);
  background: white;
  border-right: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.2s ease;
  display: flex;
  flex-direction: column;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

/* Sidebar Header */
.sb-head {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}

/* Logo */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--gray-900);
  min-width: 0;
}

.logo {
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.brand-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.sidebar.collapsed .brand-text {
  display: none;
}

.sidebar.collapsed .logo {
  display: none;
}

.sidebar.collapsed .sb-head {
  justify-content: center;
}

/* Toggle Button */
.sb-toggle {
  border: 1px solid var(--gray-300);
  background: white;
  border-radius: var(--radius);
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
  font-size: 16px;
  color: var(--gray-600);
}

.sb-toggle:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.sidebar.collapsed .sb-toggle {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.sidebar.collapsed .sb-toggle:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

/* Sidebar Nav */
.sb-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

/* Sidebar Title */
.sb-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 10px 8px;
  margin-top: 8px;
}

.sidebar.collapsed .sb-title {
  display: none;
}

/* Sidebar Links */
.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius);
  color: var(--gray-700);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  margin-bottom: 4px;
}

.sb-link:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.sb-link.active {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  font-weight: 700;
}

.sb-ico {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 400;
  flex-shrink: 0;
  background: white;
}

.sb-link.active .sb-ico {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.sb-text {
  white-space: nowrap;
}

.sidebar.collapsed .sb-text {
  display: none;
}

/* ============================================================================
   Main Content Area
   ============================================================================ */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ============================================================================
   Topbar
   ============================================================================ */

.topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.top-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-left .company {
  font-weight: 700;
  font-size: 14px;
  color: var(--gray-900);
}

.top-left .sub {
  font-size: 13px;
  color: var(--gray-500);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Pills (Toggle buttons) */
.pill {
  border: 1px solid var(--gray-300);
  background: white;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--gray-600);
}

.pill:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

.pill.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

/* User Menu */
.user-menu {
  position: relative;
}

.userbox {
  border: 1px solid var(--gray-300);
  background: white;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-family);
  display: flex;
  gap: 10px;
  align-items: center;
  transition: all 0.15s ease;
  cursor: pointer;
}

.userbox:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

.user-menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  min-width: 240px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  margin-top: 4px;
}

.user-menu-dropdown.open {
  display: block;
}

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.user-menu-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 4px 0;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
  text-decoration: none;
  transition: background 0.15s;
}

.user-menu-item:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.user-menu-logout {
  color: var(--error);
}

.user-menu-logout:hover {
  background: var(--error-light);
  color: var(--error);
}

.avatar {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

/* ============================================================================
   Content Area
   ============================================================================ */

.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ============================================================================
   Auth Pages (Login / Register)
   ============================================================================ */

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  padding: 20px;
}

.auth-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
}

.auth-logo-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-logo-subtitle {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--gray-500);
  margin-top: 6px;
}

.auth-logo .logo {
  width: 48px;
  height: 48px;
  font-size: 20px;
}

.auth-logo .brand-text {
  font-size: 28px;
}

.auth-title {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.auth-subtitle {
  text-align: center;
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 32px;
}

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

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--gray-600);
}

.auth-footer a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* ============================================================================
   Mobile Responsive
   ============================================================================ */

.mobile-menu-btn {
  display: none;
  border: 1px solid var(--gray-300);
  background: white;
  border-radius: var(--radius);
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  color: var(--gray-600);
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transform: translateX(-100%);
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  .content {
    padding: 16px;
  }
  
  .topbar {
    padding: 0 16px;
  }
}

/* ============================================================================
   Utilities
   ============================================================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-small { font-size: 13px; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

/* ============================================================================
   Transform Editor
   ============================================================================ */

.transform-editor {
  max-width: 1400px;
  margin: 0 auto;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}

.fields-panel {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
}

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

.panel-header h3 {
  margin: 0;
  font-size: 18px;
}

.editor-panel-wrapper {
  position: sticky;
  top: 80px;
}

.editor-panel {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.editor-panel h4 {
  margin: 0 0 20px;
  font-size: 16px;
}

.field-card {
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.field-card:hover {
  border-color: var(--primary);
  background: white;
}

.field-card.selected {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.05);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.2);
}

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

.field-key {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
}

.field-source {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 8px;
}

.pipeline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pipeline-tags .tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
}

.pipeline-tags .tag.validation {
  background: var(--warning-light);
  color: #b45309;
}

.pipeline-tags .tag.required {
  background: var(--error-light);
  color: var(--error);
}

.pipeline-tags .tag.meta {
  background: #ede9fe;
  color: #6d28d9;
}

.pipeline-tags .tag.helper {
  background: #fff3e0;
  color: #e65100;
  font-weight: 700;
}

.transform-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.transform-item {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: box-shadow 0.15s, opacity 0.15s;
}

.transform-item.dragging {
  opacity: 0.4;
}

.transform-item.drag-over-above {
  box-shadow: 0 -2px 0 0 var(--primary);
}

.transform-item.drag-over-below {
  box-shadow: 0 2px 0 0 var(--primary);
}

.transform-drag-handle {
  cursor: grab;
  color: var(--gray-400);
  font-size: 16px;
  padding: 0 6px 0 0;
  user-select: none;
  line-height: 1;
}

.transform-drag-handle:active {
  cursor: grabbing;
}

.transform-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
}

.transform-params {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 20px 0 12px;
}

.divider {
  height: 1px;
  background: var(--gray-200);
  margin: 16px 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 20px;
  font-weight: 600;
}

/* ============================================================================
   Modals (Transform editor)
   ============================================================================ */

.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
  animation: edlg-fade-in 0.18s ease-out;
}

.modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
}

.modal-content {
  position: relative;
  z-index: 1;
  background: white;
  border-radius: var(--radius-xl);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  animation: edlg-scale-in 0.2s ease-out;
  padding: 0;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.06) 0%, transparent 100%);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-800);
}

.close-btn {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  font-size: 18px;
  cursor: pointer;
  color: var(--gray-500);
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.close-btn:hover {
  background: var(--gray-200);
  color: var(--gray-800);
  border-color: var(--gray-300);
}

.modal-actions {
  display: flex;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--gray-100);
  justify-content: flex-end;
}

/* Op-grid inside modals */
.op-grid {
  display: grid;
  gap: 6px;
  padding: 16px 24px 20px;
}

.op-item {
  padding: 12px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.op-item:hover {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.05);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.10);
}

.op-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-900);
  margin-bottom: 2px;
}

.op-desc {
  font-size: 12px;
  color: var(--gray-500);
}

/* Params form inside modal */
#paramsForm {
  padding: 16px 24px 4px;
}

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

  .editor-panel-wrapper {
    position: relative;
    top: 0;
  }

  .editor-panel {
    max-height: none;
  }
}

/* ============================================================================
   EXIMP Dialog (nahrazuje alert / confirm)
   ============================================================================ */

.edlg-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.edlg-overlay.active {
  display: flex;
  animation: edlg-fade-in 0.18s ease-out;
}

@keyframes edlg-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes edlg-scale-in {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.edlg {
  background: white;
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  animation: edlg-scale-in 0.2s ease-out;
  overflow: hidden;
  text-align: center;
}

/* Icon circle */
.edlg-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 28px auto 0;
}

.edlg-icon svg {
  width: 28px;
  height: 28px;
}

.edlg-icon i {
  font-size: 28px;
}

/* Variants — icon colors */
.edlg-info .edlg-icon {
  background: var(--info-light);
  color: var(--info);
}

.edlg-success .edlg-icon {
  background: var(--success-light);
  color: var(--success);
}

.edlg-warning .edlg-icon {
  background: var(--warning-light);
  color: #b45309;
}

.edlg-danger .edlg-icon {
  background: var(--error-light);
  color: var(--error);
}

.edlg-question .edlg-icon {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
}

/* Body */
.edlg-body {
  padding: 16px 28px 4px;
}

.edlg-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}

.edlg-text {
  margin: 0;
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.55;
}

/* Buttons */
.edlg-actions {
  display: flex;
  gap: 10px;
  padding: 20px 28px 24px;
  justify-content: center;
}

.edlg-btn {
  padding: 9px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  border: 1px solid var(--gray-300);
  background: white;
  color: var(--gray-700);
  transition: all 0.15s;
  min-width: 90px;
}

.edlg-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.edlg-btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.edlg-btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.edlg-btn-danger {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

.edlg-btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* ============================================================================
   Company Switcher Dropdown
   ============================================================================ */

.company-switcher {
  position: relative;
}

.company-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 14px;
  color: var(--gray-900);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.company-switcher-btn:hover {
  background: var(--gray-100);
}

.company-switcher-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  min-width: 260px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  margin-top: 4px;
}

.company-switcher-dropdown.open {
  display: block;
}

.company-switcher-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--font-family);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.company-switcher-item:hover {
  background: var(--gray-100);
}

.company-switcher-item.active {
  background: rgba(var(--primary-rgb), 0.1);
}

.company-switcher-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
}

.company-switcher-ico {
  font-size: 12px;
  color: var(--gray-500);
}

/* ============================================================================
   Auth Divider & OAuth Buttons
   ============================================================================ */

.auth-divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  gap: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

.auth-divider span {
  font-size: 13px;
  color: var(--gray-500);
  white-space: nowrap;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 18px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  background: white;
  color: var(--gray-700);
}

.btn-oauth:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-google {
  color: var(--gray-700);
}

.btn-apple {
  background: #000;
  color: #fff;
  border-color: #000;
}

.btn-apple:hover {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #fff;
}

/* ============================================================================
   Impersonate Banner
   ============================================================================ */

.impersonate-banner {
  background: #fef3c7;
  border-bottom: 2px solid #f59e0b;
  color: #92400e;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ============================================================================
   Dark Mode Toggle
   ============================================================================ */

.theme-toggle {
  position: relative;
  width: 52px;
  height: 30px;
  background: var(--gray-200);
  border-radius: 999px;
  border: 1px solid var(--gray-300);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  padding: 0;
  flex-shrink: 0;
}

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

.theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.theme-toggle-thumb svg {
  width: 13px;
  height: 13px;
  color: white;
}

.theme-toggle-thumb i {
  font-size: 12px;
  color: white;
}

[data-theme="dark"] .theme-toggle {
  background: var(--gray-700);
  border-color: var(--gray-600);
}

[data-theme="dark"] .theme-toggle-thumb {
  left: calc(100% - 25px);
}

/* ============================================================================
   Dark Mode Theme
   ============================================================================ */

[data-theme="dark"] {
  --primary: #00b8c7;
  --primary-light: #1a3a3d;
  --primary-hover: #00d4e5;
  --primary-rgb: 0, 184, 199;

  --accent: #f36f32;
  --accent-hover: #ff8a50;
  --accent-rgb: 243, 111, 50;

  --gray-50: #0f1117;
  --gray-100: #161822;
  --gray-200: #232636;
  --gray-300: #343850;
  --gray-400: #555a73;
  --gray-500: #8088a0;
  --gray-600: #a0a7bc;
  --gray-700: #c4c9d9;
  --gray-800: #e0e3eb;
  --gray-900: #f0f1f5;

  --success: #22c55e;
  --success-light: #0f2918;
  --warning: #f59e0b;
  --warning-light: #2a2008;
  --error: #f87171;
  --error-light: #2a1010;
  --info: #60a5fa;
  --info-light: #0f1a2e;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

/* Dark mode overrides for elements with hardcoded white backgrounds */
[data-theme="dark"] body {
  background: var(--gray-50);
  color: var(--gray-800);
}

[data-theme="dark"] .sidebar {
  background: var(--gray-100);
  border-right-color: var(--gray-200);
}

[data-theme="dark"] .topbar {
  background: var(--gray-100);
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .sb-head {
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] .sb-toggle {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-700);
}

[data-theme="dark"] .sb-toggle:hover {
  background: var(--gray-200);
  border-color: var(--gray-400);
}

[data-theme="dark"] .sb-ico {
  background: var(--gray-200);
  border-color: var(--gray-300);
}

[data-theme="dark"] .sb-link:hover {
  background: var(--gray-200);
}

[data-theme="dark"] .btn,
[data-theme="dark"] .btn-secondary {
  background: var(--gray-200);
  color: var(--gray-800);
  border-color: var(--gray-300);
}

[data-theme="dark"] .btn:hover:not(:disabled),
[data-theme="dark"] .btn-secondary:hover:not(:disabled) {
  background: var(--gray-300);
  border-color: var(--gray-400);
}

[data-theme="dark"] .input,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="file"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--gray-200);
  color: var(--gray-800);
  border-color: var(--gray-300);
}

[data-theme="dark"] .input:disabled,
[data-theme="dark"] input:disabled,
[data-theme="dark"] select:disabled {
  background: var(--gray-100);
  color: var(--gray-500);
}

[data-theme="dark"] .card {
  background: var(--gray-100);
  border-color: var(--gray-200);
}

[data-theme="dark"] table {
  background: var(--gray-100);
}

[data-theme="dark"] thead {
  background: var(--gray-200);
}

[data-theme="dark"] th {
  color: var(--gray-800);
  border-bottom-color: var(--gray-300);
}

[data-theme="dark"] td {
  border-bottom-color: var(--gray-200);
}

[data-theme="dark"] tbody tr:hover {
  background: var(--gray-200);
}

[data-theme="dark"] .pill {
  background: var(--gray-200);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

[data-theme="dark"] .pill:hover {
  background: var(--gray-300);
  border-color: var(--gray-400);
}

[data-theme="dark"] .userbox {
  background: var(--gray-200);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

[data-theme="dark"] .userbox:hover {
  background: var(--gray-300);
  border-color: var(--gray-400);
}

[data-theme="dark"] .user-menu-dropdown {
  background: var(--gray-100);
  border-color: var(--gray-200);
}

[data-theme="dark"] .user-menu-divider {
  background: var(--gray-200);
}

[data-theme="dark"] .user-menu-item:hover {
  background: var(--gray-200);
}

[data-theme="dark"] .user-menu-logout {
  color: var(--error);
}

[data-theme="dark"] .user-menu-logout:hover {
  background: var(--error-light);
}

[data-theme="dark"] .company-switcher-btn {
  color: var(--gray-900);
}

[data-theme="dark"] .company-switcher-btn:hover {
  background: var(--gray-200);
}

[data-theme="dark"] .company-switcher-dropdown {
  background: var(--gray-100);
  border-color: var(--gray-200);
}

[data-theme="dark"] .company-switcher-item:hover {
  background: var(--gray-200);
}

[data-theme="dark"] .fields-panel,
[data-theme="dark"] .editor-panel {
  background: var(--gray-100);
  border-color: var(--gray-200);
}

[data-theme="dark"] .field-card {
  background: var(--gray-200);
  border-color: var(--gray-300);
}

[data-theme="dark"] .field-card:hover {
  border-color: var(--primary);
  background: var(--gray-100);
}

[data-theme="dark"] .field-card.selected {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
}

[data-theme="dark"] .transform-item {
  background: var(--gray-200);
  border-color: var(--gray-300);
}

/* Preview field cards (injected by JS in import_definition_edit.php) */
[data-theme="dark"] .preview-field-card {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
}

[data-theme="dark"] .preview-error {
  background: var(--error-light) !important;
  border-color: #5a2020 !important;
  color: #fca5a5 !important;
}

/* Rule group cards (injected by transform-editor.js) */
[data-theme="dark"] .rule-group-card {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
}

[data-theme="dark"] .rule-group-header {
  background: var(--gray-200) !important;
  border-bottom-color: var(--gray-300) !important;
}

/* Live Preview panel gradient */
[data-theme="dark"] div[style*="linear-gradient(135deg, #f8f9fb"] {
  background: var(--gray-100) !important;
}

/* Condition card backgrounds */
[data-theme="dark"] .condition-card {
  background: var(--gray-200) !important;
  border-color: var(--gray-300) !important;
}

[data-theme="dark"] .modal-content {
  background: var(--gray-100);
  box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .modal-header {
  border-bottom-color: var(--gray-200);
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1) 0%, transparent 100%);
}

[data-theme="dark"] .modal-actions {
  border-top-color: var(--gray-200);
}

[data-theme="dark"] .close-btn {
  background: var(--gray-200);
  border-color: var(--gray-300);
  color: var(--gray-700);
}

[data-theme="dark"] .close-btn:hover {
  background: var(--gray-300);
  color: var(--gray-900);
}

[data-theme="dark"] .op-item {
  border-color: var(--gray-200);
}

[data-theme="dark"] .op-item:hover {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
}

[data-theme="dark"] .edlg {
  background: var(--gray-100);
}

[data-theme="dark"] .edlg-btn {
  background: var(--gray-200);
  border-color: var(--gray-300);
  color: var(--gray-800);
}

[data-theme="dark"] .edlg-btn:hover {
  background: var(--gray-300);
  border-color: var(--gray-400);
}

[data-theme="dark"] .mobile-menu-btn {
  background: var(--gray-200);
  border-color: var(--gray-300);
  color: var(--gray-700);
}

[data-theme="dark"] .auth-container {
  background: var(--gray-50);
}

[data-theme="dark"] .auth-card {
  background: var(--gray-100);
  border-color: var(--gray-200);
}

[data-theme="dark"] .auth-title {
  color: var(--gray-900);
}

[data-theme="dark"] .auth-subtitle {
  color: var(--gray-600);
}

[data-theme="dark"] .auth-footer {
  color: var(--gray-700);
}

[data-theme="dark"] .auth-divider span {
  color: var(--gray-600);
}

[data-theme="dark"] .auth-logo-subtitle {
  color: var(--gray-600);
}

[data-theme="dark"] label {
  color: var(--gray-800);
}

[data-theme="dark"] .sb-title {
  color: var(--gray-600);
}

[data-theme="dark"] .sb-link {
  color: var(--gray-800);
}

[data-theme="dark"] .sb-link:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

[data-theme="dark"] .sb-link.active {
  color: var(--primary);
}

[data-theme="dark"] .top-left .company {
  color: var(--gray-900);
}

[data-theme="dark"] .top-left .sub {
  color: var(--gray-600);
}

[data-theme="dark"] .text-muted {
  color: var(--gray-600);
}

[data-theme="dark"] .company-switcher-name {
  color: var(--gray-900);
}

[data-theme="dark"] .company-switcher-ico {
  color: var(--gray-600);
}

[data-theme="dark"] .user-menu-item {
  color: var(--gray-800);
}

[data-theme="dark"] .user-menu-header {
  color: var(--gray-800);
}

[data-theme="dark"] .form-group small {
  color: var(--gray-600);
}

[data-theme="dark"] .transform-params {
  color: var(--gray-600);
}

[data-theme="dark"] .op-desc {
  color: var(--gray-600);
}

[data-theme="dark"] .edlg-title {
  color: var(--gray-900);
}

[data-theme="dark"] .edlg-text {
  color: var(--gray-700);
}

[data-theme="dark"] .btn-oauth {
  background: var(--gray-200);
  color: var(--gray-800);
  border-color: var(--gray-300);
}

[data-theme="dark"] .btn-oauth:hover {
  background: var(--gray-300);
  border-color: var(--gray-400);
}

[data-theme="dark"] .impersonate-banner {
  background: #2a2008;
  border-bottom-color: #f59e0b;
  color: #fbbf24;
}

[data-theme="dark"] .divider {
  background: var(--gray-200);
}

[data-theme="dark"] .alert-success {
  background: var(--success-light);
  color: #86efac;
}

[data-theme="dark"] .alert-error {
  background: var(--error-light);
  color: #fca5a5;
}

[data-theme="dark"] .alert-warning {
  background: var(--warning-light);
  color: #fcd34d;
}

[data-theme="dark"] .alert-info {
  background: var(--info-light);
  color: #93c5fd;
}

/* ============================================================================
   Dark Mode — !important overrides for inline styles in PHP templates
   These catch hardcoded background:#fff / background:white in style="" attrs
   ============================================================================ */

[data-theme="dark"] table[style] {
  background: var(--gray-100) !important;
}

[data-theme="dark"] table[style] thead,
[data-theme="dark"] table[style] th[style] {
  background: var(--gray-200) !important;
}

[data-theme="dark"] table[style] td[style] {
  border-color: var(--gray-200) !important;
}

[data-theme="dark"] table[style] tbody tr:hover {
  background: var(--gray-200) !important;
}

/* Cards, boxes, panels with inline white bg */
[data-theme="dark"] div[style*="background:#fff"],
[data-theme="dark"] div[style*="background: #fff"],
[data-theme="dark"] div[style*="background:white"],
[data-theme="dark"] div[style*="background: white"] {
  background: var(--gray-100) !important;
}

/* Inline-styled form elements */
[data-theme="dark"] select[style],
[data-theme="dark"] input[style] {
  background: var(--gray-200) !important;
  color: var(--gray-800) !important;
  border-color: var(--gray-300) !important;
}

/* Warning/info boxes with light backgrounds */
[data-theme="dark"] div[style*="background:#fff8e6"],
[data-theme="dark"] div[style*="background:#fffbeb"],
[data-theme="dark"] div[style*="background:#fff7ed"] {
  background: var(--warning-light) !important;
  border-color: #5a4a10 !important;
  color: #fcd34d !important;
}

/* Error/danger inline backgrounds */
[data-theme="dark"] div[style*="background:#fff1f2"],
[data-theme="dark"] div[style*="background:#fff2f2"],
[data-theme="dark"] td[style*="background:#fff2f2"] {
  background: var(--error-light) !important;
}

/* Skipped row backgrounds */
[data-theme="dark"] tr[style*="background:#fff8f0"] {
  background: rgba(243, 111, 50, 0.08) !important;
}

/* Code elements */
[data-theme="dark"] code[style*="background:white"],
[data-theme="dark"] code[style*="background:#fff"] {
  background: var(--gray-200) !important;
  color: var(--gray-800) !important;
}

/* Inline-styled borders */
[data-theme="dark"] div[style*="border:1px solid #e6e8ee"],
[data-theme="dark"] div[style*="border:1px solid #e6e9ee"],
[data-theme="dark"] div[style*="border: 1px solid #e6"] {
  border-color: var(--gray-200) !important;
}

/* Generic white-bg elements in content area */
[data-theme="dark"] .content div[style*="background:#fff"],
[data-theme="dark"] .content div[style*="background:white"],
[data-theme="dark"] .content span[style*="background:#fff"],
[data-theme="dark"] .content span[style*="background:white"] {
  background: var(--gray-100) !important;
}

/* Inline text colors that are too dark for dark mode */
[data-theme="dark"] [style*="color:#333"],
[data-theme="dark"] [style*="color: #333"] {
  color: var(--gray-800) !important;
}

[data-theme="dark"] [style*="color:#444"],
[data-theme="dark"] [style*="color: #444"] {
  color: var(--gray-700) !important;
}

[data-theme="dark"] [style*="color:#555"],
[data-theme="dark"] [style*="color: #555"] {
  color: var(--gray-700) !important;
}

[data-theme="dark"] [style*="color:#666"],
[data-theme="dark"] [style*="color: #666"] {
  color: var(--gray-600) !important;
}

[data-theme="dark"] [style*="color:#777"],
[data-theme="dark"] [style*="color: #777"] {
  color: var(--gray-600) !important;
}

[data-theme="dark"] [style*="color:#999"],
[data-theme="dark"] [style*="color: #999"] {
  color: var(--gray-600) !important;
}

[data-theme="dark"] [style*="color:#6a4a00"] {
  color: #fcd34d !important;
}

[data-theme="dark"] [style*="color:#111827"],
[data-theme="dark"] [style*="color: #111827"],
[data-theme="dark"] [style*="color:#111"] {
  color: var(--gray-900) !important;
}

[data-theme="dark"] [style*="color:#15803d"] {
  color: var(--success) !important;
}

[data-theme="dark"] [style*="color:#dc2626"] {
  color: var(--error) !important;
}

[data-theme="dark"] [style*="color:#6b7280"],
[data-theme="dark"] [style*="color: #6b7280"] {
  color: var(--gray-600) !important;
}

[data-theme="dark"] [style*="color:#374151"],
[data-theme="dark"] [style*="color: #374151"] {
  color: var(--gray-800) !important;
}

[data-theme="dark"] [style*="color:#b00000"],
[data-theme="dark"] [style*="color:#b91c1c"],
[data-theme="dark"] [style*="color:#b00020"] {
  color: var(--error) !important;
}

[data-theme="dark"] [style*="color:#1b7f2a"] {
  color: var(--success) !important;
}

[data-theme="dark"] [style*="color:#ad6b00"] {
  color: var(--warning) !important;
}

[data-theme="dark"] [style*="color:#0066cc"] {
  color: var(--info) !important;
}

/* Inline-styled th backgrounds (#f0f2f3, #f7f8fb) */
[data-theme="dark"] th[style*="background:#f0f2f3"],
[data-theme="dark"] th[style*="background: #f0f2f3"] {
  background: var(--gray-200) !important;
  color: var(--gray-800) !important;
  border-color: var(--gray-300) !important;
}

/* Inline-styled borders on td */
[data-theme="dark"] td[style*="border:1px solid #ddd"],
[data-theme="dark"] td[style*="border: 1px solid #ddd"],
[data-theme="dark"] th[style*="border:1px solid #ddd"],
[data-theme="dark"] th[style*="border: 1px solid #ddd"] {
  border-color: var(--gray-300) !important;
}

[data-theme="dark"] td[style*="border-top:1px solid #eef0f5"],
[data-theme="dark"] td[style*="border-top: 1px solid #eef0f5"],
[data-theme="dark"] td[style*="border-bottom:1px solid #eef0f5"],
[data-theme="dark"] td[style*="border-bottom: 1px solid #eef0f5"] {
  border-color: var(--gray-200) !important;
}

[data-theme="dark"] th[style*="border-bottom:1px solid #e6e8ee"],
[data-theme="dark"] th[style*="border-bottom: 1px solid #e6e8ee"] {
  border-color: var(--gray-300) !important;
}

/* Inline border wrapping divs */
[data-theme="dark"] div[style*="border:1px solid #e6e8ee"],
[data-theme="dark"] div[style*="border: 1px solid #e6e8ee"] {
  border-color: var(--gray-200) !important;
}

/* Empty state backgrounds */
[data-theme="dark"] div[style*="background:#f8fafc"],
[data-theme="dark"] div[style*="background: #f8fafc"] {
  background: var(--gray-100) !important;
}

/* HR borders in dark mode */
[data-theme="dark"] hr[style*="border-top:1px solid #eef0f5"] {
  border-top-color: var(--gray-200) !important;
}

/* Batch preview mapped table headers (#e8f4f8) */
[data-theme="dark"] th[style*="background:#e8f4f8"] {
  background: var(--gray-200) !important;
  border-color: var(--gray-300) !important;
  color: var(--gray-800) !important;
}

/* Success-tinted backgrounds (#f0fdf4) — rule notes */
[data-theme="dark"] div[style*="background:#f0fdf4"] {
  background: rgba(34, 197, 94, 0.08) !important;
  border-color: #22543d !important;
  color: #86efac !important;
}

/* Error-tinted backgrounds (#fee2e2 / #fca5a5) */
[data-theme="dark"] div[style*="background:#fee2e2"] {
  background: var(--error-light) !important;
  border-color: #5a2020 !important;
  color: #fca5a5 !important;
}

/* Rule evaluation colored boxes */
[data-theme="dark"] div[style*="background:#f0fdf4"],
[data-theme="dark"] div[style*="background:#fff5f5"] {
  border-color: var(--gray-300) !important;
}

/* Batch preview loading / empty state text */
[data-theme="dark"] [style*="color:#991b1b"] {
  color: #fca5a5 !important;
}

/* Preview output primary-tinted backgrounds */
[data-theme="dark"] .preview-output {
  background: rgba(var(--primary-rgb), 0.08) !important;
  border-color: var(--gray-300) !important;
}

/* Section title in editor */
[data-theme="dark"] .section-title {
  color: var(--gray-800);
}

/* No selection placeholder */
[data-theme="dark"] .no-selection {
  color: var(--gray-600);
}

/* Meta badge purple in dark mode */
[data-theme="dark"] [style*="background:#ede9fe"] {
  background: rgba(109, 40, 217, 0.15) !important;
  color: #c4b5fd !important;
}

/* Rule evaluation success/fail colored boxes */
[data-theme="dark"] div[style*="background:#fff5f5"] {
  background: rgba(220, 38, 38, 0.06) !important;
}

/* Skipped rows in batch preview */
[data-theme="dark"] tr[style*="background:#fff8f0"] {
  background: rgba(243, 111, 50, 0.08) !important;
}

/* Error cell background */
[data-theme="dark"] td[style*="background:#fff2f2"] {
  background: rgba(220, 38, 38, 0.1) !important;
}

/* Page-local .cardlike / .table-wrap / .ac-modal classes (admin pages) */
[data-theme="dark"] .cardlike {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
}

[data-theme="dark"] .table-wrap {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
}

[data-theme="dark"] .ac-modal {
  background: var(--gray-100) !important;
  border-color: var(--gray-200) !important;
}

[data-theme="dark"] .ac-modal-h {
  border-bottom-color: var(--gray-200) !important;
}

[data-theme="dark"] .ac-modal-f {
  border-top-color: var(--gray-200) !important;
}

[data-theme="dark"] .xbtn {
  background: var(--gray-200) !important;
  border-color: var(--gray-300) !important;
  color: var(--gray-700) !important;
}

[data-theme="dark"] .msg.error {
  background: var(--error-light) !important;
  border-color: #5a2020 !important;
  color: #fca5a5 !important;
}

[data-theme="dark"] .msg.success {
  background: var(--success-light) !important;
  border-color: #1a4a2a !important;
  color: #86efac !important;
}

[data-theme="dark"] .role-change-wrap {
  background: var(--gray-200) !important;
  border-color: var(--gray-300) !important;
}

[data-theme="dark"] .badge-admin {
  background: #1e2a4a !important;
  border-color: #3a4a7a !important;
  color: #93b4fd !important;
}

[data-theme="dark"] .badge-ok {
  background: var(--success-light) !important;
  border-color: #1a4a2a !important;
  color: #86efac !important;
}

[data-theme="dark"] .badge-off {
  background: var(--gray-200) !important;
  border-color: var(--gray-300) !important;
  color: var(--gray-600) !important;
}

[data-theme="dark"] .badge-user {
  background: var(--gray-200) !important;
  border-color: var(--gray-300) !important;
  color: var(--gray-800) !important;
}
