/* === Emotional Healing CRM - Premium Theme === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #5b21b6;
  --primary-light: #dbeafe;
  --primary-50: #eff6ff;
  --accent: #f59e0b;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --gray-50: #fafafa;
  --gray-100: #f4f4f5;
  --gray-200: #e4e4e7;
  --gray-300: #d4d4d8;
  --gray-400: #a1a1aa;
  --gray-500: #71717a;
  --gray-600: #52525b;
  --gray-700: #3f3f46;
  --gray-800: #27272a;
  --gray-900: #18181b;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.1);
  --sidebar-w: 240px;
  --topbar-h: 60px;
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Roboto, Helvetica, Arial, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

/* === Login Page === */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 50%, rgba(255,255,255,.1) 0%, transparent 50%),
              radial-gradient(circle at 80% 50%, rgba(255,255,255,.08) 0%, transparent 50%);
}
.login-card {
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  position: relative;
  animation: fadeUp .5s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.login-card h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: .25rem;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-card p { color: var(--gray-500); font-size: .875rem; margin-bottom: 2rem; }

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--gray-900) 0%, #09090b 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}
.sidebar-header {
  padding: 1.25rem 1.25rem .75rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-header .brand {
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sidebar-header .brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.sidebar-header small {
  display: block;
  font-weight: 400;
  font-size: .7rem;
  opacity: .4;
  margin-top: 2px;
  padding-left: 36px;
}

/* Sidebar Nav */
.sidebar-nav { flex: 1; padding: .5rem 0; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 10px; }
.sidebar-nav .nav-section { padding: .75rem 1.25rem .25rem; font-size: .65rem; text-transform: uppercase; letter-spacing: .05em; opacity: .35; font-weight: 600; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem 1.25rem;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  font-size: .875rem;
  transition: all .15s;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active {
  background: rgba(37,99,235,.15);
  color: #93c5fd;
  border-left-color: var(--primary);
}
.sidebar-nav a .nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }
.sidebar-nav a .badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Sidebar Footer - User info + Logout */
.sidebar-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .625rem;
  margin-bottom: .5rem;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info .name { font-size: .8125rem; font-weight: 600; color: rgba(255,255,255,.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .role-badge {
  display: inline-block;
  font-size: .6rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  margin-top: 2px;
}
.role-badge.admin { background: rgba(37,99,235,.3); color: #93c5fd; }
.role-badge.sales { background: rgba(5,150,105,.3); color: #6ee7b7; }
.role-badge.lead { background: rgba(245,158,11,.3); color: #fde68a; }
.role-badge.partner { background: rgba(37,99,235,.3); color: #93c5fd; }
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: .375rem;
  width: 100%;
  padding: .5rem .75rem;
  background: rgba(255,255,255,.05);
  border: none;
  border-radius: 6px;
  color: rgba(255,255,255,.5);
  font-size: .75rem;
  cursor: pointer;
  transition: all .15s;
}
.sidebar-logout:hover { background: rgba(239,68,68,.15); color: #fca5a5; }

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Bar */
.topbar {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  padding: 0 1.5rem;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar h2 { font-size: 1rem; font-weight: 600; color: var(--gray-700); }
.topbar .user-info {
  font-size: .8125rem;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.topbar .user-info .role-tag {
  font-size: .65rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

/* Page Content */
.page-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

/* === Mobile Header === */
.mobile-header { display: none; background: var(--gray-900); color: #fff; padding: .75rem 1rem; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.mobile-header .menu-btn { background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; padding: .25rem; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.mobile-header .menu-btn:hover { background: rgba(255,255,255,.1); }
.mobile-header h1 { font-size: .9375rem; font-weight: 600; }

/* === Cards & Stats Grid === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card .stat-icon { font-size: 1.5rem; margin-bottom: .5rem; }
.stat-card .label { font-size: .75rem; color: var(--gray-500); margin-bottom: .25rem; font-weight: 500; }
.stat-card .value { font-size: 1.625rem; font-weight: 800; color: var(--gray-900); letter-spacing: -.02em; }
.stat-card .sub { font-size: .75rem; color: var(--gray-400); margin-top: 2px; }
.stat-card .stat-trend { position: absolute; right: 1rem; top: 1rem; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; }

/* === Tables === */
.table-wrap {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.table-wrap th, .table-wrap td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--gray-100); }
.table-wrap th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-600);
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tbody tr { transition: background .1s; }
.table-wrap tbody tr:hover { background: var(--primary-50); }
.table-wrap tbody tr:active { background: var(--primary-light); }

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .6875rem;
  font-weight: 600;
}
.status-pending { background: var(--warning-light); color: #92400e; }
.status-following { background: #dbeafe; color: #1e40af; }
.status-converted { background: var(--success-light); color: #065f46; }
.status-lost { background: var(--danger-light); color: #991b1b; }

/* === Forms === */
.form-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  max-width: 640px;
  animation: fadeUp .3s ease;
}
.form-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--gray-800); }
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: .375rem;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: .875rem;
  font-family: inherit;
  transition: all .15s;
  background: #fff;
  color: var(--gray-800);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-group input:hover, .form-group select:hover, .form-group textarea:hover { border-color: var(--gray-300); }
.form-group textarea { min-height: 80px; resize: vertical; }
.form-group .help-text { font-size: .6875rem; color: var(--gray-400); margin-top: .25rem; }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .8125rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .15s;
  text-decoration: none;
  line-height: 1.4;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 3px rgba(37,99,235,.2); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.btn-secondary { background: #fff; border-color: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: .375rem .75rem; font-size: .75rem; }
.btn-lg { padding: .75rem 1.25rem; font-size: .9375rem; width: 100%; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--gray-500); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-700); }

/* === Detail Cards === */
.detail-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.25rem; }
.detail-field .label {
  font-size: .6875rem;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}
.detail-field .value { font-size: .875rem; font-weight: 500; margin-top: 3px; color: var(--gray-800); }

/* === Timeline === */
.timeline { position: relative; padding-left: 1.5rem; margin: 1rem 0; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--gray-200); }
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ''; position: absolute; left: -1.375rem; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 3px solid var(--primary-light); }
.timeline-item .time { font-size: .6875rem; color: var(--gray-400); }
.timeline-item .desc { font-size: .8125rem; margin-top: 2px; color: var(--gray-700); }

/* === Modal === */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex;
  align-items: center; justify-content: center; z-index: 1000; padding: 1rem;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: var(--radius-lg); padding: 1.5rem;
  width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal h3 { font-size: 1.125rem; font-weight: 700; margin-bottom: 1rem; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--gray-100); }

/* === Toast === */
.toast {
  position: fixed; top: 1rem; right: 1rem; z-index: 2000;
  padding: .75rem 1rem; border-radius: 10px; font-size: .8125rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.info { background: var(--primary); color: #fff; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === Charts === */
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: .5rem 0; }
.bar-chart .bar { flex: 1; border-radius: 6px 6px 0 0; min-height: 4px; transition: height .5s cubic-bezier(.4,0,.2,1); position: relative; }
.bar-chart .bar .bar-label { position: absolute; bottom: -1.5rem; left: 50%; transform: translateX(-50%); font-size: .6rem; color: var(--gray-400); white-space: nowrap; font-weight: 500; }

/* === Loading === */
.loading { text-align: center; padding: 4rem; color: var(--gray-400); }
.spinner { display: inline-block; width: 28px; height: 28px; border: 3px solid var(--gray-200); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === Empty State === */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--gray-400); }
.empty-state .icon { font-size: 3rem; margin-bottom: .75rem; opacity: .5; }
.empty-state p { font-size: .875rem; }

/* === Section Cards === */
.section-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.section-card h3, .section-card h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* === Rankings Specific === */
.rank-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.rank-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  transition: background .15s;
}
.rank-item:last-child { border-bottom: none; }
.rank-item:hover { background: var(--gray-50); }
.rank-item .rank-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .75rem;
  flex-shrink: 0;
}
.rank-item:nth-child(1) .rank-num { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; }
.rank-item:nth-child(2) .rank-num { background: linear-gradient(135deg, #9ca3af, #6b7280); color: #fff; }
.rank-item:nth-child(3) .rank-num { background: linear-gradient(135deg, #cd7f32, #a16207); color: #fff; }
.rank-item .rank-num.other { background: var(--gray-100); color: var(--gray-500); }
.rank-item .rank-name { font-weight: 600; font-size: .875rem; flex: 1; }
.rank-item .rank-count { font-size: .8125rem; font-weight: 700; color: var(--primary); }

/* === Toolbar === */
.toolbar {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.toolbar .search-input { flex: 1; min-width: 200px; position: relative; }
.toolbar .search-input input {
  width: 100%;
  padding: .5rem .75rem;
  padding-left: 2.25rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: .8125rem;
  transition: all .15s;
  background: #fff;
}
.toolbar .search-input input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.toolbar .search-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); font-size: .8125rem; opacity: .4; pointer-events: none; }

/* === Progress Bars === */
.progress-bar {
  background: var(--gray-100);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  margin: 4px 0;
}
.progress-bar .fill {
  height: 100%;
  border-radius: 20px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* === Filter/Sort Buttons === */
.filter-group { display: flex; gap: .375rem; flex-wrap: wrap; }
.filter-btn {
  padding: .375rem .75rem;
  border-radius: 20px;
  border: 1.5px solid var(--gray-200);
  background: #fff;
  cursor: pointer;
  font-size: .75rem;
  font-weight: 500;
  color: var(--gray-500);
  transition: all .15s;
}
.filter-btn:hover { border-color: var(--gray-300); color: var(--gray-700); }
.filter-btn.active { background: var(--primary-50); border-color: var(--primary); color: var(--primary); }

/* === Responsive === */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; inset: 0; z-index: 200; width: 100%; }
  .mobile-header { display: flex; }
  .main-content { margin-left: 0; }
  .page-content { padding: .75rem; }
  .topbar { padding: 0 .75rem; height: auto; min-height: 48px; flex-wrap: wrap; gap: .25rem; }
  .topbar h2 { font-size: .875rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .stat-card { padding: .75rem; }
  .stat-card .value { font-size: 1.25rem; }
  .form-card { padding: 1rem; }
  .modal { max-width: 100%; margin: .5rem; }
}

/* === Mobile Bottom Nav === */
.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--gray-200); z-index: 100; box-shadow: 0 -2px 10px rgba(0,0,0,.05); }
.mobile-nav a { flex: 1; text-align: center; padding: .5rem .25rem; font-size: .625rem; color: var(--gray-500); text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mobile-nav a.active { color: var(--primary); }
.mobile-nav a .nav-icon { font-size: 1.25rem; }
@media (max-width: 768px) {
  .mobile-nav { display: flex; }
  .page-content { padding-bottom: 70px; }
}

/* === Utils === */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-sm { font-size: .8125rem; }
.text-xs { font-size: .6875rem; }
.text-muted { color: var(--gray-400); }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-btn { cursor: pointer; padding: 2px 6px; border-radius: 4px; font-size: .6875rem; background: var(--gray-100); border: none; color: var(--gray-500); }
.copy-btn:hover { background: var(--gray-200); }

/* === Input Focus Styles === */
input:focus, select:focus, textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1) !important;
}

/* === Checkbox accent === */
input[type="checkbox"] { accent-color: var(--primary); }

/* === Modal form elements === */
#weightInputs input[type="number"]:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1) !important;
}

/* === Rule cards === */
.rule-card { transition: box-shadow .2s; }
.rule-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }

/* === Assignment Rules Page === */
.rules-page { max-width: 960px; margin: 0 auto; }
.rules-header { text-align: center; margin-bottom: 28px; }
.rules-header h2 { font-size: 22px; font-weight: 700; color: #111827; margin: 0 0 6px; }
.rules-header p { font-size: 14px; color: #6b7280; margin: 0; line-height: 1.6; }
.rules-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }

.rule-card {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  border: 1px solid #e5e7eb;
  transition: all .2s;
}
.rule-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.06); border-color: #d1d5db; }
.rule-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.rule-card-name { font-size: 16px; font-weight: 700; color: #111827; }
.rule-card-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
}
.rule-card-badge.on { background: #d1fae5; color: #065f46; }
.rule-card-badge.off { background: #fee2e2; color: #991b1b; }

.rule-tag {
  display: inline-block; font-size: 12px; font-weight: 500;
  padding: 3px 10px; border-radius: 6px; margin-bottom: 16px;
  background: #dbeafe; color: #1d4ed8;
}

.rule-sales-section {
  background: #f9fafb; border-radius: 10px; padding: 12px 16px;
}
.rule-sales-title { font-size: 11px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }

/* Modal improvements */
.modal-wide { max-width: 520px !important; padding: 32px !important; }
.modal-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.modal-subtitle { font-size: 13px; color: #6b7280; margin: 0 0 28px; }

.form-control {
  width: 100%; padding: 10px 12px; border: 1.5px solid #d1d5db;
  border-radius: 8px; font-size: 14px; color: #111827;
  background: #fff; outline: none; transition: all .15s;
  font-family: inherit;
}
.form-control:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }

.sales-checklist { border: 1.5px solid #e5e7eb; border-radius: 10px; padding: 6px; max-height: 240px; overflow-y: auto; background: #fafafa; }
.sales-checklist label {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; cursor: pointer; transition: background .1s;
  font-size: 14px;
}
.sales-checklist label:hover { background: #f3f4f6; }
.sales-checklist input[type="checkbox"] { width: 16px; height: 16px; accent-color: #2563eb; }

.weight-section { display: none; margin-bottom: 20px; background: #eff6ff; border-radius: 10px; padding: 20px; }
.weight-section.show { display: block; }
.weight-section-title { font-size: 13px; font-weight: 600; color: #1d4ed8; margin-bottom: 12px; }

.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding-top: 20px; border-top: 1px solid #e5e7eb; }

.empty-rules { grid-column: 1 / -1; text-align: center; padding: 64px 20px; color: #9ca3af; }
.empty-rules .icon { font-size: 48px; margin-bottom: 12px; }
.empty-rules h3 { font-size: 16px; font-weight: 600; color: #6b7280; margin: 0 0 4px; }
.empty-rules p { font-size: 13px; margin: 0; }
