:root {
  color-scheme: light;
  --ink: #11131a;
  --muted: #6b7080;
  --line: rgba(17, 19, 26, 0.11);
  --surface: rgba(255, 255, 255, 0.78);
  --violet: #6655f2;
  --blue: #3d8dff;
  --mint: #62e4ca;
  --shadow: 0 30px 80px rgba(38, 43, 68, 0.12);
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #f6f7fb;
  font-family: "DM Sans", system-ui, sans-serif;
  overflow-x: hidden;
}

button, input { font: inherit; }
button { color: inherit; }

.hidden { display: none !important; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 48vw;
  height: 48vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .18;
  pointer-events: none;
}

.ambient-one { top: -24vw; left: 28vw; background: #8f7bff; }
.ambient-two { right: -24vw; bottom: -28vw; background: #58d7ff; }

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 18px;
  text-align: center;
  color: var(--muted);
}

.mini-orb, .orb-small {
  width: 54px;
  height: 54px;
  margin: auto;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff 0 10%, #6fe8da 26%, #6557f2 66%, #17264f 100%);
  box-shadow: 0 0 32px rgba(101, 87, 242, .42);
  animation: breathe 2.4s ease-in-out infinite;
}

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .9fr) 1.1fr; }

.brand-panel {
  min-height: 100vh;
  padding: 42px clamp(34px, 5vw, 84px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: white;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at 76% 24%, rgba(96, 231, 208, .18), transparent 24%),
    radial-gradient(circle at 20% 92%, rgba(98, 85, 242, .34), transparent 32%),
    linear-gradient(145deg, #0d1021 0%, #171735 54%, #11182c 100%);
}

.brand-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .16;
  background-image: linear-gradient(rgba(255,255,255,.09) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.09) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
  pointer-events: none;
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-family: "Space Grotesk", sans-serif; font-weight: 600; letter-spacing: .02em; position: relative; z-index: 1; }
.brand small { display: block; font: 500 .68rem/1.2 "DM Sans", sans-serif; color: rgba(255,255,255,.58); letter-spacing: .06em; }
.brand-mark { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.38); border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }

.brand-copy { position: relative; z-index: 1; max-width: 620px; padding: 76px 0 40px; }
.eyebrow { margin: 0 0 12px; color: #7264ed; font-size: .76rem; font-weight: 700; letter-spacing: .16em; }
.brand-copy .eyebrow { color: #8ff0df; }
.brand-copy h1 { margin: 0; font: 600 clamp(2.7rem, 5vw, 5.6rem)/.98 "Space Grotesk", sans-serif; letter-spacing: -.055em; }
.brand-copy .intro { max-width: 530px; margin: 26px 0 0; color: rgba(255,255,255,.64); font-size: clamp(1rem, 1.25vw, 1.2rem); line-height: 1.6; }
.brand-footer { position: relative; z-index: 1; margin: 0; color: rgba(255,255,255,.42); font-size: .8rem; }

.orb-stage { position: absolute; width: 250px; height: 250px; right: -24px; top: -104px; }
.orb-core { position: absolute; inset: 62px; border-radius: 50%; background: radial-gradient(circle at 32% 25%, #fff 0 7%, #81f1dd 20%, #7061ff 54%, #18224c 100%); box-shadow: 0 0 50px rgba(99, 88, 255, .48), 0 0 120px rgba(96, 230, 208, .16); animation: breathe 3.2s ease-in-out infinite; }
.orb-ring { position: absolute; border-radius: 50%; border: 1px solid rgba(139, 242, 224, .34); }
.ring-one { inset: 34px; animation: orbit 11s linear infinite; border-left-color: transparent; }
.ring-two { inset: 10px; animation: orbit 16s linear infinite reverse; border-right-color: transparent; }

.auth-panel { min-height: 100vh; display: grid; place-items: center; padding: 48px 24px; }
.auth-card { width: min(100%, 470px); padding: clamp(28px, 4vw, 48px); border: 1px solid rgba(255,255,255,.82); border-radius: 30px; background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.auth-card h2, .setup-card h2, .organization-hero h2, .next-card h2 { margin: 0; font: 600 clamp(2rem, 4vw, 3rem)/1.05 "Space Grotesk", sans-serif; letter-spacing: -.045em; }
.form-intro { color: var(--muted); line-height: 1.6; margin: 14px 0 30px; }

form { display: grid; gap: 10px; }
label { margin-top: 9px; font-size: .88rem; font-weight: 600; }
input { width: 100%; min-height: 53px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; outline: none; background: rgba(255,255,255,.8); transition: border-color .2s, box-shadow .2s, background .2s; }
input:focus { border-color: rgba(102,85,242,.58); box-shadow: 0 0 0 4px rgba(102,85,242,.1); background: white; }
.label-row { margin-top: 9px; display: flex; align-items: center; justify-content: space-between; }
.label-row label { margin: 0; }
.text-button, .back-button { border: 0; padding: 0; color: #6255d7; background: none; cursor: pointer; font-size: .86rem; }
.text-button:hover, .back-button:hover { text-decoration: underline; }
.strong { font-weight: 700; }
.back-button { margin-bottom: 28px; color: var(--muted); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 60px; }
.password-toggle { position: absolute; right: 8px; top: 8px; min-width: 44px; height: 37px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-size: .8rem; font-weight: 700; }
.password-toggle:hover { background: #f0effb; color: #5548c7; }

.primary-button, .secondary-button { min-height: 53px; margin-top: 16px; padding: 0 18px; border: 0; border-radius: 14px; display: flex; align-items: center; justify-content: space-between; gap: 20px; cursor: pointer; font-weight: 700; transition: transform .2s, box-shadow .2s, opacity .2s; }
.primary-button { color: white; background: linear-gradient(110deg, #5e51df, #4b80ee); box-shadow: 0 12px 28px rgba(83,79,222,.25); }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(83,79,222,.34); }
.primary-button:disabled { cursor: wait; opacity: .65; transform: none; }
.secondary-button { justify-content: center; width: 100%; color: #5548c7; background: #eeecff; }
.switch-copy { margin: 26px 0 0; color: var(--muted); text-align: center; font-size: .9rem; }
.form-message { min-height: 22px; margin: 4px 0 0; color: #bf334c; font-size: .86rem; line-height: 1.45; }
.form-message.success { color: #237865; }
.success-view { text-align: center; }
.success-icon { width: 64px; height: 64px; margin: 0 auto 24px; border-radius: 50%; display: grid; place-items: center; color: #256e60; background: #dff9f1; font-size: 1.8rem; }

.dashboard { min-height: 100vh; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 30px 24px 24px; display: flex; flex-direction: column; color: white; background: #111422; }
.dashboard-brand { margin: 0 10px 42px; }
.sidebar nav { display: grid; gap: 7px; }
.nav-item { width: 100%; min-height: 48px; padding: 0 12px; border: 0; border-radius: 12px; display: flex; align-items: center; gap: 11px; color: rgba(255,255,255,.56); background: transparent; text-align: left; }
.nav-item.active { color: white; background: rgba(255,255,255,.09); }
.nav-item small { margin-left: auto; color: rgba(255,255,255,.34); font-size: .63rem; }
.nav-icon { width: 24px; text-align: center; }
.sidebar-bottom { margin-top: auto; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.1); }
.user-mini { display: flex; align-items: center; gap: 11px; }
.user-mini > span:last-child { min-width: 0; }
.user-mini strong, .user-mini small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-mini strong { font-size: .9rem; }
.user-mini small { margin-top: 3px; color: rgba(255,255,255,.46); font-size: .73rem; }
.avatar { flex: 0 0 39px; height: 39px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #6655f2, #58cfc0); font-weight: 700; }
.signout-button { width: 100%; margin-top: 14px; padding: 9px 0; border: 0; color: rgba(255,255,255,.54); background: transparent; cursor: pointer; text-align: left; font-size: .78rem; }
.signout-button:hover { color: white; }

.workspace { min-width: 0; padding: clamp(32px, 5vw, 72px); }
.workspace-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 42px; }
.workspace-header h1 { margin: 0; font: 600 clamp(2.2rem, 4.5vw, 4.5rem)/1 "Space Grotesk", sans-serif; letter-spacing: -.055em; }
.live-chip { padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.72); color: var(--muted); font-size: .78rem; }
.live-chip span, .status-dot { width: 8px; height: 8px; border-radius: 50%; background: #43c69f; box-shadow: 0 0 0 4px rgba(67,198,159,.12); }

.setup-card, .organization-hero, .next-card, .metric-card { border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.72); box-shadow: 0 20px 60px rgba(45,48,74,.08); backdrop-filter: blur(16px); }
.setup-card { max-width: 870px; padding: clamp(28px, 5vw, 58px); border-radius: 28px; display: grid; grid-template-columns: auto 1fr; gap: 28px; }
.setup-number { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; color: #5d50dd; background: #eceaff; font: 600 1rem "Space Grotesk"; }
.setup-card p, .organization-hero p, .next-card p { color: var(--muted); line-height: 1.6; }
.organization-form { max-width: 590px; margin-top: 22px; grid-template-columns: 1fr auto; align-items: start; }
.organization-form .compact { margin: 0; white-space: nowrap; }

.organization-hero { padding: clamp(28px, 4vw, 48px); border-radius: 28px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.organization-monogram { flex: 0 0 clamp(80px, 10vw, 130px); height: clamp(80px, 10vw, 130px); border-radius: 34%; display: grid; place-items: center; color: white; background: radial-gradient(circle at 32% 20%, #82ebdc, #6655f2 62%, #222f5e); box-shadow: 0 18px 46px rgba(83,79,222,.25); font: 600 clamp(2rem, 5vw, 4rem) "Space Grotesk"; }
.dashboard-grid { margin-top: 22px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.metric-card { min-height: 170px; padding: 24px; border-radius: 20px; display: flex; flex-direction: column; }
.metric-label { color: var(--muted); font-size: .8rem; }
.metric-card strong { margin: auto 0 8px; display: flex; align-items: center; gap: 10px; font: 600 1.7rem "Space Grotesk"; }
.metric-card small { color: var(--muted); line-height: 1.45; }
.muted-card { background: rgba(241,242,248,.72); }
.next-card { margin-top: 22px; padding: clamp(26px, 4vw, 42px); border-radius: 24px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 28px; }
.orb-small { width: 82px; height: 82px; }
.next-card h2 { font-size: clamp(1.6rem, 3vw, 2.5rem); }
.next-card p:last-child { margin-bottom: 0; }

@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { transform: scale(.94); filter: saturate(.9); } 50% { transform: scale(1.06); filter: saturate(1.25); } }

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; }
  .brand-panel { min-height: 430px; padding: 30px 28px; }
  .brand-copy { padding: 64px 0 24px; }
  .brand-copy h1 { font-size: clamp(2.6rem, 10vw, 4.4rem); }
  .orb-stage { right: -68px; top: -90px; }
  .auth-panel { min-height: auto; padding: 42px 18px 64px; }
  .dashboard { grid-template-columns: 88px minmax(0, 1fr); }
  .sidebar { padding: 24px 14px; }
  .dashboard-brand > span:last-child, .nav-item:not(.active) small, .nav-item { font-size: 0; }
  .dashboard-brand { margin: 0 auto 36px; }
  .nav-item { justify-content: center; }
  .nav-icon { font-size: 1rem; }
  .user-mini > span:last-child, .signout-button { display: none; }
  .user-mini { justify-content: center; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .brand-panel { min-height: 390px; }
  .brand-copy .intro { max-width: 86%; }
  .auth-card { padding: 28px 20px; border-radius: 22px; }
  .dashboard { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 18px 20px; flex-direction: row; align-items: center; }
  .dashboard-brand { margin: 0; }
  .sidebar nav { margin-left: auto; }
  .nav-item:not(.active), .sidebar-bottom { display: none; }
  .nav-item.active { min-height: 40px; }
  .workspace { padding: 34px 18px 56px; }
  .workspace-header { display: block; }
  .live-chip { margin-top: 20px; }
  .setup-card { grid-template-columns: 1fr; }
  .organization-form { grid-template-columns: 1fr; }
  .organization-form .compact { margin-top: 4px; }
  .organization-hero { align-items: flex-start; }
  .organization-monogram { flex-basis: 72px; height: 72px; border-radius: 22px; }
  .next-card { grid-template-columns: 1fr; }
  .orb-small { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
