/* =============================================================
   Sky Platform Portal — portal.css
   Landing page + Product Launcher
   Stack: Bootstrap 5.3.3 + Bootstrap Icons 1.11.3 + Sarabun
   ============================================================= */

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

html, body {
  font-family: 'Sarabun', sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* -------- Design tokens ------------------------------------ */
:root {
  /* Product gradients */
  --grad-ledger:  linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --grad-hr:      linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
  --grad-buildq:  linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --grad-ops:     linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);

  --c-ledger:  #3b82f6;
  --c-hr:      #14b8a6;
  --c-buildq:  #f59e0b;
  --c-ops:     #8b5cf6;

  /* Portal surfaces (landing — always dark) */
  --sky-bg:           #06091a;
  --sky-surface:      rgba(255,255,255,.04);
  --sky-surface-2:    rgba(255,255,255,.07);
  --sky-border:       rgba(255,255,255,.08);
  --sky-border-2:     rgba(255,255,255,.14);
  --sky-text:         #f0f4ff;
  --sky-text-mute:    #8fa1c7;
  --sky-text-faint:   #4e5f85;

  /* Home page (light/dark switchable) */
  --home-bg:          #f1f5f9;
  --home-surface:     #ffffff;
  --home-border:      #e2e8f0;
  --home-text-1:      #0f172a;
  --home-text-2:      #475569;
  --home-text-3:      #94a3b8;
  --home-topbar-bg:   #ffffff;
  --home-topbar-border: #e2e8f0;

  /* Radii */
  --r-sm:  8px;
  --r:     14px;
  --r-lg:  20px;
  --r-xl:  28px;
}

[data-bs-theme="dark"] {
  --home-bg:          #0b1120;
  --home-surface:     #131c2f;
  --home-border:      #1f2a44;
  --home-text-1:      #e5e9f4;
  --home-text-2:      #a8b3d1;
  --home-text-3:      #6e7aa3;
  --home-topbar-bg:   #0d1425;
  --home-topbar-border: #1a2540;
}

/* -------- Shared typography -------------------------------- */
.gradient-text {
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   LANDING PAGE STYLES
   ============================================================ */

/* ---- Body (landing) --------------------------------------- */
body.is-landing {
  background: var(--sky-bg);
  color: var(--sky-text);
  min-height: 100vh;
}

/* ---- Noise texture overlay -------------------------------- */
body.is-landing::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 0;
}

/* ---- Gradient mesh background ----------------------------- */
.sky-bg-mesh {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
}
.sky-orb {
  position: absolute; border-radius: 50%;
  filter: blur(100px);
  animation: orb-drift 12s ease-in-out infinite;
}
.sky-orb-1 {
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(59,130,246,.28) 0%, transparent 70%);
  top: -200px; left: -100px;
  animation-delay: 0s;
}
.sky-orb-2 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(139,92,246,.22) 0%, transparent 70%);
  top: -100px; right: -150px;
  animation-delay: -4s;
}
.sky-orb-3 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(20,184,166,.18) 0%, transparent 70%);
  bottom: 10%; left: 20%;
  animation-delay: -8s;
}
.sky-orb-4 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(245,158,11,.14) 0%, transparent 70%);
  bottom: -100px; right: 10%;
  animation-delay: -2s;
}

@keyframes orb-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -40px) scale(1.05); }
  66%       { transform: translate(-20px, 20px) scale(.97); }
}

/* Subtle grid overlay */
.sky-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ---- Navigation ------------------------------------------- */
.portal-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  padding: .875rem 2rem;
  display: flex; align-items: center; gap: 2rem;
  transition: background .3s, border-color .3s, box-shadow .3s;
}
.portal-nav.scrolled {
  background: rgba(6, 9, 26, .82);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--sky-border);
  box-shadow: 0 1px 40px rgba(0,0,0,.4);
}
.portal-nav .brand {
  display: flex; align-items: center; gap: .625rem;
  font-weight: 800; font-size: 1.125rem; color: #fff;
  text-decoration: none; letter-spacing: -.02em;
}
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: grid; place-items: center;
  color: #fff; font-size: 1rem; font-weight: 900;
  box-shadow: 0 0 20px rgba(59,130,246,.5);
}
.portal-nav .nav-links {
  display: flex; align-items: center; gap: .25rem;
  list-style: none; margin: 0; padding: 0;
}
.portal-nav .nav-links a {
  color: var(--sky-text-mute); font-size: .9rem; font-weight: 500;
  text-decoration: none; padding: .4rem .875rem; border-radius: 8px;
  transition: color .15s, background .15s;
}
.portal-nav .nav-links a:hover { color: #fff; background: var(--sky-surface-2); }
.portal-nav .nav-actions { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.btn-ghost {
  background: none; border: 1px solid var(--sky-border-2); color: var(--sky-text);
  padding: .45rem 1.1rem; border-radius: 9px; font-size: .9rem; font-weight: 500;
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
  font-family: 'Sarabun', sans-serif;
}
.btn-ghost:hover { border-color: rgba(255,255,255,.3); background: var(--sky-surface-2); }
.btn-sky {
  background: linear-gradient(135deg, #3b82f6, #6d28d9);
  color: #fff; border: none;
  padding: .5rem 1.25rem; border-radius: 9px; font-size: .9rem; font-weight: 600;
  cursor: pointer; transition: opacity .15s, transform .15s;
  font-family: 'Sarabun', sans-serif;
  box-shadow: 0 0 24px rgba(59,130,246,.35);
}
.btn-sky:hover { opacity: .9; transform: translateY(-1px); }

/* ---- Hero ------------------------------------------------- */
.portal-hero {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 8rem 1.5rem 6rem;
  text-align: center;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.25);
  color: #93c5fd; font-size: .8125rem; font-weight: 600; letter-spacing: .08em;
  padding: .35rem 1rem; border-radius: 99px;
  margin-bottom: 1.75rem; text-transform: uppercase;
}
.hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #3b82f6;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,.6); }
  50%       { box-shadow: 0 0 0 5px rgba(59,130,246,0); }
}
.hero-h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800; line-height: 1.1;
  letter-spacing: -.03em;
  color: #fff;
  margin-bottom: 1.5rem;
}
.hero-h1 span { display: block; }
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--sky-text-mute); line-height: 1.7;
  max-width: 600px; margin: 0 auto 2.5rem;
}
.hero-actions {
  display: flex; align-items: center; justify-content: center;
  gap: 1rem; flex-wrap: wrap;
  margin-bottom: 4rem;
}
.btn-hero-primary {
  display: inline-flex; align-items: center; gap: .5rem;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: #fff; font-weight: 700; font-size: 1rem;
  padding: .875rem 2rem; border-radius: 12px; border: none;
  cursor: pointer; text-decoration: none;
  transition: opacity .2s, transform .2s, box-shadow .2s;
  box-shadow: 0 4px 30px rgba(59,130,246,.4);
  font-family: 'Sarabun', sans-serif;
}
.btn-hero-primary:hover {
  opacity: .92; transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(59,130,246,.5);
  color: #fff;
}
.btn-hero-secondary {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--sky-surface); color: var(--sky-text);
  font-weight: 600; font-size: 1rem;
  padding: .875rem 2rem; border-radius: 12px;
  border: 1px solid var(--sky-border-2);
  cursor: pointer; text-decoration: none;
  transition: background .2s, border-color .2s, transform .2s;
  font-family: 'Sarabun', sans-serif;
}
.btn-hero-secondary:hover {
  background: var(--sky-surface-2); border-color: rgba(255,255,255,.2);
  transform: translateY(-1px); color: #fff;
}

/* Hero product badges */
.hero-products {
  display: flex; align-items: center; justify-content: center;
  gap: .625rem; flex-wrap: wrap;
  margin-bottom: 3rem;
}
.product-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .875rem; border-radius: 99px;
  font-size: .8125rem; font-weight: 600;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.product-badge-ledger {
  background: rgba(59,130,246,.15); border: 1px solid rgba(59,130,246,.3);
  color: #93c5fd;
}
.product-badge-hr {
  background: rgba(20,184,166,.15); border: 1px solid rgba(20,184,166,.3);
  color: #5eead4;
}
.product-badge-buildq {
  background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.3);
  color: #fcd34d;
}
.product-badge-ops {
  background: rgba(139,92,246,.15); border: 1px solid rgba(139,92,246,.3);
  color: #c4b5fd;
}
.product-badge .bi { font-size: .875rem; }

/* Hero screenshot / preview card */
.hero-preview {
  position: relative; max-width: 900px; margin: 0 auto;
  border-radius: var(--r-xl); overflow: hidden;
  border: 1px solid var(--sky-border-2);
  box-shadow: 0 40px 120px -20px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.05);
}
.hero-preview-bar {
  background: rgba(255,255,255,.06); padding: .75rem 1rem;
  display: flex; align-items: center; gap: .5rem;
  border-bottom: 1px solid var(--sky-border);
}
.traffic-light { display: flex; gap: .375rem; }
.traffic-light span {
  width: 10px; height: 10px; border-radius: 50%;
  display: block;
}
.traffic-light .red    { background: #ef4444; }
.traffic-light .yellow { background: #f59e0b; }
.traffic-light .green  { background: #10b981; }
.preview-url {
  flex: 1; background: rgba(0,0,0,.3); border-radius: 6px;
  padding: .2rem .75rem; font-size: .75rem; color: var(--sky-text-mute);
  text-align: center;
}
.hero-preview-body {
  background: linear-gradient(180deg, rgba(13,20,40,.8) 0%, rgba(6,9,26,.9) 100%);
  padding: 2rem;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem;
}

/* Mini product cards inside preview */
.mini-card {
  border-radius: 12px; padding: 1rem;
  border: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column; gap: .5rem;
  transition: transform .2s, border-color .2s;
  cursor: default;
}
.mini-card:hover { transform: translateY(-3px); border-color: rgba(255,255,255,.2); }
.mini-card .mini-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center; font-size: 1rem; color: #fff;
  flex-shrink: 0;
}
.mini-card h6 { font-size: .8rem; font-weight: 700; color: #fff; margin: 0; }
.mini-card p  { font-size: .7rem; color: var(--sky-text-mute); margin: 0; line-height: 1.4; }
.mini-stat { font-size: .75rem; font-weight: 700; color: #fff; margin-top: auto; }
.mini-stat span { font-size: .65rem; color: var(--sky-text-mute); font-weight: 400; }

/* ---- Section: Products ------------------------------------ */
.section-products {
  position: relative; z-index: 1;
  padding: 6rem 1.5rem;
}
.section-label {
  font-size: .75rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--sky-text-faint);
  margin-bottom: .75rem;
}
.section-heading {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800; line-height: 1.15; letter-spacing: -.02em;
  color: #fff; margin-bottom: 1rem;
}
.section-sub {
  font-size: 1.0625rem; color: var(--sky-text-mute); line-height: 1.65;
  max-width: 560px;
}
.prod-card {
  position: relative; overflow: hidden;
  background: var(--sky-surface); border: 1px solid var(--sky-border);
  border-radius: var(--r-lg); padding: 2rem;
  transition: border-color .25s, transform .25s, box-shadow .25s;
  cursor: default; height: 100%;
}
.prod-card::before {
  content: ''; position: absolute; inset: 0;
  opacity: 0; transition: opacity .3s;
  border-radius: inherit;
  pointer-events: none;
}
.prod-card:hover { transform: translateY(-4px); box-shadow: 0 24px 60px -10px rgba(0,0,0,.5); }
.prod-card.ledger { --c: #3b82f6; }
.prod-card.hr     { --c: #14b8a6; }
.prod-card.buildq { --c: #f59e0b; }
.prod-card.ops    { --c: #8b5cf6; }
.prod-card:hover { border-color: var(--c); }
.prod-card:hover::before { opacity: 1; background: radial-gradient(ellipse at top left, rgba(var(--c-rgb),.06), transparent 60%); }

.prod-card-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.25rem; color: #fff;
  margin-bottom: 1.25rem;
  transition: transform .25s;
}
.prod-card:hover .prod-card-icon { transform: scale(1.08); }
.prod-card.ledger .prod-card-icon { background: var(--grad-ledger); box-shadow: 0 8px 24px rgba(59,130,246,.4); }
.prod-card.hr     .prod-card-icon { background: var(--grad-hr);     box-shadow: 0 8px 24px rgba(20,184,166,.4); }
.prod-card.buildq .prod-card-icon { background: var(--grad-buildq); box-shadow: 0 8px 24px rgba(245,158,11,.4); }
.prod-card.ops    .prod-card-icon { background: var(--grad-ops);    box-shadow: 0 8px 24px rgba(139,92,246,.4); }

.prod-card h3 { font-size: 1.125rem; font-weight: 700; color: #fff; margin-bottom: .375rem; }
.prod-card p  { font-size: .9rem; color: var(--sky-text-mute); line-height: 1.6; margin-bottom: 1.25rem; }
.prod-features { list-style: none; padding: 0; margin: 0 0 1.5rem; display: flex; flex-direction: column; gap: .5rem; }
.prod-features li {
  display: flex; align-items: center; gap: .5rem;
  font-size: .8375rem; color: var(--sky-text-mute);
}
.prod-features li .bi { font-size: .75rem; color: var(--c); flex-shrink: 0; }
.prod-link {
  display: inline-flex; align-items: center; gap: .375rem;
  font-size: .875rem; font-weight: 600; color: var(--c);
  text-decoration: none;
  transition: gap .2s;
}
.prod-link:hover { gap: .625rem; }

/* Glow line at top of card on hover */
.prod-card::after {
  content: ''; position: absolute; top: 0; left: 1.5rem; right: 1.5rem; height: 1px;
  background: linear-gradient(90deg, transparent, var(--c), transparent);
  opacity: 0; transition: opacity .3s;
  pointer-events: none;
}
.prod-card:hover::after { opacity: 1; }

/* ---- Section: Stats -------------------------------------- */
.section-stats {
  position: relative; z-index: 1;
  padding: 4rem 1.5rem;
  border-top: 1px solid var(--sky-border);
  border-bottom: 1px solid var(--sky-border);
}
.stat-item { text-align: center; }
.stat-number {
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 800; letter-spacing: -.03em;
  line-height: 1; margin-bottom: .375rem;
}
.stat-label { font-size: .9rem; color: var(--sky-text-mute); font-weight: 500; }

/* ---- Section: Features ----------------------------------- */
.section-features {
  position: relative; z-index: 1;
  padding: 6rem 1.5rem;
}
.feature-row { display: flex; flex-direction: column; gap: 1rem; }
.feature-item {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.25rem; border-radius: var(--r);
  border: 1px solid transparent;
  transition: border-color .2s, background .2s;
  cursor: default;
}
.feature-item:hover { border-color: var(--sky-border-2); background: var(--sky-surface); }
.feature-item .fi {
  width: 42px; height: 42px; border-radius: 10px;
  display: grid; place-items: center; font-size: 1.1rem; color: #fff;
  flex-shrink: 0;
}
.feature-item h5 { font-size: .9375rem; font-weight: 700; color: #fff; margin-bottom: .25rem; }
.feature-item p  { font-size: .85rem; color: var(--sky-text-mute); margin: 0; line-height: 1.5; }

/* ---- Section: Pricing ------------------------------------ */
.section-cta {
  position: relative; z-index: 1;
  padding: 7rem 1.5rem;
}
.cta-card {
  background: linear-gradient(135deg, rgba(59,130,246,.12) 0%, rgba(139,92,246,.10) 50%, rgba(20,184,166,.08) 100%);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--r-xl); padding: 4rem 3rem;
  text-align: center; position: relative; overflow: hidden;
}
.cta-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 60% 0%, rgba(59,130,246,.15), transparent 60%),
              radial-gradient(ellipse at 20% 100%, rgba(139,92,246,.12), transparent 60%);
}
.cta-card h2 {
  font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 800;
  letter-spacing: -.03em; color: #fff;
  position: relative; z-index: 1; margin-bottom: 1rem;
}
.cta-card p {
  font-size: 1.0625rem; color: var(--sky-text-mute);
  position: relative; z-index: 1; max-width: 500px; margin: 0 auto 2rem;
}
.cta-actions { position: relative; z-index: 1; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.cta-note {
  font-size: .8rem; color: var(--sky-text-faint); margin-top: 1.25rem;
  position: relative; z-index: 1;
}

/* ---- Footer ---------------------------------------------- */
.portal-footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--sky-border);
  padding: 3.5rem 2rem 2rem;
  color: var(--sky-text-mute); font-size: .875rem;
}
.footer-brand { font-weight: 800; color: #fff; font-size: 1.0625rem; margin-bottom: .625rem; display: flex; align-items: center; gap: .5rem; }
.footer-tagline { font-size: .8375rem; color: var(--sky-text-faint); margin-bottom: 1.5rem; }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.footer-links a { color: var(--sky-text-mute); text-decoration: none; font-size: .85rem; transition: color .15s; }
.footer-links a:hover { color: #fff; }
.footer-col-title { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sky-text-faint); margin-bottom: .75rem; }
.footer-bottom {
  margin-top: 3rem; padding-top: 1.5rem;
  border-top: 1px solid var(--sky-border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.footer-legal { display: flex; gap: 1.5rem; }
.footer-legal a { color: var(--sky-text-faint); text-decoration: none; font-size: .8rem; transition: color .15s; }
.footer-legal a:hover { color: var(--sky-text-mute); }

/* ============================================================
   HOME PAGE (AUTHENTICATED LAUNCHER) STYLES
   ============================================================ */
body.is-home {
  background: var(--home-bg);
  color: var(--home-text-1);
  min-height: 100vh;
}

/* ---- Home topbar ----------------------------------------- */
.home-topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--home-topbar-bg);
  border-bottom: 1px solid var(--home-topbar-border);
  padding: 0 1.75rem;
  height: 64px;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 1px 0 var(--home-topbar-border);
}
.home-brand {
  display: flex; align-items: center; gap: .625rem;
  font-weight: 800; color: var(--home-text-1); text-decoration: none;
  font-size: 1rem; letter-spacing: -.02em; flex-shrink: 0;
}
.home-brand .brand-logo {
  box-shadow: 0 0 16px rgba(59,130,246,.3);
}
.home-topbar .topbar-sep {
  width: 1px; height: 20px; background: var(--home-border); flex-shrink: 0;
}
.home-topbar .company-pill {
  display: flex; align-items: center; gap: .5rem;
  background: var(--home-bg); border: 1px solid var(--home-border);
  border-radius: 99px; padding: .3rem .875rem .3rem .5rem;
  font-size: .85rem; font-weight: 500; color: var(--home-text-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.home-topbar .company-pill:hover { border-color: var(--c-ledger); background: var(--home-surface); }
.company-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--grad-ledger); color: #fff;
  font-size: .6875rem; font-weight: 700; display: grid; place-items: center;
  flex-shrink: 0;
}
.home-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .625rem; }
.topbar-iconbtn {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center;
  background: none; border: 1px solid var(--home-border);
  color: var(--home-text-2); cursor: pointer;
  font-size: 1rem; transition: border-color .15s, background .15s, color .15s;
}
.topbar-iconbtn:hover { border-color: var(--c-ledger); background: var(--home-surface); color: var(--c-ledger); }
.notif-btn { position: relative; }
.notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #ef4444; border: 2px solid var(--home-topbar-bg);
}
.home-avatar-btn {
  display: flex; align-items: center; gap: .5rem;
  background: none; border: 1px solid var(--home-border); border-radius: 10px;
  padding: .35rem .625rem; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.home-avatar-btn:hover { border-color: var(--home-border); background: var(--home-bg); }
.h-avatar {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff; font-size: .75rem; font-weight: 700;
  display: grid; place-items: center; flex-shrink: 0;
}
.h-avatar-name { font-size: .825rem; font-weight: 600; color: var(--home-text-1); }

/* ---- Home content ---------------------------------------- */
.home-content { max-width: 1280px; margin: 0 auto; padding: 2.5rem 1.75rem 4rem; }

/* Welcome banner */
.welcome-banner {
  background: linear-gradient(135deg, #1e40af 0%, #4c1d95 50%, #0d9488 100%);
  border-radius: var(--r-xl); padding: 2.5rem 2.5rem;
  color: #fff; position: relative; overflow: hidden; margin-bottom: 2.5rem;
}
.welcome-banner::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
}
.welcome-banner .orb {
  position: absolute; border-radius: 50%; opacity: .3;
  filter: blur(60px); pointer-events: none;
}
.welcome-banner .orb-1 { width: 300px; height: 300px; background: #60a5fa; top: -100px; right: 5%; }
.welcome-banner .orb-2 { width: 200px; height: 200px; background: #a78bfa; bottom: -60px; right: 25%; }
.welcome-greeting {
  font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,.6); margin-bottom: .25rem; position: relative;
}
.welcome-name {
  font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 800; letter-spacing: -.02em;
  margin-bottom: .5rem; position: relative;
}
.welcome-meta {
  font-size: .9rem; color: rgba(255,255,255,.65); position: relative;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.welcome-meta .dot { opacity: .4; }
.welcome-actions { position: relative; margin-top: 1.5rem; display: flex; gap: .75rem; flex-wrap: wrap; }
.btn-welcome-1 {
  display: inline-flex; align-items: center; gap: .4rem;
  background: #fff; color: #1e40af; font-weight: 700; font-size: .9rem;
  padding: .55rem 1.25rem; border-radius: 9px; border: none; cursor: pointer;
  transition: opacity .2s, transform .2s; font-family: 'Sarabun', sans-serif;
}
.btn-welcome-1:hover { opacity: .9; transform: translateY(-1px); }
.btn-welcome-2 {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(255,255,255,.15); color: #fff; font-weight: 600; font-size: .9rem;
  padding: .55rem 1.25rem; border-radius: 9px; border: 1px solid rgba(255,255,255,.25);
  cursor: pointer; transition: background .2s; font-family: 'Sarabun', sans-serif;
}
.btn-welcome-2:hover { background: rgba(255,255,255,.22); }

/* Section heading */
.home-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.home-section-title { font-size: 1rem; font-weight: 700; color: var(--home-text-1); }
.home-section-sub { font-size: .8rem; color: var(--home-text-3); margin-top: .1rem; }

/* ---- App tiles (product launcher) ------------------------ */
.app-tile {
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: var(--r-lg); padding: 2rem;
  display: flex; flex-direction: column;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  text-decoration: none; color: var(--home-text-1);
  position: relative; overflow: hidden;
  height: 100%;
}
.app-tile::after {
  content: ''; position: absolute;
  top: -60px; right: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  opacity: .07; transition: opacity .3s, transform .3s;
}
.app-tile.ledger { --tc: #3b82f6; }
.app-tile.ledger::after { background: #3b82f6; }
.app-tile.hr     { --tc: #14b8a6; }
.app-tile.hr::after     { background: #14b8a6; }
.app-tile.buildq { --tc: #f59e0b; }
.app-tile.buildq::after { background: #f59e0b; }
.app-tile.ops    { --tc: #8b5cf6; }
.app-tile.ops::after    { background: #8b5cf6; }

.app-tile:hover {
  border-color: var(--tc); transform: translateY(-3px);
  box-shadow: 0 16px 48px rgba(0,0,0,.12);
  color: var(--home-text-1);
}
.app-tile:hover::after { opacity: .14; transform: scale(1.3); }

.tile-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center; font-size: 1.5rem; color: #fff;
  margin-bottom: 1.25rem; position: relative; z-index: 1;
  transition: transform .2s;
}
.app-tile.ledger .tile-icon { background: var(--grad-ledger); box-shadow: 0 8px 24px rgba(59,130,246,.35); }
.app-tile.hr     .tile-icon { background: var(--grad-hr);     box-shadow: 0 8px 24px rgba(20,184,166,.35); }
.app-tile.buildq .tile-icon { background: var(--grad-buildq); box-shadow: 0 8px 24px rgba(245,158,11,.35); }
.app-tile.ops    .tile-icon { background: var(--grad-ops);    box-shadow: 0 8px 24px rgba(139,92,246,.35); }
.app-tile:hover .tile-icon  { transform: scale(1.06); }

.tile-name { font-size: 1.0625rem; font-weight: 700; margin-bottom: .25rem; position: relative; z-index: 1; }
.tile-desc { font-size: .875rem; color: var(--home-text-2); line-height: 1.55; margin-bottom: 1.25rem; flex: 1; position: relative; z-index: 1; }
.tile-meta { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.tile-plan {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; font-weight: 600; color: var(--tc);
  background: rgba(0,0,0,.04); border-radius: 6px; padding: .25rem .625rem;
}
[data-bs-theme="dark"] .tile-plan { background: rgba(255,255,255,.06); }
.tile-go {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .8125rem; font-weight: 700; color: var(--tc);
}
.app-tile-disabled {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}
.tile-status-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .7rem; font-weight: 600; padding: .2rem .6rem;
  border-radius: 99px;
}
.tile-status-active {
  background: rgba(16,185,129,.12); color: #059669;
  border: 1px solid rgba(16,185,129,.25);
}
.tile-status-coming {
  background: rgba(148,163,184,.1); color: #64748b;
  border: 1px solid rgba(148,163,184,.2);
}
[data-bs-theme="dark"] .tile-status-active { background: rgba(52,211,153,.12); color: #34d399; border-color: rgba(52,211,153,.25); }
[data-bs-theme="dark"] .tile-status-coming  { background: rgba(100,116,139,.12); color: #94a3b8; border-color: rgba(100,116,139,.2); }

/* ---- Activity feed --------------------------------------- */
.activity-card {
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: var(--r-lg);
  overflow: hidden; height: 100%;
}
.activity-card-head {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--home-border);
  display: flex; align-items: center; justify-content: space-between;
}
.activity-card-title { font-size: .9375rem; font-weight: 700; }
.activity-list { padding: .5rem 0; }
.activity-item {
  display: flex; align-items: flex-start; gap: .875rem;
  padding: .75rem 1.5rem;
  transition: background .15s; cursor: default;
}
.activity-item:hover { background: var(--home-bg); }
.activity-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; font-size: .875rem;
  flex-shrink: 0; margin-top: .1rem;
}
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: .8375rem; color: var(--home-text-1); line-height: 1.45; margin-bottom: .15rem; }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: .75rem; color: var(--home-text-3); }
.activity-tag {
  font-size: .6875rem; font-weight: 600; padding: .175rem .5rem;
  border-radius: 5px; flex-shrink: 0; align-self: flex-start; margin-top: .2rem;
}
.at-ledger { background: rgba(59,130,246,.1); color: #3b82f6; }
.at-hr     { background: rgba(20,184,166,.1); color: #0d9488; }
.at-buildq { background: rgba(245,158,11,.1); color: #d97706; }
.at-ops    { background: rgba(139,92,246,.1); color: #7c3aed; }
[data-bs-theme="dark"] .at-ledger { background: rgba(59,130,246,.15); color: #60a5fa; }
[data-bs-theme="dark"] .at-hr     { background: rgba(20,184,166,.15); color: #2dd4bf; }
[data-bs-theme="dark"] .at-buildq { background: rgba(245,158,11,.15); color: #fbbf24; }
[data-bs-theme="dark"] .at-ops    { background: rgba(139,92,246,.15); color: #c4b5fd; }

/* Plan summary widget */
.plan-widget {
  background: var(--home-surface);
  border: 1px solid var(--home-border);
  border-radius: var(--r-lg); overflow: hidden;
}
.plan-widget-head {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--home-border);
  font-size: .9rem; font-weight: 700;
}
.plan-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--home-border);
}
.plan-item:last-child { border-bottom: none; }
.plan-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.plan-item-name { font-size: .85rem; font-weight: 600; flex: 1; }
.plan-item-plan { font-size: .75rem; color: var(--home-text-3); }
.plan-badge {
  font-size: .7rem; font-weight: 600; padding: .2rem .55rem;
  border-radius: 5px;
}
.pb-active { background: rgba(16,185,129,.1); color: #059669; }
[data-bs-theme="dark"] .pb-active { background: rgba(52,211,153,.12); color: #34d399; }

/* ---- Responsive ------------------------------------------ */
@media (max-width: 991px) {
  .portal-nav .nav-links { display: none; }
  .hero-preview-body { grid-template-columns: repeat(2, 1fr); }
  .cta-card { padding: 2.5rem 1.5rem; }
  .welcome-banner { padding: 2rem 1.5rem; }
}
@media (max-width: 767px) {
  .hero-preview { display: none; }
  .portal-nav { padding: .75rem 1.25rem; }
  .section-products, .section-features, .section-cta, .section-stats { padding: 4rem 1.25rem; }
  .home-content { padding: 1.5rem 1rem 3rem; }
  .home-topbar { padding: 0 1rem; }
}
