/* ===================================================
   KrediTalent ATS - Main Stylesheet
   =================================================== */

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #818cf8;
  --primary-bg: #eef2ff;
  --secondary: #0ea5e9;
  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --info: #06b6d4;
  --info-bg: #cffafe;
  --purple: #8b5cf6;
  --purple-bg: #ede9fe;
  --orange: #f97316;
  --orange-bg: #ffedd5;
  --pink: #ec4899;
  --pink-bg: #fce7f3;

  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --sidebar-bg: #1e1b4b;
  --sidebar-hover: #2d2a6e;
  --sidebar-active: #4f46e5;
  --sidebar-text: #c7d2fe;
  --sidebar-text-muted: #818cf8;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
  --shadow-xl: 0 25px 50px -12px rgba(0,0,0,.25);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --sidebar-w: 260px;
  --topbar-h: 64px;
  --transition: all .2s ease;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; cursor: pointer; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; }
ul { list-style: none; }
.hidden { display: none !important; }

/* ======= SCROLLBAR ======= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ======= LOGIN ======= */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4f46e5 100%);
}
.login-bg { position: absolute; inset: 0; z-index: 0; }
.login-shapes .shape {
  position: absolute;
  border-radius: 50%;
  opacity: .07;
  background: white;
}
.shape-1 { width: 500px; height: 500px; top: -150px; right: -100px; }
.shape-2 { width: 350px; height: 350px; bottom: -100px; left: -80px; }
.shape-3 { width: 200px; height: 200px; top: 50%; left: 40%; }

.login-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
  max-width: 440px;
  padding: 24px;
}

.login-brand { text-align: center; color: white; }
.brand-logo {
  width: 72px; height: 72px;
  background: rgba(255,255,255,.15);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: white;
  margin: 0 auto 16px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.2);
}
.login-brand h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.login-brand h1 span { color: #a5b4fc; }
.login-brand p { color: rgba(255,255,255,.65); font-size: 13px; margin-top: 4px; }

.login-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 100%;
  box-shadow: var(--shadow-xl);
}
.login-card h2 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-subtitle { color: var(--text-2); font-size: 13px; margin-bottom: 24px; margin-top: 4px; }

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-2); margin-bottom: 8px;
}
.form-group label i { margin-right: 6px; color: var(--primary); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px; color: var(--text);
  background: var(--surface);
  transition: var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg);
}
.input-password { position: relative; }
.input-password input { padding-right: 44px; }
.toggle-password {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; color: var(--text-3); padding: 4px;
  transition: var(--transition);
}
.toggle-password:hover { color: var(--primary); }

.login-error {
  background: var(--danger-bg); color: var(--danger);
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}

.btn-login {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white; border-radius: var(--radius);
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: var(--transition); box-shadow: 0 4px 15px rgba(79,70,229,.35);
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(79,70,229,.45); }
.btn-login:active { transform: translateY(0); }

.login-demo { margin-top: 24px; }
.login-demo p { font-size: 12px; color: var(--text-3); text-align: center; margin-bottom: 10px; }
.demo-accounts { display: flex; gap: 8px; flex-wrap: wrap; }
.demo-btn {
  flex: 1; min-width: 100px; padding: 8px 12px;
  background: var(--primary-bg); color: var(--primary);
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
  transition: var(--transition); border: 1px solid #c7d2fe;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.demo-btn:hover { background: var(--primary); color: white; }

/* ======= APP LAYOUT ======= */
.app { display: flex; min-height: 100vh; }

/* ======= SIDEBAR ======= */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 200;
  transition: var(--transition);
  box-shadow: 4px 0 20px rgba(0,0,0,.15);
}
.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-footer span { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 16px 0; }
.sidebar.collapsed .sidebar-footer .btn-logout { justify-content: center; }

.sidebar-header {
  padding: 20px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 38px; height: 38px; border-radius: var(--radius);
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: white; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { color: white; font-weight: 700; font-size: 16px; line-height: 1; }
.brand-sub { color: var(--sidebar-text-muted); font-size: 11px; font-weight: 500; }
.sidebar-toggle {
  background: rgba(255,255,255,.1); color: var(--sidebar-text);
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); font-size: 14px;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.2); }

.sidebar-user {
  padding: 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white; flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { color: white; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-badge {
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 99px; background: rgba(79,70,229,.4);
  color: #a5b4fc; width: fit-content; margin-top: 2px;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 8px; }
.nav-section { margin-bottom: 8px; }
.nav-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: var(--sidebar-text-muted); padding: 8px 12px 4px;
  display: block;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius);
  color: var(--sidebar-text); font-size: 13px; font-weight: 500;
  transition: var(--transition); position: relative;
  cursor: pointer; margin-bottom: 2px;
}
.nav-item i { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-item span { flex: 1; }
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active {
  background: var(--sidebar-active); color: white;
  box-shadow: 0 4px 12px rgba(79,70,229,.4);
}
.nav-badge {
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 99px; background: var(--danger); color: white;
  min-width: 20px; text-align: center;
}
.nav-badge.new { background: var(--success); }
.nav-badge:empty, .nav-badge[data-count="0"] { display: none; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.btn-logout {
  width: 100%; padding: 10px 12px;
  background: rgba(239,68,68,.1); color: #fca5a5;
  border-radius: var(--radius); font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  transition: var(--transition);
}
.btn-logout:hover { background: rgba(239,68,68,.2); color: #fecaca; }

/* ======= MAIN WRAPPER ======= */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: var(--transition);
}
.main-wrapper.expanded { margin-left: 72px; }

/* ======= TOPBAR ======= */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 16px; flex: 1; }
.mobile-menu-btn {
  display: none; background: none; color: var(--text-2);
  font-size: 18px; padding: 4px 8px;
}

.global-search {
  position: relative; max-width: 420px; width: 100%;
}
.global-search i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 14px;
}
.global-search input {
  width: 100%; padding: 9px 14px 9px 38px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); font-size: 13px; color: var(--text);
  transition: var(--transition);
}
.global-search input:focus { border-color: var(--primary); background: white; box-shadow: 0 0 0 3px var(--primary-bg); }

.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: white; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); max-height: 320px; overflow-y: auto; z-index: 999;
  display: none;
}
.search-results.show { display: block; }
.search-item {
  padding: 10px 14px; cursor: pointer; transition: var(--transition);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--primary-bg); }
.search-item-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.search-item-info { flex: 1; min-width: 0; }
.search-item-name { font-size: 13px; font-weight: 600; color: var(--text); }
.search-item-sub { font-size: 11px; color: var(--text-3); }

.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  width: 38px; height: 38px; border-radius: var(--radius);
  background: var(--surface-2); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: var(--transition); position: relative;
  border: 1px solid var(--border);
}
.topbar-btn:hover { background: var(--primary-bg); color: var(--primary); }
.badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid white;
  display: none;
}
.badge-dot.show { display: block; }

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; position: relative; transition: var(--transition);
}
.topbar-user:hover { background: var(--primary-bg); border-color: #c7d2fe; }
.topbar-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
}
.topbar-user span { font-size: 13px; font-weight: 600; color: var(--text); }
.topbar-user i { font-size: 11px; color: var(--text-3); }

.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: white; border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  min-width: 200px; z-index: 999; display: none; overflow: hidden;
}
.user-dropdown.show { display: block; }
.dropdown-header { padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.dropdown-header strong { display: block; font-size: 14px; color: var(--text); }
.dropdown-header small { font-size: 12px; color: var(--text-3); }
.user-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; font-size: 13px; color: var(--text-2);
  transition: var(--transition);
}
.user-dropdown a:hover { background: var(--danger-bg); color: var(--danger); }
.user-dropdown a i { width: 16px; }

/* ======= PAGE CONTENT ======= */
.page-content {
  flex: 1; padding: 24px; overflow-y: auto;
}

/* ======= PAGE HEADER ======= */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header-left h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.page-header-left p { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.page-header-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ======= BUTTONS ======= */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; transition: var(--transition);
  white-space: nowrap;
}
.btn i { font-size: 13px; }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(79,70,229,.3); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(79,70,229,.4); transform: translateY(-1px); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }
.btn-info { background: var(--info); color: white; }
.btn-info:hover { background: #0891b2; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; }
.btn-icon { padding: 8px; border-radius: var(--radius); background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.btn-icon:hover { background: var(--primary-bg); color: var(--primary); }

/* ======= CARDS ======= */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--primary); }
.card-body { padding: 20px; }

/* ======= STATS CARDS ======= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; gap: 16px;
  transition: var(--transition); cursor: default;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.blue::before { background: var(--primary); }
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }
.stat-card.purple::before { background: var(--purple); }
.stat-card.cyan::before { background: var(--info); }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-card.blue .stat-icon { background: var(--primary-bg); color: var(--primary); }
.stat-card.green .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.orange .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.red .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-card.purple .stat-icon { background: var(--purple-bg); color: var(--purple); }
.stat-card.cyan .stat-icon { background: var(--info-bg); color: var(--info); }

.stat-info { flex: 1; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 4px; font-weight: 500; }
.stat-change {
  font-size: 11px; font-weight: 600; margin-top: 6px;
  display: flex; align-items: center; gap: 4px;
}
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ======= TABLES ======= */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 11px 16px; text-align: left;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-3); background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody td { padding: 13px 16px; font-size: 13px; color: var(--text-2); vertical-align: middle; }
.td-name { font-weight: 600; color: var(--text); }
.td-actions { display: flex; gap: 6px; align-items: center; }

/* ======= BADGES ======= */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge i { font-size: 9px; }
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-gray { background: #f1f5f9; color: var(--text-3); }
.badge-pink { background: var(--pink-bg); color: var(--pink); }

/* ======= FILTERS BAR ======= */
.filters-bar {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; margin-bottom: 16px;
}
.filter-input {
  position: relative;
}
.filter-input i {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 13px; pointer-events: none;
}
.filter-input input, .filter-select {
  height: 36px; padding: 0 12px 0 32px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 13px; color: var(--text); background: white;
  transition: var(--transition); min-width: 160px;
}
.filter-select { padding: 0 12px; min-width: 140px; }
.filter-input input:focus, .filter-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }

/* ======= SCORE BADGE ======= */
.score-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 99px; font-weight: 700;
  font-size: 12px;
}
.score-high { background: var(--success-bg); color: var(--success); }
.score-mid { background: var(--warning-bg); color: var(--warning); }
.score-low { background: var(--danger-bg); color: var(--danger); }

/* ======= MODAL ======= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 1000; padding: 24px; overflow-y: auto;
  backdrop-filter: blur(4px);
}
.modal-container {
  background: white; border-radius: var(--radius-xl);
  width: 100%; max-width: 720px;
  box-shadow: var(--shadow-xl);
  animation: modalIn .2s ease;
  margin: auto;
}
.modal-container.modal-sm { max-width: 440px; }
.modal-container.modal-xl { max-width: 960px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-20px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: var(--transition);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 24px; max-height: 75vh; overflow-y: auto; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ======= FORM GRID ======= */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full-width { grid-column: 1 / -1; }
.form-group textarea {
  resize: vertical; min-height: 80px; padding: 11px 14px;
}
.skills-input-container { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.skill-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; background: var(--primary-bg); color: var(--primary);
  border-radius: 99px; font-size: 12px; font-weight: 500;
}
.skill-tag button { background: none; color: var(--primary); font-size: 11px; padding: 0 0 0 2px; }
.skill-tag button:hover { color: var(--danger); }
.skills-add-btn {
  padding: 4px 10px; background: var(--surface-2); color: var(--text-3);
  border: 1px dashed var(--border-2); border-radius: 99px; font-size: 12px;
  transition: var(--transition);
}
.skills-add-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

/* ======= TOAST ======= */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: var(--radius-md);
  background: white; box-shadow: var(--shadow-lg);
  border-left: 4px solid; min-width: 280px; max-width: 380px;
  animation: toastIn .3s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.info { border-color: var(--info); }
.toast-icon { font-size: 18px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }
.toast-text { flex: 1; }
.toast-text strong { display: block; font-size: 13px; color: var(--text); }
.toast-text span { font-size: 12px; color: var(--text-3); }
.toast-close { background: none; color: var(--text-3); font-size: 13px; padding: 2px; }

/* ======= DASHBOARD ======= */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}
.dashboard-grid .col-span-2 { grid-column: span 2; }
.dashboard-grid .col-span-3 { grid-column: span 3; }

.chart-container { position: relative; height: 260px; }
.chart-container canvas { max-height: 260px !important; }

.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; padding-bottom: 0; }
.list-item-icon {
  width: 38px; height: 38px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.list-item-content { flex: 1; min-width: 0; }
.list-item-title { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.list-item-right { flex-shrink: 0; text-align: right; }
.list-item-time { font-size: 11px; color: var(--text-3); }

/* ======= PRIORITY BADGES ======= */
.priority-urgente { background: #fef0f0; color: var(--danger); border: 1px solid #fecaca; }
.priority-alta { background: var(--orange-bg); color: var(--orange); border: 1px solid #fed7aa; }
.priority-media { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }
.priority-baja { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }

/* ======= STATUS BADGES ======= */
.status-abierta { background: var(--success-bg); color: var(--success); }
.status-pausada { background: var(--warning-bg); color: var(--warning); }
.status-cerrada { background: #f1f5f9; color: var(--text-3); }
.status-cancelada { background: var(--danger-bg); color: var(--danger); }
.status-programada { background: var(--primary-bg); color: var(--primary); }
.status-realizada { background: var(--success-bg); color: var(--success); }
.status-cancelada { background: var(--danger-bg); color: var(--danger); }

/* ======= STAGE BADGES ======= */
.stage-nuevo { background: #f1f5f9; color: #64748b; }
.stage-revisado { background: var(--info-bg); color: var(--info); }
.stage-preseleccionado { background: var(--primary-bg); color: var(--primary); }
.stage-contactado { background: var(--purple-bg); color: var(--purple); }
.stage-entrevista_rrhh { background: var(--orange-bg); color: var(--orange); }
.stage-entrevista_lider { background: var(--pink-bg); color: var(--pink); }
.stage-prueba { background: var(--warning-bg); color: var(--warning); }
.stage-oferta { background: #f0fdf4; color: #16a34a; }
.stage-contratado { background: var(--success-bg); color: var(--success); }
.stage-descartado { background: var(--danger-bg); color: var(--danger); }

/* ======= KANBAN ======= */
.kanban-board {
  display: flex; gap: 14px;
  overflow-x: auto; padding-bottom: 16px;
  min-height: 500px;
}
.kanban-column {
  min-width: 220px; max-width: 220px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.kanban-col-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.kanban-col-title {
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; gap: 7px;
}
.kanban-col-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.kanban-count {
  font-size: 11px; font-weight: 700; padding: 2px 7px;
  background: white; border-radius: 99px;
  color: var(--text-3); border: 1px solid var(--border);
}
.kanban-cards {
  flex: 1; padding: 10px; display: flex; flex-direction: column; gap: 8px;
  min-height: 80px;
  transition: background .15s;
}
.kanban-cards.drag-over { background: var(--primary-bg); }
.kanban-card {
  background: white; border-radius: var(--radius);
  padding: 12px; border: 1px solid var(--border);
  cursor: grab; box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--primary); }
.kanban-card.dragging { opacity: .5; cursor: grabbing; }
.kanban-card-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.kanban-card-vacancy { font-size: 11px; color: var(--text-3); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kanban-card-footer { display: flex; align-items: center; justify-content: space-between; }

/* ======= CANDIDATE PROFILE ======= */
.profile-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-md); padding: 28px; color: white; margin-bottom: 20px;
  display: flex; gap: 20px; align-items: flex-start;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(255,255,255,.2); border: 3px solid rgba(255,255,255,.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: white; flex-shrink: 0;
}
.profile-info h2 { font-size: 22px; font-weight: 800; }
.profile-info p { font-size: 13px; opacity: .8; margin-top: 4px; }
.profile-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.profile-badge {
  padding: 4px 12px; background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2); border-radius: 99px;
  font-size: 12px; font-weight: 500;
  backdrop-filter: blur(4px);
}

.stage-timeline { display: flex; flex-direction: column; gap: 0; }
.stage-step {
  display: flex; gap: 12px; align-items: flex-start;
  padding-bottom: 16px; position: relative;
}
.stage-step:not(:last-child)::before {
  content: ''; position: absolute; left: 15px; top: 32px; bottom: 0;
  width: 2px; background: var(--border);
}
.stage-step-dot {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; z-index: 1;
}
.stage-step-dot.done { background: var(--success); color: white; }
.stage-step-dot.current { background: var(--primary); color: white; }
.stage-step-dot.pending { background: var(--surface-2); color: var(--text-3); border: 2px solid var(--border); }
.stage-step-content { flex: 1; padding-top: 4px; }
.stage-step-title { font-size: 13px; font-weight: 600; color: var(--text); }
.stage-step-date { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ======= ALERTS MODULE ======= */
.alerts-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: white;
  transition: var(--transition);
}
.alert-item:hover { box-shadow: var(--shadow-sm); }
.alert-item.unread { border-left: 4px solid var(--primary); background: var(--primary-bg); }
.alert-item.unread.danger { border-left-color: var(--danger); background: #fff8f8; }
.alert-item.unread.warning { border-left-color: var(--warning); background: #fffbf0; }
.alert-item.unread.success { border-left-color: var(--success); background: #f0fff8; }
.alert-icon { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.alert-content { flex: 1; }
.alert-title { font-size: 13px; font-weight: 600; color: var(--text); }
.alert-msg { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.alert-time { font-size: 11px; color: var(--text-3); flex-shrink: 0; }

/* ======= IA HUB ======= */
.ai-hub-header {
  background: linear-gradient(135deg, #1e1b4b, #4f46e5, #7c3aed);
  border-radius: var(--radius-md); padding: 32px; color: white;
  margin-bottom: 24px; position: relative; overflow: hidden;
}
.ai-hub-header::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.ai-feature-card {
  background: white; border-radius: var(--radius-md); padding: 20px;
  border: 1px solid var(--border); transition: var(--transition);
  cursor: pointer;
}
.ai-feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--primary); }
.ai-feature-icon {
  width: 52px; height: 52px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: white; margin-bottom: 14px;
}
.ai-coming-soon {
  display: inline-block; padding: 2px 10px;
  background: var(--warning-bg); color: var(--warning);
  border-radius: 99px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ======= EMPTY STATE ======= */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-3);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-state p { font-size: 13px; margin-bottom: 20px; }

/* ======= PROGRESS BAR ======= */
.progress-bar-container { background: var(--surface-2); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; transition: width .5s ease; }
.progress-bar.success { background: var(--success); }
.progress-bar.primary { background: var(--primary); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* ======= TABS ======= */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  color: var(--text-3); border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer; transition: var(--transition); border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--primary); background: var(--primary-bg); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

/* ======= REPORTS ======= */
.reports-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.reports-grid .full-width { grid-column: 1 / -1; }

/* ======= AVATAR GROUP ======= */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: white; flex-shrink: 0; }
.avatar-blue { background: linear-gradient(135deg, #818cf8, var(--primary)); }
.avatar-green { background: linear-gradient(135deg, #34d399, var(--success)); }
.avatar-orange { background: linear-gradient(135deg, #fbbf24, var(--orange)); }
.avatar-purple { background: linear-gradient(135deg, #a78bfa, var(--purple)); }
.avatar-pink { background: linear-gradient(135deg, #f472b6, var(--pink)); }

/* ======= RESPONSIVE ======= */
@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid .col-span-3 { grid-column: span 2; }
  .reports-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid .col-span-2, .dashboard-grid .col-span-3 { grid-column: span 1; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .main-wrapper.expanded { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .topbar-user span { display: none; }
  .modal-overlay { padding: 12px; }
  .modal-body { padding: 16px; max-height: 65vh; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .filter-input, .filter-select { width: 100%; }
  .demo-accounts { flex-direction: column; }
}

/* ======= SIDEBAR OVERLAY FOR MOBILE ======= */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ======= SETUP SCREEN ======= */
#setup-screen {
  position: fixed; inset: 0; z-index: 9999;
  overflow-y: auto;
}
#setup-screen .login-screen {
  min-height: 100vh;
  align-items: flex-start;
  padding-top: 40px;
}
#setup-screen .login-container {
  max-width: 620px;
  padding-bottom: 40px;
}
#setup-screen .form-grid {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 600px) {
  #setup-screen .form-grid { grid-template-columns: 1fr; }
}

/* ======= RICH TEXT EDITOR (QUILL) - PLANTILLAS ======= */
.quill-wrapper {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.quill-wrapper .ql-toolbar {
  background: var(--surface-2);
  border: none;
  border-bottom: 1.5px solid var(--border);
  padding: 8px 10px;
  flex-wrap: wrap;
  gap: 4px;
}
.quill-wrapper .ql-toolbar .ql-formats {
  margin-right: 8px;
}
.quill-wrapper .ql-container {
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  min-height: 260px;
}
.quill-wrapper .ql-editor {
  min-height: 260px;
  line-height: 1.7;
  color: var(--text-1);
  padding: 14px 16px;
}
.quill-wrapper .ql-editor.ql-blank::before {
  color: var(--text-3);
  font-style: italic;
  left: 16px;
}
.ql-snow .ql-picker { color: var(--text-1); }
.ql-snow .ql-stroke { stroke: var(--text-2); }
.ql-snow .ql-fill  { fill: var(--text-2); }
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow .ql-toolbar button:hover .ql-stroke { stroke: var(--primary); }
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow .ql-toolbar button:hover .ql-fill   { fill: var(--primary); }
.ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--primary); }
.ql-snow.ql-toolbar button.ql-active .ql-fill   { fill: var(--primary); }

/* Chips de variables en editor */
.tpl-vars-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px;
  background: var(--primary-bg);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius);
}
.tpl-var-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  background: white;
  border: 1.5px solid var(--primary);
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.tpl-var-chip:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(99,102,241,.3);
}
.tpl-var-chip i { font-size: 9px; }

/* ======= EMAIL PREVIEW WRAPPER ======= */
.email-preview-shell {
  background: #f3f4f6;
  border-radius: var(--radius);
  padding: 20px;
  border: 1.5px solid var(--border);
}
.email-preview-shell .email-header-bar {
  background: white;
  border-radius: 8px 8px 0 0;
  padding: 14px 20px;
  border: 1px solid #e5e7eb;
  border-bottom: none;
}
.email-preview-shell .email-header-bar .email-subject {
  font-weight: 700; font-size: 14px; color: #111827;
  margin-bottom: 4px;
}
.email-preview-shell .email-header-bar .email-meta {
  font-size: 11px; color: #6b7280;
}
.email-preview-shell .email-body-frame {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0 0 8px 8px;
  min-height: 200px;
  overflow: hidden;
}
.email-preview-shell .email-body-frame iframe {
  width: 100%; border: none;
  min-height: 320px; display: block;
}

/* Card de plantilla - mini preview */
.tpl-card-preview {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.5;
  max-height: 60px;
  overflow: hidden;
  position: relative;
  margin-top: 8px;
}
.tpl-card-preview::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 24px;
  background: linear-gradient(transparent, var(--surface));
}

/* Tab de modo editor */
.editor-mode-tabs {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
}
.editor-mode-tab {
  flex: 1; padding: 8px 14px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2);
  border: none; cursor: pointer; transition: all .15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.editor-mode-tab.active {
  background: var(--primary); color: white;
}
.editor-mode-tab:not(.active):hover {
  background: var(--primary-bg); color: var(--primary);
}

/* ======= CODE EDITOR (CodeMirror) ======= */
.code-editor-wrapper {
  border: 1.5px solid #2d2d3a;
  border-radius: var(--radius);
  overflow: hidden;
  background: #282a36;
}
.code-editor-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  background: #1e1f29;
  border-bottom: 1px solid #3d3f52;
}
.code-editor-topbar .dots { display: flex; gap: 6px; }
.code-editor-topbar .dot {
  width: 12px; height: 12px; border-radius: 50%;
}
.dot-red   { background: #ff5f57; }
.dot-yellow{ background: #febc2e; }
.dot-green { background: #28c840; }
.code-editor-topbar .code-lang-badge {
  font-size: 11px; font-weight: 700;
  color: #bd93f9; letter-spacing: .5px;
  font-family: 'Fira Code', 'Consolas', monospace;
}
.code-editor-topbar .code-actions { display: flex; gap: 6px; }
.code-editor-topbar .code-action-btn {
  padding: 3px 10px; font-size: 11px; font-weight: 600;
  background: #44475a; color: #f8f8f2;
  border: none; border-radius: 4px; cursor: pointer;
  transition: background .15s;
}
.code-editor-topbar .code-action-btn:hover { background: #6272a4; }
.code-editor-topbar .code-action-btn.primary { background: #6366f1; color: white; }
.code-editor-topbar .code-action-btn.primary:hover { background: #4f46e5; }

/* CodeMirror overrides */
.CodeMirror {
  height: 360px !important;
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
}
.CodeMirror-scroll { padding-bottom: 8px; }

/* ======= SPLIT VIEW (código | preview) ======= */
.split-editor-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 400px;
}
.split-editor-view.full-code   { grid-template-columns: 1fr; }
.split-editor-view.full-preview{ grid-template-columns: 1fr; }

.split-panel-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-3); margin-bottom: 6px;
  display: flex; align-items: center; gap: 5px;
}

/* Preview iframe container */
.preview-iframe-container {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #f3f4f6;
  min-height: 400px;
  display: flex; flex-direction: column;
}
.preview-iframe-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
  background: #e5e7eb;
  border-bottom: 1px solid #d1d5db;
  font-size: 11px; color: #6b7280;
}
.preview-iframe-toolbar .url-bar {
  flex: 1; margin: 0 10px;
  background: white; border-radius: 20px;
  padding: 3px 12px; font-size: 11px; color: #374151;
  border: 1px solid #d1d5db;
}
.preview-iframe-toolbar .browser-dots { display: flex; gap: 5px; }
.preview-iframe-toolbar .browser-dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.preview-iframe-container iframe {
  flex: 1; width: 100%; border: none;
  min-height: 360px;
}

/* Toolbar de acciones rápidas sobre el código */
.quick-insert-bar {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 8px 10px;
  background: #1e1f29;
  border-top: 1px solid #3d3f52;
}
.quick-insert-btn {
  padding: 3px 9px; font-size: 11px; font-weight: 600;
  background: #44475a; color: #f8f8f2;
  border: none; border-radius: 4px; cursor: pointer;
  transition: all .15s; font-family: monospace;
}
.quick-insert-btn:hover { background: #bd93f9; color: #1e1f29; }
.quick-insert-btn.var-chip { background: #3d3f52; color: #50fa7b; border: 1px solid #50fa7b33; }
.quick-insert-btn.var-chip:hover { background: #50fa7b; color: #1e1f29; }
.quick-insert-btn.snippet { background: #3d3f52; color: #ffb86c; border: 1px solid #ffb86c33; }
.quick-insert-btn.snippet:hover { background: #ffb86c; color: #1e1f29; }

/* Upload imagen en plantilla */
.bg-image-section {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface-2);
}
.bg-image-preview {
  width: 100%; height: 80px;
  object-fit: cover; border-radius: 6px;
  margin-top: 8px; display: none;
}
.bg-image-preview.visible { display: block; }

/* Modo tabs del formulario */
.tpl-form-tabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tpl-form-tab {
  padding: 10px 20px; font-size: 13px; font-weight: 600;
  background: none; border: none; color: var(--text-3);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .15s;
  display: flex; align-items: center; gap: 7px;
}
.tpl-form-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tpl-form-tab:hover:not(.active) { color: var(--text-1); }
