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

:root {
  --bg: #080514;
  --surface: #120b24;
  --surface-2: #191130;
  --border: rgba(168, 85, 247, 0.22);
  --text: #f5f3ff;
  --muted: #a79ec4;
  --purple: #8b5cf6;
  --magenta: #d946ef;
  --pink: #ec4899;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  line-height: 1.45;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.sm {
  font-size: 12px;
}

.grad-pink {
  background: linear-gradient(90deg, #c084fc, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.grad-magenta {
  background: linear-gradient(90deg, #a855f7, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ======================================================
   PORTAL SPLIT GLASS LOGIN SCREEN
   ====================================================== */
.portal-auth-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  overflow: hidden;
  background:
    radial-gradient(62% 56% at 18% 12%, rgba(124, 58, 237, 0.42) 0%, rgba(124, 58, 237, 0) 70%),
    radial-gradient(45% 42% at 86% 24%, rgba(168, 85, 247, 0.18) 0%, rgba(168, 85, 247, 0) 70%),
    linear-gradient(160deg, #070312 0%, #100626 52%, #070312 100%);
}

.portal-ambient-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.12), transparent 62%);
}

.portal-horizon-arc {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -240px;
  height: 360px;
  border-top: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 -20px 80px rgba(139, 92, 246, 0.16);
}

.portal-glass-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  border-radius: 24px;
  border: 1px solid rgba(168, 85, 247, 0.28);
  background: linear-gradient(145deg, rgba(22, 12, 42, 0.88) 0%, rgba(13, 8, 26, 0.94) 100%);
  backdrop-filter: blur(22px);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.72),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

/* LEFT COLUMN */
.portal-left {
  padding: 30px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: radial-gradient(circle at 18% 20%, rgba(168, 85, 247, 0.14), transparent 55%);
}

.portal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.portal-logo-badge {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid rgba(192, 132, 252, 0.45);
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.35);
  background: #fff;
  flex-shrink: 0;
}

.portal-logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portal-brand-name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.portal-brand-sub {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #a79ec4;
  margin-top: 2px;
}

.portal-ai-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(192, 132, 252, 0.28);
  font-size: 11px;
  font-weight: 600;
  color: #e9d5ff;
}

.pill-bolt {
  color: #f472b6;
}

.portal-hero h1 {
  font-size: 31px;
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.portal-hero-desc {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #b4abd0;
  max-width: 400px;
}

/* Middle Showcase */
.portal-showcase-mid {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  align-items: center;
  gap: 18px;
}

.laptop-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 4px;
  perspective: 600px;
}

.laptop-screen {
  position: relative;
  width: 152px;
  height: 98px;
  border-radius: 11px 11px 4px 4px;
  border: 2px solid rgba(216, 180, 254, 0.55);
  background: linear-gradient(135deg, #4c1d95 0%, #9333ea 52%, #ec4899 100%);
  box-shadow:
    0 0 36px rgba(168, 85, 247, 0.45),
    inset 0 0 22px rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotateY(8deg) rotateX(4deg);
  overflow: hidden;
}

.laptop-glare {
  position: absolute;
  top: -30%;
  left: -30%;
  width: 120%;
  height: 90%;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.25), transparent 60%);
  pointer-events: none;
}

.laptop-brand-text {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.laptop-base {
  width: 174px;
  height: 12px;
  margin-top: -1px;
  border-radius: 3px 3px 12px 12px;
  background: linear-gradient(180deg, #c084fc 0%, #581c87 100%);
  box-shadow: 0 12px 24px rgba(168, 85, 247, 0.45);
  transform: rotateY(8deg) rotateX(-25deg);
}

.feature-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feature-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(192, 132, 252, 0.16);
  font-size: 12px;
  font-weight: 600;
  color: #ede9fe;
  text-decoration: none;
  transition: 0.15s ease;
}

.feature-link:hover {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(216, 180, 254, 0.45);
}

.feat-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(168, 85, 247, 0.18);
  color: #d8b4fe;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

/* Bottom 3 Mini Tiles */
.portal-bottom-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mini-tile {
  padding: 11px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(192, 132, 252, 0.16);
  text-align: center;
}

.mini-tile-top {
  font-size: 16px;
  font-weight: 800;
  color: #e9d5ff;
}

.mini-tile-sub {
  margin-top: 3px;
  font-size: 10.5px;
  color: #a79ec4;
  font-weight: 600;
}

/* RIGHT COLUMN */
.portal-right {
  padding: 34px 34px 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-panel-head {
  text-align: center;
  margin-bottom: 18px;
}

.auth-panel-head h2 {
  font-size: 24px;
  font-weight: 800;
}

.auth-panel-head p {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 18px;
}

.auth-tab {
  border: none;
  border-radius: 9px;
  padding: 9px 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: #b4abd0;
  transition: 0.15s ease;
}

.auth-tab.active {
  background: linear-gradient(90deg, #9333ea 0%, #d946ef 100%);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(192, 38, 211, 0.35);
}

.portal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.p-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.p-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #e9d5ff;
}

.p-ico {
  opacity: 0.85;
  font-size: 11px;
}

.p-field input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(192, 132, 252, 0.2);
  background: rgba(255, 255, 255, 0.045);
  color: #ffffff;
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.p-field input::placeholder {
  color: #7c7399;
}

.p-field input:focus {
  outline: none;
  border-color: #c084fc;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.18);
}

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

.pw-wrap input {
  padding-right: 40px;
}

.pw-toggle {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: #a79ec4;
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}

.pw-toggle:hover {
  color: #ffffff;
}

.form-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.remember-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #b4abd0;
  cursor: pointer;
}

.remember-check input {
  width: 14px;
  height: 14px;
  accent-color: #c084fc;
}

.forgot-link {
  background: transparent;
  border: none;
  color: #d8b4fe;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.forgot-link:hover {
  color: #f472b6;
}

.btn-gradient-cta {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(90deg, #7c3aed 0%, #c026d3 55%, #ec4899 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(192, 38, 211, 0.36);
  transition: transform 0.12s ease, filter 0.15s ease;
}

.btn-gradient-cta:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-gradient-cta:disabled {
  opacity: 0.65;
  cursor: wait;
}

.switch-prompt {
  text-align: center;
  font-size: 12px;
  color: #a79ec4;
  margin-top: 2px;
}

.inline-switch {
  background: transparent;
  border: none;
  color: #e879f9;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.inline-switch:hover {
  text-decoration: underline;
}

.portal-admin-foot {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: right;
}

.muted-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
}

.muted-link:hover {
  color: #fff;
}

.text-link {
  color: #c084fc;
  text-decoration: none;
  font-weight: 600;
}

.text-link:hover {
  text-decoration: underline;
}

/* ======================================================
   MODAL & SIGNED-IN DASHBOARD SHELL
   ====================================================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 2, 10, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 150;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: #140d28;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar {
  background: #0d081a;
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-logo.sm {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(192, 132, 252, 0.45);
  background: #fff;
  object-fit: cover;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 36px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
}

.stat-value.accent {
  color: #d8b4fe;
}

.stat-value.ok-text {
  color: var(--ok);
}

.stat-value.err-text {
  color: var(--err);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}

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

.card-head h2 {
  font-size: 16px;
  font-weight: 800;
}

.slots-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.slot-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.slot-title {
  font-size: 13.5px;
  font-weight: 700;
}

.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.model-tag {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 7px;
  background: rgba(168, 85, 247, 0.16);
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: #e9d5ff;
}

.guide-list {
  margin-top: 12px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: #d1d5db;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field.align-end {
  justify-content: flex-end;
}

.field > span {
  font-size: 12px;
  font-weight: 600;
  color: #e9d5ff;
}

.field input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid rgba(192, 132, 252, 0.2);
  border-radius: 9px;
  color: var(--text);
  padding: 9px 11px;
  font-size: 13px;
  font-family: inherit;
}

.field input:focus {
  outline: none;
  border-color: #c084fc;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  text-decoration: none;
  transition: 0.15s ease;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn.sm {
  padding: 7px 11px;
  font-size: 12px;
}

.btn-primary {
  background: linear-gradient(90deg, #7c3aed, #c026d3);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  color: #e5e7eb;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  display: inline-block;
}

.pill.ok {
  background: rgba(52, 211, 153, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: var(--ok);
}

.pill.wait {
  background: rgba(251, 191, 36, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: var(--warn);
}

.pill.plan {
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.45);
  color: #e9d5ff;
}

.alert {
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 12.5px;
}

.alert.err {
  background: rgba(248, 113, 113, 0.14);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--err);
}

.alert.ok {
  background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--ok);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 14px;
}

.proj-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.proj-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #0b0716;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

.proj-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.proj-title {
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
  border: 1px dashed rgba(192, 132, 252, 0.25);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
}

.footer {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.toast {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  background: #2e1065;
  border: 1px solid rgba(192, 132, 252, 0.6);
  color: #f3e8ff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.toast.err {
  background: #450a0a;
  border-color: rgba(248, 113, 113, 0.6);
  color: #fecaca;
}

@media (max-width: 860px) {
  .portal-glass-card {
    grid-template-columns: 1fr;
  }
  .portal-left {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 24px 22px;
  }
  .portal-right {
    padding: 26px 22px;
  }
  .portal-showcase-mid {
    grid-template-columns: 1fr;
  }
}
