/* ============================================
   VGO PORTAL — STYLES
   Light theme default, dark theme via [data-theme="dark"]
   Shared across client portal, admin portal, login.
   ============================================ */

/* ============================================
   THEME TOKENS
   ============================================ */

:root {
  /* brand — red is the only accent; used sparingly */
  --accent: #ef4444;
  --accent-hover: #f87171;
  --accent-active: #dc2626;
  --accent-muted: rgba(239, 68, 68, 0.12);
  --accent-glow: rgba(239, 68, 68, 0.30);
  --accent-contrast: #ffffff;

  /* signature red gradient — banner, nav cap, active pills all share it */
  --banner-grad: linear-gradient(118deg, #991b1b 0%, #dc2626 45%, #ef4444 75%, #f87171 100%);
  --banner-grad-text: #ffffff;

  /* legacy "purple" tokens retired → mapped to the red accent so any
     not-yet-migrated component blends into the unified palette */
  --purple: #ef4444;
  --purple-soft: #f7a8a8;
  --purple-muted: rgba(239, 68, 68, 0.12);
  --purple-border: rgba(239, 68, 68, 0.30);

  /* status — data semantics only */
  --green: #22c55e;
  --green-muted: rgba(34, 197, 94, 0.14);
  --red: #ef4444;
  --red-muted: rgba(239, 68, 68, 0.12);
  --blue: #3b82f6;
  --blue-muted: rgba(59, 130, 246, 0.14);
  --yellow: #f59e0b;
  --yellow-muted: rgba(245, 158, 11, 0.14);

  /* surfaces — neutral charcoal (dark is the alternate theme) */
  --bg-primary: #0d0e11;
  --bg-secondary: #131418;
  --bg-card: #17181d;
  --bg-card-hover: #1e2026;
  --bg-input: #101116;
  --bg-inset: rgba(255, 255, 255, 0.03);

  /* text — cool off-white */
  --text-primary: #ecedef;
  --text-secondary: #a3a7af;
  --text-muted: #71767f;
  --text-faint: #4e525a;

  /* borders / overlays */
  --border: #23252c;
  --border-hover: #33363f;
  --overlay-1: rgba(255, 255, 255, 0.04);
  --overlay-2: rgba(255, 255, 255, 0.08);
  --overlay-3: rgba(255, 255, 255, 0.14);

  /* shadows (dark leans on borders; shadows stay subtle) */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);

  /* chart (referenced by portal.js via getComputedStyle) */
  --chart-grid: rgba(255, 255, 255, 0.06);
  --chart-axis: #565a63;
  --chart-dot: #17181d;

  /* grain overlay — kept cheap */
  --grain-opacity: 0.045;
  --grain-blend: overlay;

  /* layout */
  --sidebar-width: 256px;
  --radius-lg: 26px;
  --radius: 18px;
  --radius-sm: 13px;
  --radius-xs: 9px;
  --topbar-h: 0px;

  /* type — warm & rounded (Gabarito display + Hanken Grotesk body).
     --font-mono intentionally points at the sans so nothing reads "typewriter". */
  --font-display: 'Gabarito', system-ui, sans-serif;
  --font-sans: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'Hanken Grotesk', system-ui, sans-serif;

  /* motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.25, 0.8, 0.3, 1);
  --dur-fast: 140ms;
  --dur: 220ms;
  --dur-slow: 420ms;
  --transition: var(--ease);

  color-scheme: dark;
}

/* Light theme overrides (opt-in via data-theme="light") */
:root[data-theme="light"] {
  /* clean, bright neutral canvas — the default identity */
  --accent: #ef4444;
  --accent-hover: #dc2626;
  --accent-active: #b91c1c;
  --accent-muted: rgba(239, 68, 68, 0.10);
  --accent-glow: rgba(239, 68, 68, 0.16);

  --purple: #ef4444;
  --purple-soft: #ef4444;
  --purple-muted: rgba(239, 68, 68, 0.10);
  --purple-border: rgba(239, 68, 68, 0.22);

  --green: #15995f;
  --green-muted: rgba(21, 153, 95, 0.13);
  --blue: #2f6df0;
  --blue-muted: rgba(47, 109, 240, 0.11);
  --yellow: #df8a16;
  --yellow-muted: rgba(223, 138, 22, 0.15);

  --bg-primary: #f4f5f7;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f6f7f9;
  --bg-input: #f0f1f4;
  --bg-inset: rgba(16, 20, 28, 0.035);

  --text-primary: #17191e;
  --text-secondary: #595f6a;
  --text-muted: #8b919c;
  --text-faint: #b9bfc9;

  --border: rgba(16, 20, 28, 0.10);
  --border-hover: rgba(16, 20, 28, 0.20);
  --overlay-1: rgba(16, 20, 28, 0.03);
  --overlay-2: rgba(16, 20, 28, 0.06);
  --overlay-3: rgba(16, 20, 28, 0.11);

  --shadow-sm: 0 1px 2px rgba(16, 20, 28, 0.05), 0 1px 3px rgba(16, 20, 28, 0.04);
  --shadow-md: 0 10px 30px rgba(16, 20, 28, 0.08);
  --shadow-lg: 0 26px 60px rgba(16, 20, 28, 0.12);

  --chart-grid: rgba(16, 20, 28, 0.07);
  --chart-axis: #a9aeb8;
  --chart-dot: #ffffff;

  --grain-opacity: 0.04;
  --grain-blend: multiply;

  color-scheme: light;
}

/* ============================================
   RESET + BASE
   ============================================ */

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  font-size: 1rem;
  line-height: 1.5;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

/* Every surface/border transitions its colors when theme flips */
.sidebar, .portal-main, .portal-mobile-header,
.info-card, .stat-card, .insight-card, .billing-card,
.support-form-card, .support-history-card, .file-card,
.chart-container, .source-bars, .data-table, .data-row,
.request-item, .plan-card, .checklist-item,
.analytics-stat-card, .analytics-live-badge,
.preview-browser, .preview-stat, .preview-device-btn,
.sidebar-link, .sidebar-label, .filter-pill, .status-badge,
.portal-btn, .login-btn, .login-field input,
.form-field input, .form-field select, .form-field textarea {
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

/* Grain overlay */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  transition: opacity var(--dur) var(--ease);
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  background-image: radial-gradient(ellipse at 50% 0%, var(--accent-glow) 0%, transparent 60%);
}

.login-container {
  width: 100%;
  max-width: 440px;
  padding: 2rem;
  position: relative;
}

/* Theme toggle that floats top-right on the login page */
.login-theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3rem;
}

.login-logo {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 1.65rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.login-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-inset);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.login-coming-soon {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1.1rem;
  margin-bottom: 1.5rem;
  background: var(--yellow-muted);
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.login-coming-soon strong {
  font-weight: 600;
  color: var(--yellow);
}

.login-coming-soon-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 0.45rem;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.6);
  animation: loginComingSoonPulse 2s ease-out infinite;
}

@keyframes loginComingSoonPulse {
  0%   { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(217, 119, 6, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
}

.login-title {
  font-size: 2.35rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--text-primary);
  line-height: 1.1;
}

.login-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: -0.5rem;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.login-field label,
.form-field label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  font-weight: 500;
}

.login-field input,
.form-field input,
.form-field select,
.form-field textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.95rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur) var(--ease);
  width: 100%;
}

.login-field input::placeholder,
.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--text-muted);
}

.login-field input:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.login-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.login-password-wrap input {
  padding-right: 2.75rem;
}
.login-password-toggle {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.login-password-toggle:hover {
  color: var(--text-primary);
  background: var(--overlay-1);
}

.form-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238a8f94' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-field select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-field textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.55;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

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

.login-forgot {
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--dur-fast) var(--ease);
}

.login-forgot:hover {
  opacity: 0.75;
}

.login-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
}

.login-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 32px var(--accent-glow);
}

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

.login-footer-text {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.login-footer-text a {
  color: var(--accent);
  text-decoration: none;
}

.login-footer-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
}

.login-footer-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-footer-powered {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

/* ============================================
   PORTAL LAYOUT
   ============================================ */

.portal-body {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--dur-slow) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.sidebar-top {
  padding: 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}

.sidebar-logo {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 1.35rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.sidebar-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-inset);
}

/* Theme toggle — lives in sidebar-top, right-aligned */
.theme-toggle {
  margin-left: auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.theme-toggle:hover {
  color: var(--text-primary);
  background: var(--overlay-1);
  border-color: var(--border-hover);
}

.theme-toggle svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
  opacity: 1;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

/* Hidden icon is the one NOT active for the current theme */
:root:not([data-theme="light"]) .theme-toggle .theme-icon-sun { opacity: 1; transform: translate(-50%, -50%) rotate(0deg) scale(1); }
:root:not([data-theme="light"]) .theme-toggle .theme-icon-moon { opacity: 0; transform: translate(-50%, -50%) rotate(-90deg) scale(0.6); }
:root[data-theme="light"] .theme-toggle .theme-icon-sun { opacity: 0; transform: translate(-50%, -50%) rotate(90deg) scale(0.6); }
:root[data-theme="light"] .theme-toggle .theme-icon-moon { opacity: 1; transform: translate(-50%, -50%) rotate(0deg) scale(1); }

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow-y: auto;
}

button.sidebar-link {
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  font-family: var(--font-sans);
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--overlay-1);
}

.sidebar-link:active {
  transform: scale(0.98);
}

.sidebar-link { position: relative; }

.sidebar-link.active {
  color: var(--text-primary);
  background: var(--overlay-2);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.sidebar-link.active svg {
  stroke: var(--accent);
}

.sidebar-bottom {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0.8rem;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #7f1d1d);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}

.sidebar-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  color: var(--text-muted) !important;
}

.sidebar-logout:hover {
  color: var(--accent) !important;
  background: var(--accent-muted) !important;
}

/* Mobile header */
.portal-mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  align-items: center;
  justify-content: space-between;
  z-index: 99;
  gap: 0.75rem;
}

.portal-mobile-header .theme-toggle {
  margin-left: 0;
}

.mobile-menu-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.25rem;
}

/* Main content */
.portal-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: 3rem 3rem 4rem;
}

/* ============================================
   SECTIONS
   ============================================ */

.portal-section {
  display: none;
}

.portal-section.active {
  display: block;
  animation: fadeIn var(--dur-slow) var(--ease);
}

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

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  gap: 1rem;
}

.section-title {
  font-size: 2.15rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--text-primary);
  line-height: 1.1;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 0.4rem;
  line-height: 1.5;
}

.section-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  padding-top: 0.75rem;
  white-space: nowrap;
}

.section-block {
  margin-top: 2.5rem;
}

.block-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

/* ============================================
   CARDS
   ============================================ */

.cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
}

.cards-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

.cards-row-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* Info cards (overview) */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.info-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.info-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.info-card-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 500;
}

.info-card-value {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.info-card-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Status badges */
.status-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-xs);
  font-weight: 500;
  display: inline-flex;
  width: fit-content;
  align-self: center;
  align-items: center;
  white-space: nowrap;
}

.status-active {
  background: var(--green-muted);
  color: var(--green);
}

.status-info {
  background: var(--blue-muted);
  color: var(--blue);
}

.status-warning {
  background: var(--yellow-muted);
  color: var(--yellow);
}

.status-error {
  background: var(--red-muted);
  color: var(--red);
}

/* Stat cards (analytics/admin dashboard) */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.stat-change {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
}

.stat-up {
  color: var(--green);
}

.stat-down {
  color: var(--red);
}

/* Insight cards */
.insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.insight-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.insight-positive .insight-icon {
  color: var(--green);
}

.insight-negative .insight-icon {
  color: var(--red);
}

.insight-value {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.insight-positive .insight-value {
  color: var(--green);
}

.insight-negative .insight-value {
  color: var(--red);
}

.insight-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}

.insight-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ============================================
   CHARTS
   ============================================ */

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  height: 260px;
  box-shadow: var(--shadow-sm);
}

.chart-large {
  height: 340px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.chart-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
}

.chart-tab {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.chart-tab:hover {
  color: var(--text-secondary);
}

.chart-tab.active {
  color: var(--text-primary);
  background: var(--bg-card);
}

/* ============================================
   DATA TABLE
   ============================================ */

.data-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  padding: 1rem 1.4rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-primary);
}

.data-row:last-child {
  border-bottom: none;
}

.data-header {
  background: var(--bg-inset);
}

.data-header span {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 500;
}

/* 4-column table for billing */
#section-billing .data-row {
  grid-template-columns: 1fr 2fr 1fr 1fr;
}

/* Source bars (analytics) */
.source-bars {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  box-shadow: var(--shadow-sm);
}

.source-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.source-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.source-name {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.source-pct {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.source-bar {
  height: 5px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.source-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 1s var(--ease);
}

/* ============================================
   BILLING
   ============================================ */

.billing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  box-shadow: var(--shadow-sm);
}

.billing-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.billing-card-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 500;
}

.billing-plan-name {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.billing-price {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.billing-amount {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--text-primary);
  line-height: 1;
}

.billing-period {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 400;
}

.billing-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.billing-features li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding-left: 1.4rem;
  position: relative;
}

.billing-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.payment-method {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

.payment-details {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.payment-card-type {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.payment-card-exp {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.billing-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.billing-info-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.billing-info-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* Danger zone */
.danger-zone {
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: var(--red-muted);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-top: 1.75rem;
}
.danger-btn {
  background: var(--red) !important;
  color: #fff !important;
}
.danger-btn:hover { background: #b91c1c !important; }

/* Buttons */
.portal-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.6rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.portal-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.portal-btn:active {
  transform: translateY(0);
}

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

.portal-btn-outline:hover {
  background: var(--accent-muted);
  box-shadow: none;
  transform: translateY(-1px);
}

.portal-btn-secondary {
  background: var(--overlay-1);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.portal-btn-secondary:hover {
  background: var(--overlay-2);
  box-shadow: none;
}

/* ============================================
   SUPPORT
   ============================================ */

.support-form-card,
.support-history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.support-form {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  margin-top: 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.request-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.request-item {
  padding: 1.25rem 1.35rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.request-item:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.request-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.request-type-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-xs);
  font-weight: 500;
}

.type-update {
  background: var(--blue-muted);
  color: var(--blue);
}

.type-bug {
  background: var(--red-muted);
  color: var(--red);
}

.type-question {
  background: var(--yellow-muted);
  color: var(--yellow);
}

.request-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.request-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ============================================
   FILES
   ============================================ */

.files-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}

.file-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.file-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.file-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-icon-image {
  background: var(--accent-muted);
  color: var(--accent);
}

.file-icon-doc {
  background: var(--blue-muted);
  color: var(--blue);
}

.file-icon-link {
  background: var(--green-muted);
  color: var(--green);
}

.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.file-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.file-download-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--overlay-1);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  flex-shrink: 0;
}

.file-download-btn:hover {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================
   TIMELINE & CHANGELOG
   ============================================ */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: 1.1rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 0.45rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px var(--accent-muted);
}

.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.timeline-text {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Changelog */
.changelog {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.changelog-month-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-weight: 500;
}

.changelog-entries {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-left: 1px solid var(--border);
  padding-left: 1.75rem;
  margin-left: 5px;
}

.changelog-entry {
  display: flex;
  gap: 1rem;
  padding: 1.1rem 0;
  position: relative;
}

.changelog-dot {
  position: absolute;
  left: -2.1rem;
  top: 1.35rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

.changelog-dot-feature {
  background: var(--accent);
}

.changelog-dot-fix {
  background: var(--blue);
}

.changelog-dot-perf {
  background: var(--green);
}

.changelog-body {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.changelog-entry-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.changelog-tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-xs);
  font-weight: 500;
}

.tag-feature {
  background: var(--accent-muted);
  color: var(--accent);
}

.tag-fix {
  background: var(--blue-muted);
  color: var(--blue);
}

.tag-perf {
  background: var(--green-muted);
  color: var(--green);
}

.tag-support {
  background: var(--yellow-muted);
  color: var(--yellow);
}

.changelog-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.changelog-text {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--green);
  z-index: 10000;
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--dur-slow) var(--ease);
  box-shadow: var(--shadow-lg);
}

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

.toast-icon {
  flex-shrink: 0;
}

/* ============================================
   ADMIN STYLES
   ============================================ */

/* Admin table layouts */
.admin-clients-table .data-row { grid-template-columns: 2fr 2fr 1fr 1fr 1fr; }
.admin-requests-table .data-row { grid-template-columns: 1.5fr 2.5fr 0.8fr 1fr 1fr 36px; }
.admin-revenue-table .data-row { grid-template-columns: 2fr 2fr 1fr 1.2fr; }
.admin-leads-table .data-row { grid-template-columns: 1.5fr 2fr 1fr 0.9fr 1fr 36px; }

/* Clickable rows */
.data-row.clickable { cursor: pointer; transition: background var(--dur-fast) var(--ease); }
.data-row.clickable:hover { background: var(--bg-card-hover); }

/* Revenue total row */
.data-row.data-total {
  background: var(--accent-muted);
  font-weight: 600;
  color: var(--accent);
  border-top: 1px solid var(--accent);
}

/* Filter pills */
.filter-pills {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.filter-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  font-weight: 500;
}

.filter-pill:hover { color: var(--text-primary); border-color: var(--border-hover); }
.filter-pill.active { color: var(--accent); border-color: var(--accent); background: var(--accent-muted); }

/* Inline status select */
.status-select {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.03em;
  padding: 0.3rem 0.6rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='8' height='5' viewBox='0 0 8 5' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%238a8f94' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.65rem;
}

.status-select:focus { border-color: var(--accent); outline: none; }

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 500;
  margin-bottom: 1.75rem;
  transition: opacity var(--dur-fast) var(--ease);
}

.back-btn:hover { opacity: 0.7; }

/* Client detail header */
.client-detail-header {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
  margin-bottom: 2rem;
}

/* Admin add update form */
.admin-inline-form {
  margin-top: 1.75rem;
  padding: 1.75rem;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.admin-inline-form h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1.1rem;
  color: var(--text-primary);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .cards-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .cards-row-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .files-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .portal-main {
    padding: 2.5rem 2rem;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 260px;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .portal-mobile-header {
    display: flex;
  }

  .portal-main {
    margin-left: 0;
    padding: 1.5rem;
    padding-top: 84px;
  }

  .cards-row,
  .cards-row-2,
  .cards-row-3 {
    grid-template-columns: 1fr;
  }

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

  .section-header {
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
  }

  .section-title {
    font-size: 1.65rem;
  }

  .chart-large {
    height: 260px;
  }

  .data-row {
    font-size: 0.8rem;
    padding: 0.85rem 1.1rem;
  }

  #section-billing .data-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
  }

  .billing-amount {
    font-size: 2.25rem;
  }

  .billing-card, .support-form-card, .support-history-card {
    padding: 1.5rem;
  }

  .login-container {
    padding: 1.5rem;
  }

  .login-title {
    font-size: 1.75rem;
  }

  /* Admin responsive */
  .admin-clients-table .data-row,
  .admin-requests-table .data-row,
  .admin-leads-table .data-row,
  .admin-revenue-table .data-row { grid-template-columns: 1fr 1fr; gap: 0.3rem; font-size: 0.8rem; }
  .client-detail-header { grid-template-columns: 1fr; }
  .filter-pills { flex-wrap: wrap; }
  .info-card-value { font-size: 1.2rem; }
  .data-row span { overflow-wrap: anywhere; min-width: 0; }
}

/* Mobile sidebar overlay */
@media (max-width: 768px) {
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur) var(--ease);
  }

  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
  }
}

/* ============================================
   ANALYTICS PAGE
   ============================================ */

.analytics-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.analytics-header .section-title { margin-bottom: 0.25rem; }
.analytics-header-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

/* Live badge */
.analytics-live-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  box-shadow: var(--shadow-sm);
}
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: livePulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* Range buttons */
.analytics-range-group { display: flex; gap: 2px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; box-shadow: var(--shadow-sm); }
.analytics-range-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  letter-spacing: 0.04em;
}
.analytics-range-btn:hover { color: var(--text-primary); }
.analytics-range-btn.active { background: var(--bg-input); color: var(--text-primary); }

/* Stat cards */
.analytics-stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.analytics-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.analytics-stat-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.analytics-stat-label {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.08em;
  font-weight: 500;
}
.analytics-stat-value {
  font-size: 1.95rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.025em;
}
.analytics-stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Chart block */
.analytics-chart-block {
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.analytics-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.analytics-chart-toggles { display: flex; gap: 2px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.analytics-metric-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: var(--font-sans);
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  font-weight: 500;
}
.analytics-metric-btn:hover { color: var(--text-primary); }
.analytics-metric-btn.active { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.analytics-chart-wrap { height: 220px; position: relative; }
.analytics-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Tables grid - 2x2 */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.analytics-table-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
}
.analytics-table-header {
  display: flex;
  justify-content: space-between;
  padding: 0 0 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  font-weight: 500;
}
.analytics-table-body { display: flex; flex-direction: column; gap: 0; }
.analytics-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.analytics-row:last-child { border-bottom: none; }
.analytics-row-label {
  font-size: 0.88rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.analytics-row-bar-wrap {
  width: 70px;
  height: 5px;
  background: var(--overlay-1);
  border-radius: 3px;
  overflow: hidden;
}
.analytics-row-bar {
  height: 100%;
  background: var(--purple);
  opacity: 0.55;
  border-radius: 3px;
  transition: width 0.5s var(--ease);
}
.analytics-row-count {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  min-width: 30px;
  text-align: right;
}
.analytics-empty-row {
  padding: 1rem 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.analytics-loading {
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}

/* Analytics responsive */
@media (max-width: 1024px) {
  .analytics-stats-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .analytics-stats-row { grid-template-columns: 1fr 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .analytics-header { flex-direction: column; }
}
@media (max-width: 480px) {
  .analytics-stats-row { grid-template-columns: 1fr; }
}

/* ============================================
   PHASED PORTAL — sidebar visibility + new sections
   ============================================ */

/* Phase-gated sidebar links: hide unless current body phase matches */
.sidebar-link[data-phase] { display: none; }
body[data-phase="building"] .sidebar-link[data-phase*="building"],
body[data-phase="choose-plan"] .sidebar-link[data-phase*="choose-plan"],
body[data-phase="starter"] .sidebar-link[data-phase*="starter"],
body[data-phase="growth"] .sidebar-link[data-phase*="growth"] {
  display: flex;
}

/* Disclaimer banner (building phase on Preview) */
.disclaimer-banner {
  background: var(--yellow-muted);
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: var(--text-primary);
  padding: 1.1rem 1.35rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 1.75rem;
}

/* Feature-request quota banner */
.quota-banner {
  background: var(--purple-muted);
  border: 1px solid var(--purple-border);
  color: var(--text-primary);
  padding: 1rem 1.35rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

/* Checklist */
.checklist-list { display: flex; flex-direction: column; gap: 0.55rem; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: opacity var(--dur-fast) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.checklist-item:hover {
  border-color: var(--border-hover);
  transform: translateX(2px);
}
.checklist-item.done {
  opacity: 0.55;
}
.checklist-item.done .checklist-title {
  text-decoration: line-through;
  color: var(--text-muted);
}
.checklist-check {
  font-family: var(--font-mono);
  color: var(--purple);
  font-weight: 700;
  width: 1.1rem;
  text-align: center;
}
.checklist-item.done .checklist-check { color: var(--green); }
.checklist-title { flex: 1; }
.checklist-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Choose Plan cards */
.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
  margin-top: 1.5rem;
}
.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.plan-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.plan-card-featured {
  border-color: var(--purple-border);
  box-shadow: 0 0 0 1px var(--purple-border), var(--shadow-md);
}
.plan-card-featured:hover {
  box-shadow: 0 0 0 1px var(--purple-border), var(--shadow-lg);
}
.plan-badge {
  position: absolute;
  top: -11px;
  right: 1.5rem;
  background: var(--purple);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.plan-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.plan-price {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1.75rem;
  font-family: var(--font-sans);
  letter-spacing: -0.03em;
  color: var(--text-primary);
}
.plan-price span {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0;
}
.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  flex: 1;
}
.plan-features li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding-left: 1.5rem;
  position: relative;
  line-height: 1.5;
}
.plan-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--purple);
  font-weight: 700;
}
.plan-btn { width: 100%; }

@media (max-width: 768px) {
  .plan-grid { grid-template-columns: 1fr; }
  .plan-card { padding: 1.75rem; }
}

/* ============================================
   PREVIEW SECTION
   ============================================ */

.preview-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--green);
  background: var(--green-muted);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-family: var(--font-mono);
}
.preview-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse-live 2s infinite;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.preview-browser {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-md);
}
.preview-browser-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  background: var(--bg-inset);
  border-bottom: 1px solid var(--border);
}
.preview-browser-dots {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.preview-browser-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--overlay-2);
}
.preview-browser-dots span:nth-child(1) { background: #ff5f57; }
.preview-browser-dots span:nth-child(2) { background: #febc2e; }
.preview-browser-dots span:nth-child(3) { background: #28c840; }
.preview-browser-url {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-browser-url svg { color: var(--green); flex-shrink: 0; }
.preview-browser-url span { overflow: hidden; text-overflow: ellipsis; }
.preview-browser-actions { flex-shrink: 0; }
.preview-open-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--purple);
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--purple-border);
  border-radius: var(--radius-sm);
  transition: all var(--dur-fast) var(--ease);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.preview-open-link:hover {
  background: var(--purple-muted);
  border-color: var(--purple);
}
.preview-browser-viewport {
  position: relative;
  width: 100%;
  background: var(--bg-primary);
  transition: max-width var(--dur-slow) var(--ease);
  margin: 0 auto;
}
.preview-browser-viewport iframe {
  width: 100%;
  height: 600px;
  border: none;
  display: block;
  background: #fff;
}
.preview-browser[data-device="tablet"] .preview-browser-viewport { max-width: 820px; }
.preview-browser[data-device="mobile"] .preview-browser-viewport { max-width: 400px; }
.preview-browser[data-device="tablet"] .preview-browser-viewport iframe,
.preview-browser[data-device="mobile"] .preview-browser-viewport iframe {
  height: 680px;
}
.preview-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  background: var(--bg-card);
  color: var(--text-secondary);
  text-align: center;
  padding: 2rem;
}
.preview-fallback svg { color: var(--text-muted); }
.preview-fallback-title { font-size: 1rem; color: var(--text-primary); margin: 0; font-weight: 600; }
.preview-fallback-sub { font-size: 0.85rem; color: var(--text-muted); margin: 0; max-width: 340px; }

.preview-stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
  margin-bottom: 2rem;
}
.preview-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.15rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: var(--shadow-sm);
}
.preview-stat-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-weight: 500;
}
.preview-stat-value {
  font-size: 1rem;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-stat-ok { color: var(--green); }

.preview-devices-row {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.preview-device-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--dur-fast) var(--ease);
}
.preview-device-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.preview-device-btn.active {
  background: var(--purple-muted);
  border-color: var(--purple-border);
  color: var(--purple);
}

@media (max-width: 768px) {
  .preview-stat-strip { grid-template-columns: repeat(2, 1fr); }
  .preview-browser-viewport iframe { height: 440px; }
}

/* ============================================
   ADMIN CLIENT DETAIL — domain edit, payment progress, timeline
   ============================================ */

/* Editable domain card */
.domain-display {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.45rem 0 0.3rem;
}
.domain-display .info-card-value { margin: 0; }
.domain-edit-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease);
}
.domain-edit-btn:hover { color: var(--purple); border-color: var(--purple-border); }
.domain-edit {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  margin: 0.45rem 0 0.3rem;
}
.domain-edit input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.domain-edit input:focus {
  outline: none;
  border-color: var(--purple-border);
}
.domain-save-btn { font-size: 0.78rem !important; padding: 0.5rem 1rem !important; }
.domain-cancel-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  cursor: pointer;
  font-family: var(--font-sans);
}
.domain-cancel-btn:hover { color: var(--text-primary); border-color: var(--border-hover); }

/* Payment progress bar */
.payment-progress-bar {
  margin-top: 0.85rem;
  height: 5px;
  background: var(--overlay-1);
  border-radius: 3px;
  overflow: hidden;
}
.payment-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple) 0%, var(--green) 100%);
  border-radius: 3px;
  transition: width var(--dur-slow) var(--ease);
}

/* Project timeline — sequential stepper (payment 1 → payment 2 → launch) */
.project-timeline {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-top: 1.25rem;
  padding: 1.1rem 0.3rem;
}
.timeline-step {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
}
.timeline-step-node {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: all var(--dur) var(--ease);
}
.timeline-step-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.timeline-step-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.005em;
}
.timeline-step-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.timeline-step-btn {
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--purple);
  letter-spacing: 0.005em;
  transition: color var(--dur-fast) var(--ease);
}
.timeline-step-btn:hover { color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--purple-border); text-underline-offset: 3px; }

/* Connectors between steps */
.timeline-connector {
  flex: 0 0 2.5rem;
  height: 1px;
  align-self: center;
  background: var(--border);
  transition: background var(--dur-slow) var(--ease);
}
.timeline-connector.done { background: var(--purple); }

/* Done state — purple, checkmark */
.timeline-step-done .timeline-step-node {
  background: var(--purple-muted);
  border-color: var(--purple-border);
  color: var(--purple);
}
.timeline-step-done .timeline-step-title { color: var(--text-primary); }
.timeline-step-done .timeline-step-sub { color: var(--text-secondary); }

/* Active state — solid purple, pulsing ring */
.timeline-step-active .timeline-step-node {
  background: var(--purple-muted);
  border-color: var(--purple);
  color: var(--purple);
  box-shadow: 0 0 0 4px var(--purple-muted);
}
.timeline-step-active .timeline-step-title,
.timeline-step-active .timeline-step-btn { color: var(--text-primary); }
.timeline-step-active .timeline-step-sub { color: var(--purple); }

/* Locked — dim, not clickable */
.timeline-step-locked .timeline-step-node {
  background: var(--bg-inset);
  border-color: var(--border);
  color: var(--text-muted);
  opacity: 0.6;
}
.timeline-step-locked .timeline-step-title { color: var(--text-muted); }
.timeline-step-locked .timeline-step-sub { color: var(--text-muted); opacity: 0.7; }

@media (max-width: 768px) {
  .project-timeline {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  .timeline-connector {
    width: 1px;
    height: 1.5rem;
    flex: none;
    margin-left: 1.1rem;
  }
}

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