/* ==========================================================================
   AutoPulse CRM — Login Page Stylesheet
   Dual theme: Obsidian Titanium (dark, default) & Alabaster Frost (light)
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
  /* Dark mode (default) */
  --bg-primary: #0A0E17;
  --bg-secondary: #111827;
  --bg-card: rgba(22, 28, 41, 0.72);
  --bg-card-solid: #161C29;
  --bg-input: rgba(15, 20, 32, 0.8);
  --bg-hover: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --accent-primary: #06B6D4;
  --accent-primary-strong: #22D3EE;
  --accent-secondary: #3B82F6;
  --accent-action: #E11D48;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #F43F5E;
  --accent-soft: rgba(6, 182, 212, 0.14);
  --success-soft: rgba(16, 185, 129, 0.14);
  --danger-soft: rgba(244, 63, 94, 0.12);
  --shadow-card: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 0 1px rgba(6, 182, 212, 0.35), 0 10px 30px -10px rgba(6, 182, 212, 0.55);
  --pulse-overlay: linear-gradient(180deg, rgba(10, 14, 23, 0.55) 0%, rgba(10, 14, 23, 0.82) 55%, rgba(10, 14, 23, 0.95) 100%);
  --gauge-track: rgba(255, 255, 255, 0.08);
  --skeleton: rgba(255, 255, 255, 0.06);
  --skeleton-shine: rgba(255, 255, 255, 0.12);
  color-scheme: dark;

  /* Shared tokens */
  --font-display: "Outfit", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --topbar-h: 72px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --theme-transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="light"] {
  --bg-primary: #F8FAFC;
  --bg-secondary: #EEF2F7;
  --bg-card: rgba(255, 255, 255, 0.84);
  --bg-card-solid: #FFFFFF;
  --bg-input: #FFFFFF;
  --bg-hover: rgba(15, 23, 42, 0.04);
  --border-color: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --accent-primary: #0891B2;
  --accent-primary-strong: #0E7490;
  --accent-secondary: #2563EB;
  --accent-action: #DC2626;
  --success: #059669;
  --warning: #D97706;
  --danger: #DC2626;
  --accent-soft: rgba(8, 145, 178, 0.1);
  --success-soft: rgba(5, 150, 105, 0.1);
  --danger-soft: rgba(220, 38, 38, 0.08);
  --shadow-card: 0 18px 40px -22px rgba(15, 23, 42, 0.28);
  --shadow-glow: 0 0 0 1px rgba(8, 145, 178, 0.3), 0 10px 26px -12px rgba(8, 145, 178, 0.45);
  --pulse-overlay: linear-gradient(180deg, rgba(248, 250, 252, 0.62) 0%, rgba(248, 250, 252, 0.86) 55%, rgba(248, 250, 252, 0.96) 100%);
  --gauge-track: rgba(15, 23, 42, 0.08);
  --skeleton: rgba(15, 23, 42, 0.06);
  --skeleton-shine: rgba(15, 23, 42, 0.1);
  color-scheme: light;
}

/* ---------- 2. Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  transition: var(--theme-transition);
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Ambient glow behind the auth panel */
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(600px 400px at 10% 15%, rgba(6, 182, 212, 0.12), transparent 70%),
    radial-gradient(500px 400px at 35% 95%, rgba(59, 130, 246, 0.1), transparent 70%);
}

[data-theme="light"] .bg-glow {
  background:
    radial-gradient(600px 400px at 10% 15%, rgba(8, 145, 178, 0.1), transparent 70%),
    radial-gradient(500px 400px at 35% 95%, rgba(37, 99, 235, 0.07), transparent 70%);
}

/* ---------- 3. Top bar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  box-shadow: 0 8px 20px -8px var(--accent-primary);
  color: #fff;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.brand-name span {
  color: var(--accent-primary);
}

.brand-tag {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-toggle {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: var(--theme-transition);
}

.lang-btn {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  transition: background-color 0.25s var(--ease-out), color 0.25s var(--ease-out);
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn[aria-pressed="true"] {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 6px 14px -6px var(--accent-primary);
}

.theme-toggle {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: var(--theme-transition), transform 0.2s var(--ease-out);
}

.theme-toggle:hover {
  transform: rotate(-12deg) scale(1.05);
  border-color: var(--accent-primary);
}

.theme-toggle svg {
  position: absolute;
  width: 20px;
  height: 20px;
  transition: transform 0.45s var(--ease-out), opacity 0.3s ease;
}

.icon-sun {
  color: #F59E0B;
  transform: translateY(30px) rotate(90deg);
  opacity: 0;
}

.icon-moon {
  color: var(--accent-primary-strong);
}

[data-theme="light"] .icon-sun {
  transform: none;
  opacity: 1;
}

[data-theme="light"] .icon-moon {
  transform: translateY(-30px) rotate(-90deg);
  opacity: 0;
}

/* ---------- 4. Split layout ---------- */
.split-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* ---------- 5. Auth panel (left) ---------- */
.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: calc(var(--topbar-h) + 24px) 48px 28px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  animation: rise-in 0.7s var(--ease-out) both;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent-primary);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  margin-bottom: 18px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: ping 2s infinite;
}

.auth-card h1 {
  font-size: clamp(1.8rem, 2.6vw, 2.35rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 10px;
}

.subtitle {
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text-primary);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s ease;
}

.input-wrap input,
.input-wrap select {
  width: 100%;
  height: 50px;
  padding: 0 46px 0 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: var(--theme-transition);
  appearance: none;
  -webkit-appearance: none;
}

.input-wrap select {
  cursor: pointer;
}

.input-wrap select option {
  background: var(--bg-card-solid);
  color: var(--text-primary);
}

.input-wrap input::placeholder {
  color: var(--text-muted);
}

.input-wrap input:hover,
.input-wrap select:hover {
  border-color: var(--border-strong);
}

.input-wrap input:focus,
.input-wrap select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.input-wrap:focus-within .input-icon {
  color: var(--accent-primary);
}

.select-chevron {
  position: absolute;
  right: 16px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.field.has-error input,
.field.has-error select {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.field-error {
  min-height: 0;
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 6px;
}

.field-error:empty {
  display: none;
}

.pwd-toggle {
  position: absolute;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.pwd-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.pwd-toggle svg {
  width: 18px;
  height: 18px;
}

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 0 20px;
  font-size: 0.88rem;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-input);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.checkbox input::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0);
  margin-top: -2px;
  transition: transform 0.2s var(--ease-out);
}

.checkbox input:checked {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.checkbox input:checked::after {
  transform: rotate(-45deg) scale(1);
}

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent-primary);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.link-btn:hover {
  color: var(--accent-primary-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.form-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  animation: shake 0.4s ease;
}

.form-alert.is-warning {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  border-color: color-mix(in srgb, var(--warning) 30%, transparent);
}

.form-alert svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.btn {
  position: relative;
  width: 100%;
  height: 52px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.01em;
  transition: transform 0.2s var(--ease-out), box-shadow 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, opacity 0.2s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.btn-primary {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  box-shadow: 0 12px 28px -12px var(--accent-primary);
  overflow: hidden;
}

.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.7s var(--ease-out);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-primary:hover:not(:disabled)::before {
  transform: translateX(100%);
}

.btn-primary svg {
  width: 18px;
  height: 18px;
  transition: transform 0.25s var(--ease-out);
}

.btn-primary:hover:not(:disabled) svg {
  transform: translateX(3px);
}

.btn-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

.btn.is-loading .btn-label,
.btn.is-loading .btn-arrow {
  display: none;
}

.btn:not(.is-loading) .btn-spinner {
  display: none;
}

.btn-outline {
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-primary);
}

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

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

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.demo-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px dashed color-mix(in srgb, var(--accent-primary) 45%, transparent);
  background: var(--accent-soft);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.demo-box strong {
  color: var(--text-primary);
  font-weight: 600;
}

.demo-box code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.8rem;
  color: var(--accent-primary);
}

.demo-fill {
  flex: none;
  border: 0;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent-primary);
  transition: transform 0.2s var(--ease-out), opacity 0.2s ease;
}

.demo-fill:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.help-line {
  margin-top: 22px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.help-line svg {
  width: 15px;
  height: 15px;
  vertical-align: -2px;
  margin-right: 3px;
}

.auth-footer {
  margin-top: 28px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- 6. Pulse panel (right) ---------- */
.pulse-panel {
  position: relative;
  overflow: hidden;
  border-left: 1px solid var(--border-color);
  background: var(--bg-secondary);
  transition: var(--theme-transition);
}

.pulse-bg {
  position: absolute;
  inset: 0;
  background-image: var(--pulse-overlay), url("assets/showroom-hero.jpg");
  background-size: cover;
  background-position: center 60%;
  transform: scale(1.04);
  animation: slow-zoom 24s ease-in-out infinite alternate;
}

.pulse-content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: calc(var(--topbar-h) + 20px) 40px 28px;
}

.pulse-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.eyebrow-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--accent-primary-strong);
  margin-bottom: 6px;
}

[data-theme="light"] .eyebrow-live {
  color: var(--accent-primary);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-action);
  animation: ping-red 1.6s infinite;
}

.pulse-header h2 {
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 700;
}

.pulse-header .pulse-sub {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.clock-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.dealer-clock {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.shift-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
}

.shift-badge.is-off {
  color: var(--text-secondary);
  background: var(--bg-hover);
  border-color: var(--border-color);
}

.shift-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  grid-template-areas:
    "att act"
    "lead lead";
  gap: 14px;
}

.metric-card {
  position: relative;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  transition: var(--theme-transition), transform 0.3s var(--ease-out);
  animation: rise-in 0.7s var(--ease-out) both;
}

.metric-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent-primary) 40%, var(--border-color));
}

.card-attendance { grid-area: att; animation-delay: 0.1s; }
.card-activity { grid-area: act; animation-delay: 0.18s; }
.card-leaderboard { grid-area: lead; animation-delay: 0.26s; }

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

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
}

.card-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--accent-primary);
  background: var(--accent-soft);
}

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

.card-chip {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

/* Attendance gauge */
.attendance-body {
  display: flex;
  align-items: center;
  gap: 18px;
}

.gauge {
  position: relative;
  flex: none;
  width: 112px;
  height: 112px;
}

.gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-track {
  fill: none;
  stroke: var(--gauge-track);
  stroke-width: 10;
}

.gauge-fill {
  fill: none;
  stroke: url(#gauge-gradient);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.6s var(--ease-out);
  filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.5));
}

.gauge-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.55rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.gauge-caption {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.breakdown {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.breakdown-row {
  display: grid;
  gap: 5px;
}

.breakdown-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
}

.breakdown-top span:first-child {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breakdown-top strong {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--gauge-track);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  transition: width 1.4s var(--ease-out);
}

/* Activity */
.activity-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.kpi {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
}

.kpi-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--success);
}

.sparkline {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 46px;
  padding-top: 4px;
}

.spark-bar {
  flex: 1;
  height: 0;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--accent-primary), color-mix(in srgb, var(--accent-primary) 25%, transparent));
  opacity: 0.85;
  transition: height 1s var(--ease-out);
}

.spark-bar.is-now {
  background: linear-gradient(180deg, var(--accent-action), color-mix(in srgb, var(--accent-action) 25%, transparent));
}

.spark-caption {
  grid-column: 1 / -1;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: -6px;
}

/* Leaderboard */
.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.leader-row {
  display: grid;
  grid-template-columns: 34px 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  transition: background-color 0.2s ease;
}

.leader-row:hover {
  background: var(--bg-hover);
}

.rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: #0A0E17;
}

.rank-1 { background: linear-gradient(135deg, #FDE68A, #F59E0B); }
.rank-2 { background: linear-gradient(135deg, #F1F5F9, #94A3B8); }
.rank-3 { background: linear-gradient(135deg, #FDBA74, #C2410C); color: #fff; }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: #fff;
}

.leader-info {
  min-width: 0;
}

.leader-name {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.leader-meta {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.leader-bar {
  margin-top: 6px;
}

.leader-bar .bar-fill.is-over {
  background: linear-gradient(90deg, var(--success), var(--accent-primary));
}

.leader-score {
  text-align: right;
}

.leader-score strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.badge-target {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--success);
  background: var(--success-soft);
}

.badge-target.is-under {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 14%, transparent);
}

/* Ticker */
.ticker {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
  transition: var(--theme-transition);
}

.ticker-label {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent-action);
}

.ticker-label svg {
  width: 14px;
  height: 14px;
}

.ticker-viewport {
  flex: 1;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.ticker-track {
  display: inline-flex;
  gap: 48px;
  white-space: nowrap;
  font-size: 0.86rem;
  color: var(--text-secondary);
  animation: marquee 32s linear infinite;
}

.ticker:hover .ticker-track {
  animation-play-state: paused;
}

.ticker-track span::before {
  content: "•";
  color: var(--accent-primary);
  margin-right: 10px;
}

.pulse-meta {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.pulse-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pulse-meta svg {
  width: 13px;
  height: 13px;
}

/* Skeleton loading state */
.is-loading .skeleton-target {
  color: transparent !important;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-shine) 50%, var(--skeleton) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

/* Fallback (static hero) */
.pulse-fallback {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  padding: 40px;
}

.pulse-fallback h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.3rem);
  font-weight: 700;
  max-width: 460px;
}

.pulse-fallback p {
  color: var(--text-secondary);
  max-width: 440px;
}

.fallback-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 14%, transparent);
}

/* ---------- 7. Modal, overlay, toast ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 15, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.25s ease both;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 26px;
  border-radius: var(--radius-xl);
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
  animation: pop-in 0.35s var(--ease-out) both;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 0;
  background: var(--bg-hover);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-card h2 {
  font-size: 1.3rem;
  margin-bottom: 6px;
  padding-right: 30px;
}

.modal-card > p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 18px;
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s var(--ease-out);
}

a.contact-item:hover {
  border-color: var(--accent-primary);
  background: var(--bg-hover);
  transform: translateX(3px);
}

.contact-item .card-icon {
  flex: none;
}

.contact-item small {
  display: block;
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.contact-item strong {
  font-weight: 600;
  font-size: 0.92rem;
}

.success-card {
  text-align: center;
  max-width: 440px;
}

.success-icon {
  width: 76px;
  height: 76px;
  margin: 4px auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--success);
  background: var(--success-soft);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--success) 8%, transparent);
}

.success-icon svg {
  width: 36px;
  height: 36px;
}

.success-icon path {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: draw 0.6s 0.2s var(--ease-out) forwards;
}

.success-card h2 {
  padding-right: 0;
}

.success-user {
  margin: 16px 0 6px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
}

.success-user strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.success-user span {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.success-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 12px 0 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  max-width: calc(100% - 40px);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--text-primary);
  background: var(--bg-card-solid);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.55);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s var(--ease-out), opacity 0.3s ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* ---------- 8. Animations ---------- */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes ping {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); }
  80%, 100% { box-shadow: 0 0 0 8px transparent; }
}

@keyframes ping-red {
  0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.6); }
  80%, 100% { box-shadow: 0 0 0 8px rgba(225, 29, 72, 0); }
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@keyframes slow-zoom {
  from { transform: scale(1.04); }
  to { transform: scale(1.12); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

/* ---------- 9. Responsive ---------- */
@media (min-width: 1024px) {
  .pulse-panel {
    position: sticky;
    top: 0;
    height: 100vh;
  }

  .pulse-content {
    overflow-y: auto;
    scrollbar-width: thin;
  }
}

@media (max-width: 1279px) and (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "att" "act" "lead";
  }
}

@media (max-width: 1023px) {
  .split-container {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    padding: calc(var(--topbar-h) + 16px) 24px 36px;
  }

  .pulse-panel {
    border-left: 0;
    border-top: 1px solid var(--border-color);
  }

  .pulse-content {
    padding: 32px 24px 36px;
  }

  .topbar {
    background: color-mix(in srgb, var(--bg-primary) 82%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    pointer-events: auto;
  }

  .auth-footer {
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --topbar-h: 64px;
  }

  .brand-tag {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "att" "act" "lead";
  }

  .attendance-body {
    flex-direction: column;
    align-items: stretch;
  }

  .gauge {
    align-self: center;
  }

  .clock-box {
    align-items: flex-start;
  }

  .demo-box {
    flex-direction: column;
    align-items: flex-start;
  }

  .leader-row {
    grid-template-columns: 30px minmax(0, 1fr) auto;
  }

  .leader-row .avatar {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
