/* Portal: public home, dashboard, sign-up. Dark-first, futurist, mobile-first. */
body.portal {
  --p-bg: #07080c; --p-surface: rgba(255, 255, 255, .04); --p-surface-2: rgba(255, 255, 255, .07);
  --p-border: rgba(255, 255, 255, .09); --p-text: #eceef4; --p-muted: #9196a6;
  --p-a: #7c8bff; --p-b: #2ee6d6; --p-grad: linear-gradient(120deg, var(--p-a), var(--p-b));
  --p-on-grad: #05060a; --p-error: #ff8a8a; --p-ok: #5ee0a0; --p-shadow: 0 20px 60px rgba(0, 0, 0, .45);
  color-scheme: dark;
  background: var(--p-bg); color: var(--p-text); min-height: 100vh; overflow-x: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: light) {
  body.portal {
    --p-bg: #f6f7fb; --p-surface: rgba(255, 255, 255, .78); --p-surface-2: #ffffff;
    --p-border: rgba(10, 14, 40, .1); --p-text: #0c0f1d; --p-muted: #5b6072;
    --p-a: #4f5ef7; --p-b: #0fb5a8; --p-on-grad: #ffffff; --p-error: #c62828; --p-ok: #137a4a;
    --p-shadow: 0 20px 50px rgba(20, 30, 80, .12);
    color-scheme: light;
  }
}
.portal .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.portal a { color: var(--p-a); }

/* Backdrop */
.bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; }
.orb-a { width: 520px; height: 520px; background: var(--p-a); top: -180px; right: -120px; }
.orb-b { width: 460px; height: 460px; background: var(--p-b); top: 40vh; left: -200px; opacity: .22; }
.grid {
  position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(var(--p-border) 1px, transparent 1px), linear-gradient(90deg, var(--p-border) 1px, transparent 1px);
  background-size: 56px 56px; mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
}
@media (prefers-reduced-motion: no-preference) {
  .orb-a { animation: drift 18s ease-in-out infinite alternate; }
  @keyframes drift { to { transform: translate(-60px, 40px); } }
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px clamp(16px, 4vw, 40px); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--p-bg) 70%, transparent); border-bottom: 1px solid var(--p-border);
}
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--p-text) !important; text-decoration: none; letter-spacing: -.01em; }
.logo-mark { width: 22px; height: 22px; border-radius: 7px; background: var(--p-grad); box-shadow: 0 0 22px color-mix(in srgb, var(--p-b) 60%, transparent); }
.nav-links { display: flex; align-items: center; gap: 14px; }
.nav-links form { margin: 0; }
.nav-link { color: var(--p-muted) !important; text-decoration: none; font-size: 14px; }
.nav-link:hover { color: var(--p-text) !important; }
.nav-user { font-size: 14px; color: var(--p-muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px;
  padding: 11px 18px; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none;
  border: 1px solid transparent; transition: transform .15s, box-shadow .15s, border-color .15s; white-space: nowrap;
}
.btn.primary { background: var(--p-grad); color: var(--p-on-grad) !important; box-shadow: 0 8px 30px color-mix(in srgb, var(--p-a) 35%, transparent); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 36px color-mix(in srgb, var(--p-a) 45%, transparent); }
.btn.ghost { background: var(--p-surface); border-color: var(--p-border); color: var(--p-text) !important; }
.btn.ghost:hover { border-color: color-mix(in srgb, var(--p-a) 50%, var(--p-border)); }
.btn.sm { padding: 7px 13px; font-size: 13px; border-radius: 10px; }
.btn.lg { padding: 14px 22px; font-size: 16px; }
.btn.block { width: 100%; }
.btn:focus-visible { outline: 2px solid var(--p-b); outline-offset: 3px; }

/* Layout */
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 64px; }
.card {
  background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 20px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--p-shadow);
}
.eyebrow { font-size: 12px; text-transform: uppercase; color: var(--p-b); margin: 0 0 12px; }
.lead { color: var(--p-muted); font-size: clamp(16px, 2vw, 18px); line-height: 1.6; margin: 0 0 24px; max-width: 560px; }
.muted { color: var(--p-muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--p-error); font-size: 14px; margin: 4px 0 0; }
.notice { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 8px; }
.notice li { padding: 12px 16px; border-radius: 12px; border: 1px solid var(--p-border); background: var(--p-surface); font-size: 14px; }
.notice li.success { border-color: color-mix(in srgb, var(--p-ok) 45%, var(--p-border)); }
.notice li.error { color: var(--p-error); }

/* Hero */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(28px, 5vw, 64px); align-items: center; padding: clamp(48px, 9vw, 110px) 0 56px; }
.hero h1 { font-size: clamp(38px, 6.5vw, 68px); line-height: 1.02; letter-spacing: -.035em; margin: 0 0 20px; font-weight: 700; }
.glow { background: var(--p-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.hero-demo { padding: 18px; display: grid; gap: 10px; transform: rotate(-1deg); }
.demo-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--p-muted); padding-bottom: 6px; border-bottom: 1px solid var(--p-border); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--p-ok); box-shadow: 0 0 10px var(--p-ok); }
.demo-msg { padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; max-width: 88%; }
.demo-msg.user { justify-self: end; background: var(--p-grad); color: var(--p-on-grad); }
.demo-msg.bot { background: var(--p-surface-2); border: 1px solid var(--p-border); }
.demo-src { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.demo-src span { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--p-border); color: var(--p-muted); }

/* Feature blocks */
.features { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.feature { padding: 22px; }
.feature h3 { margin: 14px 0 8px; font-size: 17px; letter-spacing: -.01em; }
.feature p { margin: 0; color: var(--p-muted); font-size: 14px; line-height: 1.6; }
.icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--p-surface-2); border: 1px solid var(--p-border); }
.icon svg { width: 20px; height: 20px; fill: none; stroke: var(--p-b); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 56px 0; }
.step { padding: 6px 4px; border-top: 1px solid var(--p-border); }
.step .num { display: block; margin: 16px 0 8px; color: var(--p-b); font-size: 13px; }
.step h3 { margin: 0 0 6px; font-size: 20px; }
.step p { margin: 0; color: var(--p-muted); font-size: 15px; line-height: 1.6; }

/* Join / sign in */
.join { display: grid; grid-template-columns: 1fr 380px; gap: clamp(24px, 5vw, 64px); align-items: start; padding-top: 24px; scroll-margin-top: 90px; }
.join h2 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.02em; margin: 0 0 12px; }
.plan { padding: 22px; max-width: 460px; }
.plan ul { margin: 0 0 18px; padding-left: 18px; color: var(--p-muted); line-height: 1.9; font-size: 15px; }
.signin, .formcard { padding: 24px; display: grid; gap: 8px; }
.signin h2 { margin: 0 0 6px; font-size: 20px; }
.portal label { font-size: 13px; font-weight: 600; margin-top: 6px; }
.portal input[type=text], .portal input[type=password], .portal input[type=email], .portal input:not([type]) {
  width: 100%; font: inherit; font-size: 15px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--p-border); background: var(--p-surface-2); color: var(--p-text);
}
.portal input:focus { outline: none; border-color: var(--p-a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--p-a) 25%, transparent); }
.signin .btn, .formcard .btn { margin-top: 12px; }
.field { display: grid; gap: 6px; }
.field.has-error input { border-color: var(--p-error); }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.narrow { max-width: 480px; margin: 0 auto; padding-top: clamp(40px, 8vw, 80px); }
.narrow h1 { font-size: clamp(30px, 5vw, 42px); letter-spacing: -.025em; margin: 0 0 10px; }

/* Dashboard */
.dash-head { padding: clamp(40px, 7vw, 72px) 0 28px; }
.dash-head h1 { font-size: clamp(32px, 5vw, 48px); letter-spacing: -.03em; margin: 0 0 10px; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.ws { padding: 20px; display: flex; flex-direction: column; gap: 18px; text-decoration: none; color: var(--p-text); }
.ws-top { display: flex; gap: 14px; align-items: center; min-width: 0; }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; background: var(--p-grad); color: var(--p-on-grad); }
.ws-meta { min-width: 0; }
.ws h2 { margin: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws p { margin: 4px 0 0; }
.ws-actions { display: flex; gap: 8px; margin-top: auto; }
.ws.create { border-style: dashed; align-items: flex-start; justify-content: center; transition: border-color .15s, transform .15s; }
.ws.create:hover { border-color: var(--p-a); transform: translateY(-2px); }
.plus { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; color: var(--p-b); border: 1px dashed var(--p-border); }
.ws.empty { justify-content: center; }

.foot { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; padding: 24px clamp(16px, 4vw, 40px); color: var(--p-muted); font-size: 13px; border-top: 1px solid var(--p-border); }

/* Mobile */
@media (max-width: 960px) {
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .join { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .hero-demo { transform: none; }
  .steps { grid-template-columns: 1fr; margin: 36px 0; }
  .nav-user { display: none; }
}
@media (max-width: 480px) {
  .features { grid-template-columns: 1fr; }
  .cta .btn { flex: 1 1 100%; }
  .nav-link { display: none; }
}
