:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --text: #0b0f14;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --border: #e5e7eb;
  --accent: #00d3ca;
  --accent-soft: #00d3ca40;
  --shadow: 0 2px 6px rgba(15, 23, 42, 0.05), 0 16px 34px rgba(15, 23, 42, 0.06);
  --radius-sm: 12px;
  --radius-md: 14px;
  --radius-lg: 16px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;
}

html[data-theme="dark"] {
  --bg: #0f1419;
  --panel: #131b25;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --muted-2: #6b7280;
  --border: #1f2937;
  --accent: #00d3ca;
  --accent-soft: #00d3ca33;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.32), 0 16px 34px rgba(0, 0, 0, 0.34);
  --sl-black: #e5e7eb;
  --sl-white: #131b25;
  --sl-gray-50: #111827;
  --sl-gray-100: #1f2937;
  --sl-gray-200: #334155;
  --sl-gray-300: #475569;
  --sl-gray-400: #94a3b8;
  --sl-gray-500: #cbd5e1;
  --sl-gray-600: #d1d5db;
  --sl-gray-700: #e5e7eb;
  --sl-gray-800: #f3f4f6;
  --sl-gray-900: #ffffff;
  --sl-topbar-bg: #0f1419;
  --sl-topbar-border: #1f2937;
  --sl-content-bg: #0f1419;
  --sl-content-surface: #131b25;
  --sl-sidebar-bg: #0b1118;
  --sl-sidebar-text: #e5e7eb;
  --sl-sidebar-hover: rgba(0, 211, 202, 0.12);
  --sl-sidebar-active: rgba(0, 211, 202, 0.2);
  --sl-sidebar-border: rgba(203, 213, 225, 0.2);
}

html,
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}


h1,
h2,
h3,
h4,
h5,
h6,
.topbar-title,
.card-title,
.settings-tab,
.btn {
  font-family: Manrope, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  background: #f5f7f8;
}

.app-sidebar {
  background: #ffffff !important;
  border-right: 1px solid var(--border) !important;
  box-shadow: 4px 0 18px rgba(15, 23, 42, 0.05);
}

.sidebar-brand {
  min-height: 56px;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--sp-4) !important;
}

/* Termsfeed (palette dark) save button */
.termsfeed-com---palette-dark .cc-cp-foot-save {
  background: #00d3ca !important;
}

.termsfeed-com---palette-dark .cc-pc-head-close:active,
.termsfeed-com---palette-dark .cc-pc-head-close:focus {
  background: #00d3ca !important;
  border: 2px solid #00d3ca !important;
}

.sidebar-nav a {
  color: #111827 !important;
  border: 1px solid transparent;
}

.sidebar-nav a .nav-icon {
  width: 25px !important;
  height: 25px !important;
  border-radius: 8px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #111827;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.sidebar-nav a .nav-icon svg {
  width: 20px !important;
  height: 20px !important;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: #00d3ca69 !important;
  border-color: #e5e7eb;
  color: #0b0f14 !important;
}

.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon {
  background: var(--accent-soft);
  border-color: #00bfb7;
}

.sidebar-nav a.active::before {
  inset-inline-start: 6px !important;
  width: 3px !important;
  border-radius: 999px !important;
  background: var(--accent) !important;
}

.sidebar-nav a .nav-icon {
  margin-left: 10px;
}

.app-sidebar.collapsed .sidebar-inner {
  padding: 0 !important;
}

.app-sidebar.collapsed .sidebar-nav a {
  padding-left: 14px !important;
  padding-right: 18px !important;
}

.app-sidebar.collapsed .sidebar-nav a.active::before {
  left: 0 !important;
  inset-inline-start: 0 !important;
  width: 3px !important;
  height: 24px !important;
  border-radius: 999px !important;
}

.app-sidebar.collapsed .sidebar-nav a .nav-icon {
  margin-left: 12px;
}

.app-sidebar.collapsed .sidebar-nav a .nav-label,
.app-sidebar.collapsed .sidebar-nav a .nav-link-counter,
.app-sidebar.collapsed .sidebar-user > div:last-child,
.app-sidebar.collapsed .sidebar-logout span {
  opacity: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
}

.app-sidebar.collapsed .sidebar-nav a .nav-icon {
  opacity: 1 !important;
  visibility: visible !important;
}

.logo-collapsed,
.logo-expanded {
  display: none !important;
}

.app-sidebar.collapsed:not(:hover):not(.expanded) .logo-collapsed {
  display: block !important;
}

.app-sidebar.collapsed:not(:hover):not(.expanded) .logo-expanded {
  display: none !important;
}

.app-sidebar:not(.collapsed) .logo-expanded,
.app-sidebar.collapsed:hover .logo-expanded,
.app-sidebar.collapsed.expanded .logo-expanded {
  display: block !important;
}

.app-sidebar:not(.collapsed) .logo-collapsed,
.app-sidebar.collapsed:hover .logo-collapsed,
.app-sidebar.collapsed.expanded .logo-collapsed {
  display: none !important;
}

.sidebar-footer {
  border-top: 1px solid var(--border) !important;
}

.sidebar-user {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
}

.sidebar-user .small {
  color: var(--muted) !important;
}

.sidebar-user-avatar {
  background: #f3f4f6 !important;
  color: #0b0f14 !important;
  border: 1px solid #e5e7eb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.sidebar-logout {
  color: #374151 !important;
  border: 1px solid transparent;
}

.sidebar-logout:hover {
  background: #f8fafc !important;
  border-color: #e5e7eb;
  color: #111827 !important;
}

.app-main {
  background: #f5f7f8;
  max-width: 100%;
  overflow-x: hidden;
}

.app-topbar {
  background: rgba(255, 255, 255, 0.92) !important;
  border-bottom: 1px solid var(--border) !important;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  position: sticky;
}

.topbar-fixed .app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1200;
}

.topbar-fixed .app-content {
  padding-top: calc(var(--sp-6) + 72px) !important;
}

.topbar-fixed .sidebar-brand {
  margin-top: 56px;
}

/* evita che topbar fissa copra popup/modal nelle pagine client */
.topbar-fixed .modal-dialog {
  margin-top: 88px;
}
.topbar-fixed .dropdown-menu,
.topbar-fixed .dropdown-menu.show {
  margin-top: 8px;
}

@media (max-width: 992px){
  .topbar-fixed .modal-dialog {
    margin-top: 96px;
  }
  .topbar-fixed .sidebar-brand {
    margin-top: 64px;
  }
}

.app-topbar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, #0b0f14 0%, var(--accent) 50%, #0b0f14 100%);
}

.topbar-title {
  color: #0b0f14;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.topbar-subtitle,
.topbar-user-label {
  color: var(--muted);
}

.topbar-row {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: visible;
  overflow-y: visible;
}

.topbar-titles {
  min-width: 0;
}

.topbar-actions {
  min-width: 0;
  flex: 1;
  justify-content: flex-end;
  overflow-x: visible;
  overflow-y: visible;
}

.topbar-actions .dropdown {
  position: relative;
  z-index: 1200;
}

.topbar-search {
  width: min(440px, 42vw);
  flex: 1 1 320px;
  min-width: 180px;
  max-width: 440px;
}

.topbar-search .form-control-sm {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  min-height: 40px;
  padding-left: 14px;
}

.topbar-search .form-control-sm:focus {
  border-color: #00bfb7;
  box-shadow: 0 0 0 4px #00d3ca33;
}

.topbar-action-btn,
.topbar-bell {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: #111827;
  text-decoration: none;
  transition: all 0.2s ease;
}

.mobile-menu-toggle.touch-friendly {
  background: linear-gradient(135deg, #0b0f14 0%, #00d3ca 140%);
  color: #ffffff;
  border: 1px solid rgba(0, 211, 202, 0.35);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.mobile-menu-toggle.touch-friendly:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px rgba(0, 211, 202, 0.3);
}

#lottoDropdownBtn {
  position: relative;
}

#lottoBadge {
  position: absolute;
  top: -15px;
  right: -4px;
  min-width: 28px;
  height: 28px;
  line-height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 0 8px;
  border: 1px solid #ffffff;
  z-index: 2;
  pointer-events: none;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
}

.lotto-dropdown-menu {
  width: min(390px, calc(100vw - 16px));
  max-width: calc(100vw - 16px);
  right: 0 !important;
  left: auto !important;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16);
  overflow: hidden;
  z-index: 2100;
}

.lotto-dropdown-menu.show {
  display: block;
}

.lotto-dropdown-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.lotto-dropdown-list {
  max-height: 310px;
  overflow-y: auto;
}

.lotto-dropdown-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}

.lotto-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
}

.lotto-dropdown-item:last-child {
  border-bottom: 0;
}

.lotto-dropdown-thumb-wrap {
  flex: 0 0 auto;
}

.lotto-dropdown-thumb {
  width: 44px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
}

.lotto-dropdown-thumb--placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 11px;
  font-weight: 700;
}

.lotto-dropdown-main {
  min-width: 0;
  flex: 1;
}

.lotto-dropdown-model {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lotto-dropdown-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.lotto-remove-btn {
  border: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lotto-dropdown-footer {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.lotto-dropdown-total {
  font-size: 13px;
  color: var(--muted);
}

.lotto-dropdown-total strong {
  color: var(--text);
  font-size: 14px;
}

.lotto-dropdown-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#themeToggle svg {
  width: 18px;
  height: 18px;
}

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

.topbar-action-btn:hover,
.topbar-bell:hover {
  color: #0b0f14;
  border-color: #cfd4dc;
  background: #f8fafc;
  transform: translateY(-1px);
}

.topbar-user-avatar {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #0b0f14;
}

.app-content {
  padding: var(--sp-6) !important;
  padding-bottom: calc(var(--sp-6) + 150px) !important;
  background: linear-gradient(180deg, #fafbfc 0%, #f5f7f8 100%) !important;
  max-width: 100%;
  overflow-x: hidden;
}

.card,
.side__card,
.card-stat,
.modal-content,
.list-group-item {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  background: var(--panel) !important;
  box-shadow: var(--shadow) !important;
}

.card-header {
  background: #ffffff !important;
  border-bottom: 1px solid var(--border) !important;
}

.card:hover,
.side__card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08), 0 20px 36px rgba(15, 23, 42, 0.08) !important;
}

.card-stat {
  overflow: hidden;
  position: relative;
}

.card-stat::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, #0b0f14, #00d3ca);
}

/* Modal bridge style - AI Command Center */
.modal-backdrop.show {
  background: rgba(20, 20, 20, 0.35) !important;
  backdrop-filter: blur(12px);
}

.modal .modal-dialog {
  max-width: min(98vw, 1220px);
}

.modal .modal-dialog.modal-lg,
.modal .modal-dialog.modal-xl {
  max-width: min(98vw, 1360px);
}

.modal.show .modal-dialog {
  animation: slModalIn 0.25s ease;
}

.modal .modal-content {
  background: #ffffff !important;
  border: 1px solid rgba(0, 211, 202, 0.22) !important;
  border-radius: 22px !important;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.14), 0 10px 20px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 211, 202, 0.08) inset !important;
  padding: 0;
}

.modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 32px 18px;
  border-bottom: 1px solid rgba(0, 211, 202, 0.18);
  background: linear-gradient(135deg, rgba(0, 211, 202, 0.14), rgba(0, 211, 202, 0.04));
  border-radius: 22px 22px 0 0;
}

.modal .modal-title {
  font-size: 22px;
  font-weight: 600;
  color: #111111;
  letter-spacing: -0.3px;
}

.modal .modal-body {
  padding: 20px 32px;
  color: #1a1a1a;
}

.modal .modal-footer {
  padding: 18px 32px 28px;
  border-top: 1px solid rgba(0, 211, 202, 0.18);
  gap: 12px;
}

.modal .btn-primary {
  background: #00d3ca !important;
  border-color: #00d3ca !important;
  color: #ffffff !important;
  border-radius: 14px !important;
  padding: 12px 20px !important;
  font-weight: 600;
}

.modal .btn-primary:hover {
  background: #00b8b0 !important;
  border-color: #00b8b0 !important;
}

.modal .btn-secondary,
.modal .btn-outline-secondary {
  border-radius: 14px !important;
}

.modal .btn-close,
.modal .close {
  min-width: 42px;
  min-height: 42px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(0, 211, 202, 0.24);
  background-color: #f8fbfc;
  color: #0f172a;
  opacity: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  background-image: none !important;
}

.modal .btn-close {
  background-position: center;
  background-size: 14px;
}

.modal .btn-close::before,
.modal .close::before {
  content: "\00D7";
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: #0f172a !important;
  transform: translateY(-1px);
  display: inline-block;
}

.modal .btn-close:hover,
.modal .close:hover {
  background-color: rgba(0, 211, 202, 0.12);
  border-color: rgba(0, 211, 202, 0.55);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 211, 202, 0.18);
}

.modal .btn-close:focus,
.modal .close:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 211, 202, 0.25);
}

.modal .close {
  font-size: 24px;
  line-height: 1;
  text-decoration: none;
  padding: 0;
}

.modal .close span {
  display: none;
}

.btn-close {
  background-image: none !important;
  color: #0f172a;
}

.btn-close::before {
  content: "\00D7";
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: #0f172a;
}

#orderDetailModal .modal-dialog.order-detail-dialog {
  max-width: min(99vw, 1580px);
}

/* Inactivity warning modal */
#inactivity-warning-modal .modal-dialog {
  max-width: min(95vw, 560px);
}

#inactivity-warning-modal .modal-content {
  overflow: hidden;
}

#inactivity-warning-modal .sl-inactivity-header {
  background: linear-gradient(135deg, #0f172a, #0b0f14) !important;
  border-bottom: 1px solid rgba(0, 211, 202, 0.22) !important;
}

#inactivity-warning-modal .sl-inactivity-header .modal-title {
  color: #ffffff !important;
}

#inactivity-warning-modal .sl-inactivity-icon {
  color: #00d3ca;
}

#inactivity-warning-modal .modal-body {
  padding-top: 24px;
}

#inactivity-warning-modal #countdown {
  color: #00bfb7;
  font-weight: 700;
}

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

.card-stat .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: #0b0f14;
}

.card-stat .stat-icon svg {
  width: 24px;
  height: 24px;
}

.btn,
.btn-sm,
.btn-lg {
  border-radius: 12px !important;
}

.btn-primary {
  background: #0b0f14 !important;
  border-color: #0b0f14 !important;
  color: #ffffff !important;
}

.btn-primary:hover,
.btn-primary:focus {
  background: #121a23 !important;
  border-color: #121a23 !important;
  box-shadow: 0 0 0 4px #00d3ca33 !important;
}

.btn-outline-primary,
.btn-ghost {
  border-color: #d1d5db !important;
  color: #0b0f14 !important;
  background: #ffffff !important;
}

.btn-outline-primary:hover,
.btn-ghost:hover {
  border-color: #00bfb7 !important;
  background: var(--accent-soft) !important;
}

.form-control,
.form-select,
.input,
textarea,
select {
  border: 1px solid #d1d5db !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  background: #ffffff !important;
  color: #0b0f14 !important;
}

.form-control:focus,
.form-select:focus,
.input:focus,
textarea:focus,
select:focus {
  border-color: #00bfb7 !important;
  box-shadow: 0 0 0 4px #00d3ca33 !important;
}

.table,
.table-wrapper .table {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 14px;
  overflow: hidden;
}

.table thead,
.table thead tr,
.table thead th,
.table-wrapper .table thead,
.table-wrapper .table thead tr,
.table-wrapper .table thead th,
.table-sticky thead th {
  background: #00d3ca !important;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  color: #0b0f14 !important;
  border-bottom: 1px solid #00bfb7 !important;
}

.table tbody tr {
  border-bottom: 1px solid #edf1f4;
}

.table tbody tr:hover {
  background: #f6fbfb !important;
}

.status-pill,
.badge--in-verifica,
.badge--rifiutati,
.badge--confermati,
.badge--da-caricare {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 10px;
  border: 1px solid transparent;
}

.badge--in-verifica {
  background: #ffedd5;
  border-color: #fdba74;
  color: #9a3412;
}

.badge--rifiutati {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.badge--confermati {
  background: #ccfbf1;
  border-color: #5eead4;
  color: #115e59;
}

.badge--da-caricare {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}

.badge--vehicle-d {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.badge--vehicle-p {
  background: #ffedd5;
  border-color: #fdba74;
  color: #9a3412;
}

.badge--vehicle-v {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.badge--richieste {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
}

.badge--request {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
}

.badge--data {
  background: #cffafe;
  border: 1px solid #67e8f9;
  color: #155e75;
}

.badge--date {
  background: #cffafe;
  border: 1px solid #67e8f9;
  color: #155e75;
}

.badge--valore {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.badge--value {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.badge--upload {
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
}

.badge--rejected {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.stock-density-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
}

.stock-density-controls .btn {
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 999px !important;
}

.stock-density-value {
  min-width: 72px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.page-stock .app-main,
.page-stock .app-content,
.stock-client-page .app-content,
.admin-stock-page .app-content {
  min-width: 0;
  overflow-x: hidden;
  overflow-y: visible !important;
}

.page-stock,
.stock-client-page,
.admin-stock-page {
  overflow-x: hidden;
}

.stock-client-shell {
  display: block;
}

.stock-admin-shell {
  display: block;
}

.stock-client-table-card {
  display: block;
}

.stock-admin-table-card {
  display: block;
}

.stock-client-table-card .table-wrapper,
.stock-admin-table-card .table-wrapper {
  --stock-zoom: 1;
  overflow-x: auto;
  overflow-y: visible !important;
  max-height: none !important;
}

.stock-client-table-card .table,
.stock-admin-table-card .table {
  font-size: calc(0.88rem * var(--stock-zoom));
  min-width: max-content;
}

.stock-client-table-card .table th,
.stock-client-table-card .table td,
.stock-admin-table-card .table th,
.stock-admin-table-card .table td {
  padding: calc(0.72rem * var(--stock-zoom)) calc(0.64rem * var(--stock-zoom));
}

.stock-client-table-card .table th,
.stock-client-table-card .table td {
  border-right: 1px solid rgba(148, 163, 184, 0.35);
}

.stock-client-table-card .table th:last-child,
.stock-client-table-card .table td:last-child {
  border-right: 0;
}

.table-scroll {
  overflow-x: auto;
  overflow-y: visible !important;
  max-height: none !important;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.table-wrapper.stock-density-2 .table th,
.table-wrapper.stock-density-2 .table td {
  padding: 0.95rem 0.9rem;
  font-size: 0.98rem;
}

.table-wrapper.stock-density-3 .table th,
.table-wrapper.stock-density-3 .table td {
  padding: 0.82rem 0.78rem;
  font-size: 0.93rem;
}

.table-wrapper.stock-density-4 .table th,
.table-wrapper.stock-density-4 .table td {
  padding: 0.7rem 0.65rem;
  font-size: 0.88rem;
}

.table-wrapper.stock-density-5 .table th,
.table-wrapper.stock-density-5 .table td {
  padding: 0.58rem 0.55rem;
  font-size: 0.83rem;
}

.stock-main-image {
  width: 100px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
}

.stock-main-image-link {
  display: inline-block;
  text-decoration: none;
}

.stock-desc-cell {
  min-width: 360px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.stock-status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.stock-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--sl-gray-600);
}

.vehicle-views-counter {
  font-size: 12px;
  color: var(--sl-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: var(--sl-spacing-xs);
}

.stock-price-cell {
  white-space: nowrap;
}

.stock-media-count {
  min-width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  background: #fff;
}

.media-col {
  width: 56px;
  min-width: 56px;
  text-align: center;
}

.is-selected {
  background: rgba(0,211,202,0.08) !important;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .app-main,
html[data-theme="dark"] .app-content {
  background: #0f1419 !important;
  color: var(--text) !important;
}

html[data-theme="dark"] .app-topbar,
html[data-theme="dark"] .sidebar-brand,
html[data-theme="dark"] .sidebar-footer,
html[data-theme="dark"] .card-header {
  border-color: var(--border) !important;
}

html[data-theme="dark"] .app-topbar {
  background: rgba(15, 20, 25, 0.94) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .app-sidebar,
html[data-theme="dark"] .sidebar-user,
html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .settings-tabs,
html[data-theme="dark"] .ai-hero-card,
html[data-theme="dark"] .ai-insight-card {
  background: var(--panel) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

html[data-theme="dark"] .topbar-title,
html[data-theme="dark"] .topbar-user-contact,
html[data-theme="dark"] .table,
html[data-theme="dark"] .sidebar-nav a,
html[data-theme="dark"] .sidebar-logout,
html[data-theme="dark"] .sidebar-user .fw-semibold,
html[data-theme="dark"] .text-dark {
  color: var(--text) !important;
}

html[data-theme="dark"] .sidebar-nav a .nav-icon,
html[data-theme="dark"] .sidebar-user-avatar,
html[data-theme="dark"] .topbar-action-btn,
html[data-theme="dark"] .topbar-bell,
html[data-theme="dark"] .topbar-user-avatar,
html[data-theme="dark"] .stock-density-controls {
  background: #111827 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}

html[data-theme="dark"] .topbar-search .form-control-sm,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: #0f172a !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
}

html[data-theme="dark"] .table tbody tr {
  border-color: #1f2937;
}

html[data-theme="dark"] .table tbody tr:hover {
  background: #111827 !important;
}

html[data-theme="dark"] .table thead,
html[data-theme="dark"] .table thead tr,
html[data-theme="dark"] .table thead th,
html[data-theme="dark"] .table-wrapper .table thead,
html[data-theme="dark"] .table-wrapper .table thead tr,
html[data-theme="dark"] .table-wrapper .table thead th,
html[data-theme="dark"] .table-sticky thead th {
  background: #00d3ca !important;
  color: #04110f !important;
}

html[data-theme="dark"] .table > :not(caption) > * > * {
  background: #111827 !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
}

html[data-theme="dark"] .table > thead > tr > th,
html[data-theme="dark"] .table.table-sticky > thead > tr > th {
  background: #00d3ca !important;
  color: #04110f !important;
}

html[data-theme="dark"] .sidebar-user .small {
  color: var(--muted) !important;
}

html[data-theme="dark"] .text-muted {
  color: #9ca3af !important;
}

html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .table-light,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .offcanvas,
html[data-theme="dark"] .popover,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer {
  background: #131b25 !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
}

html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .table-wrapper,
html[data-theme="dark"] .card.bg-white,
html[data-theme="dark"] .topbar-search-dropdown,
html[data-theme="dark"] .topbar-search-result-item,
html[data-theme="dark"] .topbar-search-empty,
html[data-theme="dark"] .topbar-search-group-title,
html[data-theme="dark"] pre {
  background: #111827 !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
}

html[data-theme="dark"] .btn-outline-secondary,
html[data-theme="dark"] .btn-outline-primary,
html[data-theme="dark"] .btn-outline-info,
html[data-theme="dark"] .btn-outline-warning,
html[data-theme="dark"] .btn-outline-danger {
  color: #e5e7eb !important;
  border-color: #475569 !important;
  background: #111827 !important;
}

html[data-theme="dark"] [style*="background: white"],
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background:#ffffff"],
html[data-theme="dark"] [style*="background: #ffffff"],
html[data-theme="dark"] [style*="background:#f8f9fa"],
html[data-theme="dark"] [style*="background: #f8f9fa"],
html[data-theme="dark"] [style*="background-color: white"],
html[data-theme="dark"] [style*="background-color:#fff"],
html[data-theme="dark"] [style*="background-color: #fff"],
html[data-theme="dark"] [style*="background-color:#ffffff"],
html[data-theme="dark"] [style*="background-color: #ffffff"],
html[data-theme="dark"] [style*="background-color:#f8f9fa"],
html[data-theme="dark"] [style*="background-color: #f8f9fa"] {
  background: #131b25 !important;
  color: #e5e7eb !important;
}

html[data-theme="dark"] .text-dark,
html[data-theme="dark"] .text-black,
html[data-theme="dark"] .text-body,
html[data-theme="dark"] [class*="text-dark"] {
  color: #e5e7eb !important;
}

html[data-theme="dark"] .vehicle-header,
html[data-theme="dark"] .vehicle-gallery,
html[data-theme="dark"] .vehicle-inspection,
html[data-theme="dark"] .vehicle-logistics,
html[data-theme="dark"] .vehicle-timeline,
html[data-theme="dark"] .request-wizard-container .company-card,
html[data-theme="dark"] .request-wizard-container .wizard-nav,
html[data-theme="dark"] .request-wizard-container .card,
html[data-theme="dark"] .fact-card,
html[data-theme="dark"] .inspection-item,
html[data-theme="dark"] .timeline-step,
html[data-theme="dark"] .logistics-item {
  background: #131b25 !important;
  border-color: #374151 !important;
  color: #e5e7eb !important;
}

html[data-theme="dark"] .request-wizard-container .label,
html[data-theme="dark"] .request-wizard-container .value {
  color: #e5e7eb !important;
}

html[data-theme="dark"] .request-wizard-container .alert-warning {
  background: rgba(245, 158, 11, 0.2) !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
  color: #fde68a !important;
}

html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-primary:hover,
html[data-theme="dark"] .btn-outline-info:hover,
html[data-theme="dark"] .btn-outline-warning:hover,
html[data-theme="dark"] .btn-outline-danger:hover {
  background: #1f2937 !important;
  border-color: #64748b !important;
}

html[data-theme="dark"] .lotto-dropdown-menu,
html[data-theme="dark"] .lotto-dropdown-header,
html[data-theme="dark"] .lotto-dropdown-footer,
html[data-theme="dark"] .lotto-dropdown-item {
  background: #131b25 !important;
  border-color: #374151 !important;
}

html[data-theme="dark"] .lotto-dropdown-model,
html[data-theme="dark"] .lotto-dropdown-meta {
  color: #e5e7eb !important;
}

html[data-theme="dark"] .stock-media-count {
  background: #0f172a;
  color: #e5e7eb;
  border-color: #374151;
}

.badge,
.user-role-badge,
.status-badge {
  border-radius: 999px !important;
  padding: 6px 10px !important;
  font-weight: 700 !important;
}

.settings-tabs {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px;
  box-shadow: var(--shadow);
}

.settings-tab {
  border-radius: 10px !important;
  font-weight: 700;
}

.settings-tab.active {
  background: var(--accent-soft) !important;
  color: #0b0f14 !important;
  border-color: #00bfb7 !important;
}

.settings-tab-content {
  border-radius: var(--radius-lg) !important;
}

#tab-templates iframe#template_preview {
  border-radius: 12px;
  background: #ffffff;
}

html[data-theme="dark"] .settings-tabs,
html[data-theme="dark"] .settings-tab-content,
html[data-theme="dark"] #tab-templates iframe#template_preview {
  background: #131b25 !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
}

.alert,
.toast,
.sl-toast {
  border-radius: 12px !important;
}

body:not(.theme-dark) .bg-white .text-white:not(.badge):not(.btn),
body:not(.theme-dark) .card.bg-white .text-white:not(.badge):not(.btn) {
  color: #0b0f14 !important;
}

/* Dashboard AI command center blocks */
.ai-hero-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.ai-hero-card,
.ai-insight-card {
  padding: var(--sp-6);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.ai-hero-title {
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 var(--sp-2);
}

.ai-hero-subtitle {
  color: var(--muted);
  margin-bottom: var(--sp-4);
}

.ai-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.ai-hero-meta-item {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 999px;
  padding: 6px 12px;
}

.ai-hero-meta-item .label {
  color: var(--muted);
  font-size: 12px;
}

.ai-last-viewed-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: stretch;
  max-height: 250px;
  overflow: hidden;
}

.ai-last-viewed-media {
  width: 120px;
  min-width: 120px;
  border-radius: 10px;
  overflow: hidden;
  background: #e5e7eb;
}

.ai-last-viewed-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ai-last-viewed-placeholder {
  width: 100%;
  height: 100%;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 8px;
}

.ai-last-viewed-content {
  flex: 1;
  min-width: 0;
}

.ai-last-viewed-price {
  font-size: 1.1rem;
  font-weight: 800;
  margin-top: 4px;
}

.ai-last-viewed-empty {
  color: var(--muted);
  font-size: 14px;
}

.ai-mini-chart {
  width: 100%;
  height: 84px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  border: 1px solid #e8edf2;
  display: grid;
  place-items: center;
}

.ai-mini-chart svg {
  width: calc(100% - 24px);
  height: 56px;
}

.ai-insight-card {
  display: grid;
  gap: var(--sp-3);
}

.ai-insight-media {
  height: 112px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0b0f14 0%, #1f2937 45%, #00d3ca 140%);
  position: relative;
  overflow: hidden;
}

.ai-insight-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ai-insight-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e5e7eb;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.ai-insight-media::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.ai-insight-title {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.ai-insight-text {
  margin: 0;
  color: var(--muted);
}

.ai-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.ai-kpi-value {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.ai-kpi-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

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

.discover-filters {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.discover-filters-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.discover-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.discover-card-media {
  position: relative;
  height: 170px;
  background: linear-gradient(135deg, #d1d5db 0%, #f3f4f6 100%);
}

.discover-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.discover-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

.discover-selected-tag,
.discover-remove-tag {
  position: absolute;
  top: 10px;
  z-index: 2;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  line-height: 1.2;
}

.discover-selected-tag {
  left: 10px;
  color: #ffffff;
  background: #16a34a;
}

.discover-remove-tag {
  right: 10px;
  color: #991b1b;
  border: 1px solid #fecaca;
  background: #fee2e2;
  cursor: pointer;
}

.discover-remove-tag--with-discount {
  top: 10px;
}

.discover-discount-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 2;
  width: 65px;
  height: 65px;
  border-radius: 50px;
  font-size: 19px;
  font-weight: 700;
  padding: 4px 8px;
  line-height: 1.2;
  color: #ffffff;
  background: #00d3ca;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.discover-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.discover-card-title {
  font-size: 1.05rem;
  margin: 0;
  color: var(--text);
}

.discover-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 13px;
  color: var(--muted);
}

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

.discover-price-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.discover-price-listino {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.discover-price-discount {
  font-size: 12px;
  color: #dc3545;
  font-weight: 700;
}

.discover-price-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.discover-price {
  font-family: Manrope, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
}

html[data-theme="dark"] .discover-card-media {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

html[data-theme="dark"] .discover-filters,
html[data-theme="dark"] .ai-hero-meta-item,
html[data-theme="dark"] .ai-last-viewed-card {
  background: #0f1722;
  border-color: #334155;
}

html[data-theme="dark"] .mobile-menu-toggle.touch-friendly {
  background: linear-gradient(135deg, #0f172a 0%, #00bfb7 140%);
  border-color: rgba(0, 211, 202, 0.45);
}

/* Login cleanup to match SaaS language */
body.page-login .main {
  background: #f5f7f8 !important;
}

body.page-login .card,
body.page-login .side__card {
  background: #ffffff !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
}

body.page-login .card__head {
  background: #ffffff !important;
  border-bottom: 1px solid var(--border) !important;
}

body.page-login .card__title,
body.page-login .side__title,
body.page-login label,
body.page-login .side__text,
body.page-login .card__kicker,
body.page-login .fineprint,
body.page-login .a-ghost {
  color: #0b0f14 !important;
}

body.page-login .input {
  border: 1px solid #d1d5db !important;
  color: #0b0f14 !important;
  background: #ffffff !important;
}

body.page-login .input::placeholder {
  color: #94a3b8 !important;
}

body.page-login .a-ghost {
  border: 1px solid #d1d5db !important;
  background: #ffffff !important;
}

body.page-login .a-ghost:hover {
  background: #f8fafc !important;
  border-color: #bfc8d3 !important;
}

@media (max-width: 1200px) {
  .ai-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 992px) {
  .app-sidebar {
    background: #ffffff !important;
  }

  .app-main {
    margin-left: 0 !important;
  }

  .topbar-search {
    width: min(100%, 360px);
  }

  .ai-hero-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .lotto-dropdown-menu {
    right: 8px !important;
    left: auto !important;
    width: min(360px, calc(100vw - 16px));
    max-width: calc(100vw - 16px);
  }

  .stock-client-table-card .table-wrapper,
  .stock-admin-table-card .table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
  }

  .app-content {
    padding: var(--sp-4) !important;
  }

  .app-topbar {
    padding: 12px !important;
  }

  .ai-kpi-grid {
    grid-template-columns: 1fr;
  }

  .topbar-row {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
    gap: 8px;
  }

  .topbar-search {
    width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
  }

  .discover-filters-grid {
    grid-template-columns: 1fr;
  }

  .discover-grid {
    grid-template-columns: 1fr;
  }

  .ai-last-viewed-card {
    flex-direction: column;
    max-height: none;
  }

  .ai-last-viewed-media {
    width: 100%;
    min-width: 100%;
    height: 140px;
  }

  .table-responsive,
  .table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
  }
}
