/* ============================================================
   HTG APPLICATIONS PORTAL — Core Styles
   Prefix: ap-*    Theme attribute: data-theme (light|dark)
   Palette: #4AAB48 green + #00C2CB teal primary, #EF9623 orange
            + #FFD302 yellow accents, #225529 forest for depth.
   Layout: right-side liquid-glass sidebar, content on the left.
   ============================================================ */

:root {
  /* Brand colors */
  --ap-green:        #4AAB48;
  --ap-green-bright: #6FCF65;
  --ap-green-deep:   #2F7A2E;
  --ap-teal:         #00C2CB;
  --ap-teal-bright:  #3FE0E6;
  --ap-teal-deep:    #008B91;
  --ap-orange:       #EF9623;
  --ap-orange-deep:  #B2580F;
  --ap-yellow:       #FFD302;
  --ap-yellow-deep:  #D4A800;
  --ap-forest:       #225529;
  --ap-forest-deep:  #0F2A14;

  /* Gradients */
  --ap-grad-primary: linear-gradient(135deg, #4AAB48 0%, #00C2CB 100%);
  --ap-grad-cool:    linear-gradient(135deg, #00C2CB 0%, #4AAB48 55%, #2F7A2E 100%);
  --ap-grad-warm:    linear-gradient(135deg, #EF9623 0%, #FFD302 100%);
  --ap-grad-forest:  linear-gradient(180deg, #225529 0%, #0F2A14 100%);
  --ap-grad-chrome:  linear-gradient(180deg, #C8EAE0 0%, #4AAB48 28%, #00C2CB 55%, #4AAB48 82%, #D9F2EA 100%);

  /* Fonts */
  --ap-font-body:    'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --ap-font-display: 'Fraunces', Georgia, serif;
  --ap-font-mono:    'JetBrains Mono', 'Menlo', monospace;

  /* Layout */
  --ap-sidebar-w: 280px;
  --ap-topbar-h:  68px;

  /* Motion */
  --ap-ease:     cubic-bezier(0.22, 1, 0.36, 1);
  --ap-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ap-dur-q: 180ms;
  --ap-dur:   380ms;
  --ap-dur-s: 700ms;

  /* Radii */
  --ap-r-sm: 10px;
  --ap-r:    16px;
  --ap-r-lg: 22px;
  --ap-r-xl: 30px;
}

/* LIGHT MODE (default) */
:root[data-theme="light"],
:root:not([data-theme]) {
  --ap-bg-canvas:      #F1FBF4;
  --ap-bg-layer-1:     rgba(255, 255, 255, 0.72);
  --ap-bg-layer-2:     rgba(232, 248, 242, 0.68);
  --ap-bg-panel:       rgba(255, 255, 255, 0.72);
  --ap-bg-panel-solid: #FFFFFF;
  --ap-bg-input:       rgba(74, 171, 72, 0.06);
  --ap-bg-hover:       rgba(0, 194, 203, 0.1);
  --ap-bg-active:      rgba(0, 194, 203, 0.2);

  --ap-border:        rgba(47, 122, 46, 0.16);
  --ap-border-strong: rgba(47, 122, 46, 0.36);
  --ap-border-soft:   rgba(47, 122, 46, 0.08);

  --ap-text-primary:   #0E2A14;
  --ap-text-secondary: #3E5A44;
  --ap-text-muted:     #6D8A72;

  --ap-shadow-sm:    0 4px 14px rgba(15, 42, 20, 0.07);
  --ap-shadow:       0 18px 50px rgba(15, 42, 20, 0.14);
  --ap-shadow-lift:  0 30px 80px rgba(15, 42, 20, 0.22);
  --ap-shadow-glow:  0 0 60px rgba(0, 194, 203, 0.3);

  --ap-sidebar-bg: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.62) 0%,
    rgba(232, 248, 242, 0.52) 50%,
    rgba(210, 240, 233, 0.58) 100%
  );
}

/* DARK MODE */
:root[data-theme="dark"] {
  --ap-bg-canvas:      #061B10;
  --ap-bg-layer-1:     rgba(14, 36, 22, 0.85);
  --ap-bg-layer-2:     rgba(22, 50, 32, 0.6);
  --ap-bg-panel:       rgba(18, 40, 26, 0.58);
  --ap-bg-panel-solid: #0F2A17;
  --ap-bg-input:       rgba(255, 255, 255, 0.04);
  --ap-bg-hover:       rgba(0, 194, 203, 0.14);
  --ap-bg-active:      rgba(0, 194, 203, 0.24);

  --ap-border:        rgba(0, 194, 203, 0.2);
  --ap-border-strong: rgba(0, 194, 203, 0.42);
  --ap-border-soft:   rgba(255, 255, 255, 0.06);

  --ap-text-primary:   #E4F5E2;
  --ap-text-secondary: #B6D5B2;
  --ap-text-muted:     #7A9A80;

  --ap-shadow-sm:   0 4px 12px rgba(0, 0, 0, 0.35);
  --ap-shadow:      0 18px 50px rgba(0, 0, 0, 0.55);
  --ap-shadow-lift: 0 30px 80px rgba(0, 0, 0, 0.7);
  --ap-shadow-glow: 0 0 60px rgba(0, 194, 203, 0.38);

  --ap-sidebar-bg: linear-gradient(
    180deg,
    rgba(14, 36, 22, 0.5) 0%,
    rgba(14, 36, 22, 0.34) 50%,
    rgba(34, 85, 41, 0.42) 100%
  );
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-anchor: none; background: var(--ap-bg-canvas); }

body {
  font-family: var(--ap-font-body);
  background: var(--ap-bg-canvas);
  color: var(--ap-text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient animated mesh (under everything) */
body::before {
  content: '';
  position: fixed; inset: -10%;
  transform: translateZ(0);
  background:
    radial-gradient(circle 560px at 12% 18%, rgba(0, 194, 203, 0.2), transparent 55%),
    radial-gradient(circle 480px at 88% 20%, rgba(74, 171, 72, 0.16), transparent 55%),
    radial-gradient(circle 620px at 50% 96%, rgba(239, 150, 35, 0.1), transparent 55%);
  pointer-events: none;
  z-index: -1;
  /* HTG_LIGHT: infinite anim disabled */ animation: none;
}
:root[data-theme="dark"] body::before { opacity: 0.7; }

@keyframes apMeshDrift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(3%, -2%) scale(1.04); }
  100% { transform: translate(-2%, 3%) scale(0.98); }
}

a    { color: inherit; text-decoration: none; }
img  { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
code { font-family: var(--ap-font-mono); }

/* ============================================================
   SHELL — Content on left, sidebar on RIGHT
   ============================================================ */
.ap-shell { display: flex; min-height: 100vh; }

.ap-main {
  flex: 1;
  display: flex; flex-direction: column;
  /* Reserve space on the RIGHT for the sidebar */
  margin-right: var(--ap-sidebar-w);
  min-width: 0;
  transition: margin-right var(--ap-dur) var(--ap-ease);
}
@media (max-width: 1023px) { .ap-main { margin-right: 0; } }

.ap-content {
  flex: 1;
  padding: 2rem 2rem 3rem;
  animation: apFadeUp 500ms var(--ap-ease-out) both;
}
@media (max-width: 767px) { .ap-content { padding: 1.25rem 1.25rem 2rem; } }

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

/* ============================================================
   LIQUID GLASS SIDEBAR — right side, transparent, motion lit
   ============================================================ */
.ap-sidebar {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--ap-sidebar-w);
  background: var(--ap-sidebar-bg);
  /* HTG_LIGHT: backdrop-filter disabled */
  /* HTG_LIGHT: backdrop-filter disabled */
  border-left: 1px solid var(--ap-border);
  display: flex; flex-direction: column;
  z-index: 50;
  overflow-y: auto;
  transition: transform var(--ap-dur) var(--ap-ease);
  isolation: isolate;
}

/* Liquid light effect inside the sidebar */
.ap-sidebar::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 90% 50% at 60% 0%, rgba(0, 194, 203, 0.22), transparent 60%),
    radial-gradient(ellipse 70% 40% at 30% 100%, rgba(74, 171, 72, 0.18), transparent 60%);
  pointer-events: none;
  z-index: -1;
  /* HTG_LIGHT: infinite anim disabled */ animation: none;
}
@keyframes apSidebarGlow {
  0%   { transform: translate(0, 0); opacity: 0.85; }
  100% { transform: translate(-3%, 2%); opacity: 1; }
}

/* Liquid flowing accent line */
.ap-sidebar::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(0, 194, 203, 0.4) 20%,
    rgba(74, 171, 72, 0.5) 50%,
    rgba(0, 194, 203, 0.4) 80%,
    transparent 100%
  );
  background-size: 100% 200%;
  /* HTG_LIGHT: infinite anim disabled */ animation: none;
  pointer-events: none;
}
@keyframes apAccentFlow {
  0%   { background-position: 0% 0%; }
  100% { background-position: 0% 100%; }
}

@media (max-width: 1023px) {
  .ap-sidebar { transform: translateX(100%); }
  .ap-sidebar.is-open { transform: translateX(0); box-shadow: var(--ap-shadow-lift); }
}

/* Sidebar head with logo */
.ap-sidebar-head {
  padding: 1.4rem 1.25rem 1.25rem;
  border-bottom: 1px solid var(--ap-border);
}
.ap-sidebar-brand {
  display: flex; align-items: center; gap: 0.75rem;
  transition: transform var(--ap-dur-q) var(--ap-ease);
}
.ap-sidebar-brand:hover { transform: translateX(-2px); }
.ap-sidebar-logo {
  width: 46px; height: 46px; object-fit: contain;
  background: #FFFFFF;
  border-radius: 12px; padding: 5px;
  box-shadow: 0 6px 18px rgba(0, 194, 203, 0.32);
}
.ap-sidebar-brand-text { line-height: 1.2; }
.ap-sidebar-title {
  font-family: var(--ap-font-display);
  font-weight: 700; font-size: 1.12rem;
  background: var(--ap-grad-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ap-sidebar-sub {
  font-size: 0.7rem; color: var(--ap-text-muted);
  letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 600;
}

/* Nav */
.ap-sidebar-nav { flex: 1; padding: 1rem 0.75rem; }
.ap-nav-group { margin-bottom: 1.25rem; }
.ap-nav-label {
  font-size: 0.68rem; color: var(--ap-text-muted);
  letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 700;
  padding: 0 0.6rem 0.5rem;
}
.ap-nav-link {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  color: var(--ap-text-secondary);
  font-weight: 500; font-size: 0.92rem;
  transition: background var(--ap-dur-q), color var(--ap-dur-q), transform var(--ap-dur-q);
  position: relative;
}
.ap-nav-link:hover {
  background: var(--ap-bg-hover);
  color: var(--ap-text-primary);
  transform: translateX(-2px);
}
.ap-nav-link.is-active {
  background: var(--ap-bg-active);
  color: var(--ap-text-primary);
  font-weight: 600;
}
.ap-nav-link.is-active::before {
  content: '';
  position: absolute; left: -0.75rem; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 2px;
  background: var(--ap-grad-primary);
  box-shadow: 0 0 12px rgba(0, 194, 203, 0.6);
}
.ap-nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.ap-nav-badge {
  margin-left: auto;
  font-size: 0.65rem; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
  background: var(--ap-grad-warm); color: #2B1304;
}

/* Sidebar foot — user card */
.ap-sidebar-foot {
  border-top: 1px solid var(--ap-border);
  padding: 0.9rem 0.75rem;
}
.ap-user-card {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.6rem; border-radius: 12px;
  background: var(--ap-bg-input);
  border: 1px solid var(--ap-border);
}
.ap-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--ap-grad-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0;
  box-shadow: inset 1px 1px 2px rgba(255,255,255,0.4), 0 4px 12px rgba(0,194,203,0.35);
}
.ap-user-text { flex: 1; min-width: 0; }
.ap-user-name { font-size: 0.85rem; font-weight: 600; color: var(--ap-text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-user-role { font-size: 0.72rem; color: var(--ap-text-muted); }
.ap-user-logout {
  width: 32px; height: 32px; border-radius: 8px;
  color: var(--ap-text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--ap-dur-q);
}
.ap-user-logout:hover { background: var(--ap-bg-hover); color: var(--ap-orange); transform: rotate(-8deg); }
.ap-user-logout svg { width: 16px; height: 16px; }

/* ============================================================
   TOPBAR
   ============================================================ */
.ap-topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--ap-topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 0 1.75rem;
  background: var(--ap-bg-layer-1);
  /* HTG_LIGHT: backdrop-filter disabled */
  /* HTG_LIGHT: backdrop-filter disabled */
  border-bottom: 1px solid var(--ap-border);
}
@media (max-width: 767px) { .ap-topbar { padding: 0 1rem; } }

.ap-topbar-crumb {
  font-size: 0.88rem; color: var(--ap-text-secondary); font-weight: 500;
}
.ap-topbar-actions { display: flex; align-items: center; gap: 0.4rem; }

.ap-icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--ap-border);
  background: var(--ap-bg-input);
  color: var(--ap-text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--ap-dur-q);
}
.ap-icon-btn:hover { border-color: var(--ap-border-strong); color: var(--ap-teal-deep); transform: translateY(-1px); }
:root[data-theme="dark"] .ap-icon-btn:hover { color: var(--ap-teal-bright); }

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

.ap-theme-icon--sun  { display: block; }
.ap-theme-icon--moon { display: none; }
:root[data-theme="dark"] .ap-theme-icon--sun  { display: block; color: #FFD28A; }
:root[data-theme="dark"] .ap-theme-icon--moon { display: none; }
:root[data-theme="light"] .ap-theme-icon--sun  { display: none; }
:root[data-theme="light"] .ap-theme-icon--moon { display: block; color: var(--ap-green-deep); }

.ap-sidebar-toggle { display: none; }
@media (max-width: 1023px) { .ap-sidebar-toggle { display: inline-flex; } }

/* ============================================================
   PAGE LEAD + HEADINGS
   ============================================================ */
.ap-page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.ap-page-title {
  font-family: var(--ap-font-display);
  font-weight: 700; font-size: 1.8rem; line-height: 1.15;
  color: var(--ap-text-primary);
}
.ap-page-title-accent {
  background: var(--ap-grad-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ap-page-sub { color: var(--ap-text-secondary); margin-top: 0.25rem; font-size: 0.95rem; }

/* ============================================================
   BUTTONS
   ============================================================ */
.ap-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.68rem 1.1rem;
  border-radius: 12px;
  font-weight: 600; font-size: 0.9rem;
  border: 1px solid var(--ap-border-strong);
  background: var(--ap-bg-panel);
  color: var(--ap-text-primary);
  transition: all var(--ap-dur-q) var(--ap-ease);
  letter-spacing: 0.01em;
}
.ap-btn:hover { border-color: var(--ap-teal); background: var(--ap-bg-hover); transform: translateY(-1px); }
.ap-btn--primary {
  background: var(--ap-grad-primary); color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 26px rgba(0, 194, 203, 0.32);
}
.ap-btn--primary:hover { box-shadow: 0 16px 36px rgba(0, 194, 203, 0.46); transform: translateY(-2px); }
.ap-btn--warm {
  background: var(--ap-grad-warm); color: #2B1304;
  border-color: transparent;
  box-shadow: 0 10px 26px rgba(239, 150, 35, 0.32);
}
.ap-btn--warm:hover { box-shadow: 0 16px 36px rgba(239, 150, 35, 0.45); transform: translateY(-2px); }
.ap-btn--ghost { background: transparent; }
.ap-btn--full { width: 100%; }
.ap-btn--sm { padding: 0.42rem 0.85rem; font-size: 0.82rem; }
.ap-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ============================================================
   GLASS PANELS
   ============================================================ */
.ap-panel {
  position: relative;
  background: var(--ap-bg-panel);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-lg);
  /* HTG_LIGHT: backdrop-filter disabled */
  /* HTG_LIGHT: backdrop-filter disabled */
  box-shadow: var(--ap-shadow-sm);
  overflow: hidden;
  isolation: isolate;
}
.ap-panel::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 40% at 20% 0%, rgba(0, 194, 203, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 30% at 80% 100%, rgba(74, 171, 72, 0.08), transparent 60%);
  pointer-events: none;
  z-index: -1;
}
.ap-panel-head {
  padding: 1.1rem 1.35rem;
  border-bottom: 1px solid var(--ap-border-soft);
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.75rem; flex-wrap: wrap;
}
.ap-panel-title {
  font-family: var(--ap-font-display);
  font-weight: 700; font-size: 1.1rem;
  color: var(--ap-text-primary);
}
.ap-panel-body { padding: 1.35rem; }

/* ============================================================
   HERO BANNER ON DASHBOARD
   ============================================================ */
.ap-hero {
  position: relative;
  padding: 2rem 2.2rem;
  border-radius: var(--ap-r-xl);
  background: var(--ap-grad-forest);
  color: #F4FBF2;
  overflow: hidden;
  box-shadow: var(--ap-shadow-lift);
  margin-bottom: 1.75rem;
  isolation: isolate;
}
.ap-hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle 380px at 15% 25%, rgba(0, 194, 203, 0.3), transparent 60%),
    radial-gradient(circle 420px at 85% 80%, rgba(74, 171, 72, 0.32), transparent 60%);
  z-index: -1;
}
.ap-hero-inner {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap;
}
.ap-hero-avatar {
  width: 78px; height: 78px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.35);
  background: var(--ap-grad-chrome);
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.3), inset 2px 2px 4px rgba(255,255,255,0.45);
}
.ap-hero-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ap-hero-avatar-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--ap-forest-deep); font-weight: 700; font-family: var(--ap-font-display); font-size: 1.8rem;
}
.ap-hero-text { flex: 1; min-width: 200px; }
.ap-hero-eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
  color: #D7F5D1;
  margin-bottom: 0.6rem;
}
.ap-hero-eyebrow-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ap-yellow);
  box-shadow: 0 0 8px var(--ap-yellow);
  /* HTG_LIGHT: infinite anim disabled */ animation: none;
}
@keyframes apPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.ap-hero-title {
  font-family: var(--ap-font-display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.1;
  font-weight: 700;
  color: #FFFFFF;
}
.ap-hero-sub { margin-top: 0.35rem; color: #CDE8CA; font-size: 0.95rem; }

/* WebGL mount on hero (subtle orb in corner) */
.ap-hero-orb {
  position: absolute;
  right: -20px; top: 50%;
  transform: translateY(-50%);
  width: 200px; height: 200px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.9;
}
@media (max-width: 640px) { .ap-hero-orb { display: none; } }

/* ============================================================
   STEP CARDS (dashboard journey)
   ============================================================ */
.ap-steps { display: flex; flex-direction: column; gap: 0.9rem; }

.ap-step {
  position: relative;
  display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap;
  padding: 1.2rem 1.35rem;
  background: var(--ap-bg-panel);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r);
  /* HTG_LIGHT: backdrop-filter disabled */
  /* HTG_LIGHT: backdrop-filter disabled */
  transition: all var(--ap-dur) var(--ap-ease);
  box-shadow: var(--ap-shadow-sm);
}
.ap-step:hover { transform: translateY(-2px); box-shadow: var(--ap-shadow); border-color: var(--ap-border-strong); }

.ap-step.is-pending { opacity: 0.62; }

.ap-step-badge {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem;
  flex-shrink: 0;
  font-family: var(--ap-font-display);
}
.ap-step.is-active .ap-step-badge {
  background: var(--ap-grad-primary);
  color: #fff;
  box-shadow: inset 1px 1px 2px rgba(255,255,255,0.4), 0 8px 22px rgba(0,194,203,0.35);
  /* HTG_LIGHT: infinite anim disabled */ animation: none;
}
@keyframes apBadgePulse {
  0%, 100% { box-shadow: inset 1px 1px 2px rgba(255,255,255,0.4), 0 8px 22px rgba(0,194,203,0.35); }
  50%      { box-shadow: inset 1px 1px 2px rgba(255,255,255,0.4), 0 12px 30px rgba(0,194,203,0.55); }
}
.ap-step.is-completed .ap-step-badge {
  background: linear-gradient(135deg, #2F7A2E 0%, #4AAB48 100%);
  color: #fff;
}
.ap-step.is-pending .ap-step-badge {
  background: var(--ap-bg-input);
  color: var(--ap-text-muted);
  border: 1px dashed var(--ap-border);
}
.ap-step-badge svg { width: 22px; height: 22px; }

.ap-step-text { flex: 1; min-width: 180px; }
.ap-step-title {
  font-family: var(--ap-font-display);
  font-size: 1.1rem; font-weight: 700;
  color: var(--ap-text-primary);
  margin-bottom: 0.15rem;
}
.ap-step-state {
  font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.ap-step.is-active    .ap-step-state { color: var(--ap-teal-deep); }
:root[data-theme="dark"] .ap-step.is-active .ap-step-state { color: var(--ap-teal-bright); }
.ap-step.is-completed .ap-step-state { color: var(--ap-green-deep); }
:root[data-theme="dark"] .ap-step.is-completed .ap-step-state { color: var(--ap-green-bright); }
.ap-step.is-pending   .ap-step-state { color: var(--ap-text-muted); }

.ap-step-desc { margin-top: 0.2rem; font-size: 0.88rem; color: var(--ap-text-secondary); }
.ap-step-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

/* ============================================================
   AUTH PAGES (login, signup)
   ============================================================ */
.ap-auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
  position: relative;
}
.ap-auth-mesh {
  position: absolute; inset: 0;
  pointer-events: none; overflow: hidden;
  z-index: 0;
}
.ap-auth-mesh span {
  position: absolute;
  border-radius: 50%;
  /* HTG_LIGHT: filter:blur disabled */
  opacity: 0.6;
}
.ap-auth-mesh span:nth-child(1) {
  width: 420px; height: 420px;
  top: -8%; left: -6%;
  background: var(--ap-teal);
  /* HTG_LIGHT: infinite anim disabled */ animation: none;
}
.ap-auth-mesh span:nth-child(2) {
  width: 380px; height: 380px;
  bottom: -10%; right: -8%;
  background: var(--ap-green);
  /* HTG_LIGHT: infinite anim disabled */ animation: none;
}
.ap-auth-mesh span:nth-child(3) {
  width: 280px; height: 280px;
  top: 45%; right: 20%;
  background: var(--ap-orange);
  opacity: 0.28;
  /* HTG_LIGHT: infinite anim disabled */ animation: none;
}
@keyframes apAuthFloat1 { 0% { transform: translate(0, 0); } 100% { transform: translate(40px, 30px); } }
@keyframes apAuthFloat2 { 0% { transform: translate(0, 0); } 100% { transform: translate(-50px, -40px); } }

.ap-auth-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 460px;
  padding: 2.2rem;
  background: var(--ap-bg-panel);
  /* HTG_LIGHT: backdrop-filter disabled */
  /* HTG_LIGHT: backdrop-filter disabled */
  border: 1px solid var(--ap-border-strong);
  border-radius: var(--ap-r-lg);
  box-shadow: var(--ap-shadow-lift);
}
.ap-auth-card--wide { max-width: 720px; }

.ap-auth-brand {
  display: flex; align-items: center; gap: 0.7rem;
  margin-bottom: 1.4rem;
}
.ap-auth-brand img {
  width: auto;
  height: 64px;
  max-width: 200px;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}
.ap-auth-brand .brand-logo-img--light { display: block; }
.ap-auth-brand .brand-logo-img--dark  { display: none; }
:root[data-theme="dark"] .ap-auth-brand .brand-logo-img--light,
[data-theme="dark"] .ap-auth-brand .brand-logo-img--light { display: none; }
:root[data-theme="dark"] .ap-auth-brand .brand-logo-img--dark,
[data-theme="dark"] .ap-auth-brand .brand-logo-img--dark  { display: block; }
.ap-auth-brand-text .ap-sidebar-title { font-size: 1.05rem; }

.ap-auth-title {
  font-family: var(--ap-font-display);
  font-weight: 700; font-size: 1.7rem; line-height: 1.15;
  color: var(--ap-text-primary);
  margin-bottom: 0.35rem;
}
.ap-auth-sub { color: var(--ap-text-secondary); font-size: 0.92rem; margin-bottom: 1.4rem; }

.ap-field { margin-bottom: 0.95rem; }
.ap-field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ap-text-primary); margin-bottom: 0.3rem; }
.ap-field input, .ap-field select, .ap-field textarea {
  width: 100%;
  padding: 0.78rem 0.95rem;
  background: var(--ap-bg-input);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r-sm);
  color: var(--ap-text-primary);
  font-family: inherit; font-size: 1rem; /* 1rem = 16px — prevents iOS zoom on focus */
  transition: border-color 180ms, box-shadow 180ms, background 180ms;
}
.ap-field input:focus, .ap-field select:focus, .ap-field textarea:focus {
  outline: none;
  border-color: var(--ap-teal);
  box-shadow: 0 0 0 4px rgba(0, 194, 203, 0.2);
  background: var(--ap-bg-panel-solid);
}
.ap-field-help { font-size: 0.78rem; color: var(--ap-text-muted); margin-top: 0.25rem; }
.ap-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
@media (max-width: 560px) { .ap-field-row { grid-template-columns: 1fr; } }

.ap-auth-error {
  padding: 0.7rem 0.9rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--ap-r-sm);
  color: #B91C1C;
  font-size: 0.88rem; font-weight: 500;
  margin-bottom: 1rem;
}
:root[data-theme="dark"] .ap-auth-error { color: #FFB8A8; background: rgba(198, 59, 30, 0.22); }

.ap-auth-foot { margin-top: 1.25rem; text-align: center; font-size: 0.88rem; color: var(--ap-text-secondary); }
.ap-auth-foot a { color: var(--ap-teal-deep); font-weight: 600; }
:root[data-theme="dark"] .ap-auth-foot a { color: var(--ap-teal-bright); }

/* Signup choice tiles */
.ap-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.4rem; }
@media (max-width: 520px) { .ap-choice-grid { grid-template-columns: 1fr; } }

.ap-choice {
  position: relative;
  padding: 1.6rem 1.25rem;
  background: var(--ap-bg-input);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-r);
  transition: all var(--ap-dur) var(--ap-ease);
  cursor: pointer;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}
.ap-choice::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--ap-grad-primary);
  opacity: 0; z-index: -1;
  transition: opacity var(--ap-dur) var(--ap-ease);
}
.ap-choice:hover { transform: translateY(-4px); border-color: var(--ap-teal); box-shadow: var(--ap-shadow); }
.ap-choice:hover::before { opacity: 0.08; }
.ap-choice-coin {
  width: 64px; height: 64px; border-radius: 50%;
  margin: 0 auto 0.85rem;
  background: var(--ap-grad-chrome);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 2px 2px 4px rgba(255,255,255,0.5), inset -2px -2px 6px rgba(0,0,0,0.2), 0 10px 26px rgba(0,194,203,0.35);
}
.ap-choice-coin svg { width: 28px; height: 28px; color: var(--ap-forest-deep); }
.ap-choice-title { font-family: var(--ap-font-display); font-size: 1.2rem; font-weight: 700; color: var(--ap-text-primary); margin-bottom: 0.25rem; }
.ap-choice-desc { font-size: 0.85rem; color: var(--ap-text-secondary); }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.ap-flash {
  padding: 0.85rem 1.1rem;
  background: rgba(0, 194, 203, 0.14);
  border: 1px solid var(--ap-border-strong);
  border-radius: var(--ap-r-sm);
  color: var(--ap-teal-deep);
  font-weight: 500;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
:root[data-theme="dark"] .ap-flash { color: var(--ap-teal-bright); }
.ap-flash--success { background: rgba(74, 171, 72, 0.14); color: var(--ap-green-deep); }
:root[data-theme="dark"] .ap-flash--success { color: var(--ap-green-bright); }
.ap-flash--error { background: rgba(198, 59, 30, 0.16); border-color: rgba(198, 59, 30, 0.4); color: #8B1E0E; }
:root[data-theme="dark"] .ap-flash--error { color: #FFB8A8; }
.ap-flash--warning { background: rgba(239, 150, 35, 0.16); border-color: rgba(239, 150, 35, 0.4); color: var(--ap-orange-deep); }

/* ============================================================
   COMING SOON (placeholder)
   ============================================================ */
.ap-coming {
  min-height: 60vh;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 2rem;
}
.ap-coming-inner { max-width: 480px; }
.ap-coming-icon {
  width: 82px; height: 82px; border-radius: 50%;
  margin: 0 auto 1.25rem;
  background: var(--ap-grad-chrome);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 2px 2px 4px rgba(255,255,255,0.5), inset -2px -2px 6px rgba(0,0,0,0.2), 0 16px 40px rgba(0,194,203,0.32);
}
.ap-coming-icon svg { width: 34px; height: 34px; color: var(--ap-forest-deep); }
.ap-coming h1 { font-family: var(--ap-font-display); font-size: 1.7rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--ap-text-primary); }
.ap-coming p { color: var(--ap-text-secondary); margin-bottom: 1.25rem; }

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
.ap-reveal {
  opacity: 0;
  transition: opacity 480ms ease;
}
.ap-reveal.is-visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .ap-reveal { opacity: 1; transition: none; } }

/* ===== STAGGERED REVEAL FOR CLIENT PAGES (BATCH 6C) ===== */
[data-ap-surface="client"] .ap-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 700ms cubic-bezier(0.22, 1, 0.36, 1),
              transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
  /* HTG_LIGHT: will-change disabled */
}
[data-ap-surface="client"] .ap-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Sequential delay for child reveals inside same parent */
[data-ap-surface="client"] .ap-reveal:nth-of-type(1) { transition-delay: 0ms; }
[data-ap-surface="client"] .ap-reveal:nth-of-type(2) { transition-delay: 80ms; }
[data-ap-surface="client"] .ap-reveal:nth-of-type(3) { transition-delay: 160ms; }
[data-ap-surface="client"] .ap-reveal:nth-of-type(4) { transition-delay: 240ms; }
[data-ap-surface="client"] .ap-reveal:nth-of-type(5) { transition-delay: 320ms; }

/* Hide overflow-anchor jumps caused by reveal */
[data-ap-surface="client"] {
  overflow-anchor: auto;
}

/* No-JS fallback */
.no-js [data-ap-surface="client"] .ap-reveal {
  opacity: 1 !important;
  transform: none !important;
}


/* HTG smart logo, swaps light / dark based on data-theme */
.htg-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}
.htg-logo__img {
  display: block;
  height: 36px;
  width: auto;
  max-width: 100%;
}
.htg-logo__img--dark { display: none; }
:root[data-theme="dark"] .htg-logo__img--light,
:root[data-theme="dark"] .htg-logo__img--light { display: none; }
:root[data-theme="dark"] .htg-logo__img--dark,
:root[data-theme="dark"] .htg-logo__img--dark { display: block; }

/* Sidebar / header context overrides */
.ap-sidebar .htg-logo__img,
.cms-sidebar .htg-logo__img,
.em-sidebar .htg-logo__img,
.pt-sidebar .htg-logo__img {
  height: 32px;
}
.nav .htg-logo__img,
.htg-header .htg-logo__img {
  height: 38px;
}

/* APPS PORTAL LOGO RULE */
.ap-topbar .nav__logo-img,
.ap-sidebar .nav__logo-img,
.ap-auth-brand .nav__logo-img {
  display: block !important;
  height: 40px !important;
  width: auto !important;
  max-width: 160px !important;
  object-fit: contain !important;
}


.em-sidebar-logo,
.pt-sidebar-logo,
.cms-sidebar-logo,
.ap-sidebar-logo {
  height: 36px !important;
  width: auto !important;
  max-width: 130px !important;
  object-fit: contain !important;
}

/* LOGO BOX NEUTRALIZATION v2 — kill white box on the IMG element itself */
.em-sidebar-logo,
.pt-sidebar-logo,
.cms-sidebar-logo,
.ap-sidebar-logo,
.em-auth-logo,
.pt-auth-logo,
.cms-auth-logo,
.ap-auth-logo {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* Sidebar logos: clean size */
.em-sidebar-logo,
.pt-sidebar-logo,
.cms-sidebar-logo,
.ap-sidebar-logo {
  width: auto !important;
  height: 36px !important;
  max-width: 130px !important;
  object-fit: contain !important;
}

/* Auth logos: clean size */
.em-auth-logo,
.pt-auth-logo,
.cms-auth-logo,
.ap-auth-logo {
  width: auto !important;
  height: 50px !important;
  max-width: 180px !important;
  object-fit: contain !important;
}

/* ===== Phase 2E.1: applicant referral widget ===== */
.ap-referral-widget {
  margin: 1rem 0.85rem 0.5rem; padding: 0.95rem 1rem; border-radius: 14px;
  background: linear-gradient(135deg, rgba(74,171,72,0.08), rgba(239,150,35,0.06));
  border: 1.5px solid rgba(74,171,72,0.22);
  display: flex; flex-direction: column; gap: 0.55rem;
}
.ap-referral-title { font-weight: 700; font-size: 0.92rem; color: var(--ap-text-primary); }
.ap-referral-sub { font-size: 0.78rem; color: var(--ap-text-secondary); line-height: 1.35; }
.ap-referral-code {
  display: flex; align-items: center; gap: 0.45rem;
  background: rgba(74,171,72,0.07); border: 1px dashed rgba(74,171,72,0.35);
  border-radius: 8px; padding: 0.45rem 0.55rem;
}
.ap-referral-code code { flex: 1; font-size: 0.82rem; font-weight: 700; color: #225529; background: transparent; letter-spacing: 0.02em; }
.ap-referral-copy { background: transparent; border: 0; color: #4AAB48; cursor: pointer; padding: 0.2rem; border-radius: 6px; transition: background 0.15s; }
.ap-referral-copy:hover { background: rgba(74,171,72,0.15); }
.ap-referral-copy.is-copied { color: #225529; background: rgba(74,171,72,0.25); }
.ap-referral-stats { display: flex; gap: 0.85rem; font-size: 0.74rem; color: var(--ap-text-secondary); }
.ap-referral-stats strong { color: var(--ap-text-primary); }
.ap-referral-share-btn {
  display: block; text-align: center; font-size: 0.82rem; font-weight: 600;
  text-decoration: none; padding: 0.45rem 0.6rem; border-radius: 8px;
  background: linear-gradient(135deg, #4AAB48, #225529); color: #fff; transition: transform 0.15s;
}
.ap-referral-share-btn:hover { transform: translateY(-1px); color: #fff; }
.ap-referral-terms { font-size: 0.72rem; color: var(--ap-text-muted); text-align: center; text-decoration: underline; }

/* ===== Phase 2E.1 dark-mode polish for referral widget ===== */
/* Light mode: keep the existing soft-green tint (already styled above). */
/* Dark mode: brighter borders, deeper translucent fill, lighter text. */
[data-theme="dark"] .ap-referral-widget {
  background: linear-gradient(135deg,
              rgba(74, 171, 72, 0.18),
              rgba(239, 150, 35, 0.12));
  border: 1.5px solid rgba(255, 211, 2, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
[data-theme="dark"] .ap-referral-title {
  color: #FFD302;
}
[data-theme="dark"] .ap-referral-sub {
  color: rgba(255, 255, 255, 0.72);
}
[data-theme="dark"] .ap-referral-code {
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed rgba(255, 211, 2, 0.45);
}
[data-theme="dark"] .ap-referral-code code {
  color: #FFE066;
}
[data-theme="dark"] .ap-referral-copy {
  color: #FFD302;
}
[data-theme="dark"] .ap-referral-copy:hover {
  background: rgba(255, 211, 2, 0.18);
}
[data-theme="dark"] .ap-referral-copy.is-copied {
  background: rgba(74, 171, 72, 0.45);
  color: #fff;
}
[data-theme="dark"] .ap-referral-stats {
  color: rgba(255, 255, 255, 0.65);
}
[data-theme="dark"] .ap-referral-stats strong {
  color: #fff;
}
[data-theme="dark"] .ap-referral-share-btn {
  background: linear-gradient(135deg, #4AAB48, #2d7d2c);
  box-shadow: 0 2px 8px rgba(74, 171, 72, 0.4);
}
[data-theme="dark"] .ap-referral-terms {
  color: rgba(255, 255, 255, 0.5);
}

/* ============================================================
   HTG_SIDEBAR_FIX — restores opaque sidebar background (no blur)
   The earlier strip removed backdrop-filter, which left the sidebar
   transparent. This adds a SOLID background so the sidebar is opaque
   without using the GPU-heavy blur.
   ============================================================ */
#apSidebar,
.ap-sidebar,
[data-ap-sidebar] {
  /* Solid backgrounds — no blur, no GPU cost */
  background: var(--ap-bg-panel-solid, #ffffff) !important;
  background-color: var(--ap-bg-panel-solid, #ffffff) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* Dark-mode sidebar background */
:root[data-theme="dark"] #apSidebar,
:root[data-theme="dark"] .ap-sidebar,
:root[data-theme="dark"] [data-ap-sidebar] {
  background: #0e1f17 !important;
  background-color: #0e1f17 !important;
}

/* Make sure sidebar sits above page content with proper stacking */
#apSidebar,
.ap-sidebar {
  z-index: 100 !important;
  position: fixed !important;
}

/* The sidebar header (logo + 'My Portal Applications') should not
   block clicks meant for the close overlay area. Keep header interactive
   for its own content only. */
#apSidebar > header,
.ap-sidebar > header,
#apSidebar .ap-sidebar-head,
.ap-sidebar .ap-sidebar-head,
#apSidebar .ap-sidebar-brand,
.ap-sidebar .ap-sidebar-brand {
  position: relative;
  z-index: 2;
  background: inherit !important;
}

/* Overlay behind sidebar — clicking it closes the sidebar.
   Make sure it shows when sidebar is open, with proper backdrop. */
.ap-sidebar-overlay,
[data-ap-sidebar-overlay] {
  position: fixed !important;
  inset: 0;
  background: rgba(0, 0, 0, 0.5) !important;
  z-index: 99 !important;
  display: none;
}
#apSidebar.is-open ~ .ap-sidebar-overlay,
#apSidebar.is-open + .ap-sidebar-overlay,
.ap-sidebar.is-open ~ .ap-sidebar-overlay,
.ap-sidebar.is-open + .ap-sidebar-overlay {
  display: block !important;
}

/* Ensure nothing behind the sidebar bleeds through visually */
#apSidebar.is-open,
.ap-sidebar.is-open {
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

/* ── iOS zoom prevention (global, touch devices only) ──────────────────
   iOS Safari zooms the viewport when a focused input's computed font-size
   is below 16px.  This rule targets only touch/coarse-pointer devices so
   desktop appearance is unchanged.  !important wins any specificity race
   from other component stylesheets. ── */
@media (hover: none) and (pointer: coarse) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  input[type="search"],
  input[type="url"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="time"],
  input[type="month"],
  input[type="week"],
  select,
  textarea {
    font-size: 16px !important;
  }
}
