/* =============================================
   TRACKINGTAP — $1000 PREMIUM DASHBOARD
   ============================================= */

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

:root {
  --bg: #060608;
  --bg-raised: #0c0c10;
  --bg-card: rgba(255,255,255,0.025);
  --bg-card-hover: rgba(255,255,255,0.05);
  --bg-glass: rgba(255,255,255,0.03);
  --border: rgba(255,255,255,0.05);
  --border-hover: rgba(62,207,180,0.25);
  --text: #e4e4e7;
  --text-dim: rgba(228,228,231,0.45);
  --text-muted: rgba(228,228,231,0.25);
  --accent: #3ecfb4;
  --accent-dim: rgba(62,207,180,0.12);
  --accent-glow: rgba(62,207,180,0.08);
  --blue: #2d6da3;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --font: 'Outfit', -apple-system, sans-serif;
  --font-display: 'Sora', 'Outfit', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --radius: 14px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

/* === AMBIENT GLOW === */
body::before {
  content: '';
  position: fixed;
  width: 800px; height: 800px;
  top: -200px; right: -200px;
  background: radial-gradient(circle, rgba(62,207,180,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}
body::after {
  content: '';
  position: fixed;
  width: 600px; height: 600px;
  bottom: -100px; left: -100px;
  background: radial-gradient(circle, rgba(45,109,163,0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

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

/* === SIDEBAR === */
.sidebar {
  width: 280px;
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

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

.sidebar-logo {
  max-height: 92px;
  max-width: 220px;
  width: auto;
  height: auto;
  flex-shrink: 0;
}

.sidebar-brand { display: flex; flex-direction: column; }
.brand-name { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.03em; }
.brand-tagline { font-size: 11px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }

.sidebar-nav { padding: 12px 0; flex: 1; }

.sidebar-section {
  padding: 18px 18px 6px;
  font-size: 9.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1.8px;
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: all 0.2s var(--ease);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s var(--ease);
  margin: 1px 8px;
  border-radius: 8px;
  position: relative;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.03);
  color: var(--text);
}
.sidebar-nav a:hover .nav-icon { opacity: 0.8; }

.sidebar-nav a.active {
  background: var(--accent-dim);
  color: var(--accent);
}
.sidebar-nav a.active .nav-icon { opacity: 1; color: var(--accent); }

.sidebar-nav .nav-item {
  border: 1px solid transparent;
}

.sidebar-nav .nav-item:hover {
  border-color: rgba(255,255,255,0.06);
}

.sidebar-nav .nav-item.active {
  border-color: rgba(62,207,180,0.26);
  box-shadow: inset 0 0 0 1px rgba(62,207,180,0.1);
}

.sidebar-nav .nav-item.locked-item {
  opacity: 0.62;
}

.sidebar-nav .nav-item.locked-item:hover {
  opacity: 0.86;
}

.nav-lock {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.92;
}

.sidebar-footer {
  margin: 14px 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  padding: 9px 12px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.upgrade-banner {
  border: 1px solid rgba(62,207,180,0.32);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(7, 20, 25, 0.92), rgba(8, 12, 20, 0.9));
  box-shadow: 0 18px 36px rgba(0,0,0,0.24);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.upgrade-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(62,207,180,0.35);
  background: rgba(62,207,180,0.14);
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}

.upgrade-banner-copy {
  flex: 1;
}

.upgrade-banner-copy h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.upgrade-banner-copy p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.feature-disabled {
  opacity: 0.55;
  pointer-events: none;
  filter: grayscale(0.3);
}

.feature-tip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.usage-progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  overflow: hidden;
}

.usage-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3ecfb4, #2d6da3);
}

/* === MAIN === */
.main-content {
  margin-left: 280px;
  flex: 1;
  padding: 28px 36px;
  min-height: 100vh;
}

/* === ANIMATIONS === */
@keyframes enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes glow { 0%,100% { box-shadow: 0 0 0 0 rgba(62,207,180,0.2); } 50% { box-shadow: 0 0 12px 2px rgba(62,207,180,0.1); } }

.top-header { animation: enter 0.4s var(--ease) both; }
.metrics-grid { animation: enter 0.4s var(--ease) 0.06s both; }
.card { animation: enter 0.4s var(--ease) 0.12s both; }

/* === TOP HEADER === */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.top-header h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
}

.top-header .date {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
  font-weight: 400;
}

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

.notification-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.notification-btn:hover { border-color: var(--border-hover); color: var(--accent); }

.avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: flex; align-items: center; justify-content: center;
  color: var(--bg);
  font-weight: 700;
  font-size: 13px;
}

/* === METRICS === */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: all 0.3s var(--ease);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(62,207,180,0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.metric-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.08);
  transform: translateY(-2px);
}
.metric-card:hover::before { opacity: 1; }

.metric-card.featured {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(62,207,180,0.06) 0%, rgba(45,109,163,0.04) 100%);
  border-color: rgba(62,207,180,0.1);
}

.metric-card.highlight-today { border-color: rgba(62,207,180,0.15); }

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

.metric-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
}

.metric-badge.up {
  display: flex; align-items: center; gap: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(34,197,94,0.1);
  color: #4ade80;
}

.metric-badge-live {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  color: var(--accent);
}

.metric-value {
  font-family: var(--font);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.metric-card.featured .metric-value { font-size: 32px; }

.metric-label {
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 500;
}

.metric-sparkline {
  margin-top: 12px;
  height: 30px;
}
.metric-sparkline svg { width: 100%; height: 100%; }

/* === CARDS === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}

.card:hover { border-color: rgba(255,255,255,0.07); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card-body { padding: 20px 22px; }

/* === LIVE BADGE === */
.live-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  color: var(--accent);
}

.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

/* === TABLE === */
table { width: 100%; border-collapse: collapse; }

table th {
  text-align: left;
  padding: 8px 14px;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

table td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
  color: var(--text-dim);
}

table td strong { color: var(--text); font-weight: 600; }
table tr { transition: background 0.15s; }
table tr:hover { background: rgba(255,255,255,0.015); }
table tr:last-child td { border-bottom: none; }

.points-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  background: rgba(62,207,180,0.1);
  color: var(--accent);
}

/* === BADGES === */
.badge {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge-active { background: rgba(34,197,94,0.1); color: #4ade80; }
.badge-inactive { background: rgba(239,68,68,0.1); color: #f87171; }
.badge-bronze { background: rgba(180,140,100,0.08); color: #c9a66b; }
.badge-silver { background: rgba(148,163,184,0.08); color: #94a3b8; }
.badge-gold { background: rgba(234,179,8,0.08); color: #facc15; }

/* === BUTTONS === */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 24px rgba(62,207,180,0.15);
}
.btn-primary:hover { box-shadow: 0 0 32px rgba(62,207,180,0.25); transform: translateY(-1px); }

.btn-success {
  background: linear-gradient(135deg, #059669, #22c55e);
  color: white;
}
.btn-success:hover { transform: translateY(-1px); }

.btn-danger {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.15);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-sm { padding: 5px 12px; font-size: 11.5px; }

/* === FORMS === */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.form-group .form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  background: rgba(255,255,255,0.02);
  color: var(--text);
  transition: all 0.2s var(--ease);
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(255,255,255,0.04);
}

input[type="date"] {
  background: var(--bg2, #0a0d14);
  color: var(--text, #eef0f4);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font, 'DM Sans', sans-serif);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
  color-scheme: dark;
}

input[type="date"]:focus {
  border-color: var(--accent, #3ecfb4);
  box-shadow: 0 0 0 3px rgba(62, 207, 180, 0.1);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

select.form-control option { background: var(--bg-raised); color: var(--text); }
textarea.form-control { min-height: 90px; resize: vertical; }

/* === SEARCH === */
.search-bar { display: flex; gap: 10px; margin-bottom: 18px; }

.search-bar input {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  background: rgba(255,255,255,0.02);
  color: var(--text);
  transition: all 0.2s;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* === COLOR PICKER === */
.color-options { display: flex; gap: 8px; flex-wrap: wrap; }

.color-option {
  width: 34px; height: 34px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s var(--ease);
}
.color-option:hover { transform: scale(1.15); }
.color-option.selected { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }

/* === CARD PREVIEW === */
.card-preview {
  width: 340px;
  min-height: 220px;
  border-radius: 20px;
  padding: 26px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  transition: all 0.3s var(--ease);
}
.card-preview:hover { transform: scale(1.02) translateY(-4px); }

.card-preview .pattern-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; opacity: 0.12; pointer-events: none; }

.card-preview .program-name { font-size: 19px; font-weight: 800; margin-bottom: 2px; letter-spacing: -0.03em; position: relative; z-index: 1; }
.card-preview .issuer-name { font-size: 12px; opacity: 0.55; margin-bottom: 14px; position: relative; z-index: 1; font-weight: 400; }

.card-preview .logo-preview {
  position: absolute; top: 20px; right: 20px;
  width: 42px; height: 42px;
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; z-index: 1;
}
.card-preview .logo-preview img { max-width: 100%; max-height: 100%; }

/* === STAMPS === */
.stamps-container { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; position: relative; z-index: 1; }

.stamp {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  transition: all 0.2s var(--ease);
}
.stamp.filled { background: rgba(255,255,255,0.85); color: #111; box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.stamp.empty { opacity: 0.3; }

/* === PATTERNS === */
.pattern-waves { background-image: url("data:image/svg+xml,%3Csvg width='100' height='20' viewBox='0 0 100 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21.184 20c.357-.13.72-.264 1.088-.402l1.768-.661C33.64 15.347 39.647 14 50 14c10.271 0 15.362 1.222 24.629 4.928.955.383 1.869.74 2.75 1.072h6.225c-2.51-.73-5.139-1.691-8.233-2.928C65.888 13.278 60.562 12 50 12c-10.626 0-16.855 1.397-26.66 5.063l-1.767.662c-2.475.923-4.66 1.674-6.724 2.275h6.335zm0-20C13.258 2.892 8.077 4 0 4V2c5.744 0 9.951-.574 14.85-2h6.334zM77.38 0C85.239 2.966 90.502 4 100 4V2c-6.842 0-11.386-.542-16.396-2h-6.225zM0 14c8.44 0 13.718-1.21 22.272-4.402l1.768-.661C33.64 5.347 39.647 4 50 4c10.271 0 15.362 1.222 24.629 4.928C84.112 12.722 89.438 14 100 14v-2c-10.271 0-15.362-1.222-24.629-4.928C65.888 3.278 60.562 2 50 2 39.374 2 33.145 3.397 23.34 7.063l-1.767.662C13.223 10.84 8.163 12 0 12v2z' fill='%23ffffff' fill-opacity='0.06' fill-rule='evenodd'/%3E%3C/svg%3E"); }
.pattern-stars { background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 5l2.5 7.5H30l-6 4.5 2.5 7.5-6-4.5-6 4.5 2.5-7.5-6-4.5h7.5z' fill='%23ffffff' fill-opacity='0.05'/%3E%3C/svg%3E"); }
.pattern-lines { background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.02) 10px, rgba(255,255,255,0.02) 20px); }
.pattern-hearts { background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 30l-8-8c-3-3-3-7 0-10s7-3 10 0c3-3 7-3 10 0s3 7 0 10z' fill='%23ffffff' fill-opacity='0.04' transform='scale(0.6) translate(13,10)'/%3E%3C/svg%3E"); }
.pattern-arrows { background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M15 5l10 15-10 15' fill='none' stroke='%23ffffff' stroke-opacity='0.04' stroke-width='2'/%3E%3C/svg%3E"); }

/* === CAMPAIGNS === */
.campaign-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s var(--ease);
}
.campaign-card:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.02); }
.campaign-info h4 { font-size: 13px; font-weight: 600; margin-bottom: 2px; color: var(--text); }
.campaign-info p { font-size: 11.5px; color: var(--text-muted); }
.campaign-stats { text-align: right; }
.campaign-stats .sent { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -0.03em; }
.campaign-stats .label { font-size: 10px; color: var(--text-muted); }

/* === ALERTS === */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: enter 0.3s var(--ease);
}
.alert-success { background: rgba(34,197,94,0.06); color: #4ade80; border: 1px solid rgba(34,197,94,0.1); }
.alert-error { background: rgba(239,68,68,0.06); color: #f87171; border: 1px solid rgba(239,68,68,0.1); }
.alert-info { background: rgba(62,207,180,0.06); color: var(--accent); border: 1px solid rgba(62,207,180,0.1); }

/* === GRID === */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* === RULES === */
.rule-visual {
  background: rgba(62,207,180,0.03);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  border: 1px dashed rgba(62,207,180,0.12);
  margin-bottom: 16px;
}
.rule-visual .rule-flow { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 13px; flex-wrap: wrap; }
.rule-visual .rule-step { background: rgba(255,255,255,0.04); padding: 8px 16px; border-radius: 8px; font-weight: 500; border: 1px solid var(--border); color: var(--text); }
.rule-visual .rule-step strong { color: var(--accent); }
.rule-visual .rule-arrow { color: var(--accent); font-size: 16px; }

/* === LOGIN === */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
}
.login-page::before {
  content: '';
  position: absolute;
  top: 25%; left: 50%;
  transform: translate(-50%, -50%);
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(62,207,180,0.06) 0%, transparent 60%);
  pointer-events: none;
}

.login-box {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 400px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.4);
  position: relative; z-index: 1;
  animation: enter 0.5s var(--ease);
}

.login-box .login-logo { display: block; margin: 0 auto 20px; height: 48px; }
.login-box h1 { text-align: center; font-size: 22px; font-weight: 800; letter-spacing: -0.04em; margin-bottom: 4px; }
.login-box .subtitle { text-align: center; color: var(--text-dim); margin-bottom: 28px; font-size: 13.5px; }
.login-box .btn-primary { width: 100%; padding: 11px; font-size: 14px; justify-content: center; border-radius: 10px; }

/* === EMPTY === */
.empty-state { text-align: center; padding: 44px 20px; }
.empty-icon { margin-bottom: 12px; }
.empty-state h3 { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.empty-state p { font-size: 12.5px; color: var(--text-muted); margin-bottom: 16px; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .sidebar { width: 60px; }
  .sidebar-header { padding: 16px 12px; }
  .sidebar-brand, .sidebar-section { display: none; }
  .sidebar-logo { max-height: 56px; max-width: 56px; }
  .sidebar-nav a span { display: none; }
  .sidebar-nav a { justify-content: center; padding: 10px; margin: 2px 4px; }
  .main-content { margin-left: 60px; padding: 20px; }
  .grid-2 { grid-template-columns: 1fr; }
  .metric-card.featured { grid-column: span 1; }
}
@media (max-width: 768px) { .metrics-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .metrics-grid { grid-template-columns: 1fr; } }

/* === DASHBOARD PRO UPGRADE === */
.dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 20px;
  background: linear-gradient(140deg, rgba(62,207,180,0.08) 0%, rgba(45,109,163,0.07) 45%, rgba(255,255,255,0.02) 100%);
  border: 1px solid rgba(62,207,180,0.16);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  overflow: hidden;
}

.dashboard-hero::before {
  content: '';
  position: absolute;
  top: -140px;
  right: -80px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(62,207,180,0.26), rgba(62,207,180,0));
  pointer-events: none;
}

.dashboard-hero-left,
.dashboard-hero-right {
  position: relative;
  z-index: 1;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  color: #baf8eb;
  background: rgba(0,0,0,0.24);
  border: 1px solid rgba(255,255,255,0.11);
  margin-bottom: 12px;
}

.dashboard-hero h2 {
  font-size: 31px;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.04em;
  margin-bottom: 10px;
  max-width: 650px;
}

.dashboard-hero p {
  color: rgba(228,228,231,0.78);
  max-width: 560px;
  font-size: 13.5px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-hero-right {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 18px;
  align-items: center;
}

.hero-health-ring {
  --health: 0;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(10,10,14,0.95) 58%, transparent 59%),
    conic-gradient(#3ecfb4 calc(var(--health) * 1%), rgba(255,255,255,0.12) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.16);
}

.hero-health-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.hero-health-inner span {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.hero-health-inner small {
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(228,228,231,0.6);
}

.hero-health-meta {
  display: grid;
  gap: 10px;
}

.hero-health-meta div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 8px 10px;
}

.hero-health-meta span {
  font-size: 11px;
  color: rgba(228,228,231,0.7);
}

.hero-health-meta strong {
  font-size: 14px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.kpi-grid-pro {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  grid-column: span 3;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 15px;
  transition: all 0.25s var(--ease);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(62,207,180,0.28);
  box-shadow: 0 14px 30px rgba(3,6,12,0.35);
}

.kpi-card.kpi-revenue {
  grid-column: span 6;
  background: linear-gradient(135deg, rgba(62,207,180,0.13), rgba(45,109,163,0.06));
  border-color: rgba(62,207,180,0.2);
}

.kpi-card.kpi-live {
  border-color: rgba(62,207,180,0.2);
}

.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(228,228,231,0.56);
  font-weight: 600;
}

.kpi-value {
  margin-top: 9px;
  font-size: 31px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
}

.kpi-card.kpi-revenue .kpi-value {
  font-size: 38px;
}

.kpi-foot {
  margin-top: 9px;
  font-size: 11.5px;
  color: rgba(228,228,231,0.58);
  display: flex;
  align-items: center;
  gap: 6px;
}

.insights-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
  margin-bottom: 20px;
}

.performance-card .card-body {
  display: grid;
  gap: 12px;
}

.performance-row {
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.015);
  border: 1px solid rgba(255,255,255,0.06);
}

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

.performance-meta span {
  font-size: 12px;
  color: rgba(228,228,231,0.66);
}

.performance-meta strong {
  font-size: 13px;
  color: var(--text);
}

.performance-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.performance-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3ecfb4, #2d6da3);
  transition: width 0.35s var(--ease);
}

.quick-feed-list {
  list-style: none;
  display: grid;
  gap: 9px;
}

.quick-feed-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 9px 10px;
}

.quick-feed-list strong {
  display: block;
  font-size: 12.5px;
  color: var(--text);
  margin-bottom: 2px;
}

.quick-feed-list span {
  font-size: 11px;
  color: rgba(228,228,231,0.62);
}

.quick-feed-list small {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #a8f2e2;
}

.compact-empty {
  padding: 30px 14px;
}

@media (max-width: 1220px) {
  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .dashboard-hero h2 {
    font-size: 27px;
  }

  .kpi-card {
    grid-column: span 4;
  }

  .kpi-card.kpi-revenue {
    grid-column: span 8;
  }

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

@media (max-width: 900px) {
  .kpi-card,
  .kpi-card.kpi-revenue {
    grid-column: span 6;
  }

  .dashboard-hero-right {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

@media (max-width: 640px) {
  .dashboard-hero {
    padding: 18px;
  }

  .dashboard-hero h2 {
    font-size: 22px;
  }

  .kpi-card,
  .kpi-card.kpi-revenue {
    grid-column: span 12;
  }

  .kpi-value {
    font-size: 26px;
  }

  .kpi-card.kpi-revenue .kpi-value {
    font-size: 30px;
  }
}

/* === DASHBOARD MOTION UPGRADE === */
@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes shimmerSweep {
  0% { transform: translateX(-150%); }
  100% { transform: translateX(150%); }
}

@keyframes feedAppear {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes barGrow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.reveal-up {
  opacity: 0;
  animation: revealUp 0.62s var(--ease) forwards;
}

.reveal-delay-1 { animation-delay: 0.02s; }
.reveal-delay-2 { animation-delay: 0.1s; }
.reveal-delay-3 { animation-delay: 0.18s; }
.reveal-delay-4 { animation-delay: 0.26s; }
.reveal-delay-5 { animation-delay: 0.34s; }

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

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.12), rgba(255,255,255,0));
  transform: translateX(-150%);
  pointer-events: none;
}

.kpi-card:hover::after {
  animation: shimmerSweep 0.9s var(--ease);
}

.kpi-card .kpi-value,
.hero-health-ring,
.quick-feed-list li,
.dashboard-activity-card table tr {
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), color 0.25s var(--ease);
}

.kpi-card:hover .kpi-value {
  transform: translateY(-1px);
  color: #f7fffe;
  text-shadow: 0 0 24px rgba(62,207,180,0.16);
}

.hero-health-ring {
  box-shadow: 0 10px 28px rgba(0,0,0,0.22), inset 0 0 0 1px rgba(255,255,255,0.02);
}

.hero-health-ring:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 16px 36px rgba(0,0,0,0.28), 0 0 0 1px rgba(62,207,180,0.22);
}

.performance-row:nth-child(1) .performance-bar span { animation: barGrow 0.75s var(--ease) 0.2s both; }
.performance-row:nth-child(2) .performance-bar span { animation: barGrow 0.75s var(--ease) 0.28s both; }
.performance-row:nth-child(3) .performance-bar span { animation: barGrow 0.75s var(--ease) 0.36s both; }
.performance-bar span { transform-origin: left center; }

.quick-feed-list li {
  opacity: 0;
  animation: feedAppear 0.45s var(--ease) forwards;
}

.quick-feed-list li:nth-child(1) { animation-delay: 0.06s; }
.quick-feed-list li:nth-child(2) { animation-delay: 0.12s; }
.quick-feed-list li:nth-child(3) { animation-delay: 0.18s; }
.quick-feed-list li:nth-child(4) { animation-delay: 0.24s; }
.quick-feed-list li:nth-child(5) { animation-delay: 0.3s; }

.quick-feed-list li:hover {
  transform: translateY(-2px);
  border-color: rgba(62,207,180,0.25);
}

.dashboard-activity-card table tbody tr {
  opacity: 0;
  animation: tableRise 0.4s var(--ease) forwards;
}

.dashboard-activity-card table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.dashboard-activity-card table tbody tr:nth-child(2) { animation-delay: 0.1s; }
.dashboard-activity-card table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.dashboard-activity-card table tbody tr:nth-child(4) { animation-delay: 0.2s; }
.dashboard-activity-card table tbody tr:nth-child(5) { animation-delay: 0.25s; }
.dashboard-activity-card table tbody tr:nth-child(6) { animation-delay: 0.3s; }
.dashboard-activity-card table tbody tr:nth-child(7) { animation-delay: 0.35s; }
.dashboard-activity-card table tbody tr:nth-child(8) { animation-delay: 0.4s; }

@media (prefers-reduced-motion: reduce) {
  .reveal-up,
  .quick-feed-list li,
  .dashboard-activity-card table tbody tr,
  .performance-bar span {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }

  .kpi-card:hover::after {
    animation: none !important;
  }
}

/* === THEME MODES === */
body {
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

body[data-theme='light'] {
  --bg: #f5f7fb;
  --bg-raised: #ffffff;
  --bg-card: rgba(255,255,255,0.86);
  --bg-card-hover: rgba(255,255,255,0.96);
  --bg-glass: rgba(16,24,40,0.03);
  --border: rgba(15,23,42,0.09);
  --border-hover: rgba(45,109,163,0.34);
  --text: #0f172a;
  --text-dim: rgba(15,23,42,0.72);
  --text-muted: rgba(15,23,42,0.48);
  --accent: #0d9488;
  --accent-dim: rgba(13,148,136,0.12);
  --accent-glow: rgba(13,148,136,0.18);
}

body[data-theme='light'] .auth-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,0.9));
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

body[data-theme='light'] .auth-logo-wrap {
  background: rgba(13, 148, 136, 0.08);
  border-color: rgba(13, 148, 136, 0.22);
}

body[data-theme='light'] table td {
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

body[data-theme='light'] table tr:hover {
  background: rgba(15, 23, 42, 0.04);
}

body[data-theme='light'] .quick-feed-list li,
body[data-theme='light'] .performance-row,
body[data-theme='light'] .theme-choice,
body[data-theme='light'] .settings-note,
body[data-theme='light'] .twofa-setup-box {
  background: rgba(255,255,255,0.82);
  border-color: rgba(15, 23, 42, 0.09);
}

body[data-theme='light'] .hero-health-meta div {
  background: rgba(255,255,255,0.8);
  border-color: rgba(15, 23, 42, 0.1);
}

body[data-theme='light'] .dashboard-hero {
  background: linear-gradient(145deg, rgba(13,148,136,0.11), rgba(45,109,163,0.08), rgba(255,255,255,0.88));
}

body[data-theme='light'] .kpi-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.86));
}
body[data-theme='light'] .kpi-card:hover .kpi-value {
  color: #0f172a;
  text-shadow: none;
}
body[data-theme='light'] .quick-feed-list li:hover,
body[data-theme='light'] .dashboard-activity-card table tbody tr:hover {
  background: rgba(15, 23, 42, 0.055);
  border-color: rgba(15, 23, 42, 0.12);
}
body[data-theme='light'] .dashboard-activity-card table tbody tr:hover td,
body[data-theme='light'] .dashboard-activity-card table tbody tr:hover td strong,
body[data-theme='light'] .quick-feed-list li:hover strong,
body[data-theme='light'] .quick-feed-list li:hover span {
  color: #0f172a;
}
body[data-theme='light'] .sidebar-logo-clean {
  filter: drop-shadow(0 1px 1px rgba(15,23,42,0.42)) drop-shadow(0 0 2px rgba(15,23,42,0.3));
}

body[data-theme='light'] .sidebar-nav .nav-item:hover {
  border-color: rgba(15, 23, 42, 0.12);
}

body[data-theme='light'] .sidebar-nav .nav-item.active {
  border-color: rgba(13,148,136,0.34);
  box-shadow: inset 0 0 0 1px rgba(13,148,136,0.12);
}

body[data-theme='light'] .sidebar-footer {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.09);
}

body[data-theme='light'] .dashboard-hero p,
body[data-theme='light'] .hero-health-meta span,
body[data-theme='light'] .kpi-label,
body[data-theme='light'] .kpi-foot,
body[data-theme='light'] .performance-meta span,
body[data-theme='light'] .quick-feed-list span,
body[data-theme='light'] .empty-state p,
body[data-theme='light'] table td,
body[data-theme='light'] table th {
  color: rgba(15, 23, 42, 0.72);
}

body[data-theme='light'] .kpi-value,
body[data-theme='light'] .metric-value,
body[data-theme='light'] .performance-meta strong,
body[data-theme='light'] .quick-feed-list strong,
body[data-theme='light'] .card-header h3,
body[data-theme='light'] .empty-state h3 {
  color: #0f172a;
}

body[data-theme='light'] .hero-pill {
  background: rgba(13, 148, 136, 0.16);
  color: #065f57;
  border-color: rgba(13, 148, 136, 0.2);
}

body[data-theme='light'] .hero-health-ring {
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.96) 58%, transparent 59%),
    conic-gradient(#0d9488 calc(var(--health) * 1%), rgba(15,23,42,0.12) 0);
}

body[data-theme='light'] .hero-health-inner small {
  color: rgba(15, 23, 42, 0.6);
}

body[data-theme='light'] .performance-bar {
  background: rgba(15, 23, 42, 0.12);
}

body[data-theme='light'] .performance-bar span {
  background: linear-gradient(90deg, #0d9488, #2563eb);
}

body[data-theme='light'] .card,
body[data-theme='light'] .kpi-card,
body[data-theme='light'] .dashboard-hero {
  border-color: rgba(15, 23, 42, 0.1);
}

@media (prefers-color-scheme: light) {
  body[data-theme='auto'] {
    --bg: #f5f7fb;
    --bg-raised: #ffffff;
    --bg-card: rgba(255,255,255,0.86);
    --bg-card-hover: rgba(255,255,255,0.96);
    --bg-glass: rgba(16,24,40,0.03);
    --border: rgba(15,23,42,0.09);
    --border-hover: rgba(45,109,163,0.34);
    --text: #0f172a;
    --text-dim: rgba(15,23,42,0.72);
    --text-muted: rgba(15,23,42,0.48);
    --accent: #0d9488;
    --accent-dim: rgba(13,148,136,0.12);
    --accent-glow: rgba(13,148,136,0.18);
  }

  body[data-theme='auto'] .auth-panel {
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,0.9));
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
  }

  body[data-theme='auto'] .auth-logo-wrap {
    background: rgba(13, 148, 136, 0.08);
    border-color: rgba(13, 148, 136, 0.22);
  }

  body[data-theme='auto'] table td {
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  }

  body[data-theme='auto'] table tr:hover {
    background: rgba(15, 23, 42, 0.04);
  }

  body[data-theme='auto'] .quick-feed-list li,
  body[data-theme='auto'] .performance-row,
  body[data-theme='auto'] .theme-choice,
  body[data-theme='auto'] .settings-note,
  body[data-theme='auto'] .twofa-setup-box {
    background: rgba(255,255,255,0.82);
    border-color: rgba(15, 23, 42, 0.09);
  }

  body[data-theme='auto'] .hero-health-meta div {
    background: rgba(255,255,255,0.8);
    border-color: rgba(15, 23, 42, 0.1);
  }

  body[data-theme='auto'] .dashboard-hero {
    background: linear-gradient(145deg, rgba(13,148,136,0.11), rgba(45,109,163,0.08), rgba(255,255,255,0.88));
  }

  body[data-theme='auto'] .kpi-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.86));
  }
  body[data-theme='auto'] .kpi-card:hover .kpi-value {
    color: #0f172a;
    text-shadow: none;
  }
  body[data-theme='auto'] .quick-feed-list li:hover,
  body[data-theme='auto'] .dashboard-activity-card table tbody tr:hover {
    background: rgba(15, 23, 42, 0.055);
    border-color: rgba(15, 23, 42, 0.12);
  }
  body[data-theme='auto'] .dashboard-activity-card table tbody tr:hover td,
  body[data-theme='auto'] .dashboard-activity-card table tbody tr:hover td strong,
  body[data-theme='auto'] .quick-feed-list li:hover strong,
  body[data-theme='auto'] .quick-feed-list li:hover span {
    color: #0f172a;
  }
  body[data-theme='auto'] .sidebar-logo-clean {
    filter: drop-shadow(0 1px 1px rgba(15,23,42,0.42)) drop-shadow(0 0 2px rgba(15,23,42,0.3));
  }

  body[data-theme='auto'] .sidebar-nav .nav-item:hover {
    border-color: rgba(15, 23, 42, 0.12);
  }

  body[data-theme='auto'] .sidebar-nav .nav-item.active {
    border-color: rgba(13,148,136,0.34);
    box-shadow: inset 0 0 0 1px rgba(13,148,136,0.12);
  }

  body[data-theme='auto'] .sidebar-footer {
    background: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.09);
  }

  body[data-theme='auto'] .dashboard-hero p,
  body[data-theme='auto'] .hero-health-meta span,
  body[data-theme='auto'] .kpi-label,
  body[data-theme='auto'] .kpi-foot,
  body[data-theme='auto'] .performance-meta span,
  body[data-theme='auto'] .quick-feed-list span,
  body[data-theme='auto'] .empty-state p,
  body[data-theme='auto'] table td,
  body[data-theme='auto'] table th {
    color: rgba(15, 23, 42, 0.72);
  }

  body[data-theme='auto'] .kpi-value,
  body[data-theme='auto'] .metric-value,
  body[data-theme='auto'] .performance-meta strong,
  body[data-theme='auto'] .quick-feed-list strong,
  body[data-theme='auto'] .card-header h3,
  body[data-theme='auto'] .empty-state h3 {
    color: #0f172a;
  }

  body[data-theme='auto'] .hero-pill {
    background: rgba(13, 148, 136, 0.16);
    color: #065f57;
    border-color: rgba(13, 148, 136, 0.2);
  }

  body[data-theme='auto'] .hero-health-ring {
    background:
      radial-gradient(circle at center, rgba(255,255,255,0.96) 58%, transparent 59%),
      conic-gradient(#0d9488 calc(var(--health) * 1%), rgba(15,23,42,0.12) 0);
  }

  body[data-theme='auto'] .hero-health-inner small {
    color: rgba(15, 23, 42, 0.6);
  }

  body[data-theme='auto'] .performance-bar {
    background: rgba(15, 23, 42, 0.12);
  }

  body[data-theme='auto'] .performance-bar span {
    background: linear-gradient(90deg, #0d9488, #2563eb);
  }

  body[data-theme='auto'] .card,
  body[data-theme='auto'] .kpi-card,
  body[data-theme='auto'] .dashboard-hero {
    border-color: rgba(15, 23, 42, 0.1);
  }
}

/* === FOURTH PASS: MOBILE UX POLISH === */
@media (max-width: 900px) {
  .main-content {
    padding: 14px;
  }

  .top-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .top-header h1 {
    font-size: clamp(26px, 8vw, 40px);
    line-height: 0.95;
  }

  .top-header .date {
    font-size: 12px;
    line-height: 1.35;
  }

  .card,
  .kpi-card,
  .sms-card,
  .rules-card,
  .qr-panel,
  .section-card,
  .crm-shell {
    border-radius: 16px;
  }

  .card-header,
  .card-body {
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (max-width: 760px) {
  .btn,
  .crm-btn,
  .form-control,
  .sidebar-nav a {
    min-height: 42px;
  }

  .btn-sm {
    min-height: 38px;
  }

  .grid-2 {
    gap: 10px;
  }

  .sidebar {
    width: 68px;
  }

  .main-content {
    margin-left: 68px;
    padding: 12px;
  }

  .sidebar-header {
    padding: 10px 8px;
  }

  .sidebar-logo {
    max-height: 58px;
    max-width: 58px;
  }
}

/* === THIRD PASS POLISH === */
:where(a, button, .btn, .crm-btn, .nav-item, input, select, textarea):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 78%, #ffffff 22%);
  outline-offset: 2px;
}

.btn,
.crm-btn,
.nav-item,
.card,
.kpi-card,
.sms-item,
.rule-item,
.qr-panel,
.rules-card,
.sms-card,
.section-card {
  transition:
    transform 0.18s var(--ease),
    box-shadow 0.2s var(--ease),
    border-color 0.2s var(--ease),
    background-color 0.2s var(--ease),
    color 0.2s var(--ease);
}

.card:hover,
.rules-card:hover,
.sms-card:hover,
.qr-panel:hover,
.section-card:hover {
  border-color: rgba(62, 207, 180, 0.32);
}

table tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 9%, transparent 91%);
}

.sidebar-logo {
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.26));
}

.top-header .date {
  font-weight: 500;
}

body[data-theme='light'] .btn-outline,
body[data-theme='light'] .crm-btn,
body[data-theme='light'] .sms-pill,
body[data-theme='light'] .rule-step,
body[data-theme='light'] .rules-help-item,
body[data-theme='light'] .qr-step {
  color: #0f172a;
}

body[data-theme='light'] .btn-outline:hover,
body[data-theme='light'] .crm-btn:hover {
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.24);
  background: rgba(15, 23, 42, 0.06);
}

@media (prefers-color-scheme: light) {
  body[data-theme='auto'] .btn-outline,
  body[data-theme='auto'] .crm-btn,
  body[data-theme='auto'] .sms-pill,
  body[data-theme='auto'] .rule-step,
  body[data-theme='auto'] .rules-help-item,
  body[data-theme='auto'] .qr-step {
    color: #0f172a;
  }

  body[data-theme='auto'] .btn-outline:hover,
  body[data-theme='auto'] .crm-btn:hover {
    color: #0f172a;
    border-color: rgba(15, 23, 42, 0.24);
    background: rgba(15, 23, 42, 0.06);
  }
}

.sidebar-logo-clean,
.auth-logo-img,
.pass-logo-wrap img,
.logo-box img,
.logo-preview img {
  background: transparent;
  object-fit: contain;
}

/* === AUTH PREMIUM === */
.auth-shell {
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  background: radial-gradient(circle at 15% 20%, rgba(62,207,180,0.14), transparent 40%), radial-gradient(circle at 85% 70%, rgba(45,109,163,0.14), transparent 45%), var(--bg);
  overflow: hidden;
}

.auth-brand-pattern {
  position: absolute;
  inset: -20%;
  background-image: url('/images/trackingtap-logo.png');
  background-size: 120px;
  background-repeat: repeat;
  opacity: 0.035;
  transform: rotate(-14deg);
  filter: saturate(0.2) contrast(1.1);
  pointer-events: none;
}

.auth-panel {
  width: min(460px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 26px;
  position: relative;
  z-index: 2;
  backdrop-filter: blur(14px);
  box-shadow: 0 28px 80px rgba(0,0,0,0.35);
}

.auth-panel-wide {
  width: min(620px, 100%);
}

.auth-logo-wrap {
  width: 196px;
  height: 196px;
  border-radius: 14px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
}

.auth-logo-img {
  max-width: 160px;
  max-height: 160px;
}

.auth-kicker {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.auth-panel h1 {
  margin-top: 8px;
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.auth-panel p {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
}

.auth-form {
  margin-top: 18px;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  margin-top: 2px;
  padding: 11px 14px;
  font-size: 13px;
}

.auth-footnote {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.auth-footnote a {
  color: var(--accent);
  font-weight: 600;
}

/* === CUSTOMIZE PRO === */
.customize-pro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 14px;
}

.customize-form .customize-divider {
  margin: 16px 0;
  border-top: 1px solid var(--border);
}

.brand-color-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.color-dot {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 9px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.16s var(--ease), border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.color-dot:hover {
  transform: translateY(-1px);
}

.color-dot.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.custom-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 12px;
}

.custom-color-row input[type='color'] {
  width: 44px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1px;
  background: transparent;
  cursor: pointer;
}

.customize-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.customize-preview-stack {
  display: grid;
  gap: 14px;
}

.pro-pass-preview {
  width: 100%;
  aspect-ratio: 1.58;
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 55px rgba(0,0,0,0.46);
  border: 1px solid rgba(255,255,255,0.2);
  background: #070d2b;
}

.pass-bg-image,
.pass-bg-overlay {
  position: absolute;
  inset: 0;
}

.pass-bg-image {
  background-size: cover;
  background-position: center;
  filter: saturate(1.15);
}

.pass-content {
  position: relative;
  z-index: 2;
  height: 100%;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

.pass-hero-strip {
  height: 72px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 20% 50%, rgba(255,255,255,0.2), transparent 40%),
    linear-gradient(120deg, rgba(20,34,88,0.9), rgba(8,16,58,0.95)),
    rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.22);
  margin-bottom: 10px;
}

.pass-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.pass-top-row h4 {
  font-size: 18px;
  letter-spacing: -0.03em;
  margin-bottom: 3px;
  color: #fff;
}

.pass-top-row span {
  font-size: 12px;
  color: rgba(255,255,255,0.82);
}

.pass-logo-wrap {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(255,255,255,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  overflow: hidden;
}

.pass-logo-wrap img {
  width: 90%;
  height: 90%;
  object-fit: cover;
}

.pass-logo-wrap svg {
  width: 28px;
  height: 28px;
}

.pass-stamps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 8px;
}

.pass-stamps span {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: rgba(255,255,255,0.26);
  border: 1px solid rgba(255,255,255,0.36);
  color: rgba(255,255,255,0.96);
}

.pass-stamps span.is-filled {
  background: rgba(255,255,255,0.98);
  color: #1f2937;
}

.pass-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pass-metrics small {
  display: block;
  font-size: 9px;
  color: rgba(255,255,255,0.68);
  letter-spacing: 0.08em;
}

.pass-metrics strong {
  font-size: 24px;
  line-height: 1;
  color: #fff;
}

.pass-qr-frame {
  margin-top: auto;
  width: 108px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(15,23,42,0.22);
  padding: 6px;
}

.pass-qr-frame span {
  display: block;
  text-align: center;
  color: #111827;
  font-size: 9px;
  margin-top: 3px;
}

.qr-fake-grid {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3px;
  background:
    linear-gradient(90deg, #111 0 12.5%, #fff 12.5% 25%, #111 25% 37.5%, #fff 37.5% 50%, #111 50% 62.5%, #fff 62.5% 75%, #111 75% 87.5%, #fff 87.5%),
    linear-gradient(#111 0 12.5%, #fff 12.5% 25%, #111 25% 37.5%, #fff 37.5% 50%, #111 50% 62.5%, #fff 62.5% 75%, #111 75% 87.5%, #fff 87.5%);
  background-size: 18px 18px;
}

.pro-pass-preview.style-clean .pass-hero-strip {
  background: linear-gradient(120deg, rgba(255,255,255,0.22), rgba(255,255,255,0.04));
}

.pro-pass-preview.style-clean .pass-stamps span {
  border-radius: 11px;
}

.pro-pass-preview.style-vivid .pass-hero-strip {
  background:
    radial-gradient(circle at 15% 20%, rgba(255,145,77,0.55), transparent 40%),
    radial-gradient(circle at 80% 30%, rgba(62,207,180,0.45), transparent 44%),
    linear-gradient(120deg, rgba(66,44,255,0.5), rgba(255,48,90,0.42));
}

.pro-pass-preview.style-vivid .pass-stamps span.is-filled {
  background: #f8fafc;
  color: #0f172a;
}

/* === SETTINGS === */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.settings-form {
  display: grid;
  gap: 12px;
}

.settings-note {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.settings-note-success {
  border-color: rgba(34,197,94,0.28);
  background: rgba(34,197,94,0.08);
  color: #4ade80;
}

.settings-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.6;
}

.theme-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.theme-choice {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.16s var(--ease);
}

.theme-choice input {
  accent-color: var(--accent);
}

.theme-choice.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.twofa-setup-box {
  margin-top: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.02);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
}

.twofa-setup-box code {
  color: var(--accent);
  word-break: break-all;
}

@media (max-width: 1120px) {
  .customize-pro-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 768px) {
  .auth-panel {
    padding: 22px 16px;
  }

  .auth-panel h1 {
    font-size: 24px;
  }

  .theme-choice-grid {
    grid-template-columns: 1fr;
  }
}

/* === CUSTOMERS CREATE === */
.customers-create-card {
  margin-bottom: 14px;
}

.customers-create-header {
  justify-content: center;
}

.customers-create-header h3 {
  text-align: center;
}

.customers-create-form {
  display: grid;
  gap: 12px;
}

.customers-create-submit {
  width: 100%;
  justify-content: center;
}

.customers-create-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.customer-code-wrap {
  min-width: 240px;
  display: grid;
  gap: 6px;
}

.customer-code {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: rgba(62,207,180,0.08);
  border: 1px solid rgba(62,207,180,0.2);
  border-radius: 7px;
  padding: 5px 8px;
  word-break: break-all;
}

.customer-code-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.join-qr-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
  align-items: center;
}

.join-qr-image {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px;
}

.join-qr-content p {
  margin: 0;
  color: var(--text-dim);
}

@media (max-width: 900px) {
  .customers-create-grid {
    grid-template-columns: 1fr;
  }

  .join-qr-card {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

/* === FULL EXPERIENCE REDESIGN (2026) === */
body {
  background:
    radial-gradient(900px 500px at 8% -8%, rgba(62, 207, 180, 0.11), transparent 60%),
    radial-gradient(820px 440px at 108% 8%, rgba(45, 109, 163, 0.11), transparent 62%),
    var(--bg);
}

.main-content {
  padding: 30px clamp(18px, 2.3vw, 36px);
}

.top-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.top-header h1 {
  font-size: clamp(30px, 4.3vw, 56px);
  letter-spacing: -0.06em;
  line-height: 0.94;
}

.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-raised) 86%, transparent 14%), var(--bg-card));
  border-radius: 20px;
  border-color: color-mix(in srgb, var(--border) 78%, rgba(255, 255, 255, 0.08) 22%);
}

.card-header,
.card-body {
  padding-left: 18px;
  padding-right: 18px;
}

.btn {
  border-radius: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, #3ecfb4, #58d7f1);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 12%),
    var(--bg-raised);
  border-right-color: color-mix(in srgb, var(--border) 68%, rgba(255, 255, 255, 0.09) 32%);
}

.sidebar-header {
  padding-top: 18px;
  padding-bottom: 18px;
  background:
    linear-gradient(180deg, rgba(62, 207, 180, 0.14), rgba(45, 109, 163, 0.06) 56%, rgba(62, 207, 180, 0));
}

.sidebar-logo {
  max-height: 132px;
  max-width: 264px;
}

.sidebar-nav .nav-item {
  border-radius: 12px;
}

.sidebar-nav .nav-item.active {
  background: linear-gradient(135deg, rgba(62, 207, 180, 0.22), rgba(45, 109, 163, 0.15));
}

.sidebar-footer {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
  border-radius: 12px;
}

body[data-theme='light'] {
  --bg: #f4f7fb;
  --bg-raised: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fbff;
  --bg-glass: rgba(20, 34, 63, 0.03);
  --border: rgba(13, 23, 42, 0.12);
  --text: #0f172a;
  --text-dim: rgba(15, 23, 42, 0.66);
  --text-muted: rgba(15, 23, 42, 0.44);
  --accent: #0f9f8a;
  --accent-dim: rgba(15, 159, 138, 0.12);
  --accent-glow: rgba(15, 159, 138, 0.14);
}

body[data-theme='light'] .card,
body[data-theme='light'] .kpi-card,
body[data-theme='light'] .crm-shell,
body[data-theme='light'] .section-card {
  box-shadow: 0 14px 28px rgba(18, 38, 63, 0.07);
}

body[data-theme='light'] .sidebar-logo {
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.22)) drop-shadow(0 0 1px rgba(15, 23, 42, 0.45));
}
body[data-theme='light'] .sidebar-header {
  background:
    linear-gradient(180deg, rgba(15, 159, 138, 0.16), rgba(45, 109, 163, 0.08) 56%, rgba(15, 159, 138, 0.02));
}

body[data-theme='light'] table tr:hover td,
body[data-theme='light'] table tr:hover td strong,
body[data-theme='light'] .quick-feed-list li:hover,
body[data-theme='light'] .quick-feed-list li:hover strong,
body[data-theme='light'] .quick-feed-list li:hover span {
  color: #0f172a !important;
}

@media (prefers-color-scheme: light) {
  body[data-theme='auto'] {
    --bg: #f4f7fb;
    --bg-raised: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fbff;
    --bg-glass: rgba(20, 34, 63, 0.03);
    --border: rgba(13, 23, 42, 0.12);
    --text: #0f172a;
    --text-dim: rgba(15, 23, 42, 0.66);
    --text-muted: rgba(15, 23, 42, 0.44);
    --accent: #0f9f8a;
    --accent-dim: rgba(15, 159, 138, 0.12);
    --accent-glow: rgba(15, 159, 138, 0.14);
  }

  body[data-theme='auto'] .card,
  body[data-theme='auto'] .kpi-card,
  body[data-theme='auto'] .crm-shell,
  body[data-theme='auto'] .section-card {
    box-shadow: 0 14px 28px rgba(18, 38, 63, 0.07);
  }

  body[data-theme='auto'] .sidebar-logo {
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.22)) drop-shadow(0 0 1px rgba(15, 23, 42, 0.45));
  }
  body[data-theme='auto'] .sidebar-header {
    background:
      linear-gradient(180deg, rgba(15, 159, 138, 0.16), rgba(45, 109, 163, 0.08) 56%, rgba(15, 159, 138, 0.02));
  }

  body[data-theme='auto'] table tr:hover td,
  body[data-theme='auto'] table tr:hover td strong,
  body[data-theme='auto'] .quick-feed-list li:hover,
  body[data-theme='auto'] .quick-feed-list li:hover strong,
  body[data-theme='auto'] .quick-feed-list li:hover span {
    color: #0f172a !important;
  }
}
