/* ═══════════════════════════════════════════════════
   GHL ALL RECORDS — UI REDESIGN
   Inspired by: dark sidebar + clean white main area
   ═══════════════════════════════════════════════════ */

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

/* ─── TOKENS ─── */
:root {
  /* Sidebar */
  --sb-bg: #060f21;
  --sb-hover: rgba(197, 160, 89, 0.08);
  --sb-active: rgba(197, 160, 89, 0.15);
  --sb-text: #94a3b8;
  --sb-text-act: #c5a059;
  --sb-border: rgba(255, 255, 255, .03);
  --sb-width: 260px;

  /* Main */
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;

  /* Accent */
  --accent: #c5a059;
  --accent-dark: #8e6e3d;
  --accent-bg: rgba(197, 160, 89, .10);

  /* Text */
  --text: #1e293b;
  --muted: #64748b;
  --dim: #94a3b8;

  /* Status */
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;

  /* Misc */
  --r: 10px;
  --r-sm: 6px;
  --font: 'Inter', sans-serif;
  --shadow: 0 1px 4px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .06);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, .12);

  /* MavRick Branding */
  --mv-blue: #060f21;
  --mv-blue-light: #0a1931;
  --mv-gold: #c5a059;
  --mv-gold-soft: #e2d1a8;
  --mv-bronze: #8e6e3d;
  --mv-dark: #0f172a;
  --mv-white: #ffffff;
  --mv-glass: rgba(255, 255, 255, 0.04);
  --mv-radius: 24px;
  --mv-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  --mv-font-head: 'Outfit', sans-serif;
  --mv-font-body: 'Inter', sans-serif;
}

/* ─── RESET ─── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
}

/* ══════════════════════════════════════════════
   LOGIN — MavRick Branded (Dallas, TX)
══════════════════════════════════════════════ */

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  z-index: 999;
  font-family: var(--mv-font-body);
}

/* ── LEFT: Brand Panel ── */
.login-brand-panel {
  flex: 1;
  position: relative;
  background: var(--mv-blue); /* Fallback */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  min-width: 0;
}

.video-background {
  position: absolute;
  top: 50%; left: 50%;
  width: 100%; height: 100%;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
}
.video-background iframe {
  width: 100vw;
  height: 56.25vw; /* 16:9 aspect ratio */
  min-height: 100vh;
  min-width: 177.77vh; /* 16:9 aspect ratio */
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(1.2); /* scale up to hide black bars */
}

/* architectural line pattern */
.login-brand-grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(rgba(197, 160, 89, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(197, 160, 89, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  -webkit-mask-image: radial-gradient(circle at 0% 0%, black 20%, transparent 80%);
  mask-image: radial-gradient(circle at 0% 0%, black 20%, transparent 80%);
}

.login-brand-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 10% 10%, rgba(197, 160, 89, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 90% 90%, rgba(10, 25, 49, 0.5) 0%, transparent 50%);
}

.login-brand-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(8, 24, 50, .8) 0%, transparent 55%);
}

.login-brand-content {
  position: relative;
  z-index: 2;
  padding: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
}

.login-brand-central {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.brand-logo-img {
  width: 220px;
  height: auto;
  max-width: 80%;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4));
}

.login-brand-hero h2 {
  font-family: var(--mv-font-head);
  font-size: 56px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  letter-spacing: -3px;
  margin-bottom: 8px;
}

.login-brand-hero p {
  font-family: var(--mv-font-body);
  font-size: 14px;
  color: var(--mv-gold);
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 600;
}

/* ── RIGHT: Form Panel ── */
.login-form-panel {
  width: 510px;
  flex-shrink: 0;
  background: #fdfdfd; 
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
}

.login-form-panel::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(#e5e7eb 0.8px, transparent 0.8px);
  background-size: 24px 24px;
  opacity: 0.4;
}

.login-card {
  position: relative;
  background: #fff;
  border-radius: 28px;
  padding: 64px 56px 48px;
  width: 100%;
  max-width: 460px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow:
    0 10px 40px -10px rgba(0, 0, 0, 0.08),
    0 20px 80px -20px rgba(0, 0, 0, 0.1);
  animation: cardFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Header — horizontal layout */
.login-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}

.login-logo-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--mv-blue);
  width: 54px;
  height: 54px;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.form-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.login-header-text {
  flex: 1;
  min-width: 0;
}

.login-title {
  font-family: var(--mv-font-head);
  font-size: 32px;
  font-weight: 800;
  color: var(--mv-dark);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 8px;
}

.login-sub {
  font-size: 15px;
  color: #64748b;
  font-family: var(--mv-font-body);
  line-height: 1.5;
  font-weight: 400;
}

/* Divider */
.login-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, #e2e8f0 25%, #e2e8f0 75%, transparent);
  margin-bottom: 26px;
}

/* Form */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.field-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: .9px;
  font-family: var(--mv-font-body);
}

/* Input wrapper */
.login-input-wrap {
  position: relative;
}

.login-input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: #c4ccd8;
  pointer-events: none;
  transition: color .2s;
  z-index: 1;
}

.login-input-wrap:focus-within .login-input-icon {
  color: var(--mv-blue);
}

/* Password toggle */
.login-pw-toggle {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  color: #9ca3af;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color .2s, background .15s;
  z-index: 1;
}

.login-pw-toggle:hover {
  color: var(--mv-blue);
  background: rgba(26, 75, 140, .06);
}

/* Form inputs (scoped) */
.login-form-panel .field-input {
  width: 100%;
  padding: 14px 44px 14px 42px;
  background: #fdfdfd; 
  border: 1.5px solid #e5e7eb;
  border-radius: 14px;
  color: var(--mv-dark);
  font-size: 15px;
  font-family: var(--mv-font-body);
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-form-panel .field-input:focus {
  border-color: var(--mv-gold);
  box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.1);
  background: #fff;
}

.login-form-panel .field-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.forgot-link {
  display: block;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--mv-gold);
  text-decoration: none;
  margin-top: -8px;
  margin-bottom: 4px;
  transition: color 0.2s;
}

.forgot-link:hover { color: var(--mv-bronze); }

/* Error */
.login-error {
  background: #fef2f2;
  border: 1px solid rgba(220, 38, 38, .18);
  color: #b91c1c;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-family: var(--mv-font-body);
  line-height: 1.5;
}

/* CTA */
.login-btn {
  margin-top: 14px;
  padding: 18px 24px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--mv-font-head);
  border-radius: 14px;
  width: 100%;
  letter-spacing: .5px;
  background: linear-gradient(135deg, var(--mv-gold) 0%, var(--mv-bronze) 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 30px -10px rgba(142, 110, 61, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.login-btn:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 15px 35px -10px rgba(142, 110, 61, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.login-btn:active {
  transform: translateY(0);
  opacity: 1;
}

.login-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}



.login-footer-note {
  margin-top: 24px;
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  font-family: var(--mv-font-body);
}

/* ── General field-input (used in modals, schema, user forms) ── */
.field-input {
  width: 100%;
  padding: 11px 14px;
  background: #f8fafc;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .15);
  background: #fff;
}

/* ══════════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════════ */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ══════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════ */
.sidebar {
  width: var(--sb-width);
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sb-border);
  flex-shrink: 0;
  overflow: hidden;
  z-index: 9999999;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
  width: 72px; /* Just enough for icons */
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-group-header,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .accordion-chevron,
.sidebar.collapsed .err-count,
.sidebar.collapsed #sidebar-user-text,
.sidebar.collapsed .nav-accordion-content,
.sidebar.collapsed .logo-img {
  display: none !important;
}

.sidebar.collapsed .logo {
  padding: 22px 0 18px 0;
  justify-content: center;
}

.sidebar.collapsed .nav-item {
  padding: 0 !important;
  justify-content: center !important;
  width: 44px;
  height: 44px;
  margin: 0 auto 6px auto;
  border-radius: 12px;
}

.sidebar.collapsed .nav-item > div {
  justify-content: center !important;
}

.sidebar.collapsed .nav-item.active {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar.collapsed .nav-icon {
  margin: 0 !important;
}

.sidebar.collapsed #sidebar-toggle svg {
  transform: rotate(180deg);
}

.sidebar.collapsed #sidebar-toggle {
  position: static !important;
  margin: 0 auto !important;
  transform: none !important;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1) !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.sidebar.collapsed #sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.2) !important;
}

.sidebar.collapsed .nav-item.active::before {
  display: none;
}

.sidebar.collapsed .sidebar-footer > div {
  justify-content: center !important;
  padding: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

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

.sidebar.collapsed .status-dot {
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--sb-border);
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #34d399, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  flex-shrink: 0;
}

.logo-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.logo-sub {
  font-size: 11px;
  color: var(--sb-text);
  margin-top: 1px;
}

/* Nav */
.nav-group-header {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 12px 8px 12px;
}
.nav-group-header:first-child {
  margin-top: 4px;
}

.nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--sb-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  transition: background .15s, color .15s;
  position: relative;
}

.nav-item:hover {
  background: var(--sb-hover);
  color: #cbd5e1;
}

.nav-item.active {
  background: var(--sb-active);
  color: var(--sb-text-act);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-icon {
  width: 16px;
  height: 16px;
  opacity: .7;
  flex-shrink: 0;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

/* Err badge on nav */
.err-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--error);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  margin-left: auto;
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--sb-border);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  flex-shrink: 0;
  transition: background .3s;
}

.status-dot.ok {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-dot.err {
  background: var(--error);
}

#status-text {
  font-size: 12px;
  color: var(--sb-text);
}

.logout-btn {
  width: 100%;
  padding: 8px;
  border-radius: var(--r-sm);
  background: none;
  border: 1px solid var(--sb-border);
  color: var(--sb-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, .1);
  color: #ef4444;
  border-color: rgba(239, 68, 68, .3);
}

/* ══════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}

/* ─── Tab sections ─── */
.tab {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.tab.active {
  display: flex;
}

/* ─── Page header ─── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.page-header p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* ─── Scrollable body inside a tab ─── */
.tab-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ══════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════ */
.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: all .18s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 12px rgba(52, 211, 153, .35);
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1.5px solid var(--border-dark);
}

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

.btn-danger {
  background: rgba(239, 68, 68, .1);
  color: var(--error);
  border: 1.5px solid rgba(239, 68, 68, .25);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, .18);
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1.5px solid var(--border-dark);
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.icon-btn:hover {
  border-color: var(--error);
  color: var(--error);
}

/* ══════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
}

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

/* ══════════════════════════════════════════════
   IMPORT TAB
══════════════════════════════════════════════ */
.dropzone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--r);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--surface);
}

.dropzone:hover,
.dropzone.over {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.drop-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  margin: 0 auto 16px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 26px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.dropzone p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.drop-hint {
  font-size: 12px;
  color: var(--dim);
  background: var(--bg);
  padding: 3px 10px;
  border-radius: 20px;
}

.file-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
}

.file-bar-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.file-bar-icon::after {
  content: '📄';
}

.file-bar-info {
  flex: 1;
  min-width: 0;
}

.file-bar-info strong {
  font-size: 13px;
  font-weight: 600;
  display: block;
  color: var(--text);
}

.file-bar-info span {
  font-size: 12px;
  color: var(--muted);
}

/* Radio cards for dup handling */
.radio-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.radio-card {
  flex: 1;
  min-width: 160px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border-dark);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--surface);
}

.radio-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.radio-card input {
  accent-color: var(--accent);
  margin-top: 2px;
}

.radio-body strong {
  font-size: 13px;
  font-weight: 600;
  display: block;
}

.radio-body small {
  font-size: 12px;
  color: var(--muted);
}

/* Progress */
.prog-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
}

.prog-track {
  background: var(--border);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  width: 0%;
  transition: width .3s ease;
}

/* Result card */
.result-card {
  text-align: center;
  padding: 36px 24px;
}

.result-stats {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 16px;
}

.rs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.rs strong {
  font-size: 28px;
  font-weight: 800;
}

.rs small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ══════════════════════════════════════════════
   FILTERS BAR
══════════════════════════════════════════════ */
.filters-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
  padding: 6px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: visible;
  position: relative;
  z-index: 200;
}

.search-wrap {
  position: relative;
  width: 100%;
}

.search-ico {
  position: absolute;
  left: 11px;
  top: 11px;
  width: 16px;
  height: 16px;
  color: var(--dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  background: #fff;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: all .2s ease;
}

.search-input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.flt-select {
  height: 38px;
  min-width: 120px;
  padding: 0 12px;
  background: #fff;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: all .2s ease;
}

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

.btn-reset {
  height: 38px;
  padding: 0 16px;
  background: #f8fafc;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--r-sm);
  color: #475569;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-reset:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

/* ══════════════════════════════════════════════
   CUSTOM MULTISELECT
══════════════════════════════════════════════ */
.custom-ms {
  position: relative;
  min-width: 125px;
  font-family: var(--font);
}

.custom-ms-display {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border-dark);
  background: #fff;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: all .2s ease;
}

.custom-ms-display:hover {
  border-color: var(--accent);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.filter-label {
  font-size: 10px;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: 0.5px;
  padding-left: 2px;
}

.ms-values {
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.ms-chevron {
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  margin-top: -5px;
  margin-right: 2px;
  transition: transform 0.2s;
  pointer-events: none;
}

.custom-ms-menu.show+.custom-ms-display .ms-chevron {
  transform: rotate(-135deg);
}

.ms-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text);
  font-weight: 500;
  transition: border-color .2s;
}

.ms-chip:hover {
  border-color: var(--accent);
}

.ms-chip-x {
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
  transition: color .2s;
}

.ms-chip-x:hover {
  color: var(--danger);
}

.custom-ms-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: 250px;
  background: var(--surface);
  border: 1px solid var(--border-dark);
  border-radius: var(--r-sm);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.custom-ms-menu.show {
  display: flex;
}

.custom-ms-search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.custom-ms-search {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  outline: none;
  font-family: var(--font);
  color: var(--text);
}

.custom-ms-search:focus {
  border-color: var(--accent);
}

.custom-ms-options {
  max-height: 250px;
  overflow-y: auto;
  padding: 0;
}

.custom-ms-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background .15s;
}

.custom-ms-opt:hover {
  background: var(--bg);
}

.selected-opt {
  background: var(--bg);
  font-weight: 600;
}

.custom-ms-opt input {
  cursor: pointer;
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.custom-ms-opt span {
  font-size: 13px;
  color: var(--text);
  user-select: none;
  line-height: 1.2;
}

/* Sticky Header in MS */
.prospect-ms-header {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  /* Solid background since it is sticky */
  position: sticky;
  top: 0;
  z-index: 50;
}

.prospect-ms-action {
  background: none;
  border: none;
  padding: 0;
  font-size: 10px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.prospect-ms-action:hover {
  opacity: 0.7;
  text-decoration: underline;
}

.prospect-ms-action--danger {
  color: var(--danger);
}

/* ══════════════════════════════════════════════
   CUSTOM SCROLLBAR (Horizontal UI)
══════════════════════════════════════════════ */
.custom-scrollbar::-webkit-scrollbar {
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ══════════════════════════════════════════════
   STATS CARDS (Teams-style drilldown)
   Establishing lower stack priority than filters
══════════════════════════════════════════════ */
.stats-row {
  position: relative;
  z-index: 50;
  margin-top: 5px;
}

.stats-cards-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  padding: 4px 4px 10px 4px;
  overflow-x: auto;
  scroll-behavior: smooth;
}

.stats-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  min-width: 100px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  user-select: none;
}

/* ──────────────────────────────────────────────────────────────────────────
   STATS DASHBOARD
   ────────────────────────────────────────────────────────────────────────── */
.stats-row {
  margin: 0 0 24px 0;
  padding: 0 24px;
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 4px;
  height: 22px; 
}

.activity-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mv-font-head);
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  margin: 32px 24px 12px 24px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.stats-header__label {
  font-family: var(--mv-font-head);
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stats-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(239, 68, 68, 0.05); 
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.1);
  padding: 0 8px; /* High-precision minimal padding */
  border-radius: 4px;
  font-size: 8.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  height: 18px; /* Tighter height */
}

.stats-clear-btn:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.stats-clear-btn::before {
  content: '✕';
  font-size: 11px;
}

.btn-reset {
  background: #f1f5f9;
  color: #475569;
  border: 1.5px solid #e2e8f0;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-reset:hover {
  background: #e2e8f0;
  color: #1e293b;
  border-color: #cbd5e1;
}

.stats-cards-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 4px 12px 4px;
  scroll-behavior: smooth;
}

.stats-card {
  flex: 0 0 auto;
  min-width: 135px;
  height: 40px; /* Fixed height for consistency */
  background: #fff;
  border-radius: 8px;
  padding: 4px 10px 4px 28px; /* Extra left padding to clear checkbox */
  border: 1.5px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stats-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
  border-color: var(--border-dark);
}

.stats-card--idle {
  opacity: 0.8;
  border-color: var(--border);
  background: #fcfcfc;
}

.stats-card--idle .stats-card__count {
  color: #94a3b8;
}

.stats-card__checkbox {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  cursor: pointer;
  margin: 0;
}

.stats-card__count {
  font-family: var(--mv-font-head);
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: -2px;
  line-height: 1;
}

.stats-card__label {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

/* Selected/Active State */
.stats-card--active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.2);
  opacity: 1;
}

.stats-card--active .stats-card__count,
.stats-card--active .stats-card__label {
  color: #fff;
}

.stats-card--active .stats-card__checkbox {
  accent-color: #064e3b;
}

/* Custom Scrollbar for stats row */
.stats-cards-row::-webkit-scrollbar {
  height: 4px;
}
.stats-cards-row::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}
.stats-cards-row::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
.stats-cards-row::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ══════════════════════════════════════════════
   TABLE CARD
══════════════════════════════════════════════ */
.tbl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.tbl-toolbar {
  min-height: 48px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.toolbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  animation: fadeIn .2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.selection-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.selection-badge {
  background: #f1f5f9;
  color: #475569;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  transition: all .2s;
  cursor: pointer;
}

.selection-badge:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.selection-badge.active {
  background: #eff6ff;
  color: #3b82f6;
  border-color: #bfdbfe;
}

.link-btn {
  background: none;
  border: none;
  color: #3b82f6;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 99px;
  transition: all .25s;
}

.link-btn:hover {
  background: #f1f5f9;
}

.link-btn.active {
  background: #3b82f6;
  color: #ffffff !important;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.bulk-actions-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bulk-btn {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.bulk-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.bulk-btn:hover .ico-bulk {
  color: #1e293b;
}

.bulk-btn.danger:hover {
  background: #fef2f2;
  color: #dc2626;
}

.bulk-btn.danger:hover .ico-bulk {
  color: #dc2626;
}

.ico-bulk {
  font-style: normal;
  font-size: 14px;
  color: #94a3b8;
  display: inline-flex;
}

.btn-danger-ghost {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  padding: 8px;
  cursor: pointer;
  border-radius: 4px;
}

.btn-danger-ghost:hover {
  color: #ef4444;
  background: #fef2f2;
}

.muted-sm {
  font-size: 12px;
  color: var(--muted);
}

.tbl-wrap {
  overflow: auto;
  flex: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

thead {
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 2;
}

thead th {
  padding: 8px 16px;
  background: #ffffff;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  user-select: none;
}

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

.sort-th {
  cursor: pointer;
  transition: all .15s;
}

.sort-th:hover {
  background: #f8fafc;
  color: #1e293b;
}

.sort-wrap-box {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.sort-badge {
  background: #3b82f6;
  color: #ffffff;
  font-size: 9px;
  font-weight: 800;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
  flex-shrink: 0;
}

.sort-ico {
  width: 11px;
  height: 11px;
  color: #3b82f6;
  stroke-width: 4.5;
  transition: transform 0.2s, color 0.15s;
  flex-shrink: 0;
}

.sort-ico-neutral {
  width: 11px;
  height: 11px;
  color: #94a3b8;
  transition: color 0.2s;
  flex-shrink: 0;
}

.sort-th:hover .sort-ico-neutral {
  color: #475569;
}

thead th.sortable {
  cursor: pointer;
}

thead th.sortable:hover {
  color: var(--accent);
}

tbody tr {
  transition: background .12s;
  border-bottom: 1px solid var(--border);
}

tbody tr:hover {
  background: #f8fafc;
}

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

tbody td {
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 48px !important;
  font-size: 14px;
  white-space: normal !important;
}

/* Checkbox column */
.cb-col {
  width: 40px;
  padding: 6px 8px 6px 16px !important;
}

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

/* ══════════════════════════════════════════════
   BADGES & PILLS
══════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-bg);
  color: var(--accent-dark);
  border: 1px solid rgba(52, 211, 153, .25);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
}

.badge-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-bg);
  color: var(--accent-dark);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border: 1px solid rgba(52, 211, 153, .2);
}

/* ══════════════════════════════════════════════
   COLUMNS PANEL
══════════════════════════════════════════════ */
.cols-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border-dark);
  border-radius: var(--r);
  padding: 16px;
  width: 340px;
  box-shadow: var(--shadow-md);
  z-index: 50;
}

.cols-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.cols-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 6px;
  transition: background .12s;
}

.cols-grid label:hover {
  background: var(--bg);
}

/* ══════════════════════════════════════════════
   PAGINATION
══════════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-card);
  font-size: 13px;
  color: var(--text);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-info, .pagination-options {
  color: var(--dim);
}

.pagination-info strong, .pagination-options strong {
  color: var(--text);
  font-weight: 600;
}

.pg-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid var(--border-dark);
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pg-btn:hover:not(:disabled) {
  border-color: #000;
  color: #000;
}

.pg-btn.active {
  background: #111827;
  border-color: #111827;
  color: #fff;
  font-weight: 600;
}

.pg-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  background: #f8fafc;
}

.pg-ellipsis {
  font-size: 13px;
  color: var(--dim);
  padding: 0 4px;
}

/* ══════════════════════════════════════════════
   STATS ROW
══════════════════════════════════════════════ */
.stats-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 28px 4px;
  overflow-x: auto;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 16px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}

.stat-pill:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(52, 211, 153, .15);
}

/* ══════════════════════════════════════════════
   SCHEMA MANAGER
══════════════════════════════════════════════ */
.sm-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-family: var(--font);
}

.sm-input {
  width: 100%;
  padding: 7px 10px;
  background: #f8fafc;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}

.sm-input:focus {
  border-color: var(--accent);
  background: #fff;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

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

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: var(--border-dark);
  cursor: pointer;
  transition: background .2s;
}

.toggle input:checked+.toggle-track {
  background: var(--accent);
}

.toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}

.toggle input:checked+.toggle-track::after {
  transform: translateX(16px);
}

.err-reason {
  font-size: 11px;
  color: var(--error);
  background: rgba(239, 68, 68, .07);
  border-radius: 4px;
  padding: 2px 7px;
  display: block;
  margin-top: 3px;
  white-space: normal;
  max-width: 260px;
}

.editable-cell {
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 3px 7px;
  cursor: text;
  transition: border-color .15s, background .15s;
  display: inline-block;
  min-width: 60px;
}

.editable-cell:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--accent-bg);
}

/* ══════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  transform: translateY(80px);
  opacity: 0;
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), opacity .3s;
  pointer-events: none;
  z-index: 9999;
  max-width: 320px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--error);
}

/* ══════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border-radius: var(--r);
  padding: 28px 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  animation: modal-in .2s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(.96) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text);
}

.modal p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.sql-box {
  background: #f8fafc;
  border: 1px solid var(--border-dark);
  border-radius: var(--r-sm);
  padding: 16px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: var(--text);
  max-height: 280px;
  overflow: auto;
  white-space: pre;
}

/* ══════════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--dim);
}

/* ══════════════════════════════════════════════
   IMPORT TAB – scrollable body wrapper
══════════════════════════════════════════════ */
#tab-import .tab-body {
  gap: 16px;
}

/* ══════════════════════════════════════════════
   HISTORY & USERS TABS
══════════════════════════════════════════════ */
#tab-history,
#tab-users,
#tab-records,
#tab-errors,
#tab-schema {
  overflow: hidden;
}

#tab-history .tbl-card,
#tab-users .tbl-card,
#tab-errors .tbl-card {
  margin: 18px 28px;
  flex: 1;
}

#tab-records .tbl-card {
  margin: 8px 28px 16px;
  flex: 1;
}

/* Schema tab uses a card wrapping the table — make it scrollable */
#tab-schema.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#tab-schema .page-header {
  flex-shrink: 0;
}

#tab-schema .schema-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#tab-schema .tbl-card {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Compact inputs inside schema table */
.field-input.sm,
input.sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1.5px solid var(--border-dark);
  background: var(--bg);
  font-family: var(--font);
  color: var(--text);
  outline: none;
  width: 100%;
  transition: border-color .2s;
}

.field-input.sm:focus,
input.sm:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .1);
}

.flt-select.sm,
select.sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1.5px solid var(--border-dark);
  background: #fff;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
  outline: none;
  width: 100%;
  transition: border-color .2s;
}

.flt-select.sm:focus,
select.sm:focus {
  border-color: var(--accent);
}

/* Schema table column widths */
#schema-table th:nth-child(1),
#schema-table td:nth-child(1) {
  width: 35%;
}

#schema-table th:nth-child(2),
#schema-table td:nth-child(2) {
  width: 30%;
}

#schema-table th:nth-child(3),
#schema-table td:nth-child(3) {
  width: 14%;
}

#schema-table th:nth-child(4),
#schema-table td:nth-child(4) {
  width: 10%;
  text-align: center;
}

#schema-table th:nth-child(5),
#schema-table td:nth-child(5) {
  width: 11%;
  text-align: center;
}

/* Active toggle cell */
#schema-table td:nth-child(4) {
  text-align: center;
  vertical-align: middle;
}

/* Allow text to wrap inside schema cells */
#schema-table td {
  white-space: normal;
  overflow: visible;
  max-width: none;
  padding: 8px 12px;
  vertical-align: middle;
}

/* Records tab specific */
#tab-records .filters-bar {
  margin: 0;
}

#tab-records .stats-row {
  padding: 6px 28px 0;
  display: block;
  margin: 0;
}

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --sb-width: 64px;
  }

  .logo-title,
  .logo-sub,
  #status-text,
  .nav-item span.nav-label {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 12px 0;
  }

  .nav-icon {
    opacity: 1;
  }

  .sidebar-footer {
    align-items: center;
  }

  .logout-btn {
    font-size: 0;
    padding: 10px;
  }
}

/* ══════════════════════════════════════════════
   ACTIONS DROPDOWN MENU
══════════════════════════════════════════════ */
.actions-cell {
  overflow: visible !important;
  white-space: normal !important;
  position: relative;
}

.actions-dropdown-container {
  position: relative;
  display: inline-block;
}

.actions-ellipsis-btn {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.actions-ellipsis-btn:hover {
  background: #f1f5f9;
  color: var(--text);
}

.actions-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 1000;
  min-width: 170px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  padding: 6px 0;
  transform-origin: top right;
  animation: scaleIn 0.15s ease-out;
}

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

.actions-dropdown-item {
  width: 100%;
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

.actions-dropdown-item:hover {
  background: #f8fafc;
  color: #0f172a;
}

.actions-dropdown-item.danger {
  color: #e11d48;
}

.actions-dropdown-item.danger:hover {
  background: #fff1f2;
  color: #be123c;
}

/* Disabled and blurred state for filters bar during active import session */
.filters-bar.disabled-blur {
  pointer-events: none !important;
  opacity: 0.35 !important;
  filter: blur(1.5px) !important;
  user-select: none !important;
  transition: all 0.3s ease;
}

/* Sidebar Nav Accordion styles */
.nav-accordion-group {
  display: flex;
  flex-direction: column;
}

.nav-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 28px;
}

.nav-accordion-group.expanded .nav-accordion-content {
  max-height: 100px;
  margin-bottom: 6px;
}

.nav-accordion-group.expanded .accordion-chevron {
  transform: rotate(180deg);
}

.nav-subitem {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--sb-text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  transition: background .15s, color .15s;
  opacity: 0.85;
}

.nav-subitem:hover {
  background: var(--sb-hover);
  color: #cbd5e1;
  opacity: 1;
}

.nav-subitem.active {
  color: var(--sb-text-act);
  font-weight: 600;
  opacity: 1;
  background: rgba(197, 160, 89, 0.05);
}

/* Row Action Buttons styling */
.row-del-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.row-del-btn:hover {
  background: #fde8e8;
  color: #ef4444;
}

.row-del-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}

/* Column Resizer styling */
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  user-select: none;
  z-index: 100;
  transition: background-color 0.1s ease;
}

.col-resizer:hover,
.col-resizer.resizing {
  background-color: var(--accent);
  width: 4px;
}

/* ─── Actions Dropdown Styling ───────────────── */
.actions-dropdown-container {
  position: relative;
  display: inline-block;
}

.actions-ellipsis-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.actions-ellipsis-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

.actions-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #ffffff;
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  min-width: 160px;
  overflow: hidden;
  padding: 4px 0;
}

.actions-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s ease;
  text-decoration: none;
  box-sizing: border-box;
}

.actions-dropdown-item:hover {
  background-color: var(--bg-hover, #f8fafc);
}

.actions-dropdown-item.danger {
  color: #ef4444;
}

.actions-dropdown-item.danger:hover {
  background-color: #fef2f2;
}

/* ══════════════════════════════════════════════
   FULL VIEW MODE
══════════════════════════════════════════════ */
#tab-records.full-view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  height: 100%;
  z-index: 999999;
  border-radius: 0;
  margin: 0 !important;
  background: #f8fafc;
  max-height: 100vh;
}

#tab-records.full-view .unified-header {
  border-radius: 0;
}

#tab-records.full-view .tbl-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0 !important;
}

#tab-records.full-view .tbl-wrap {
  flex: 1;
  min-height: 0;
}

.search-highlight {
  background-color: var(--accent);
  color: #ffffff;
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 600;
}